On Fri, Sep 12, 2003 at 03:08:19PM -0700, Paul Eggert wrote: > Daniel Jacobowitz <drow@xxxxxxxxx> writes: > > > I think the easiest way for me to do this is simply to locally reset > > the warnings-are-errors flag for AC_PREPROC_IFELSE. I don't suppose > > you're interested in making this an exported feature? > > If by "exported feature" you mean "documented for Autoconf" then I'm > interested in it. It's a bit esoteric, but if GCC ran into the > problem, other people might too. Well, if I were going to document this feature, I'd do it like this. I didn't bother to add the C++ version since I expect that to be less useful. What do you think? -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2003-09-15 Daniel Jacobowitz <drow@xxxxxxxxxx> * doc/autoconf.texi (C Compiler Characteristics): Document AC_PROG_CPP_WERROR. * lib/autoconf/c.m4 (AC_PROG_CPP_WERROR): New macro. (_AC_CHECK_HEADER_MONGREL): Don't warn about inconsistency if the preprocessor is set to give errors for any warning. Index: doc/autoconf.texi =================================================================== RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v retrieving revision 1.757 diff -u -p -r1.757 autoconf.texi --- doc/autoconf.texi 2 Sep 2003 19:13:59 -0000 1.757 +++ doc/autoconf.texi 16 Sep 2003 02:36:34 -0000 @@ -5297,7 +5297,17 @@ extension. Some preprocessors don't indicate missing include files by the error status. For such preprocessors an internal variable is set that causes other macros to check the standard error from the preprocessor and -consider the test failed if any warnings have been reported. +consider the test failed if any warnings have been reported. Otherwise +warnings are permitted unless @code{AC_PROG_CPP_WERROR} is specified. +@end defmac + +@defmac AC_PROG_CPP_WERROR +@acindex{PROG_CPP_WERROR} +@ovindex CPP +If this macro is used, warnings from the preprocessor will be treated +as errors even if the preprocessor reports errors correctly. This is useful +for avoiding headers which generate mandatory warnings, such as deprecation +notices. @end defmac Index: lib/autoconf/c.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v retrieving revision 1.182 diff -u -p -r1.182 c.m4 --- lib/autoconf/c.m4 3 Sep 2003 00:35:52 -0000 1.182 +++ lib/autoconf/c.m4 16 Sep 2003 02:36:34 -0000 @@ -419,6 +419,12 @@ AC_SUBST(CPP)dnl AC_LANG_POP(C)dnl ])# AC_PROG_CPP +# AC_PROG_CPP_WERROR +# ------------------ +# Treat warnings from the preprocessor as errors. +AC_DEFUN([AC_PROG_CPP_WERROR], +[AC_REQUIRE([AC_PROG_CPP])dnl +ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR # AC_LANG_COMPILER(C) # ------------------- Index: lib/autoconf/headers.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/headers.m4,v retrieving revision 1.34 diff -u -p -r1.34 headers.m4 --- lib/autoconf/headers.m4 22 May 2003 15:17:06 -0000 1.34 +++ lib/autoconf/headers.m4 16 Sep 2003 02:36:35 -0000 @@ -121,13 +121,13 @@ AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@i AC_MSG_RESULT([$ac_header_preproc]) # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in + yes:no: ) AC_MSG_WARN([$1: accepted by the compiler, rejected by the preprocessor!]) AC_MSG_WARN([$1: proceeding with the compiler's result]) ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) AC_MSG_WARN([$1: present but cannot be compiled]) AC_MSG_WARN([$1: check for missing prerequisite headers?]) AC_MSG_WARN([$1: see the Autoconf documentation])