Title: [280689] trunk
Revision
280689
Author
[email protected]
Date
2021-08-05 08:27:03 -0700 (Thu, 05 Aug 2021)

Log Message

GCC 11 builds should use -Wno-array-bounds, -Wno-nonnull
https://bugs.webkit.org/show_bug.cgi?id=228601

Patch by Michael Catanzaro <[email protected]> on 2021-08-05
Reviewed by Carlos Garcia Campos.

.:

Prior to GCC 11, these were good warnings that could catch serious errors. But GCC 11 has
just become too sensitive and it's flagging what appear to be harmless cases, and not
providing enough feedback to know why. This has resulted in me littering our code with
pragmas to suppress GCC's false positives, and I think it's reached the point where it's
nicer to just turn off the warnings until such time that GCC gets this under control, and
rely on Clang instead in the meantime.

The GCC developers have indicated that these warnings will *always* produce false positives
in some circumstances, but with GCC 11 it's just too become too much IMO.

* Source/cmake/WebKitCompilerFlags.cmake:

Source/_javascript_Core:

* b3/air/AirAllocateRegistersByGraphColoring.cpp:
* jit/JITCall.cpp:
(JSC::JIT::compileOpCall):

Source/WebCore:

* css/CSSValue.h:
(WebCore::CSSValue::deref):
* css/StyleRule.h:
(WebCore::StyleRuleBase::deref const):
* dom/Node.h:
(WebCore::Node::deref const):

Source/WebKit:

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::Stream::~Stream):

Source/WTF:

* wtf/Bitmap.h:
(WTF::WordType>::clear):
* wtf/Compiler.h:
* wtf/Packed.h:
(WTF::PackedAlignedPtr::get const):
* wtf/RefPtr.h:
(WTF::DefaultRefDerefTraits::derefIfNotNull):

Modified Paths

Diff

Modified: trunk/ChangeLog (280688 => 280689)


--- trunk/ChangeLog	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/ChangeLog	2021-08-05 15:27:03 UTC (rev 280689)
@@ -1,3 +1,22 @@
+2021-08-05  Michael Catanzaro  <[email protected]>
+
+        GCC 11 builds should use -Wno-array-bounds, -Wno-nonnull
+        https://bugs.webkit.org/show_bug.cgi?id=228601
+
+        Reviewed by Carlos Garcia Campos.
+
+        Prior to GCC 11, these were good warnings that could catch serious errors. But GCC 11 has
+        just become too sensitive and it's flagging what appear to be harmless cases, and not
+        providing enough feedback to know why. This has resulted in me littering our code with
+        pragmas to suppress GCC's false positives, and I think it's reached the point where it's
+        nicer to just turn off the warnings until such time that GCC gets this under control, and
+        rely on Clang instead in the meantime.
+
+        The GCC developers have indicated that these warnings will *always* produce false positives
+        in some circumstances, but with GCC 11 it's just too become too much IMO.
+
+        * Source/cmake/WebKitCompilerFlags.cmake:
+
 2021-07-30  Adrian Perez de Castro  <[email protected]>
 
         [CMake] Fix fallback methods in the libgcrypt find module

Modified: trunk/Source/_javascript_Core/ChangeLog (280688 => 280689)


--- trunk/Source/_javascript_Core/ChangeLog	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-08-05 15:27:03 UTC (rev 280689)
@@ -1,3 +1,14 @@
+2021-08-05  Michael Catanzaro  <[email protected]>
+
+        GCC 11 builds should use -Wno-array-bounds, -Wno-nonnull
+        https://bugs.webkit.org/show_bug.cgi?id=228601
+
+        Reviewed by Carlos Garcia Campos.
+
+        * b3/air/AirAllocateRegistersByGraphColoring.cpp:
+        * jit/JITCall.cpp:
+        (JSC::JIT::compileOpCall):
+
 2021-08-05  Zan Dobersek  <[email protected]>
 
         Use reinterpret_cast_ptr in KeywordLookupGenerator, PropertyMapHashTable

Modified: trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.cpp (280688 => 280689)


--- trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.cpp	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.cpp	2021-08-05 15:27:03 UTC (rev 280689)
@@ -1466,10 +1466,7 @@
         if (!reg) {
             dataLog("FATAL: No color for ", tmp, "\n");
             dataLog("Code:\n");
-// https://bugs.webkit.org/show_bug.cgi?id=224782
-IGNORE_ARRAY_BOUNDS_WARNINGS_BEGIN
             dataLog(m_code);
-IGNORE_ARRAY_BOUNDS_WARNINGS_END
             RELEASE_ASSERT_NOT_REACHED();
         }
         return reg;
