Hi Bertrand, On Sat, Mar 06, 2021 at 08:25:46PM +0000, Bertrand Jacquin wrote: > gcc returns non zero code if an option is not supported (tested > from 6.5 to 10.2). > > $ gcc -Wfoobar -E -xc - -o /dev/null < /dev/null > /dev/null 2>&1 ; echo $? > 1 > > clang always return 0 if an option in not recognized unless > -Werror is also passed, preventing a correct probing of options > supported by the compiler (tested with clang 6.0.1 to 11.1.0). > > $ clang -Wfoobar -E -xc - -o /dev/null < /dev/null > /dev/null 2>&1 ; echo > $? > 0 > $ clang -Werror -Wfoobar -E -xc - -o /dev/null < /dev/null > /dev/null 2>&1 > ; echo $? > 1
That's interesting, because we've constantly been complaining about gcc not accepting random -Wfoobar and requiring runtime discovery, but on the other hand, not having any info about support is a problem as well. I can indeed imagine that we could enable -Werror=some-option-about-commandline but that would require to detect it, so I think that -Werror indeed remains an acceptable solution here. > Please note today this is not visible since clang 11 exit with SIGABRT > or with return code 1 on older version due to bad file descriptor from > file descriptor handling > > $ clang -Wfoobar -E -xc - -o /dev/null < /dev/null 2>&0 ; echo $? > Aborted (core dumped) > 134 This is particularly ugly, I can imagine how annoying it can become if a tens of cores are produced upon every single haproxy build. Let's hope they quickly fix it. Thanks for the explanation, I'm taking your patch! Willy