From 8b528093bb7667af114961b3375c16c14f0e9ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ma=C5=82ecki?= Date: Mon, 5 Oct 2026 03:40:21 -0700 Subject: [PATCH] Stop suppressing the for-frameworks guard inside umbrella context Summary: The for-frameworks guard skipped its warning whenever `RN_UMBRELLA_CONTEXT` was defined, and its message told consumers to include the header through the module umbrella. Neither makes sense for this tier: umbrellas only re-export public headers, and framework-tier modules have no umbrella at all. The exemption therefore had no legitimate use; its only effect was to hide a public header transitively leaking a for-frameworks header into consumer code. Drop the `RN_UMBRELLA_CONTEXT` exemption so such a leak is reported, and point the message at the only real escape hatch, `RN_ALLOW_FRAMEWORKS`. No umbrella or public header includes a for-frameworks header today, so this does not change any existing build. Changelog: [Internal] Differential Revision: D123399815 --- .../react/cxxstableapi/FrameworksGuard.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/react-native/ReactCommon/react/cxxstableapi/FrameworksGuard.h b/packages/react-native/ReactCommon/react/cxxstableapi/FrameworksGuard.h index 3f73494371c3..df3743c06de8 100644 --- a/packages/react-native/ReactCommon/react/cxxstableapi/FrameworksGuard.h +++ b/packages/react-native/ReactCommon/react/cxxstableapi/FrameworksGuard.h @@ -13,23 +13,25 @@ // #include // // "For frameworks" headers are APIs intended for framework authors integrating -// React Native, not for ordinary app code. Including one directly emits a -// SUPPRESSIBLE warning under enforcement. A framework author acknowledges the -// usage by defining `RN_ALLOW_FRAMEWORKS`, which silences the warning. +// React Native, not for ordinary app code. Including one, directly or +// transitively, emits a SUPPRESSIBLE warning under enforcement. A framework +// author acknowledges the usage by defining `RN_ALLOW_FRAMEWORKS`, which +// silences the warning. Module umbrellas never re-export these headers, so +// `RN_UMBRELLA_CONTEXT` does not suppress the warning: a public header that +// includes a for-frameworks header leaks it, and is reported. // // See for the full `RN_*` macro contract. // In short: // RN_STRICT_API Consumer opt-in master switch; the guard is inert // without it. // RN_ALLOW_FRAMEWORKS Consumer opt-out acknowledging framework-tier usage. -// RN_UMBRELLA_CONTEXT Internal marker set by an umbrella around its includes. // RN_BUILDING Set by React Native's own build. // // This header is intentionally NOT `#pragma once`-guarded: it must be -// re-evaluated on every inclusion so each direct include is checked. +// re-evaluated on every inclusion so each include is checked. // ============================================================================= -#if defined(RN_STRICT_API) && !defined(RN_ALLOW_FRAMEWORKS) && !defined(RN_UMBRELLA_CONTEXT) && !defined(RN_BUILDING) +#if defined(RN_STRICT_API) && !defined(RN_ALLOW_FRAMEWORKS) && !defined(RN_BUILDING) #warning \ - "This is a 'for frameworks' React Native API, intended for framework authors rather than app code. Include it via the module umbrella .h>, or define RN_ALLOW_FRAMEWORKS to acknowledge framework-tier usage and silence this warning." + "This is a 'for frameworks' React Native API, intended for framework authors rather than app code. Define RN_ALLOW_FRAMEWORKS to acknowledge framework-tier usage and silence this warning." #endif