@@ -1484,8 +1481,6 @@
 
     void initializePrecoloredTmp()
     {
-// https://bugs.webkit.org/show_bug.cgi?id=224782
-IGNORE_ARRAY_BOUNDS_WARNINGS_BEGIN
         m_coloredTmp.resize(m_lastPrecoloredRegisterIndex + 1);
         for (unsigned i = 1; i <= m_lastPrecoloredRegisterIndex; ++i) {
             Tmp tmp = TmpMapper::tmpFromAbsoluteIndex(i);
@@ -1492,7 +1487,6 @@
             ASSERT(tmp.isReg());
             m_coloredTmp[i] = tmp.reg();
         }
-IGNORE_ARRAY_BOUNDS_WARNINGS_END
     }
 
     bool mayBeCoalesced(Arg left, Arg right)

Modified: trunk/Source/_javascript_Core/jit/JITCall.cpp (280688 => 280689)


--- trunk/Source/_javascript_Core/jit/JITCall.cpp	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/_javascript_Core/jit/JITCall.cpp	2021-08-05 15:27:03 UTC (rev 280689)
@@ -253,9 +253,7 @@
         return;
     }
 
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN
     auto slowPaths = info->emitFastPath(*this, regT0, regT2, CallLinkInfo::UseDataIC::Yes);
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END
     auto doneLocation = label();
     addSlowCase(slowPaths);
 

Modified: trunk/Source/WTF/ChangeLog (280688 => 280689)


--- trunk/Source/WTF/ChangeLog	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/WTF/ChangeLog	2021-08-05 15:27:03 UTC (rev 280689)
@@ -1,3 +1,18 @@
+2021-08-05  Michael Catanzaro  <[email protected]>
+
+        GCC 11 builds should use -Wno-array-bounds, -Wno-nonnull
+        https://bugs.webkit.org/show_bug.cgi?id=228601
+
+        Reviewed by Carlos Garcia Campos.
+
+        * wtf/Bitmap.h:
+        (WTF::WordType>::clear):
+        * wtf/Compiler.h:
+        * wtf/Packed.h:
+        (WTF::PackedAlignedPtr::get const):
+        * wtf/RefPtr.h:
+        (WTF::DefaultRefDerefTraits::derefIfNotNull):
+
 2021-08-05  Zan Dobersek  <[email protected]>
 
         Avoid reinterpret_cast alignment increase warnings with GCC on CPU(RISCV64)

Modified: trunk/Source/WTF/wtf/Bitmap.h (280688 => 280689)


--- trunk/Source/WTF/wtf/Bitmap.h	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/WTF/wtf/Bitmap.h	2021-08-05 15:27:03 UTC (rev 280689)
@@ -234,9 +234,7 @@
 template<size_t bitmapSize, typename WordType>
 inline void Bitmap<bitmapSize, WordType>::clear(size_t n)
 {
-IGNORE_ARRAY_BOUNDS_WARNINGS_BEGIN
     bits[n / wordSize] &= ~(one << (n % wordSize));
-IGNORE_ARRAY_BOUNDS_WARNINGS_END
 }
 
 template<size_t bitmapSize, typename WordType>

Modified: trunk/Source/WTF/wtf/Compiler.h (280688 => 280689)


--- trunk/Source/WTF/wtf/Compiler.h	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/WTF/wtf/Compiler.h	2021-08-05 15:27:03 UTC (rev 280689)
@@ -513,13 +513,6 @@
 #define IGNORE_NULL_CHECK_WARNINGS_BEGIN IGNORE_WARNINGS_BEGIN("nonnull")
 #define IGNORE_NULL_CHECK_WARNINGS_END IGNORE_WARNINGS_END
 
-#define IGNORE_ARRAY_BOUNDS_WARNINGS_BEGIN IGNORE_WARNINGS_BEGIN("array-bounds")
-#define IGNORE_ARRAY_BOUNDS_WARNINGS_END IGNORE_WARNINGS_END
-
-/* https://bugs.webkit.org/show_bug.cgi?id=224452 */
-#define IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN IGNORE_GCC_WARNINGS_BEGIN("nonnull")
-#define IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END IGNORE_GCC_WARNINGS_END
-
 /* NO_UNIQUE_ADDRESS */
 
 #if !defined(NO_UNIQUE_ADDRESS) && defined(__has_cpp_attribute)

Modified: trunk/Source/WTF/wtf/Packed.h (280688 => 280689)


--- trunk/Source/WTF/wtf/Packed.h	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/WTF/wtf/Packed.h	2021-08-05 15:27:03 UTC (rev 280689)
@@ -142,13 +142,11 @@
         // https://bugs.webkit.org/show_bug.cgi?id=197754
         uintptr_t value = 0;
 
-IGNORE_ARRAY_BOUNDS_WARNINGS_BEGIN
 #if CPU(LITTLE_ENDIAN)
         memcpy(&value, m_storage.data(), storageSize);
 #else
         memcpy(bitwise_cast<uint8_t*>(&value) + (sizeof(void*) - storageSize), m_storage.data(), storageSize);
 #endif
-IGNORE_ARRAY_BOUNDS_WARNINGS_END
 
         if (isAlignmentShiftProfitable)
             value <<= alignmentShiftSize;

Modified: trunk/Source/WTF/wtf/RefPtr.h (280688 => 280689)


