autoconf
[Top][All Lists]
Advanced

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

Improved AC_LANG_WERROR


From: Andrey Simonenko
Subject: Improved AC_LANG_WERROR
Date: Tue, 10 Apr 2007 11:01:20 +0300
User-agent: Mutt/1.5.14 (2007-02-12)

Hello,

In [1] I started discussion about how to cancel flags set by
AC_LANG_WERROR, in [2] there was one proposition how to improve
this macro.

What do you think about the following backward compatible changes
(read updated info for the details)?

I removed m4_divert_text([DEFAULTS], [ac_[]_AC_LANG_ABBREV[]_werror_flag=])
from AC_LANG_WERROR.  Is it really needed?

lang.m4:

# AC_LANG_WERROR([VALUE])
# -----------------------
# How to treat warnings from the current language's preprocessor, compiler,
# and linker:
# 1. No arguments: treat warnings as fatal errors.
# 2. One argument: on -- treat, off -- do not treat warnings as fatal errors.
AC_DEFUN([AC_LANG_WERROR],
[m4_if(
    $#, 1, [m4_if(
        [$1], [on], [ac_[]_AC_LANG_ABBREV[]_werror_flag=yes],
        [$1], [off], [ac_[]_AC_LANG_ABBREV[]_werror_flag=],
        [m4_fatal([$0: wrong argument: `$1'])])],
    $#, 0, [ac_[]_AC_LANG_ABBREV[]_werror_flag=yes],
    [m4_fatal([$0: incorrect number of arguments: $#])])
])# AC_LANG_WERROR

autoconf.texi:

@defmac AC_LANG_WERROR (@ovar{value})
@acindex{LANG_WERROR}
Normally Autoconf ignores warnings generated by the compiler, linker, and
preprocessor.  If @var{value} is @code{on} or if an optional argument
is not given, then warnings are treated as fatal errors for the current
language.  If @var{value} is @code{off}, then the default behaviour is
restored.  This macro is useful when the
results of configuration are used where warnings are unacceptable; for
instance, if parts of a program are built with the @acronym{GCC}
@option{-Werror}
option.  If the whole program is built using @option{-Werror} it is
often simpler to put @option{-Werror} in the compiler flags (@code{CFLAGS},
etc.).
@end defmac

[1] http://lists.gnu.org/archive/html/autoconf/2006-12/msg00091.html
[2] http://lists.gnu.org/archive/html/autoconf/2007-01/msg00077.html




reply via email to

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