Skip to content
Permalink
Browse files
Build with -Wno-stringop-overflow when using GCC
https://bugs.webkit.org/show_bug.cgi?id=240596

Patch by Michael Catanzaro <mcatanzaro@redhat.com> on 2022-05-26
Reviewed by Adrian Perez de Castro.

Also, rearrange and simplify the warning flag code.

And remove suppression of -Wno-attributes, since GCC 8 is everywhere nowadays.

* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/ftl/FTLOSRExit.cpp:
(JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle):
* Source/WebCore/loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::end):
* Source/cmake/WebKitCompilerFlags.cmake:

Canonical link: https://commits.webkit.org/251018@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294895 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mcatanzaro authored and webkit-commit-queue committed May 26, 2022
1 parent db65d10 commit 90be0655d458e6cdd7a16eb1d61f8c242b829d24
Showing 4 changed files with 14 additions and 28 deletions.
@@ -20751,9 +20751,7 @@ IGNORE_CLANG_WARNINGS_END
ExitValue exitValue = exitValueForAvailability(arguments, map, availability);
if (exitValue.hasIndexInStackmapLocations())
exitValue.adjustStackmapLocationsIndexByOffset(offsetOfExitArgumentsInStackmapLocations);
IGNORE_GCC_WARNINGS_BEGIN("stringop-overflow")
exitDescriptor->m_values[i] = exitValue;
IGNORE_GCC_WARNINGS_END
}

for (auto heapPair : availabilityMap.m_heap) {
@@ -83,10 +83,8 @@ Ref<OSRExitHandle> OSRExitDescriptor::prepareOSRExitHandle(
const StackmapGenerationParams& params, uint32_t dfgNodeIndex, unsigned offset)
{
FixedVector<B3::ValueRep> valueReps(params.size() - offset);
IGNORE_GCC_WARNINGS_BEGIN("stringop-overflow")
for (unsigned i = offset, indexInValueReps = 0; i < params.size(); ++i, ++indexInValueReps)
valueReps[indexInValueReps] = params[i];
IGNORE_GCC_WARNINGS_END
unsigned index = state.jitCode->m_osrExit.size();
state.jitCode->m_osrExit.append(OSRExit(this, exitKind, nodeOrigin.forExit, nodeOrigin.semantic, nodeOrigin.wasHoisted, dfgNodeIndex, WTFMove(valueReps)));
return adoptRef(*new OSRExitHandle(index, state.jitCode.get()));
@@ -296,9 +296,7 @@ void DocumentWriter::end()
// http://bugs.webkit.org/show_bug.cgi?id=10854
// The frame's last ref may be removed and it can be deleted by checkCompleted(),
// so we'll add a protective refcount
IGNORE_GCC_WARNINGS_BEGIN("stringop-overflow")
Ref<Frame> protect(*m_frame);
IGNORE_GCC_WARNINGS_END

if (!m_parser)
return;
@@ -131,37 +131,29 @@ if (COMPILER_IS_GCC_OR_CLANG)

WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-noexcept-type)

# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80947
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "8.0" AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-attributes)
endif ()
# These GCC 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")
# https://bugs.webkit.org/show_bug.cgi?id=167643#c13
WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wno-expansion-to-defined)

# 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")
# https://bugs.webkit.org/show_bug.cgi?id=228601
WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-array-bounds)
WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-nonnull)
endif ()

# This triggers warnings in wtf/Packed.h, a header that is included in many places. It does not
# respect ignore warning pragmas and we cannot easily suppress it for all affected files.
# https://bugs.webkit.org/show_bug.cgi?id=226557
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "11.0")
# https://bugs.webkit.org/show_bug.cgi?id=240596
WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-stringop-overflow)

# This triggers warnings in wtf/Packed.h, a header that is included in many places. It does not
# respect ignore warning pragmas and we cannot easily suppress it for all affected files.
# https://bugs.webkit.org/show_bug.cgi?id=226557
WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-stringop-overread)
endif ()

# -Wodr trips over our bindings integrity feature when LTO is enabled.
# https://bugs.webkit.org/show_bug.cgi?id=229867
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
# -Wodr trips over our bindings integrity feature when LTO is enabled.
# https://bugs.webkit.org/show_bug.cgi?id=229867
WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-odr)
endif ()

# -Wexpansion-to-defined produces false positives with GCC but not Clang
# https://bugs.webkit.org/show_bug.cgi?id=167643#c13
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wno-expansion-to-defined)
endif ()

# Force SSE2 fp on x86 builds.
if (WTF_CPU_X86 AND NOT CMAKE_CROSSCOMPILING)
WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-msse2 -mfpmath=sse)

0 comments on commit 90be065

Please sign in to comment.