autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_PROG_WERROR


From: Akim Demaille
Subject: Re: AC_PROG_WERROR
Date: Thu, 02 Oct 2003 09:18:32 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Sorry, I mixed up the patches when copying/pasting from the article,
because they were stripped by my MUA.

 > Outgrowth of my earlier conversation about GCC's configury.  This patch adds
 > an AC_PROG_WERROR macro which causes all compile, link, and preprocess
 > checks to fail on warnings.  How well this will work in practice, I'm not
 > 100% sure.  My biggest concern would have been the warning messages for
 > glibc's stub functions; link checks for them would go from passing to
 > failing.  But there's already code to make them fail in the C compile check,
 > so I guess that's not a concern.  And the whole mode is optional anyway.

 > The patch is incomplete in a few ways, I suspect:
 >   - Should ac_flag_werror be initialized somewhere?
 >   - Should AC_PROG_CPP_WERROR be removed, since it was just added and this
 >     subsumes it?
 >   - Is AC_PROG_WERROR a good name?

 > But other than that this patch should be OK.  I've tested that it works as
 > expected, and I can build a correct libiberty using AC_PROG_WERROR. 
 > Thoughts?

 > I have one more patch for the upcoming autoconf release.  Coming right up.


| 2003-10-01  Daniel Jacobowitz  <address@hidden>
| 
|       * lib/autoconf/general.m4 (AC_PROG_WERROR): New macro.
|       (_AC_COMPILE_IFELSE, _AC_PREPROC_IFELSE, _AC_LINK_IFELSE): Check
|       $ac_werror_flag.
|       * doc/autoconf.texi (Generic Compiler Characteristics): Document
|       AC_PROG_WERROR.
| 
| Index: doc/autoconf.texi
| ===================================================================
| RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
| retrieving revision 1.761
| diff -u -p -r1.761 autoconf.texi
| --- doc/autoconf.texi 26 Sep 2003 13:55:04 -0000      1.761
| +++ doc/autoconf.texi 1 Oct 2003 21:05:29 -0000
| @@ -384,7 +384,7 @@ Types
|  Compilers and Preprocessors
|  
|  * Specific Compiler Characteristics::  Some portability issues
| -* Generic Compiler Characteristics::  Language independent tests
| +* Generic Compiler Characteristics::  Language independent tests and features
|  * C Compiler::                  Checking its characteristics
|  * C++ Compiler::                Likewise
|  * Fortran 77 Compiler::         Likewise
| @@ -5110,7 +5110,7 @@ compiling.
|  
|  @menu
|  * Specific Compiler Characteristics::  Some portability issues
| -* Generic Compiler Characteristics::  Language independent tests
| +* Generic Compiler Characteristics::  Language independent tests and features
|  * C Compiler::                  Checking its characteristics
|  * C++ Compiler::                Likewise
|  * Fortran 77 Compiler::         Likewise
| @@ -5177,6 +5177,12 @@ AC_CHECK_SIZEOF(int *)
|  defines @code{SIZEOF_INT_P} to be 8 on DEC Alpha AXP systems.
|  @end defmac
|  
| address@hidden AC_PROG_WERROR
| address@hidden
| +Normally Autoconf ignores warnings generated by the compiler, linker,
| +and preprocessor.  If this macro is used, warnings will be treated as
| +fatal errors instead.
| address@hidden defmac
|  
|  @node C Compiler
|  @subsection C Compiler Characteristics
| Index: lib/autoconf/general.m4
| ===================================================================
| RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
| retrieving revision 1.818
| diff -u -p -r1.818 general.m4
| --- lib/autoconf/general.m4   26 Sep 2003 09:11:23 -0000      1.818
| +++ lib/autoconf/general.m4   1 Oct 2003 21:05:31 -0000
| @@ -2030,7 +2030,11 @@ AC_DEFUN([AC_RUN_LOG],
|  ## Examining declarations.  ##
|  ## ------------------------ ##
|  
| -
| +# AC_PROG_WERROR
| +# ------------------
| +# Treat warnings from the compiler and preprocessor as errors.
| +AC_DEFUN([AC_PROG_WERROR],
| +[ac_werror_flag=yes])# AC_PROG_WERROR

To set it to a default value, use

   m4_divert_text([DEFAULTS], [ac_werror_flag=no])

somewhere executed.

|  # _AC_PREPROC_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
|  # ----------------------------------------------------------------
| @@ -2045,7 +2049,7 @@ AC_DEFUN([_AC_PREPROC_IFELSE],
|  [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
|  if _AC_EVAL_STDERR([$ac_cpp conftest.$ac_ext]) >/dev/null; then
|    if test -s conftest.err; then
| -    ac_cpp_err=$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag
| +    ac_cpp_err=$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag$ac_werror_flag
|    else
|      ac_cpp_err=
|    fi
| @@ -2127,7 +2131,8 @@ AC_DEFUN([AC_EGREP_HEADER],
|  m4_define([_AC_COMPILE_IFELSE],
|  [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
|  rm -f conftest.$ac_objext
| -AS_IF([AC_TRY_EVAL(ac_compile) &&
| +AS_IF([_AC_EVAL_STDERR($ac_compile) &&
| +      AC_TRY_COMMAND([test -z "$ac_werror_flag" || test ! -s conftest.err]) 
&&
|        AC_TRY_COMMAND([test -s conftest.$ac_objext])],
|        [$2],
|        [_AC_MSG_LOG_CONFTEST
| @@ -2166,7 +2171,8 @@ AU_DEFUN([AC_TRY_COMPILE],
|  m4_define([_AC_LINK_IFELSE],
|  [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
|  rm -f conftest.$ac_objext conftest$ac_exeext
| -AS_IF([AC_TRY_EVAL(ac_link) &&
| +AS_IF([_AC_EVAL_STDERR($ac_link) &&
| +      AC_TRY_COMMAND([test -z "$ac_werror_flag" || test ! -s conftest.err]) 
&&
|        AC_TRY_COMMAND([test -s conftest$ac_exeext])],
|        [$2],
|        [_AC_MSG_LOG_CONFTEST

Issues:

1. I think the name is wrong indeed, and I'm not sure we want this
   to be independent of the current language

2. The documentation should make it clear when and why using this
   macro

3. NEWS it please :)




reply via email to

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