6991482: Add global jdk makefile options to silence some VS2010 warnings jdk7-b124
authorohair
Tue, 28 Dec 2010 16:12:31 -0800
changeset 32951c72adc9d5f3
parent 3294 a06412e13bf7
child 3296 0a56bdd709d0
child 3315 9320dcfb5398
child 3328 aa03f76d0e80
child 3346 349b67ae3e08
child 3369 58aa8eadae5f
child 3452 006c683ead1a
6991482: Add global jdk makefile options to silence some VS2010 warnings
Reviewed-by: prr
make/common/Defs-windows.gmk
make/common/shared/Defs-windows.gmk
make/common/shared/Sanity-Settings.gmk
     1.1 --- a/make/common/Defs-windows.gmk	Tue Dec 28 15:53:50 2010 -0800
     1.2 +++ b/make/common/Defs-windows.gmk	Tue Dec 28 16:12:31 2010 -0800
     1.3 @@ -294,6 +294,13 @@
     1.4  
     1.5  # Always add _STATIC_CPPLIB definition
     1.6  STATIC_CPPLIB_OPTION = /D _STATIC_CPPLIB
     1.7 +
     1.8 +# Silence the warning about using _STATIC_CPPLIB
     1.9 +ifneq ($(SHOW_ALL_WARNINGS),true)
    1.10 +  # Needed with VS2010 to turn off the deprecated warning.
    1.11 +  STATIC_CPPLIB_OPTION += /D _DISABLE_DEPRECATE_STATIC_CPPLIB
    1.12 +endif
    1.13 +
    1.14  MS_RUNTIME_OPTION += $(STATIC_CPPLIB_OPTION)
    1.15  
    1.16  ifeq ($(CC_VERSION),msvc)
    1.17 @@ -305,7 +312,7 @@
    1.18    #   -Od      Turns off optimization and speeds compilation
    1.19    #   -YX -Fp/.../foobar.pch   Use precompiled headers (try someday?)
    1.20    #   -nologo  Don't print out startup message
    1.21 -  #   /D _STATIC_CPPLIB  
    1.22 +  #   /D _STATIC_CPPLIB
    1.23    #            Use static link for the C++ runtime (so msvcpnn.dll not needed)
    1.24    #   
    1.25    CFLAGS_COMMON  += -Zi -nologo
    1.26 @@ -395,12 +402,20 @@
    1.27  # Treat compiler warnings as errors, if requested
    1.28  #
    1.29  CFLAGS_COMMON += -W$(COMPILER_WARNING_LEVEL)
    1.30 -# Turn off security warnings about using the standard C library function strcpy
    1.31 -CFLAGS_COMMON += -D _CRT_SECURE_NO_DEPRECATE
    1.32  ifeq ($(COMPILER_WARNINGS_FATAL),true)
    1.33    CFLAGS_COMMON += -WX
    1.34  endif
    1.35  
    1.36 +# Turn off some warnings by default, enable them all if asked.
    1.37 +ifneq ($(SHOW_ALL_WARNINGS),true)
    1.38 +  # The -D _CRT_SECURE_NO_DEPRECATE turns off security/deprecated warnings on
    1.39 +  #    the standard C library functions like strcpy.
    1.40 +  CFLAGS_COMMON += -D _CRT_SECURE_NO_DEPRECATE
    1.41 +  # The -D _CRT_NONSTDC_NO_DEPRECATE turns off deprecation warnings about using
    1.42 +  #    non-standard C POSIX functions.
    1.43 +  CFLAGS_COMMON += -D _CRT_NONSTDC_NO_DEPRECATE
    1.44 +endif
    1.45 +
    1.46  CPPFLAGS_OPT    = -DNDEBUG
    1.47  CPPFLAGS_DBG    = -DDEBUG -DLOGGING
    1.48  
     2.1 --- a/make/common/shared/Defs-windows.gmk	Tue Dec 28 15:53:50 2010 -0800
     2.2 +++ b/make/common/shared/Defs-windows.gmk	Tue Dec 28 16:12:31 2010 -0800
     2.3 @@ -34,12 +34,17 @@
     2.4  #    Program.gmk may turn this down to 2 (building .exe's).
     2.5  #    Windows 64bit platforms are less likely to be warning free.
     2.6  #    Historically, Windows 32bit builds should be mostly warning free.
     2.7 +#    VS2010 introduced a large number of security warnings that are off by
     2.8 +#    default but will be turned back on with SHOW_ALL_WARNINGS=true.
     2.9  ifndef COMPILER_WARNING_LEVEL
    2.10    COMPILER_WARNING_LEVEL=3
    2.11  endif
    2.12  ifndef COMPILER_WARNINGS_FATAL
    2.13    COMPILER_WARNINGS_FATAL=false
    2.14  endif
    2.15 +ifndef SHOW_ALL_WARNINGS
    2.16 +  SHOW_ALL_WARNINGS = false
    2.17 +endif
    2.18  
    2.19  # Windows should use parallel compilation for best build times
    2.20  ifndef COMPILE_APPROACH
     3.1 --- a/make/common/shared/Sanity-Settings.gmk	Tue Dec 28 15:53:50 2010 -0800
     3.2 +++ b/make/common/shared/Sanity-Settings.gmk	Tue Dec 28 16:12:31 2010 -0800
     3.3 @@ -138,6 +138,7 @@
     3.4  ALL_SETTINGS+=$(call addOptionalSetting,FASTDEBUG)
     3.5  ALL_SETTINGS+=$(call addRequiredSetting,COMPILER_WARNINGS_FATAL)
     3.6  ALL_SETTINGS+=$(call addOptionalSetting,COMPILER_WARNING_LEVEL)
     3.7 +ALL_SETTINGS+=$(call addOptionalSetting,SHOW_ALL_WARNINGS)
     3.8  ALL_SETTINGS+=$(call addRequiredSetting,INCREMENTAL_BUILD)
     3.9  ALL_SETTINGS+=$(call addOptionalSetting,CC_HIGHEST_OPT)
    3.10  ALL_SETTINGS+=$(call addOptionalSetting,CC_HIGHER_OPT)