From c5727276089868ab11d2c0271e124e902bbbde27 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 4 May 2014 21:27:21 +0200 Subject: [PATCH] build: Compile with -Wall -Wunused only on linux. On *BSD the old set of CFLAGS causes warnings of the form /usr/pkg/include/vorbis/vorbisfile.h:75:21: warning: 'OV_CALLBACKS_DEFAULT' defined but not used /usr/pkg/include/vorbis/vorbisfile.h:82:21: warning: 'OV_CALLBACKS_NOCLOSE' defined but not used /usr/pkg/include/vorbis/vorbisfile.h:89:21: warning: 'OV_CALLBACKS_STREAMONLY' defined but not used /usr/pkg/include/vorbis/vorbisfile.h:96:21: warning: 'OV_CALLBACKS_STREAMONLY_NOCLOSE' defined but not used This commit avoids these warnings by enabling -Wall and -Wunused only on Linux systems. Let's also collect these flags in STRICT_CFLAGS rather than CFLAGS to avoid warnings when compiling the *.cmdline.c files. --- Makefile.real | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile.real b/Makefile.real index 2b245dae..63eba81e 100644 --- a/Makefile.real +++ b/Makefile.real @@ -97,24 +97,24 @@ CFLAGS += -Wmissing-noreturn CFLAGS += -Wbad-function-cast CFLAGS += -fno-strict-aliasing -ifeq ($(uname_s),Linux) - CFLAGS += -fdata-sections -ffunction-sections - CFLAGS += -Wstrict-prototypes - CFLAGS += -Wshadow - # causes warnings on *BSD for the feature test macros - CFLAGS += -Wunused-macros - LDFLAGS += -Wl,--gc-sections -endif - STRICT_CFLAGS = $(CFLAGS) -STRICT_CFLAGS += -g -Wunused -Wundef -W +STRICT_CFLAGS += -g -Wundef -W STRICT_CFLAGS += -Wredundant-decls -STRICT_CFLAGS += -Wall -Wno-sign-compare -Wno-unknown-pragmas +STRICT_CFLAGS += -Wno-sign-compare -Wno-unknown-pragmas STRICT_CFLAGS += -Wformat-security STRICT_CFLAGS += -Wmissing-format-attribute LDFLAGS += $(clock_gettime_ldflags) +ifeq ($(uname_s),Linux) + # these cause warnings on *BSD + STRICT_CFLAGS += -fdata-sections -ffunction-sections + STRICT_CFLAGS += -Wstrict-prototypes + STRICT_CFLAGS += -Wshadow + STRICT_CFLAGS += -Wunused -Wall + LDFLAGS += -Wl,--gc-sections +endif + # To put more focus on warnings, be less verbose as default # Use 'make V=1' to see the full commands ifeq ("$(origin V)", "command line") -- 2.39.5