From 57d1ad9ca6b4b925dd2700d328d2693df6a253d7 Mon Sep 17 00:00:00 2001 From: attila Date: Tue, 4 Jun 2024 10:40:45 +0200 Subject: [PATCH] Suppress GCC warnings related to the anonymous namespace used around choc::javascript The warnings are emitted by GCC on Linux, since the commit dbd3b4f34be86e797b7a49beb032ff386d116292. --- modules/juce_core/javascript/juce_Javascript.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/juce_core/javascript/juce_Javascript.cpp b/modules/juce_core/javascript/juce_Javascript.cpp index c4da5d25c5..bfd9a9eb6b 100644 --- a/modules/juce_core/javascript/juce_Javascript.cpp +++ b/modules/juce_core/javascript/juce_Javascript.cpp @@ -35,7 +35,8 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-copy-with-dtor", "-Wunused-but-set-variable", "-Wdeprecated", - "-Wunused-function") + "-Wunused-function", + "-Wpedantic") JUCE_BEGIN_IGNORE_WARNINGS_MSVC (6011 6246 6255 6262 6297 6308 6323 6340 6385 6386 28182) #include #include @@ -228,6 +229,10 @@ static qjs::JSValue juceToQuickJs (var variant, qjs::JSContext* ctx) } //============================================================================== +// Any type that references the QuickJS types inside the anonymous namespace added by us requires +// this with GCC. Suppressing this warning is fine, since these classes are only visible and used +// in a single translation unit. +JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wsubobject-linkage") class detail::QuickJSWrapper { public: @@ -268,6 +273,7 @@ private: choc::javascript::Context context = choc::javascript::createQuickJSContext(); std::function interruptHandler; }; +JUCE_END_IGNORE_WARNINGS_GCC_LIKE using SetterFn = qjs::JSValue (*) (qjs::JSContext* ctx, qjs::JSValueConst thisVal, @@ -644,6 +650,7 @@ static uint32_t toUint32 (int64 value) } //============================================================================== +JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wsubobject-linkage") struct JSFunctionArguments { explicit JSFunctionArguments (qjs::JSContext* contextIn) : context (contextIn) @@ -822,6 +829,7 @@ private: const detail::QuickJSWrapper* engine = nullptr; ValuePtr valuePtr; }; +JUCE_END_IGNORE_WARNINGS_GCC_LIKE JSObject::JSObject (const detail::QuickJSWrapper* engine) : impl (new Impl (engine))