diff --git a/src/hotspot/share/utilities/compilerWarnings_gcc.hpp b/src/hotspot/share/utilities/compilerWarnings_gcc.hpp index 8cf0ad571f0..99c2f174836 100644 --- a/src/hotspot/share/utilities/compilerWarnings_gcc.hpp +++ b/src/hotspot/share/utilities/compilerWarnings_gcc.hpp @@ -34,9 +34,7 @@ #define ATTRIBUTE_SCANF(fmt,vargs) __attribute__((format(scanf, fmt, vargs))) #endif -#define PRAGMA_DISABLE_GCC_WARNING_AUX(x) _Pragma(#x) -#define PRAGMA_DISABLE_GCC_WARNING(option_string) \ - PRAGMA_DISABLE_GCC_WARNING_AUX(GCC diagnostic ignored option_string) +#define PRAGMA_DISABLE_GCC_WARNING(optstring) _Pragma(STR(GCC diagnostic ignored optstring)) #define PRAGMA_FORMAT_NONLITERAL_IGNORED \ PRAGMA_DISABLE_GCC_WARNING("-Wformat-nonliteral") \ @@ -56,8 +54,7 @@ #define PRAGMA_STRINGOP_OVERFLOW_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wstringop-overflow") #endif -#define PRAGMA_NONNULL_IGNORED \ - PRAGMA_DISABLE_GCC_WARNING("-Wnonnull") +#define PRAGMA_NONNULL_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wnonnull") #if defined(__clang_major__) && \ (__clang_major__ >= 4 || \ diff --git a/src/hotspot/share/utilities/compilerWarnings_visCPP.hpp b/src/hotspot/share/utilities/compilerWarnings_visCPP.hpp index 0b52fa5adf3..de76b522c7b 100644 --- a/src/hotspot/share/utilities/compilerWarnings_visCPP.hpp +++ b/src/hotspot/share/utilities/compilerWarnings_visCPP.hpp @@ -25,10 +25,10 @@ #ifndef SHARE_UTILITIES_COMPILERWARNINGS_VISCPP_HPP #define SHARE_UTILITIES_COMPILERWARNINGS_VISCPP_HPP -#define PRAGMA_DIAG_PUSH __pragma(warning(push)) -#define PRAGMA_DIAG_POP __pragma(warning(pop)) +#define PRAGMA_DISABLE_MSVC_WARNING(num) _Pragma(STR(warning(disable : num))) -#define PRAGMA_DISABLE_MSVC_WARNING(num) __pragma(warning(disable : num)) +#define PRAGMA_DIAG_PUSH _Pragma("warning(push)") +#define PRAGMA_DIAG_POP _Pragma("warning(pop)") // The Visual Studio implementation of FORBID_C_FUNCTION explicitly does // nothing, because there doesn't seem to be a way to implement it for Visual