build: Compile with -Wall -Wunused only on linux.
authorAndre Noll <maan@systemlinux.org>
Sun, 4 May 2014 19:27:21 +0000 (21:27 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 26 Oct 2014 12:15:54 +0000 (13:15 +0100)
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

index 2b245dae188d6188c61f2b59aae0d2eefb20e841..63eba81e1b8df289da8a78b85bf8215dd2335139 100644 (file)
@@ -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")