Re: warning: module to simplify adding compiler warnings

2008-11-23 Thread Ralf Wildenhues
Hello Simon, just a note: * Simon Josefsson wrote on Mon, Nov 17, 2008 at 01:09:49PM CET: > > What mechanism propagates the CFLAGS setting to sub-directories? I used > > to add -W etc to CFLAGS in the top-level configure.ac, and they were > > propagated into lib/Makefile and libextra/Makefile wi

Re: warning: module to simplify adding compiler warnings

2008-11-17 Thread Simon Josefsson
Paolo Bonzini <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> I want to add some warning flags from configure, including -Werror. > > You can use AC_PREPROC_IFELSE if using GCC: > > $ gcc -E -x c /dev/null -Wno-frobnicate > cc1: error: unrecognized command line option "-Wno-frobnicate" > >

Re: warning: module to simplify adding compiler warnings

2008-11-17 Thread Simon Josefsson
Simon Josefsson <[EMAIL PROTECTED]> writes: > This is likely a autoconf or automake question, but since it was related > to the warnings module, and some of the relevant people is on this list > as well, I'm trying to raise it here: > > How do I get the WARN_CFLAGS variable defined in all of my Ma

Re: warning: module to simplify adding compiler warnings

2008-11-12 Thread Simon Josefsson
An AC_SUBST is still needed for WARN_CFLAGS though. This fixes it. /Simon >From ea74b5798d06c81b0fead783668b42ce6080a177 Mon Sep 17 00:00:00 2001 From: Simon Josefsson <[EMAIL PROTECTED]> Date: Wed, 12 Nov 2008 12:33:58 +0100 Subject: [PATCH] warnings: Invoke AC_SUBST on WARN_CFLAGS. --- Chang

Re: warning: module to simplify adding compiler warnings

2008-11-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> >> FWIW, I wouldn't use AC_ARG_VAR for gl_WARN_INIT. >> > >> > Yes, agreed: When the user wants to disable some warnings, he can do so by >> > putting the opposite -W options into the CFLAGS when configuring. That's >> > what my

Re: warning: module to simplify adding compiler warnings

2008-11-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > Here's what I understood: ... > Simon, maybe you can add a piece of text like this as documentation? Excellent! Many thanks. It matches my intentions. I have added it to the gnulib manual. /Simon

Re: warning: module to simplify adding compiler warnings

2008-11-12 Thread Bruno Haible
Simon Josefsson wrote: > >> FWIW, I wouldn't use AC_ARG_VAR for gl_WARN_INIT. > > > > Yes, agreed: When the user wants to disable some warnings, he can do so by > > putting the opposite -W options into the CFLAGS when configuring. That's > > what my proposed piece of documentation says. Non-maintai

Re: warning: module to simplify adding compiler warnings

