RFR: 8218164: Improve local control of compiler warnings
Kim Barrett
kim.barrett at oracle.com
Fri Feb 1 06:12:04 UTC 2019
> On Feb 1, 2019, at 12:50 AM, David Holmes <david.holmes at oracle.com> wrote:
>
> Hi Kim,
>
> On 1/02/2019 10:44 am, Kim Barrett wrote:
>> Please review this extension to the existing support for locally
>> disabling various compiler warnings. There are also a few updates of
>> existing code to use the new mechanisms. (There are some additional
>> opportunities to use these new mechanisms, but some were in code that
>> Oracle doesn't test, like Win32, so I left them alone.)
>> (Obviously one should not disable warnings lightly, but sometimes one
>> does what one must.)
>> There are several pieces to this change.
>> First, utilities/compilerWarnings.hpp is refactored to have
>> compiler-specific variants, similar to globalDefinitions.hpp. This
>> hadn't been done previously because only gcc (and clang) had
>> non-trivial definitions.
>> Second, implemented PRAGMA_DIAG_PUSH/POP for Visual Studio. Still no
>> implementations for xlc or solstudio though.
>> Third, added a couple of compiler-specific warning disabling macros:
>> PRAGMA_DISABLE_GCC_WARNING(option_string) // also applies to clang
>> PRAGMA_DISABLE_MSVCPP_WARNING(num)
>> They have useful implementations for the respective compilers and
>> empty definitions otherwise.
>> (I'm open to suggestions for better names, esp. for "MSVCPP".)
>
> This all seems quite reasonable to me. On the naming ... if the file has to use visCPP perhaps the macro should use VISCPP rather than MSVCPP ?
Thanks.
I’d be okay with that too. Let’s see if anyone else has any preference.
visCPP only appears a handful of times, and comes from the build system.
The way we currently identify this platform for these warning controls and
similar things is by looking for _MSC_VER. The actual product is
Microsoft Visual C++ (“often abbreviated to MSVC” - Wikipedia).
In retrospect, “MSVC” seems like a better choice than MSVCPP.
> Thanks,
> David
>
>> CR:
>> https://bugs.openjdk.java.net/browse/JDK-8218164
>> Webrev:
>> http://cr.openjdk.java.net/~kbarrett/8218164/open.00/
>> Testing:
>> mach5 tier1
More information about the hotspot-dev
mailing list