autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: best way to check for compiler _warnings_?


From: Ralf Wildenhues
Subject: Re: best way to check for compiler _warnings_?
Date: Mon, 1 Nov 2010 17:36:58 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

Hi Miles,

* Miles Bader wrote on Mon, Nov 01, 2010 at 05:33:13AM CET:
> I want to check whether the compiler is giving a warning (about an
> unrecognized command-line option).
> 
> Since the compilation still succeeds, AC_COMPILE_IFELSE doesn't do the
> job...
> 
> e.g.:
> 
>    $ g++ -o /dev/null -catfood -c /tmp/s.cc ; echo $?
>    g++: unrecognized option '-catfood'
>    0

First, please complain to the compiler vendor (whoever is responsible
for the behavior).  FWIW, I can reproduce with Debian GCC 4.3.5 but not
with upstream FSF GCC from SVN.

Then, dealing with such behavior is tricky in general.  You can use
AC_LANG_WERROR, but it has problems if the compiler is verbose by
default.  Libtool has a couple of macros that test a compiler without
and with some flag and compare output of the two, but even that is of
limited reliability if the "normal" part of the output is noisy.  It's
a mess.

Cheers,
Ralf



reply via email to

[Prev in Thread] Current Thread [Next in Thread]