< prev index next >

make/linux/makefiles/gcc.make

Print this page
rev 7793 : 8073315: Enable gcc -Wtype-limits and fix upcoming issues.


 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 -Wreturn-type
 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 
 229 # Special cases
 230 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
 231 
 232 # optimization control flags (Used by fastdebug and release variants)
 233 OPT_CFLAGS/NOOPT=-O0
 234 OPT_CFLAGS/DEBUG=-O0
 235 OPT_CFLAGS/SIZE=-Os
 236 OPT_CFLAGS/SPEED=-O3
 237 
 238 OPT_CFLAGS_DEFAULT ?= SPEED
 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




 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 -Wreturn-type
 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   else 
 225     # This flag is only known since GCC 4.3.
 226     WARNING_FLAGS += -Wtype-limits
 227   endif
 228 endif
 229 
 230 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)
 231 
 232 # Special cases
 233 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
 234 
 235 # optimization control flags (Used by fastdebug and release variants)
 236 OPT_CFLAGS/NOOPT=-O0
 237 OPT_CFLAGS/DEBUG=-O0
 238 OPT_CFLAGS/SIZE=-Os
 239 OPT_CFLAGS/SPEED=-O3
 240 
 241 OPT_CFLAGS_DEFAULT ?= SPEED
 242 
 243 # Hotspot uses very unstrict aliasing turn this optimization off
 244 # This option is added to CFLAGS rather than OPT_CFLAGS
 245 # so that OPT_CFLAGS overrides get this option too.
 246 CFLAGS += -fno-strict-aliasing


< prev index next >