moved compiler-specific warning generation to shared files (nw)

This commit is contained in:
Oliver Stöneberg 2014-03-02 16:17:12 +00:00
parent b1ee97db4c
commit 2726675591
7 changed files with 70 additions and 53 deletions

3
.gitattributes vendored
View File

@ -372,7 +372,10 @@ nl_examples/todo.c svneol=native#text/plain
nl_examples/vccs.c svneol=native#text/plain
nl_examples/vccs1.c svneol=native#text/plain
src/build/build.mak svneol=native#text/plain
src/build/cc_detection.mak svneol=native#text/plain
src/build/file2str.c svneol=native#text/plain
src/build/flags_clang.mak svneol=native#text/plain
src/build/flags_gcc.mak svneol=native#text/plain
src/build/makedep.c svneol=native#text/plain
src/build/makelist.c svneol=native#text/plain
src/build/makemak.c svneol=native#text/plain

View File

@ -557,22 +557,8 @@ COBJFLAGS += \
# warnings only applicable to C++ compiles
CPPONLYFLAGS += \
-Woverloaded-virtual
ifneq (,$(findstring clang,$(CC)))
CCOMFLAGS += \
-Wno-cast-align \
-Wno-tautological-compare \
-Wno-constant-logical-operand \
-Wno-format-security \
-Wno-shift-count-overflow \
-Wno-self-assign-field
# TODO: needs to use $(CC)
TEST_CLANG := $(shell clang --version)
ifeq ($(findstring 3.4,$(TEST_CLANG)),3.4)
CCOMFLAGS += -Wno-inline-new-delete
endif
endif
include $(SRC)/build/cc_detection.mak
ifdef SANITIZE
CCOMFLAGS += -fsanitize=$(SANITIZE)

View File

@ -0,0 +1,15 @@
ifneq ($(TARGETOS),emscripten)
ifneq (,$(findstring clang,$(CC)))
include $(SRC)/build/flags_clang.mak
else
TEST_GCC = $(shell gcc --version)
# is it Clang symlinked/renamed to GCC (Xcode 5.0 on OS X)?
ifeq ($(findstring clang,$(TEST_GCC)),clang)
include $(SRC)/build/flags_clang.mak
else
include $(SRC)/build/flags_gcc.mak
endif
endif
endif

14
src/build/flags_clang.mak Normal file
View File

@ -0,0 +1,14 @@
CCOMFLAGS += \
-Wno-cast-align \
-Wno-tautological-compare \
-Wno-constant-logical-operand \
-Wno-format-security \
-Wno-shift-count-overflow \
-Wno-self-assign-field
# TODO: needs to use $(CC)
TEST_CLANG := $(shell clang --version)
ifeq ($(findstring 3.4,$(TEST_CLANG)),3.4)
CCOMFLAGS += -Wno-inline-new-delete
endif

23
src/build/flags_gcc.mak Normal file
View File

@ -0,0 +1,23 @@
# TODO: needs to use $(CC)
TEST_GCC := $(shell gcc --version)
ifeq ($(findstring 4.4.,$(TEST_GCC)),)
#if we use new tools
LDFLAGS += -static-libstdc++
endif
ifeq ($(findstring 4.7.,$(TEST_GCC)),4.7.)
CCOMFLAGS += -Wno-narrowing -Wno-attributes
endif
ifeq ($(findstring 4.8.,$(TEST_GCC)),4.8.)
CCOMFLAGS += -Wno-narrowing -Wno-attributes -Wno-unused-local-typedefs
# array bounds checking seems to be buggy in 4.8.1 (try it on video/stvvdp1.c and video/model1.c without -Wno-array-bounds)
ifeq ($(OSD),sdl)
CCOMFLAGS += -Wno-unused-variable -Wno-array-bounds -Wno-strict-overflow
endif
endif
ifeq ($(findstring arm,$(UNAME)),arm)
CCOMFLAGS += -Wno-cast-align
endif

View File

