Skip to content

Commit 2afaf3b

Browse files
coadometa-codesync[bot]
authored andcommitted
Stop suppressing the for-frameworks guard inside umbrella context (#58850)
Summary: Pull Request resolved: #58850 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 fbshipit-source-id: 20c3da6dd27163aa644e4a8475815037baa432cf
1 parent a4ed576 commit 2afaf3b

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

‎packages/react-native/ReactCommon/react/cxxstableapi/FrameworksGuard.h‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,25 @@
1313
// #include <react/cxxstableapi/FrameworksGuard.h>
1414
//
1515
// "For frameworks" headers are APIs intended for framework authors integrating
16-
// React Native, not for ordinary app code. Including one directly emits a
17-
// SUPPRESSIBLE warning under enforcement. A framework author acknowledges the
18-
// usage by defining `RN_ALLOW_FRAMEWORKS`, which silences the warning.
16+
// React Native, not for ordinary app code. Including one, directly or
17+
// transitively, emits a SUPPRESSIBLE warning under enforcement. A framework
18+
// author acknowledges the usage by defining `RN_ALLOW_FRAMEWORKS`, which
19+
// silences the warning. Module umbrellas never re-export these headers, so
20+
// `RN_UMBRELLA_CONTEXT` does not suppress the warning: a public header that
21+
// includes a for-frameworks header leaks it, and is reported.
1922
//
2023
// See <react/cxxstableapi/UmbrellaGuard.h> for the full `RN_*` macro contract.
2124
// In short:
2225
// RN_STRICT_API Consumer opt-in master switch; the guard is inert
2326
// without it.
2427
// RN_ALLOW_FRAMEWORKS Consumer opt-out acknowledging framework-tier usage.
25-
// RN_UMBRELLA_CONTEXT Internal marker set by an umbrella around its includes.
2628
// RN_BUILDING Set by React Native's own build.
2729
//
2830
// This header is intentionally NOT `#pragma once`-guarded: it must be
29-
// re-evaluated on every inclusion so each direct include is checked.
31+
// re-evaluated on every inclusion so each include is checked.
3032
// =============================================================================
3133

32-
#if defined(RN_STRICT_API) && !defined(RN_ALLOW_FRAMEWORKS) && !defined(RN_UMBRELLA_CONTEXT) && !defined(RN_BUILDING)
34+
#if defined(RN_STRICT_API) && !defined(RN_ALLOW_FRAMEWORKS) && !defined(RN_BUILDING)
3335
#warning \
34-
"This is a 'for frameworks' React Native API, intended for framework authors rather than app code. Include it via the module umbrella <React/<Module>.h>, or define RN_ALLOW_FRAMEWORKS to acknowledge framework-tier usage and silence this warning."
36+
"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."
3537
#endif

0 commit comments

Comments
 (0)