Enable -Wpedantic for targets inside ReactCommon
Summary: React Native is compiled downstream with MSVC, meaning the introduction of code depending on language extensions specific to gcc/clang may cause breakage. We can enable `-Wpedantic` to flag any behavior not officially supported by the specified C++ standard. This will includes rules beyond what MSVC has trouble with, but seems to not have too many "noisy warnings". This change enables -Wpedantic in BUCK targets within ReactCommon. This makes the OSS C++ build for Android/iOS slightly more permissive than the internal build, A followup is to add the changes to OSS build logic as well, to avoid contributors seeing more errors upon internal submission. (checking with cortinico on how to do this for Android). react-native-windows uses a higher warning level than `-Wall`, which is an additional cause of compilation failures, but is not addressed as part of this change. Changelog: [Internal][Changed] - Enable -Wpedantic for targets inside ReactCommon Reviewed By: rshest Differential Revision: D38457812 fbshipit-source-id: 014da1ac0b7ad8f78154e6e447ed58def6bd0d47
This commit is contained in:
Родитель
4699a39489
Коммит
063c2b4668
|
@ -159,18 +159,18 @@ RCT_EXTERN NSString *RCTFormatStackTrace(NSArray<NSDictionary<NSString *, id> *>
|
|||
*/
|
||||
#if DEBUG
|
||||
|
||||
#define RCTAssertThread(thread, format...) \
|
||||
#define RCTAssertThread(thread, ...) \
|
||||
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") RCTAssert( \
|
||||
[(id)thread isKindOfClass:[NSString class]] ? [RCTCurrentThreadName() isEqualToString:(NSString *)thread] \
|
||||
: [(id)thread isKindOfClass:[NSThread class]] ? [NSThread currentThread] == (NSThread *)thread \
|
||||
: dispatch_get_current_queue() == (dispatch_queue_t)thread, \
|
||||
format); \
|
||||
__VA_ARGS__); \
|
||||
_Pragma("clang diagnostic pop")
|
||||
|
||||
#else
|
||||
|
||||
#define RCTAssertThread(thread, format...) \
|
||||
do { \
|
||||
#define RCTAssertThread(thread, ...) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,9 +30,16 @@ class JCxxCallbackImpl : public jni::HybridClass<JCxxCallbackImpl, JCallback> {
|
|||
"Lcom/facebook/react/bridge/CxxCallbackImpl;";
|
||||
|
||||
static void registerNatives() {
|
||||
#if __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
#endif
|
||||
javaClassStatic()->registerNatives({
|
||||
makeNativeMethod("nativeInvoke", JCxxCallbackImpl::invoke),
|
||||
});
|
||||
#if __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -29,6 +29,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "butter",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -10,6 +10,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "ReactCommon",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
|
|
|
@ -12,6 +12,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "cxxreact",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = get_apple_compiler_flags(),
|
||||
force_static = True,
|
||||
labels = [
|
||||
|
@ -36,6 +37,7 @@ rn_xplat_cxx_library(
|
|||
[("", "JSBigString.h")],
|
||||
prefix = "cxxreact",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = get_apple_compiler_flags(),
|
||||
force_static = True,
|
||||
labels = [
|
||||
|
@ -60,6 +62,7 @@ rn_xplat_cxx_library(
|
|||
compiler_flags = [
|
||||
"-fno-omit-frame-pointer",
|
||||
],
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = get_apple_compiler_flags(),
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
|
@ -118,6 +121,7 @@ rn_xplat_cxx_library(
|
|||
)
|
||||
for header in CXXREACT_PUBLIC_HEADERS
|
||||
]),
|
||||
compiler_flags_pedantic = True,
|
||||
fbandroid_preprocessor_flags = get_android_inspector_flags(),
|
||||
fbobjc_compiler_flags = get_apple_compiler_flags(),
|
||||
fbobjc_force_static = True,
|
||||
|
|
|
@ -36,16 +36,19 @@ enum struct ScriptTag {
|
|||
* bytes from a bundle in a way that gives access to that information.
|
||||
*/
|
||||
FOLLY_PACK_PUSH
|
||||
|
||||
struct FOLLY_PACK_ATTR Magic32 {
|
||||
uint32_t value;
|
||||
uint32_t reserved_;
|
||||
};
|
||||
|
||||
struct FOLLY_PACK_ATTR BundleHeader {
|
||||
BundleHeader() {
|
||||
std::memset(this, 0, sizeof(BundleHeader));
|
||||
}
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint32_t value;
|
||||
uint32_t reserved_;
|
||||
} magic32;
|
||||
Magic32 magic32;
|
||||
uint64_t magic64;
|
||||
};
|
||||
uint32_t version;
|
||||
|
|
|
@ -19,6 +19,7 @@ rn_xplat_cxx_library(
|
|||
"-Wdelete-non-virtual-dtor",
|
||||
"-Wwrite-strings",
|
||||
],
|
||||
compiler_flags_pedantic = True,
|
||||
cxx_compiler_flags = [
|
||||
"-Wglobal-constructors",
|
||||
"-Wmissing-prototypes",
|
||||
|
@ -43,6 +44,7 @@ rn_xplat_cxx_library(
|
|||
exported_headers = [
|
||||
"jsi/JSIDynamic.h",
|
||||
],
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_force_static = True,
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
|
@ -68,6 +70,7 @@ rn_xplat_cxx_library(
|
|||
"JSCRuntime.h",
|
||||
],
|
||||
apple_sdks = (IOS, MACOSX),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = [
|
||||
"-Os",
|
||||
],
|
||||
|
|
|
@ -26,6 +26,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "jsinspector",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbandroid_preferred_linkage = "shared",
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
|
|
|
@ -26,6 +26,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "logger",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbandroid_preferred_linkage = "shared",
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
|
|
|
@ -7,6 +7,7 @@ rn_xplat_cxx_library(
|
|||
exported_headers = glob(["*.h"]),
|
||||
compiler_flags_enable_exceptions = True,
|
||||
compiler_flags_enable_rtti = True,
|
||||
compiler_flags_pedantic = True,
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
|
@ -28,6 +29,7 @@ rn_xplat_cxx_library(
|
|||
name = "testlib",
|
||||
header_namespace = "react/bridging",
|
||||
exported_headers = glob(["tests/*.h"]),
|
||||
compiler_flags_pedantic = True,
|
||||
platforms = (ANDROID, APPLE, CXX),
|
||||
visibility = ["PUBLIC"],
|
||||
exported_deps = [
|
||||
|
|
|
@ -20,6 +20,7 @@ rn_xplat_cxx_library(
|
|||
),
|
||||
compiler_flags_enable_exceptions = True,
|
||||
compiler_flags_enable_rtti = True, # for ReactNativeConfig
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -29,6 +29,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/debug",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
exported_platform_linker_flags = [
|
||||
(
|
||||
"^android.*",
|
||||
|
|
|
@ -15,6 +15,7 @@ rn_xplat_cxx_library(
|
|||
compiler_flags = [
|
||||
"-Wno-global-constructors",
|
||||
],
|
||||
compiler_flags_pedantic = True,
|
||||
fbandroid_deps = [
|
||||
react_native_target("jni/react/jni:jni"),
|
||||
FBJNI_TARGET,
|
||||
|
|
|
@ -12,6 +12,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "ReactCommon",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbandroid_deps = [
|
||||
react_native_target("jni/react/jni:jni"),
|
||||
FBJNI_TARGET,
|
||||
|
|
|
@ -34,6 +34,7 @@ rn_xplat_cxx_library(
|
|||
compiler_flags = [
|
||||
"-lm",
|
||||
],
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -31,6 +31,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/attributedstring",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbandroid_deps = [
|
||||
react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
|
||||
],
|
||||
|
|
|
@ -30,6 +30,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/componentregistry",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -29,6 +29,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/componentregistry/native",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -29,6 +29,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/image",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbandroid_deps = [
|
||||
react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
|
||||
],
|
||||
|
|
|
@ -24,6 +24,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/inputaccessory",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -27,6 +27,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/legacyviewmanagerinterop",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -31,6 +31,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/modal",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbandroid_deps = [
|
||||
react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
|
||||
],
|
||||
|
|
|
@ -32,6 +32,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/progressbar",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
cxx_tests = [":tests"],
|
||||
fbandroid_deps = [
|
||||
react_native_target("jni/react/jni:jni"),
|
||||
|
|
|
@ -29,6 +29,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/root",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
labels = [
|
||||
|
|
|
@ -24,6 +24,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/safeareaview",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -32,6 +32,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/scrollview",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbandroid_deps = [
|
||||
react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
|
||||
],
|
||||
|
|
|
@ -33,6 +33,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/slider",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
cxx_tests = [":tests"],
|
||||
fbandroid_deps = [
|
||||
react_native_target("jni/react/jni:jni"),
|
||||
|
|
|
@ -34,6 +34,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/androidswitch",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
cxx_tests = [":tests"],
|
||||
fbandroid_deps = [
|
||||
react_native_target("jni/react/jni:jni"),
|
||||
|
|
|
@ -36,6 +36,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/text",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
cxx_tests = [":tests"],
|
||||
fbandroid_deps = [
|
||||
react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
|
||||
|
|
|
@ -33,6 +33,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/androidtextinput",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
cxx_tests = [":tests"],
|
||||
fbandroid_deps = [
|
||||
react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
|
||||
|
|
|
@ -33,6 +33,7 @@ rn_xplat_cxx_library(
|
|||
# TODO(shergin) T26519801 Figure out better directories structure
|
||||
prefix = "react/renderer/components/iostextinput",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
cxx_tests = [":tests"],
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
|
|
|
@ -29,6 +29,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/unimplementedview",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
labels = [
|
||||
|
|
|
@ -35,6 +35,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/components/view",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -657,8 +657,8 @@ static inline void fromRawValue(
|
|||
attrIterator->second.hasType<std::string>());
|
||||
|
||||
result = NativeDrawable{
|
||||
.kind = NativeDrawable::Kind::ThemeAttr,
|
||||
.themeAttr = (std::string)attrIterator->second,
|
||||
NativeDrawable::Kind::ThemeAttr,
|
||||
(std::string)attrIterator->second,
|
||||
};
|
||||
} else if (type == "RippleAndroid") {
|
||||
auto color = map.find("color");
|
||||
|
@ -666,21 +666,19 @@ static inline void fromRawValue(
|
|||
auto rippleRadius = map.find("rippleRadius");
|
||||
|
||||
result = NativeDrawable{
|
||||
.kind = NativeDrawable::Kind::Ripple,
|
||||
.ripple =
|
||||
NativeDrawable::Ripple{
|
||||
.color = color != map.end() && color->second.hasType<int32_t>()
|
||||
? (int32_t)color->second
|
||||
: std::optional<int32_t>{},
|
||||
.borderless = borderless != map.end() &&
|
||||
borderless->second.hasType<bool>()
|
||||
? (bool)borderless->second
|
||||
: false,
|
||||
.rippleRadius = rippleRadius != map.end() &&
|
||||
rippleRadius->second.hasType<Float>()
|
||||
? (Float)rippleRadius->second
|
||||
: std::optional<Float>{},
|
||||
},
|
||||
NativeDrawable::Kind::Ripple,
|
||||
std::string{},
|
||||
NativeDrawable::Ripple{
|
||||
color != map.end() && color->second.hasType<int32_t>()
|
||||
? (int32_t)color->second
|
||||
: std::optional<int32_t>{},
|
||||
borderless != map.end() && borderless->second.hasType<bool>()
|
||||
? (bool)borderless->second
|
||||
: false,
|
||||
rippleRadius != map.end() && rippleRadius->second.hasType<Float>()
|
||||
? (Float)rippleRadius->second
|
||||
: std::optional<Float>{},
|
||||
},
|
||||
};
|
||||
} else {
|
||||
LOG(ERROR) << "Unknown native drawable type: " << type;
|
||||
|
|
|
@ -32,6 +32,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/core",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -33,6 +33,7 @@ rn_xplat_cxx_library(
|
|||
),
|
||||
compiler_flags_enable_exceptions = True,
|
||||
compiler_flags_enable_rtti = True, # DebugStringConvertible
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -31,6 +31,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/element",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -36,6 +36,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/graphics",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
cxx_exported_headers = subdir_glob(
|
||||
[
|
||||
("platform/cxx/react/renderer/graphics", "**/*.h"),
|
||||
|
|
|
@ -30,6 +30,7 @@ rn_xplat_cxx_library(
|
|||
[("", "*.h")],
|
||||
prefix = "react/renderer/imagemanager",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
contacts = ["oncall+react_native@xmail.facebook.com"],
|
||||
cxx_srcs = glob(["platform/cxx/**/*.cpp"]),
|
||||
# FIXME: android relies on stubs implemented for the cxx platform
|
||||
|
|
|
@ -30,6 +30,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/leakchecker",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -29,6 +29,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/mapbuffer",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -32,6 +32,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/mounting",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -31,6 +31,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/runtimescheduler",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -30,6 +30,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/scheduler",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -32,6 +32,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/telemetry",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -31,6 +31,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/templateprocessor",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -36,6 +36,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/textlayoutmanager",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
cxx_exported_headers = subdir_glob(
|
||||
[
|
||||
("platform/cxx", "*.h"),
|
||||
|
|
|
@ -31,6 +31,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/timeline",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_labels = ["supermodule:ios/isolation/infra.react_native"],
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
|
|
|
@ -31,6 +31,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/renderer/uimanager",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
|
|
|
@ -27,6 +27,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/test_utils",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_frameworks = ["Foundation"],
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
|
|
|
@ -34,6 +34,7 @@ rn_xplat_cxx_library(
|
|||
],
|
||||
prefix = "react/utils",
|
||||
),
|
||||
compiler_flags_pedantic = True,
|
||||
fbandroid_deps = [
|
||||
react_native_target("java/com/facebook/react/common/mapbuffer/jni:jni"),
|
||||
react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
|
||||
|
|
|
@ -11,6 +11,7 @@ rn_xplat_cxx_library(
|
|||
compiler_flags = [
|
||||
"-Wno-global-constructors",
|
||||
],
|
||||
compiler_flags_pedantic = True,
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
|
|
|
@ -28,6 +28,7 @@ rn_xplat_cxx_library(
|
|||
exported_headers = {
|
||||
"ReactCommon/RuntimeExecutor.h": "ReactCommon/RuntimeExecutor.h",
|
||||
},
|
||||
compiler_flags_pedantic = True,
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_frameworks = ["Foundation"],
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
|
|
|
@ -89,7 +89,12 @@ def get_react_native_ios_target_sdk_version():
|
|||
return REACT_NATIVE_TARGET_IOS_SDK
|
||||
|
||||
# Building is not supported in OSS right now
|
||||
def rn_xplat_cxx_library(name, compiler_flags_enable_exceptions = False, compiler_flags_enable_rtti = False, **kwargs):
|
||||
def rn_xplat_cxx_library(
|
||||
name,
|
||||
compiler_flags_enable_exceptions = False,
|
||||
compiler_flags_enable_rtti = False,
|
||||
compiler_flags_pedantic = False,
|
||||
**kwargs):
|
||||
visibility = kwargs.get("visibility", [])
|
||||
kwargs = {
|
||||
k: v
|
||||
|
@ -108,10 +113,24 @@ def rn_xplat_cxx_library(name, compiler_flags_enable_exceptions = False, compile
|
|||
# OSS builds cannot have platform-specific flags here, so these are the same
|
||||
# for all platforms.
|
||||
kwargs["compiler_flags"] = kwargs.get("compiler_flags", [])
|
||||
kwargs["fbobjc_compiler_flags"] = kwargs.get("fbobjc_compiler_flags", [])
|
||||
kwargs["fbandroid_compiler_flags"] = kwargs.get("fbandroid_compiler_flags", [])
|
||||
|
||||
kwargs["compiler_flags"] = ["-std=c++17"] + kwargs["compiler_flags"]
|
||||
kwargs["compiler_flags"] = ["-Wall"] + kwargs["compiler_flags"]
|
||||
kwargs["compiler_flags"] = ["-Werror"] + kwargs["compiler_flags"]
|
||||
|
||||
# -Wpedantic catches usage of nonstandard language extensions that may not
|
||||
# be supported by other compilers (e.g. MSVC)
|
||||
if compiler_flags_pedantic:
|
||||
kwargs["compiler_flags"] = ["-Wpedantic"] + kwargs["compiler_flags"]
|
||||
|
||||
# Do not enable the flag for Apple in targets which also build Objective C++
|
||||
if any([file.endswith(".mm") for file in (kwargs.get("srcs", []) + kwargs.get("ios_srcs", []))]):
|
||||
kwargs["fbobjc_compiler_flags"] = ["-Wno-pedantic"] + kwargs["fbobjc_compiler_flags"]
|
||||
else:
|
||||
kwargs["compiler_flags"] = ["-Wno-pedantic"] + kwargs["compiler_flags"]
|
||||
|
||||
# For now, we allow turning off RTTI and exceptions for android builds only
|
||||
if compiler_flags_enable_exceptions:
|
||||
kwargs["compiler_flags"] = ["-fexceptions"] + kwargs["compiler_flags"]
|
||||
|
|
Загрузка…
Ссылка в новой задаче