[cfe-dev] clang --version question.

Daniel Dunbar daniel at zuster.org
Mon Jul 20 19:42:57 PDT 2009


On Mon, Jul 20, 2009 at 12:40 AM, Jean-Daniel
Dupas<devlists at shadowlab.org> wrote:
> Is this patch OK ?

Can you just pass the stream to write to in to PrintVersion? And maybe
add a comment to the --version output about why we explicitly want
stdout.

Otherwise looks good, please apply.

 - Daniel

>
>
>
> Le 16 juil. 09 à 05:56, Daniel Dunbar a écrit :
>
>> Fine with me. However, the change should only be for --version, I
>> think the reason it is currently to stderr is that is what happens in
>> gcc when run as -v:
>> --
>> ddunbar at giles:tmp$ gcc --version > /dev/null
>> ddunbar at giles:tmp$ gcc -v > /dev/null
>> Using built-in specs.
>> Target: i686-apple-darwin10
>> Configured with: /var/tmp/gcc/gcc-5646~6/src/configure
>> --disable-checking --enable-werror --prefix=/usr --mandir=/share/man
>> --enable-languages=c,objc,c++,obj-c++
>> --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/
>> --with-slibdir=/usr/lib --build=i686-apple-darwin10
>> --with-gxx-include-dir=/include/c++/4.2.1
>> --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10
>> --target=i686-apple-darwin10
>> Thread model: posix
>> gcc version 4.2.1 (Apple Inc. build 5646)
>> --
>>
>> - Daniel
>>
>> On Wed, Jul 15, 2009 at 5:11 PM, Jean-Daniel
>> Dupas<devlists at shadowlab.org> wrote:
>>>
>>> Hello,
>>>
>>> Is there a reason why clang outputs its version in stderr instead of
>>> stdout
>>> when passing the --version flag ?
>>> It prevents usage of this kind of script (used to detect type of parser
>>> in
>>> some projects):
>>>
>>> if $cc --version 2>/dev/null | grep -q clang; then …
>>>
>>> Note that this can be easily workaround by redirecting stderr in stdout
>>> instead of /dev/null, but I wonder if it's not simpler to change the
>>> driver
>>> to use stdout instead (see attached patch).
>>>
>>> Regards
>>> Jean-Daniel
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>
>>>
>>
>
>
>




More information about the cfe-dev mailing list