8200630: Globally suppress Visual Studio warning C4351
authorkbarrett
Wed, 04 Apr 2018 18:19:46 -0400
changeset 49676 0bb0c2f27ca9
parent 49675 e862d3c78123
child 49677 a1a7456dd8b9
8200630: Globally suppress Visual Studio warning C4351 Summary: Globally suppress warning, remove sole instance of local suppression. Reviewed-by: gtriantafill, tschatzl
src/hotspot/share/gc/shared/oopStorage.cpp
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp
--- a/src/hotspot/share/gc/shared/oopStorage.cpp	Wed Apr 04 23:05:13 2018 +0300
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp	Wed Apr 04 18:19:46 2018 -0400
@@ -120,12 +120,6 @@
 const unsigned section_count = BytesPerWord;
 const unsigned block_alignment = sizeof(oop) * section_size;
 
-// VS2013 warns (C4351) that elements of _data will be *correctly* default
-// initialized, unlike earlier versions that *incorrectly* did not do so.
-#ifdef _WINDOWS
-#pragma warning(push)
-#pragma warning(disable: 4351)
-#endif // _WINDOWS
 OopStorage::Block::Block(const OopStorage* owner, void* memory) :
   _data(),
   _allocated_bitmask(0),
@@ -142,9 +136,6 @@
   assert(owner != NULL, "NULL owner");
   assert(is_aligned(this, block_alignment), "misaligned block");
 }
-#ifdef _WINDOWS
-#pragma warning(pop)
-#endif
 
 OopStorage::Block::~Block() {
   assert(_release_refcount == 0, "deleting block while releasing");
--- a/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp	Wed Apr 04 23:05:13 2018 +0300
+++ b/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp	Wed Apr 04 18:19:46 2018 -0400
@@ -139,6 +139,7 @@
 #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union (needed in windows.h)
 #pragma warning( disable : 4511 ) // copy constructor could not be generated
 #pragma warning( disable : 4291 ) // no matching operator delete found; memory will not be freed if initialization thows an exception
+#pragma warning( disable : 4351 ) // new behavior: elements of array ... will be default initialized
 #ifdef CHECK_UNHANDLED_OOPS
 #pragma warning( disable : 4521 ) // class has multiple copy ctors of a single type
 #pragma warning( disable : 4522 ) // class has multiple assignment operators of a single type