hotspot/make/linux/makefiles/gcc.make

Print this page
rev 5893 : 8030350: Enable additional compiler warnings for GCC
Reviewed-by: dholmes, coleenp


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




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