[Top][All Lists]

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

Re: best way to check for compiler _warnings_?

From: Peter Rosin
Subject: Re: best way to check for compiler _warnings_?
Date: Tue, 02 Nov 2010 08:30:30 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20101027 Thunderbird/3.1.6

Den 2010-11-02 08:18 skrev Miles Bader:
> On Tue, Nov 2, 2010 at 4:04 PM, Peter Rosin <address@hidden> wrote:
>> Den 2010-11-02 06:46 skrev Ralf Wildenhues:
>>> Except then you may run into MSVC which prints its command-line options
>>> (dunno whether on stdout or stderr) ...
>> To expand on that tangent...
>> MSVC "only" prints the options it ends up feeding to link.exe (or maybe
>> it's link.exe that prints them?) and only if the -nologo option isn't
>> specified.  On stdout.  Unknown options are reported on stderr (with
>> zero exit status, of course).
> Yeah, this is what I tried, which seems to work OK:
>       ... junk omitted ...
>       AC_MSG_CHECKING(whether C++ compiler accepts "$OPT" option)
>         [opt_ok=yes
>        if test -s conftest.err; then
>          for ONE_OPT in $OPT; do
>            if grep -e "$ONE_OPT" conftest.err >/dev/null; then
>              opt_ok=no
>              break
>            fi
>          done
>        fi],
>       [opt_ok=no])
>       AC_MSG_RESULT([$opt_ok])
> Where OPT holds the option being checked (it can contain multiple
> options, and the warning message may only mention one of them, thus
> the loop).

That will not work for options that take an argument as a separate
command line argument, e.g. the -x LANGUAGE option in gcc.  Those
options may not be common with gcc, but they do exist, and who knows
what other compiler vendors come up with?  (MSVC doesn't have any
that I know of)


reply via email to

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