198 endif 199 200 # Keep temporary files (.ii, .s) 201 ifdef NEED_ASM 202 CFLAGS += -save-temps 203 else 204 CFLAGS += -pipe 205 endif 206 207 # Compiler warnings are treated as errors 208 WARNINGS_ARE_ERRORS = -Werror 209 210 ifeq ($(USE_CLANG), true) 211 # However we need to clean the code up before we can unrestrictedly enable this option with Clang 212 WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses 213 WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare 214 WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess 215 WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body 216 endif 217 218 WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wno-error=format-nonliteral 219 220 ifeq ($(USE_CLANG),) 221 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit 222 # conversions which might affect the values. Only enable it in earlier versions. 223 ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" 224 WARNING_FLAGS += -Wconversion 225 endif 226 endif 227 228 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) 229 # Special cases 230 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) 231 232 # The flags to use for an Optimized g++ build 233 OPT_CFLAGS/SIZE=-Os 234 OPT_CFLAGS/SPEED=-O3 235 236 # Hotspot uses very unstrict aliasing turn this optimization off 237 # This option is added to CFLAGS rather than OPT_CFLAGS 238 # so that OPT_CFLAGS overrides get this option too. 239 CFLAGS += -fno-strict-aliasing 240 241 OPT_CFLAGS_DEFAULT ?= SPEED 242 243 ifdef OPT_CFLAGS 244 ifneq ("$(origin OPT_CFLAGS)", "command line") 245 $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") | 198 endif 199 200 # Keep temporary files (.ii, .s) 201 ifdef NEED_ASM 202 CFLAGS += -save-temps 203 else 204 CFLAGS += -pipe 205 endif 206 207 # Compiler warnings are treated as errors 208 WARNINGS_ARE_ERRORS = -Werror 209 210 ifeq ($(USE_CLANG), true) 211 # However we need to clean the code up before we can unrestrictedly enable this option with Clang 212 WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses 213 WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare 214 WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess 215 WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body 216 endif 217 218 WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 219 220 ifeq ($(USE_CLANG),) 221 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit 222 # conversions which might affect the values. Only enable it in earlier versions. 223 ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" 224 WARNING_FLAGS += -Wconversion -Wno-format-nonliteral 225 else 226 WARNING_FLAGS += -Wno-error=format-nonliteral 227 endif 228 else 229 WARNING_FLAGS += -Wno-error=format-nonliteral 230 endif 231 232 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) 233 # Special cases 234 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) 235 236 # The flags to use for an Optimized g++ build 237 OPT_CFLAGS/SIZE=-Os 238 OPT_CFLAGS/SPEED=-O3 239 240 # Hotspot uses very unstrict aliasing turn this optimization off 241 # This option is added to CFLAGS rather than OPT_CFLAGS 242 # so that OPT_CFLAGS overrides get this option too. 243 CFLAGS += -fno-strict-aliasing 244 245 OPT_CFLAGS_DEFAULT ?= SPEED 246 247 ifdef OPT_CFLAGS 248 ifneq ("$(origin OPT_CFLAGS)", "command line") 249 $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") |