From 623008c296577495e00325bd3640a1b0051fa044 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 13 Nov 2020 10:20:19 -0800 Subject: tests: enable warnings for the gnulib-tests subdir * gnulib-tests/Makefile.am (AM_CFLAGS): Enable gnulib warning options for these tests. * configure.ac (GNULIB_TEST_WARN_CFLAGS): Disable the same three warning options that coreutils does, and a few more for GCC11. --- configure.ac | 14 ++++++++++++++ gnulib-tests/Makefile.am | 3 +++ 2 files changed, 17 insertions(+) diff --git a/configure.ac b/configure.ac index 0b40a9e3..e279886d 100644 --- a/configure.ac +++ b/configure.ac @@ -147,6 +147,20 @@ if test "$gl_gcc_warnings" = yes; then gl_WARN_ADD([-Wno-format-nonliteral]) gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) AC_SUBST([GNULIB_WARN_CFLAGS]) + + # For gnulib-tests, the set is slightly smaller still. + nw= + nw="$nw -Wstrict-prototypes" + # It's not worth being this picky about test programs. + nw="$nw -Wsuggest-attribute=const" + nw="$nw -Wsuggest-attribute=pure" + nw="$nw -Wsuggest-attribute=format" + nw="$nw -Wformat-truncation=2" # False alarm in strerror_r.c + nw="$nw -Wold-style-definition" + gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS], + [$GNULIB_WARN_CFLAGS], [$nw]) + gl_WARN_ADD([-Wno-return-type], [GNULIB_TEST_WARN_CFLAGS]) + AC_SUBST([GNULIB_TEST_WARN_CFLAGS]) fi # By default, argmatch should fail calling usage (EXIT_FAILURE). diff --git a/gnulib-tests/Makefile.am b/gnulib-tests/Makefile.am index 6635f706..3085f635 100644 --- a/gnulib-tests/Makefile.am +++ b/gnulib-tests/Makefile.am @@ -1 +1,4 @@ +AM_CFLAGS = include gnulib.mk + +AM_CFLAGS += $(GNULIB_TEST_WARN_CFLAGS) $(WERROR_CFLAGS) -- cgit v1.2.1