From 40fe7df654fa18b1e2184528e566ced8c2a11792 Mon Sep 17 00:00:00 2001 From: phosit Date: Sun, 5 Jan 2025 08:58:11 +0100 Subject: [PATCH] Silence dangling pointer warning for JS::Rooted With much help by @sera. --- libraries/source/spidermonkey/build.sh | 2 +- .../SupressDanglingPointerWarning.patch | 31 +++++++++++++++++++ .../source/spidermonkey/patches/patch.sh | 3 ++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 libraries/source/spidermonkey/patches/SupressDanglingPointerWarning.patch diff --git a/libraries/source/spidermonkey/build.sh b/libraries/source/spidermonkey/build.sh index cb895eee85..78d2ea2264 100755 --- a/libraries/source/spidermonkey/build.sh +++ b/libraries/source/spidermonkey/build.sh @@ -8,7 +8,7 @@ cd "$(dirname "$0")" # This should match the version in config/milestone.txt FOLDER="mozjs-115.16.1" # If same-version changes are needed, increment this. -LIB_VERSION="115.16.1+4" +LIB_VERSION="115.16.1+5" LIB_NAME="mozjs115" fetch() diff --git a/libraries/source/spidermonkey/patches/SupressDanglingPointerWarning.patch b/libraries/source/spidermonkey/patches/SupressDanglingPointerWarning.patch new file mode 100644 index 0000000000..3b06a2fa31 --- /dev/null +++ b/libraries/source/spidermonkey/patches/SupressDanglingPointerWarning.patch @@ -0,0 +1,31 @@ +From 0bfc032c102b8a251e4dc751d0b48992ebf72641 Mon Sep 17 00:00:00 2001 +From: phosit +Date: Sun, 5 Jan 2025 14:29:33 +0100 +Subject: [PATCH] Supress -Wdangling-pointer warning on GCC + +--- + js/public/RootingAPI.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h +index 42be14e67351..6b167cb8ea2e 100644 +--- a/js/public/RootingAPI.h ++++ b/js/public/RootingAPI.h +@@ -1166,7 +1166,14 @@ class MOZ_RAII Rooted : public detail::RootedTraits::StackBase, + inline void registerWithRootLists(RootedListHeads& roots) { + this->stack = &roots[JS::MapTypeToRootKind::kind]; + this->prev = *this->stack; ++#if defined(__GNUC__) && __GNUC__ >= 12 ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wdangling-pointer" ++#endif + *this->stack = this; ++#if defined(__GNUC__) && __GNUC__ >= 12 ++#pragma GCC diagnostic pop ++#endif + } + + inline RootedListHeads& rootLists(RootingContext* cx) { +-- +2.47.1 + diff --git a/libraries/source/spidermonkey/patches/patch.sh b/libraries/source/spidermonkey/patches/patch.sh index 6def418a74..d64cff9a09 100755 --- a/libraries/source/spidermonkey/patches/patch.sh +++ b/libraries/source/spidermonkey/patches/patch.sh @@ -46,3 +46,6 @@ patch -p1 <"${PATCHES}"/FixPython3.12.8.diff # https://bugzilla.mozilla.org/show_bug.cgi?id=1876415 # Fixed in ESR 128 patch -p1 <"${PATCHES}"/FixProfiling.diff + +# Supress warning on newer GCC compilers. +patch -p1 <"${PATCHES}"/SupressDanglingPointerWarning.patch