From: Tobias Deiminger Date: Thu, 7 May 2026 19:50:59 +0000 (+0200) Subject: autogen.sh: turn format issues into compiler errors X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9ba37a1b74cc05043ee10971a55b285499170530;p=thirdparty%2Fshadow.git autogen.sh: turn format issues into compiler errors This protects against undefined behavior from wrongly used conversion specifiers. Note: snprintf unit test intentionally uses an empty format string to test, well, the empt format string. Thus override format-zero-length for it. Signed-off-by: Tobias Deiminger fix format error --- diff --git a/autogen.sh b/autogen.sh index cd7b3dd63..f1740d166 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,8 +4,10 @@ autoreconf -v -f --install "$(dirname "$0")" || exit 1 CFLAGS="-O2" CFLAGS="$CFLAGS -Wall" +CFLAGS="$CFLAGS -Wformat=2" CFLAGS="$CFLAGS -Wextra" CFLAGS="$CFLAGS -Werror=discarded-qualifiers" +CFLAGS="$CFLAGS -Werror=format" CFLAGS="$CFLAGS -Werror=implicit-function-declaration" CFLAGS="$CFLAGS -Werror=implicit-int" CFLAGS="$CFLAGS -Werror=incompatible-pointer-types" diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 95dc5b797..d18372d0b 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -100,6 +100,7 @@ test_stprintf_SOURCES = \ $(NULL) test_stprintf_CFLAGS = \ $(AM_CFLAGS) \ + -Wno-format-zero-length \ $(NULL) test_stprintf_LDFLAGS = \ $(NULL)