From 9041714455c342e7a74037e8cf54cd73109ac44b Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Tue, 19 May 2026 14:20:18 -0700 Subject: [PATCH] Fix JSCRuntime invalidate() specifier ordering (noexcept before JSI_DISABLE_ASAN) Clang requires noexcept to appear before compiler attributes like __attribute__((no_sanitize("address"))). Having JSI_DISABLE_ASAN (which expands to that attribute when ASAN is enabled) after noexcept causes a build error: error: expected function body after function declarator Reorder to: noexcept JSI_DISABLE_ASAN across all four affected sites. --- .../react-native/ReactCommon/jsc/JSCRuntime.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp b/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp index ee832ad2ce5d..7c7e978561c6 100644 --- a/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp +++ b/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp @@ -8,6 +8,12 @@ #include "JSCRuntime.h" #include + +#if __has_feature(address_sanitizer) +#define JSI_DISABLE_ASAN __attribute__((no_sanitize("address"))) +#else +#define JSI_DISABLE_ASAN +#endif #include #include #include @@ -527,7 +533,7 @@ JSCRuntime::JSCSymbolValue::JSCSymbolValue( #endif } -void JSCRuntime::JSCSymbolValue::invalidate() noexcept { +void JSCRuntime::JSCSymbolValue::invalidate() noexcept JSI_DISABLE_ASAN { #ifndef NDEBUG counter_ -= 1; #endif @@ -552,7 +558,7 @@ JSCRuntime::JSCStringValue::JSCStringValue(JSStringRef str) : str_(JSStringRetain(str)) {} #endif -void JSCRuntime::JSCStringValue::invalidate() noexcept { +void JSCRuntime::JSCStringValue::invalidate() noexcept JSI_DISABLE_ASAN { // These JSC{String,Object}Value objects are implicitly owned by the // {String,Object} objects, thus when a String/Object is destructed // the JSC{String,Object}Value should be released. @@ -587,7 +593,7 @@ JSCRuntime::JSCObjectValue::JSCObjectValue( #endif } -void JSCRuntime::JSCObjectValue::invalidate() noexcept { +void JSCRuntime::JSCObjectValue::invalidate() noexcept JSI_DISABLE_ASAN { #ifndef NDEBUG counter_ -= 1; #endif @@ -863,7 +869,7 @@ jsi::Object JSCRuntime::createObject(std::shared_ptr ho) { static void getPropertyNames( JSContextRef ctx, JSObjectRef object, - JSPropertyNameAccumulatorRef propertyNames) noexcept { + JSPropertyNameAccumulatorRef propertyNames) noexcept JSI_DISABLE_ASAN { JSC_UNUSED(ctx); auto proxy = static_cast(JSObjectGetPrivate(object)); auto& rt = proxy->runtime;