Bruno Haible wrote: >> If we drop the "inline", then any compilation unit that includes >> that header without using the function will get a warning about >> the unused static function. > > Ah right, you have more gcc warnings enabled typically than I do. > > Can you give me the list of warnings options that you use on glibc systems, > so that I can change my build scripts to show the same warnings that you > would see? I remember that you use -Wshadow; what else?
Sure. It may be too much for general use, but it's what I use for coreutils when configured with --enable-gcc-warnings and when using a suitably capable version of gcc. Note that the -Wsuggest-attribute=pure option is enabled only when I use gcc-4.7.x, since it malfunctions (at least it used to) with gcc-4.6.x. Here's the relevant snippet from configure.ac: # Enable this warning only with gcc-4.7 and newer. With 4.6.1 20110824, # it suggests test.c's advance function may be pure, even though it # increments a global variable. Oops. # Normally we'd write code to test for the precise failure, but that # requires a relatively large input to make gcc exhibit the failure. gl_GCC_VERSION_IFELSE([4], [7], [gl_WARN_ADD([-Wsuggest-attribute=pure])]) And for gnulib, I disable the following: nw="$nw -Wstrict-overflow" nw="$nw -Wuninitialized" nw="$nw -Wunused-macros" nw="$nw -Wmissing-prototypes" nw="$nw -Wold-style-definition" # FIXME: remove/reenable the following two, once gnulib is adjusted. nw="$nw -Wsuggest-attribute=const" nw="$nw -Wsuggest-attribute=pure" Here's the largest set (for coreutils/src/*.o): It's derived from the list provided by the gnulib manywarnings module, with selected ones removed (see configure.ac): -W -Wall -Wattributes -Wbad-function-cast -Wbuiltin-macro-redefined -Wcast-align -Wcoverage-mismatch -Wdisabled-optimization -Werror -Wformat-security -Wformat-y2k -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wmudflap -Wmultichar -Wno-logical-op -Wno-sign-compare -Wno-unused-parameter -Wold-style-definition -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpointer-arith -Wshadow -Wstrict-aliasing -Wstrict-overflow -Wstrict-prototypes -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsync-nand -Wunknown-pragmas -Wunused -Wunused-macros -Wvolatile-register-var -Wwrite-strings -fdiagnostics-show-option -funit-at-a-time -g >> However, I will add the four AC_REQUIRE lines. > > I did that now. Thank you. > 2011-11-19 Bruno Haible <br...@clisp.org> > > Ensure 'inline' can be used in tests/test-utimens-common.h. > * modules/fdutimensat-tests (configure.ac): Require AC_C_INLINE. > * modules/futimens-tests (configure.ac): Likewise. > * modules/utimens-tests (configure.ac): Likewise. > * modules/utimensat-tests (configure.ac): Likewise.