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 $CFLAGS? I.e. can the user > disable these warning flags or not?
That's up to each maintainer, WARN_CFLAGS isn't added to CFLAGS automatically. I'm using this in libtasn1's src/Makefile.am: AM_CFLAGS = $(WARN_CFLAGS) AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_builddir)/gl ... This makes it possible to gradually fix code, just add $(WARN_CFLAGS) in those directories that you've solved all warnings for. (For example, in some projects the gnulib directory triggers warning that I would want to fix elsewhere in the project, but I don't want the build to fail because of the gnulib code.) >> gl_WARN_ADD([-Werror]) > > This is a bad idea. It will cause gratuitous frustration for users on > platforms that you haven't tested. Remember that many warnings do not > indicate something really wrong with the program, only the _possibility_ > that something is wrong. The user will then need two attempts to build a > package, instead of only one. Or he will choose to build with a proprietary > compiler rather than with gcc. > > 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. > It would be better to make the macro bail out at autoconf time if someone > attempts to put gl_WARN_ADD([-Werror]) into his configure.ac file. This is too much, I think, and would break an IMHO realistic use-case of putting -Werror in WARN_CFLAGS during make distcheck. I've pushed the module. /Simon