2008-11-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > Ralf Wildenhues wrote: >> FWIW, I wouldn't use AC_ARG_VAR for gl_WARN_INIT. > > Yes, agreed: When the user wants to disable some warnings, he can do so by > putting the opposite -W options into the CFLAGS when configuring. That's > what my proposed piece

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Bruno Haible
Ralf Wildenhues wrote: > FWIW, I wouldn't use AC_ARG_VAR for gl_WARN_INIT. Yes, agreed: When the user wants to disable some warnings, he can do so by putting the opposite -W options into the CFLAGS when configuring. That's what my proposed piece of documentation says. Non-maintainers don't need to

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Ralf Wildenhues
* Simon Josefsson wrote on Tue, Nov 11, 2008 at 02:23:14PM CET: > Paolo Bonzini <[EMAIL PROTECTED]> writes: > > >> But gl_WARN_INIT should also accept a VARIABLE argument, then? Or better, > >> make gl_WARN_INIT automatic upon the first use of gl_WARN_ADD with the > >> given VARIABLE? > > > > You

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Simon Josefsson
This is likely a autoconf or automake question, but since it was related to the warnings module, and some of the relevant people is on this list as well, I'm trying to raise it here: How do I get the WARN_CFLAGS variable defined in all of my Makefile's? In GnuTLS, I now use AC_CONFIG_SUBDIR for li

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Simon Josefsson
Paolo Bonzini <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> Paolo Bonzini <[EMAIL PROTECTED]> writes: >> gl_WARN_INIT(WARN_CFLAGS, [C Compiler warning flags]) gl_WARN_INIT(WARN_FOO_CFLAGS, [Extra C Compiler warning flags for foo]) gl_WARN_INIT(WARN_OTHER_INTERNAL_CFLAGS)

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Paolo Bonzini
Simon Josefsson wrote: > Paolo Bonzini <[EMAIL PROTECTED]> writes: > >>> gl_WARN_INIT(WARN_CFLAGS, [C Compiler warning flags]) >>> gl_WARN_INIT(WARN_FOO_CFLAGS, [Extra C Compiler warning flags for foo]) >>> gl_WARN_INIT(WARN_OTHER_INTERNAL_CFLAGS) >>> >>> The gl_WARN_INIT code would invoke AC_ARG_

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Simon Josefsson
Paolo Bonzini <[EMAIL PROTECTED]> writes: >> gl_WARN_INIT(WARN_CFLAGS, [C Compiler warning flags]) >> gl_WARN_INIT(WARN_FOO_CFLAGS, [Extra C Compiler warning flags for foo]) >> gl_WARN_INIT(WARN_OTHER_INTERNAL_CFLAGS) >> >> The gl_WARN_INIT code would invoke AC_ARG_VAR on the first and second >>

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Paolo Bonzini
> gl_WARN_INIT(WARN_CFLAGS, [C Compiler warning flags]) > gl_WARN_INIT(WARN_FOO_CFLAGS, [Extra C Compiler warning flags for foo]) > gl_WARN_INIT(WARN_OTHER_INTERNAL_CFLAGS) > > The gl_WARN_INIT code would invoke AC_ARG_VAR on the first and second > variable, but not the last. But what would the

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Simon Josefsson
Paolo Bonzini <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> Paolo Bonzini <[EMAIL PROTECTED]> writes: >> But gl_WARN_INIT should also accept a VARIABLE argument, then? Or better, make gl_WARN_INIT automatic upon the first use of gl_WARN_ADD with the given VARIABLE? >>> Yo

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Paolo Bonzini
Simon Josefsson wrote: > Paolo Bonzini <[EMAIL PROTECTED]> writes: > >>> But gl_WARN_INIT should also accept a VARIABLE argument, then? Or better, >>> make gl_WARN_INIT automatic upon the first use of gl_WARN_ADD with the >>> given VARIABLE? >> You have a point; however, gl_WARN_INIT would then ne

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Simon Josefsson
Paolo Bonzini <[EMAIL PROTECTED]> writes: >> But gl_WARN_INIT should also accept a VARIABLE argument, then? Or better, >> make gl_WARN_INIT automatic upon the first use of gl_WARN_ADD with the >> given VARIABLE? > > You have a point; however, gl_WARN_INIT would then need a second > argument for th

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Simon Josefsson
Paolo Bonzini <[EMAIL PROTECTED]> writes: >>> I can do the change, or you can do it; as you prefer. In any case if >>> you pushdef you'd better popdef too. :-) >> >> Please apply your change and I'll test whether it works for me. > > Here it is. I also added a second argument to choose the dest

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Paolo Bonzini
>>> Also, if only one argument is given, won't this do an AC_SUBST([]) ? >> Yes. And I thought it was a no-op (that's why I AC_SUBSTed WARN_CFLAGS >> separately), but it gives an error. > > Should AS_LITERAL_IF be taught to treat the empty argument as non-literal? No, absolutely. That's the pu

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Paolo Bonzini on 11/11/2008 5:52 AM: >> AS_LITERAL_IF is not documented in autoconf 2.63. Is there a documented >> replacement? > > No, but it has been forever in M4sh. I'll prepare a documentation patch. It's already been documented, a

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Paolo Bonzini
Bruno Haible wrote: > Paolo Bonzini wrote: >> @@ -47,4 +47,5 @@ >> gl_AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])]) >> AS_VAR_POPDEF([gl_Flags])dnl >> AS_VAR_POPDEF([gl_Warn])dnl >> +AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])dnl > > AS_LITERAL_IF is not documented in autoc

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Bruno Haible
Paolo Bonzini wrote: > @@ -47,4 +47,5 @@ > gl_AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])]) > AS_VAR_POPDEF([gl_Flags])dnl > AS_VAR_POPDEF([gl_Warn])dnl > +AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])dnl AS_LITERAL_IF is not documented in autoconf 2.63. Is there a documented

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Paolo Bonzini
Bruno Haible wrote: > An AC_SUBST([WARN_CFLAGS]) is missing somewhere. Why should the user have > to do it himself? We know that WARN_CFLAGS is meant to be used in > Makefile.ams. I'm committing this: 2008-11-11 Paolo Bonzini <[EMAIL PROTECTED]> * m4/warnings.m4 (gl_WARN_INIT): Substi

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Paolo Bonzini
Bruno Haible wrote: > Paolo Bonzini wrote: >> By the way, I just noticed an (unused?) warning.m4 file. Ok to delete it? > > As far as I understood the modivation for Simon's new module, the old > warning.m4 file does not match these requirements, therefore yes it is OK > to delete it; only Bison

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Bruno Haible
Paolo Bonzini wrote: > By the way, I just noticed an (unused?) warning.m4 file. Ok to delete it? As far as I understood the modivation for Simon's new module, the old warning.m4 file does not match these requirements, therefore yes it is OK to delete it; only Bison uses it. Here's what I underst

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Paolo Bonzini
> But gl_WARN_INIT should also accept a VARIABLE argument, then? Or better, > make gl_WARN_INIT automatic upon the first use of gl_WARN_ADD with the > given VARIABLE? You have a point; however, gl_WARN_INIT would then need a second argument for the description too, and then the user can directly

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Bruno Haible
An AC_SUBST([WARN_CFLAGS]) is missing somewhere. Why should the user have to do it himself? We know that WARN_CFLAGS is meant to be used in Makefile.ams. Bruno

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Bruno Haible
Paolo Bonzini wrote: > I also added a second argument to choose the destination > variable instead of hardcoding it to WARN_CFLAGS. This is good: it supports packages which are maintained by several people, with different coding guidelines in different directories. But gl_WARN_INIT should also ac

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Paolo Bonzini
>> I can do the change, or you can do it; as you prefer. In any case if >> you pushdef you'd better popdef too. :-) > > Please apply your change and I'll test whether it works for me. Here it is. I also added a second argument to choose the destination variable instead of hardcoding it to WARN

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Simon Josefsson
Paolo Bonzini <[EMAIL PROTECTED]> writes: >> +# gl_WARN_ADD([parameter]) adds parameter to WARN_CFLAGS if compiler >> +# supports it. For example, use gl_WARN_ADD([-Werror]). >> +AC_DEFUN([gl_WARN_ADD], >> +[ >> + pushdef([param],[translit([$1],[ABCDEFGHIJKLMNOPQRSTUVWXYZ./-], >> +

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Paolo Bonzini
> +# gl_WARN_ADD([parameter]) adds parameter to WARN_CFLAGS if compiler > +# supports it. For example, use gl_WARN_ADD([-Werror]). > +AC_DEFUN([gl_WARN_ADD], > +[ > + pushdef([param],[translit([$1],[ABCDEFGHIJKLMNOPQRSTUVWXYZ./-], > + [abcdefghijklmnopqrstuvwxyz__

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Simon Josefsson
Ralf Wildenhues <[EMAIL PROTECTED]> writes: > * Simon Josefsson wrote on Tue, Nov 11, 2008 at 10:32:42AM CET: >> > IMO this is just the opposite of portability. >> >> I agree, however, -Werror is useful during 'make distcheck'. I'm going >> to remove the above line from configure.ac and pass the

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Ralf Wildenhues
* Simon Josefsson wrote on Tue, Nov 11, 2008 at 10:32:42AM CET: > > IMO this is just the opposite of portability. > > I agree, however, -Werror is useful during 'make distcheck'. I'm going > to remove the above line from configure.ac and pass the flag to > configure in cfg.mk instead. Why not ju

