Bug 1483818: Disable MSVC warning C4200 about zero-size arrays in AttrArray::Impl. r=smaug
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 16 Aug 2018 12:45:50 +0200
changeset 431968 1d4014247f20ee46f294f131209151de6850c643
parent 431967 8743877cec09663c306d62897650cfb41fd4e974
child 431969 744065f01f78c24de3f18276d0bb8d47e4709f4b
push id34456
push usertoros@mozilla.com
push dateThu, 16 Aug 2018 21:33:21 +0000
treeherdermozilla-central@72442cf86f54 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1483818
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1483818: Disable MSVC warning C4200 about zero-size arrays in AttrArray::Impl. r=smaug
dom/base/AttrArray.h
--- a/dom/base/AttrArray.h
+++ b/dom/base/AttrArray.h
@@ -176,16 +176,21 @@ private:
   nsresult DoUpdateMappedAttrRuleMapper(nsMappedAttributeElement& aElement);
 
   struct InternalAttr
   {
     nsAttrName mName;
     nsAttrValue mValue;
   };
 
+#ifdef _MSC_VER
+// Disable MSVC warning 'nonstandard extension used: zero-sized array in struct/union'
+#pragma warning(push)
+#pragma warning(disable:4200)
+#endif
   class Impl
   {
   public:
 
     constexpr static size_t AllocationSizeForAttributes(uint32_t aAttrCount)
     {
       return sizeof(Impl) + aAttrCount * sizeof(InternalAttr);
     }
@@ -208,16 +213,20 @@ private:
     uint32_t mCapacity; // In number of InternalAttrs
 
     // Manually refcounted.
     nsMappedAttributes* mMappedAttrs;
 
     // Allocated in the same buffer as `Impl`.
     InternalAttr mBuffer[0];
   };
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
 
   mozilla::Span<InternalAttr> NonMappedAttrs()
   {
     return mImpl ? mImpl->NonMappedAttrs() : mozilla::Span<InternalAttr>();
   }
 
   mozilla::Span<const InternalAttr> NonMappedAttrs() const
   {