Bruno Haible via Gnulib discussion list <bug-gnulib@gnu.org> writes: > Paul Eggert wrote: >> On 2024-12-17 17:21, Bruno Haible via Gnulib discussion list wrote: >> > Therefore, how about applying -Werror only to a subset of all >> > warnings, hand-picked by the maintainer? >> >> We already tailor warnings from Gnulib as opposed to warnings from the >> main program > > Oh I see: Code that sets GNULIB_WARN_CFLAGS is already present in > gzip/configure.ac (and likewise in coreutils, grep, tar) but not yet in > diffutils/configure.ac. > > # We use a slightly smaller set of warning options for lib/. > # Remove the following and save the result in GNULIB_WARN_CFLAGS. > nw= > ... > gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) > AC_SUBST([GNULIB_WARN_CFLAGS]) > > How about adding this block to the configure.ac of > diffutils > bison > m4 > sed > that use the same idiom? Even if for the moment, nw remains empty here, > the comment would make it clear that this is the mechanism to disable > some warning options for lib/, and this would reduce the pressure on > gnulib do placate style warnings like the two recent ones.
A long-standing todo for me has been to push the manywarnings idiom into a gnulib function instead of forcing it into maintainer configure.ac's. In libidn2 I use the following block which adds the additional --enable-gcc-warnings=error alternative, which I've found quite useful. Line 96-168: https://gitlab.com/libidn/libidn2/-/blob/61ee87ee229c811bd9bf945084645058249b52cc/configure.ac#L96 As far as I can tell, all of those lines could all be replaced into something like this: gl_MEGAWARNINGS([-fanalyzer -Wbad-function-cast ... # unwantedflags], [-Wno-error=analyzer-use-of-uninitialized-value ... # error flags]) and it could be used for all packages. There is a lot of cut'n'paste logical code now that is duplicated. Maybe some additional parametrization is necessary to accomodate for all possible uses. Or at least make sure simple additional post-processing after running the gl_MEGAWARNINGS is possible. Thoughts? /Simon
signature.asc
Description: PGP signature