Re: warning: module to simplify adding compiler warnings

2008-11-11 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> It allows me to add to configure.ac this: >> >> gl_WARN_ADD([-Wall]) >> gl_WARN_ADD([-Wpointer-arith]) >> gl_WARN_ADD([-Wstrict-prototypes]) >> gl_WARN_ADD([-Wno-pointer-sign]) > > Will $WARN_CFLAGS be used before or after $CFLA

Re: warning: module to simplify adding compiler warnings

2008-11-10 Thread Bruno Haible
Simon Josefsson wrote: > It allows me to add to configure.ac this: > > gl_WARN_ADD([-Wall]) > gl_WARN_ADD([-Wpointer-arith]) > gl_WARN_ADD([-Wstrict-prototypes]) > gl_WARN_ADD([-Wno-pointer-sign]) Will $WARN_CFLAGS be used before or after $CFLAGS? I.e. can the user disable these warning flags or

Re: warning: module to simplify adding compiler warnings

2008-11-10 Thread Simon Josefsson
Updated module, thanks for review! I'll wait some more time before pushing this, in case someone finds more serious problems or has objections. /Simon >From 637ecea60f31fbc4b0d45927b27d219986a1e1aa Mon Sep 17 00:00:00 2001 From: Simon Josefsson <[EMAIL PROTECTED]> Date: Mon, 10 Nov 2008 20:44:19

Re: warning: module to simplify adding compiler warnings

2008-11-10 Thread Simon Josefsson
Ralf Wildenhues <[EMAIL PROTECTED]> writes: >> so how about something like this module? > > I'm indifferent, except that a better werror framework in Autoconf could > make your approach obsolete. Let me know when it is released. :) >> + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), foo=yes, foo=no) >

Re: warning: module to simplify adding compiler warnings

2008-11-10 Thread Ralf Wildenhues
Hi Simon, * Simon Josefsson wrote on Mon, Nov 10, 2008 at 07:09:30PM CET: > I want to add some warning flags from configure, including -Werror. > > Using CFLAGS doesn't seem to be a good idea (some autoconf tests stops > working), Also, some flags influence the preprocessor, too. > so how about

Re: warning: module to simplify adding compiler warnings

2008-11-10 Thread Paolo Bonzini
Simon Josefsson wrote: > I want to add some warning flags from configure, including -Werror. You can use AC_PREPROC_IFELSE if using GCC: $ gcc -E -x c /dev/null -Wno-frobnicate cc1: error: unrecognized command line option "-Wno-frobnicate" It is faster. Also, this: > + AC_COMPILE_IFELSE(AC_LA