[syslinux] gcc_ok fail to detect unrecognized option

Gilles Espinasse g.esp at free.fr
Thu Feb 22 11:49:31 PST 2007


Even with gcc-4.1.1, gcc does not return an error if an option is not
supported
It just ouput a message to stderr but does not return a value different from
0.
The result is that there is some warnings about every unrecognized option
and compilation continue.

barton syslinux-3.36 # gcc -dumpversion
4.1.1
barton syslinux-3.36 # gcc -ZZZ dummy.c; echo $?
gcc: unrecognized option '-ZZZ'
0
barton syslinux-3.36 # gcc -Wall dummy.c; echo $?
0

On a command line, this line work
if gcc $(1) -c -x c /dev/null 2>&1 | grep 'unrecognized option'; then echo
$(2); else echo $(1); fi
On a makefile, this pipe usage is not supported.

As a notice, -### could be used instead of -c -x c /dev/null to test option
validity.

Gilles





More information about the Syslinux mailing list