[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
David A. Wheeler
Fri, 17 Jan 2014 16:02:45 -0500 (EST)
Dale Visser said on Fri, 10 Jan 2014 10:30:19 -0500:
> The inspiration for this comes from an earlier discussion on the 'autoconf'
> list: http://lists.gnu.org/archive/html/autoconf/2013-10/msg00025.html
> The basic idea is to overall enhance the security of code built using
> autoconf, by turning on compiler warnings that the developers wouldn't
> otherwise think to.
> The patch ports over AX_FLAGS_WARN_ALL from the autoconf archive, and invokes
> it by default within AC_PROG_CC, AC_PROG_CXX and AC_PROG_FC. Of course, a
> mechanism is provided for turning off the new behavior, i.e., restoring the
> classic "no extra warnings" mode
I think this is a *great* thing. It's easy to make mistakes, and this can help
warn developers early before users get stuck with the results.
> I've looked over gl_MANYWARN_ALL_GCC ...
> 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...
> 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])
As I understand it, AC_APPEND_FLAGS provides a way to portably disable warning
flags if they're annoying for a particular project, or add specialized warning
flags for a particular project.
It seems to me that should address the obvious objection to adding warning
flags. This way, autoconf can ratchet up the warning flags by default more
than it does currently (not at all)... and make it easy to make
Zack Weinberg said:
> For GCC I would be quite hesitant to turn anything on beyond -Wall without
> explicit buy-in from the project, but I like the idea of enabling -Wall by
I pretty sure that's what Dale Visser's patch does. It says:
+ "-pedantic % -Wall" dnl GCC
Dale Visser's patch does include a comment that says:
+# For the GNU compiler it will be -Wall (and -ansi -pedantic) The result
+# is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default.
But I think this comment is no longer true.
It appears to me that the code is just trying to see if "-pedantic" *WORKS*,
and if it does, then using that as evidence that "-Wall" would work.
Dale Visser: If it doesn't actually enable "-ansi -pedantic", then this comment
should be updated to match.
I'm going to give this patch a whirl and see how it works.
--- David A. Wheeler