clang --version question.

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

driverout.patch (941 Bytes)

Don't think so. Looks good to me. Maybe Daniel will chime in with something...

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:

Is this patch OK ?

driver.patch (1.88 KB)

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

corrected patch:
pass the stream as argument and add a comment to say we are following GCC behavior.

version.patch (2.26 KB)

Thanks, applied in 76632.

- Daniel