[cfe-dev] clang --version question.

Daniel Dunbar daniel at zuster.org
Wed Jul 15 20:56:26 PDT 2009

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
--with-slibdir=/usr/lib --build=i686-apple-darwin10
--program-prefix=i686-apple-darwin10- --host=x86_64-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