]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
autogen.sh: turn format issues into compiler errors
authorTobias Deiminger <tobias.deiminger@linutronix.de>
Thu, 7 May 2026 19:50:59 +0000 (21:50 +0200)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Tue, 19 May 2026 12:46:55 +0000 (14:46 +0200)
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 <tobias.deiminger@linutronix.de>
fix format error

autogen.sh
tests/unit/Makefile.am

index cd7b3dd63863a1fb5fedf4da36f9a392a7d3b902..f1740d16630e9623f20b2b48033b6ae587632dbc 100755 (executable)
@@ -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"
index 95dc5b797e4cec29fcfb9279c908e609a29fa463..d18372d0b9e2f1ffe41d9b609e19f7868180b9e2 100644 (file)
@@ -100,6 +100,7 @@ test_stprintf_SOURCES = \
     $(NULL)
 test_stprintf_CFLAGS = \
     $(AM_CFLAGS) \
+    -Wno-format-zero-length \
     $(NULL)
 test_stprintf_LDFLAGS = \
     $(NULL)