< prev index next >

make/linux/makefiles/gcc.make

Print this page
rev 7793 : 8073315: Enable gcc -Wtype-limits and fix upcoming issues.
Summary: Relevant fixes in blockOffsetTable.cpp, os_linux.cpp, parCardTableModRefBS.cpp.
   1 #
   2 # Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #


 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


   1 #
   2 # Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #


 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 >