Makefile: Improve how we enable and disable warnings. This fixes incompatibilities between r5543 and certain platforms.

git-svn-id: https://svn.eduke32.com/eduke32@5555 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-01-12 10:31:07 +00:00
parent 4c7a460d6a
commit c695e8e911

View file

@ -279,7 +279,7 @@ ifneq ($(RELEASE)$(DEBUGANYWAY),10)
endif endif
CONLYFLAGS=-std=gnu99 -Wimplicit -Werror-implicit-function-declaration CONLYFLAGS=-std=gnu99 -Wimplicit -Werror-implicit-function-declaration
CPPONLYFLAGS= -fno-exceptions -fno-rtti -Wno-write-strings CPPONLYFLAGS= -fno-exceptions -fno-rtti
ASFORMAT=elf$(SYSBITS) ASFORMAT=elf$(SYSBITS)
ASFLAGS=-s -f $(ASFORMAT) #-g ASFLAGS=-s -f $(ASFORMAT) #-g
LINKERFLAGS= LINKERFLAGS=
@ -296,9 +296,10 @@ ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \>= 4)))
endif endif
M_TUNE_GENERIC := -mtune=generic M_TUNE_GENERIC := -mtune=generic
M_STACKREALIGN := -mstackrealign M_STACKREALIGN := -mstackrealign
W_STRICT_OVERFLOW := -Wno-strict-overflow
endif endif
W_STRICT_OVERFLOW := -Wno-strict-overflow
ifeq ($(HOSTPLATFORM),WINDOWS) ifeq ($(HOSTPLATFORM),WINDOWS)
# MSYS2 lets you create files named NUL but has a /dev/null. Go figure. # MSYS2 lets you create files named NUL but has a /dev/null. Go figure.
ifeq (,$(wildcard /dev/null)) ifeq (,$(wildcard /dev/null))
@ -404,14 +405,6 @@ ifneq (0,$(PROFILER))
endif endif
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \>= 4)))
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \>= 1)))
COMPILERFLAGS+= -Wno-attributes
endif
endif
ifeq ($(PLATFORM),WII) ifeq ($(PLATFORM),WII)
override USE_LIBVPX = 0 override USE_LIBVPX = 0
override NETCODE = 0 override NETCODE = 0
@ -510,39 +503,63 @@ else
endif endif
endif endif
W_NO_UNUSED_RESULT := W_UNINITIALIZED := -Wuninitialized
ifeq (0,$(CLANG)) W_GCC_4_1 := -Wno-attributes
# W_NO_UNUSED_RESULT := $(shell echo '' | $(CC) -E -Wno-unused-result - 2>/dev/null && echo -Wno-unused-result) W_GCC_4_2 := $(W_STRICT_OVERFLOW)
# W_NO_UNUSED_RESULT := $(findstring -Wno-unused-result,$(W_NO_UNUSED_RESULT)) W_GCC_4_4 := -Wno-unused-result
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \>= 4))) W_GCC_4_5 := -Wlogical-op -Wcast-qual
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \>= 4)))
W_NO_UNUSED_RESULT := -Wno-unused-result
endif
endif
endif
CWARNS := -W -Wall \ CWARNS = -W -Wall \
-Wpointer-arith \
-Wextra \ -Wextra \
-Wpointer-arith \
-Wno-char-subscripts \ -Wno-char-subscripts \
-Wno-missing-braces \ -Wno-missing-braces \
-Wno-unknown-warning-option \
-Wuninitialized \
-Wlogical-op \
-Wcast-qual \
-Wwrite-strings \ -Wwrite-strings \
$(W_UNINITIALIZED) \
$(W_GCC_4_1) \
$(W_GCC_4_2) \
$(W_GCC_4_4) \
$(W_GCC_4_5) \
#-Wstrict-prototypes \ #-Wstrict-prototypes \
#-Waggregate-return \ #-Waggregate-return \
#-Wcast-align \ #-Wcast-align \
#-Waddress #-Waddress
ifneq (0,$(CLANG)) ifneq (0,$(CLANG))
CWARNS+= -Wno-unused-value -Wno-parentheses CWARNS+= -Wno-unused-value -Wno-parentheses -Wno-unknown-warning-option
else
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \< 4)))
W_GCC_4_5 :=
W_GCC_4_4 :=
ifeq (0,$(OPTLEVEL))
W_UNINITIALIZED :=
endif
W_GCC_4_2 :=
W_GCC_4_1 :=
endif
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) = 4)))
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \< 5)))
W_GCC_4_5 :=
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \< 4)))
W_GCC_4_4 :=
ifeq (0,$(OPTLEVEL))
W_UNINITIALIZED :=
endif
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \< 2)))
W_GCC_4_2 :=
ifeq (1,$(strip $(shell expr $(GCC_MINOR) \< 1)))
W_GCC_4_1 :=
endif
endif
endif
endif
endif
endif endif
COMMONFLAGS+= -funsigned-char -fno-strict-aliasing $(F_JUMP_TABLES) COMMONFLAGS+= -funsigned-char -fno-strict-aliasing $(F_JUMP_TABLES)
COMPILERFLAGS+= $(CWARNS) $(W_NO_UNUSED_RESULT) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 COMPILERFLAGS+= $(CWARNS) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
ifeq (0,$(NETCODE)) ifeq (0,$(NETCODE))
COMPILERFLAGS+= -DNETCODE_DISABLE COMPILERFLAGS+= -DNETCODE_DISABLE
@ -969,7 +986,7 @@ ifeq ($(PLATFORM),WII)
LIBS+= -laesnd_tueidj -lpng -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard LIBS+= -laesnd_tueidj -lpng -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard
endif endif
COMPILERFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1 -DMIXERTYPE$(MIXERTYPE)=1 $(W_STRICT_OVERFLOW) COMPILERFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1 -DMIXERTYPE$(MIXERTYPE)=1
ifneq (0,$(USE_OPENGL)) ifneq (0,$(USE_OPENGL))
COMPILERFLAGS+= -DUSE_OPENGL COMPILERFLAGS+= -DUSE_OPENGL