[git commit] disable format security warnings

Mike Frysinger vapier at gentoo.org
Sat Aug 4 20:14:24 UTC 2012

commit: http://git.busybox.net/busybox/commit/?id=ca81a937225714f75157eb596d90255243ae2e29
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

We pass strings to printf directly a lot.  Some distros enable some flags
in their gcc by default like -Wformat-security.  With these two things, we
end up with a lot of build warnings like so:
	loginutils/chpasswd.c:42:3: warning: format not a string literal and
		no format arguments [-Wformat-security]

But we don't care.  Our focus is first and foremost on size, so adding a
lot of dummy calls like:
-	printf(some_constant_string);
+	printf("%s", some_constant_string);
is pointless bloat.

Disable this warning flag if the compiler supports it.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
 Makefile.flags |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Makefile.flags b/Makefile.flags
index c43c8dc..f5f4465 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -25,6 +25,7 @@ CFLAGS += $(call cc-option,-Wstrict-prototypes,)
 CFLAGS += $(call cc-option,-Wunused -Wunused-parameter,)
 CFLAGS += $(call cc-option,-Wunused-function -Wunused-value,)
 CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,)
+CFLAGS += $(call cc-option,-Wno-format-security,)
 # warn about C99 declaration after statement
 CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
 # If you want to add more -Wsomething above, make sure that it is

More information about the busybox-cvs mailing list