--- trunk/Source/WTF/wtf/RefPtr.h	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/WTF/wtf/RefPtr.h	2021-08-05 15:27:03 UTC (rev 280689)
@@ -38,10 +38,8 @@
 
     static ALWAYS_INLINE void derefIfNotNull(T* ptr)
     {
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN
         if (LIKELY(ptr != nullptr))
             ptr->deref();
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END
     }
 };
 

Modified: trunk/Source/WebCore/ChangeLog (280688 => 280689)


--- trunk/Source/WebCore/ChangeLog	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/WebCore/ChangeLog	2021-08-05 15:27:03 UTC (rev 280689)
@@ -1,3 +1,17 @@
+2021-08-05  Michael Catanzaro  <[email protected]>
+
+        GCC 11 builds should use -Wno-array-bounds, -Wno-nonnull
+        https://bugs.webkit.org/show_bug.cgi?id=228601
+
+        Reviewed by Carlos Garcia Campos.
+
+        * css/CSSValue.h:
+        (WebCore::CSSValue::deref):
+        * css/StyleRule.h:
+        (WebCore::StyleRuleBase::deref const):
+        * dom/Node.h:
+        (WebCore::Node::deref const):
+
 2021-08-05  Rob Buis  <[email protected]>
 
         Fix warning in HTTPParsers.parseStructuredFieldValue

Modified: trunk/Source/WebCore/css/CSSValue.h (280688 => 280689)


--- trunk/Source/WebCore/css/CSSValue.h	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/WebCore/css/CSSValue.h	2021-08-05 15:27:03 UTC (rev 280689)
@@ -70,9 +70,7 @@
         // the appropriate subclass type.
         unsigned tempRefCount = m_refCount - refCountIncrement;
         if (!tempRefCount) {
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN
             destroy();
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END
             return;
         }
         m_refCount = tempRefCount;

Modified: trunk/Source/WebCore/css/StyleRule.h (280688 => 280689)


--- trunk/Source/WebCore/css/StyleRule.h	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/WebCore/css/StyleRule.h	2021-08-05 15:27:03 UTC (rev 280689)
@@ -277,9 +277,7 @@
 inline void StyleRuleBase::deref() const
 {
     if (derefBase())
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN
         const_cast<StyleRuleBase&>(*this).destroy();
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END
 }
 
 inline void StyleRule::wrapperAdoptSelectorList(CSSSelectorList&& selectors)

Modified: trunk/Source/WebCore/dom/Node.h (280688 => 280689)


--- trunk/Source/WebCore/dom/Node.h	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/WebCore/dom/Node.h	2021-08-05 15:27:03 UTC (rev 280689)
@@ -795,9 +795,7 @@
 #if ASSERT_ENABLED
         m_inRemovedLastRefFunction = true;
 #endif
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN
         const_cast<Node&>(*this).removedLastRef();
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END
         return;
     }
     m_refCountAndParentBit = updatedRefCount;

Modified: trunk/Source/WebKit/ChangeLog (280688 => 280689)


--- trunk/Source/WebKit/ChangeLog	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/WebKit/ChangeLog	2021-08-05 15:27:03 UTC (rev 280689)
@@ -1,3 +1,13 @@
+2021-08-05  Michael Catanzaro  <[email protected]>
+
+        GCC 11 builds should use -Wno-array-bounds, -Wno-nonnull
+        https://bugs.webkit.org/show_bug.cgi?id=228601
+
+        Reviewed by Carlos Garcia Campos.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::Stream::~Stream):
+
 2021-08-05  Imanol Fernandez  <[email protected]>
 
         Fix XR related clang warnings in WPE

Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp (280688 => 280689)


--- trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp	2021-08-05 15:27:03 UTC (rev 280689)
@@ -145,7 +145,6 @@
     RefPtr<NetscapePlugInStreamLoader> m_loader;
 };
 
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN
 PluginView::Stream::~Stream()
 {
     if (m_loadCallback)
@@ -152,7 +151,6 @@
         m_loadCallback({ });
     ASSERT(!m_pluginView);
 }
-IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END
     
 void PluginView::Stream::start()
 {

Modified: trunk/Source/cmake/WebKitCompilerFlags.cmake (280688 => 280689)


--- trunk/Source/cmake/WebKitCompilerFlags.cmake	2021-08-05 15:26:18 UTC (rev 280688)
+++ trunk/Source/cmake/WebKitCompilerFlags.cmake	2021-08-05 15:27:03 UTC (rev 280689)
@@ -136,9 +136,16 @@
         WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-attributes)
     endif ()
 
+    # Since GCC 11, these warnings produce too many false positives to be useful. We'll rely on
+    # developers who build with Clang to notice these warnings.
+    if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "11.0")
+        WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-array-bounds)
+        WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-nonnull)
+    endif ()
+
     # -Wexpansion-to-defined produces false positives with GCC but not Clang
     # https://bugs.webkit.org/show_bug.cgi?id=167643#c13
-    if (CMAKE_COMPILER_IS_GNUCXX)
+    if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
         WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wno-expansion-to-defined)
     endif ()
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to