Re: best way to check for compiler _warnings_?

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

 



On Tue, Nov 2, 2010 at 4:04 PM, Peter Rosin <peda@xxxxxxxxxxxxxx> 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 ...
      CXXFLAGS="$CXXFLAGS $OPT"
      AC_MSG_CHECKING(whether C++ compiler accepts "$OPT" option)
      AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]),
        [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).

-miles

-- 
Cat is power.  Cat is peace.

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf



[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux