Discussion:
How to cancel flags set by AC_LANG_WERROR?
Andrey Simonenko
2006-12-22 10:47:03 UTC
Permalink
Hello,

How to cancel flags set by AC_LANG_WERROR in autoconf-2.61?
In other words, is there a way to set -Werror flag only for
some of tests in configure.ac? (of course it is possible to
modify ac_c_werror_flag in configure.ac)

Thanks.
Ralf Wildenhues
2007-01-21 15:06:49 UTC
Permalink
Hello Andrey,

Aplogies for the delay.
Post by Andrey Simonenko
How to cancel flags set by AC_LANG_WERROR in autoconf-2.61?
In other words, is there a way to set -Werror flag only for
some of tests in configure.ac? (of course it is possible to
modify ac_c_werror_flag in configure.ac)
At the moment, the only way to do this is to modify $ac_c_werror_flag,
which however is undocumented in the Autoconf manual.

We have two choices: document ac_LANG_werror_flag, or add accessor
macros. (Or document the current limitation and be done with it.)
WDYT?

Cheers,
Ralf
Paul Eggert
2007-01-21 22:14:34 UTC
Permalink
Post by Ralf Wildenhues
We have two choices: document ac_LANG_werror_flag, or add accessor
macros. (Or document the current limitation and be done with it.)
I suspect in the long run it'd be a mistake to document
ac_LANG_werror_flag, so we should either add accessor macros or
document the current limitation.
Andrey Simonenko
2007-01-22 11:29:41 UTC
Permalink
Post by Ralf Wildenhues
Hello Andrey,
Aplogies for the delay.
Post by Andrey Simonenko
How to cancel flags set by AC_LANG_WERROR in autoconf-2.61?
In other words, is there a way to set -Werror flag only for
some of tests in configure.ac? (of course it is possible to
modify ac_c_werror_flag in configure.ac)
At the moment, the only way to do this is to modify $ac_c_werror_flag,
which however is undocumented in the Autoconf manual.
We have two choices: document ac_LANG_werror_flag, or add accessor
macros. (Or document the current limitation and be done with it.)
WDYT?
I think that a new macro should be added.

Something like this (may be AC_LANG_NO_WERROR should check that
AC_LANG_WERROR was used before?):

lang.m4:

# AC_LANG_NO_WERROR
# ------------------
# Do not treat warnings from the current language's preprocessor, compiler,
# and linker as fatal errors.
AC_DEFUN([AC_LANG_NO_WERROR],
[ac_[]_AC_LANG_ABBREV[]_werror_flag=])# AC_LANG_NO_WERROR

autoconf.texi:

@defmac AC_LANG_NO_WERROR
@acindex{LANG_NO_WERROR}
This macro cancels effects of @code{AC_LANG_WERROR} macro and Autoconf
will treat all warnings generated by the compiler, linker, and preprocessor
as it does before @code{AC_LANG_WERROR} macro. This macro must be used
only if @code{AC_LANG_WERROR} macro was used before.
@end defmac
Keith MARSHALL
2007-01-22 11:57:12 UTC
Permalink
Post by Andrey Simonenko
Post by Ralf Wildenhues
We have two choices: document ac_LANG_werror_flag, or add accessor
macros. (Or document the current limitation and be done with it.)
WDYT?
I think that a new macro should be added.
Something like this (may be AC_LANG_NO_WERROR should check that
Or maybe, modify the definition of AC_LANG_WERROR itself, allowing it to
accept an optional ON/OFF argument? Then:

- AC_LANG_WERROR([ON]) would have the same effect as the existing
behaviour, and would be the default for backward compatibility,
so continuing to support use without any argument.

- AC_LANG_WERROR([OFF]) would cancel the effect of any prior use
of AC_LANG_WERROR([ON]), (or would simply have no effect if not
previously ON, and could be silently ignored).

Just a thought, but seems somehow cleaner than having two complementary
macros, IMHO.

Regards,
Keith.

Loading...