autoconf-patches
[Top][All Lists]
Advanced

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

Re: Turn on compiler warnings by default for AC_PROG_CC, AC_PROG_CXX & A


From: Dale Visser
Subject: Re: Turn on compiler warnings by default for AC_PROG_CC, AC_PROG_CXX & AC_PROG_FC
Date: Tue, 14 Jan 2014 10:53:05 -0500

Paul:

I've looked over gl_MANYWARN_ALL_GCC now (http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=m4/manywarnings.m4), and like how it has been structured.

One advantage of AC_FLAGS_WARN_ALL is that it has been written to work not only with gcc, but also with other compilers, such as clang and icc. I'm open to suggestions as to particular flags that you believe should be added in the gcc case. On my particular system, I am running gcc 4.8.1, and the documentation (http://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/Warning-Options.html#Warning-Options) shows the following warnings enabled by -Wall:

-Waddress   -Warray-bounds (only with -O2)  -Wc++11-compat  -Wchar-subscripts 
-Wenum-compare (in C/ObjC; this is on by default in C++)
-Wimplicit-int (C and Objective-C only)
-Wimplicit-function-declaration (C and Objective-C only)
-Wcomment  -Wformat  
-Wmain (only for C/ObjC and unless -ffreestanding) 
-Wmaybe-uninitialized
-Wmissing-braces (only for C/ObjC)
-Wnonnull  -Wparentheses  -Wpointer-sign  -Wreorder   -Wreturn-type  -Wsequence-point 
-Wsign-compare (only in C++) 
-Wstrict-aliasing  -Wstrict-overflow=1  -Wswitch  -Wtrigraphs  -Wuninitialized  -Wunknown-pragmas  -Wunused-function  -Wunused-label     -Wunused-value     -Wunused-variable  -Wvolatile-register-var

Also, it is possible to easily add flags in configure.ac using the provided AC_APPEND_FLAGS macro. For example, to specifically disable some warnings applicable to comment text:

AC_APPEND_FLAG([-Wno-comment], [CFLAGS])

where the second parameter could also be CXXFLAGS or FCFLAGS as appropriate.

Best regards,
Dale Visser
--
The plural of 'anecdote' is not 'data'.

 


reply via email to

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