@ -103,6 +103,12 @@ else
DEFS += -DSDLMAME_SDL2=0
endif
# minimal preliminary ARM support
ifeq ($(findstring arm,$(UNAME)),arm)
NOASM = 1
DEFS += -DSDLMAME_ARM
endif
ifdef NOASM
DEFS += -DSDLMAME_NOASM
endif
@ -202,9 +208,6 @@ LIBS += -lutil
# /usr/local/include is not considered a system include directory
# on FreeBSD. GL.h resides there and throws warnings
CCOMFLAGS += -isystem /usr/local/include
# No clue here. There is a popmessage(NULL) in uimenu.c which
# triggers a non-null format warning on FreeBSD only.
CCOMFLAGS += -Wno-format
NO_USE_MIDI = 1
endif
@ -434,16 +437,10 @@ SDLOS_TARGETOS = $(BASE_TARGETOS)
#-------------------------------------------------
# TEST_GCC for GCC version-specific stuff
#-------------------------------------------------
ifneq ($(TARGETOS),emscripten)
ifeq (,$(findstring clang,$(CC)))
TEST_GCC = $(shell gcc --version)
# is it Clang symlinked/renamed to GCC (Xcode 5.0 on OS X)?
ifeq ($(findstring clang,$(TEST_GCC)),clang)
CCOMFLAGS += -Wno-cast-align -Wno-constant-logical-operand -Wno-shift-count-overflow -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare -Wno-self-assign-field
endif
# Ubuntu 12.10 GCC 4.7.2 autodetect
ifeq ($(findstring 4.7.2-2ubuntu1,$(TEST_GCC)),4.7.2-2ubuntu1)
GCC46TST = $(shell which g++-4.6 2>/dev/null)
@ -452,29 +449,10 @@ $(error Ubuntu 12.10 detected. Please install the gcc-4.6 and g++-4.6 packages)
endif
CC = @gcc-4.6
LD = @g++-4.6
TEST_GCC = $(shell gcc-4.6 --version)
endif
endif
ifeq ($(findstring 4.7.,$(TEST_GCC)),4.7.)
CCOMFLAGS += -Wno-narrowing -Wno-attributes
endif
# array bounds checking seems to be buggy in 4.8.1 (try it on video/stvvdp1.c and video/model1.c without -Wno-array-bounds)
ifeq ($(findstring 4.8.,$(TEST_GCC)),4.8.)
CCOMFLAGS += -Wno-narrowing -Wno-attributes -Wno-unused-local-typedefs -Wno-unused-variable -Wno-array-bounds -Wno-strict-overflow
endif
# minimal preliminary ARM support
ifeq ($(findstring arm,$(UNAME)),arm)
CCOMFLAGS += -Wno-cast-align
DEFS += -DSDLMAME_NOASM -DSDLMAME_ARM
endif
else # compiler is specifically Clang
CCOMFLAGS += -Wno-cast-align -Wno-constant-logical-operand -Wno-shift-count-overflow -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare -Wno-self-assign-field
endif
endif
include $(SRC)/build/cc_detection.mak
#-------------------------------------------------
# Unix

View File

@ -274,20 +274,18 @@ endif
# add our prefix files to the mix
CCOMFLAGS += -include $(WINSRC)/winprefix.h
include $(SRC)/build/cc_detection.mak
# ensure we statically link the gcc runtime lib
LDFLAGS += -static-libgcc
# TODO: needs to use $(CC)
TEST_GCC := $(shell gcc --version)
ifeq ($(findstring 4.4.,$(TEST_GCC)),)
#if we use new tools
LDFLAGS += -static-libstdc++
endif
ifeq ($(findstring 4.7.,$(TEST_GCC)),4.7.)
CCOMFLAGS += -Wno-narrowing -Wno-attributes
endif
ifeq ($(findstring 4.8.,$(TEST_GCC)),4.8.)
CCOMFLAGS += -Wno-narrowing -Wno-attributes -Wno-unused-local-typedefs
endif
# add the windows libraries
LIBS += -luser32 -lgdi32 -ldsound -ldxguid -lwinmm -ladvapi32 -lcomctl32 -lshlwapi -lwsock32