diff --git a/React/Base/RCTBridge+Private.h b/React/Base/RCTBridge+Private.h index 2996d3794..c6e518e83 100644 --- a/React/Base/RCTBridge+Private.h +++ b/React/Base/RCTBridge+Private.h @@ -149,7 +149,8 @@ RCT_EXTERN void RCTRegisterModule(Class); @interface RCTCxxBridge : RCTBridge -@property (nonatomic) void *runtime; +// TODO(cjhopman): this seems unsafe unless we require that it is only called on the main js queue. +@property (nonatomic, readonly) void *runtime; - (instancetype)initWithParentBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER; diff --git a/React/React.xcodeproj/project.pbxproj b/React/React.xcodeproj/project.pbxproj index ada4ecd12..ff871363e 100644 --- a/React/React.xcodeproj/project.pbxproj +++ b/React/React.xcodeproj/project.pbxproj @@ -4959,6 +4959,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_STATIC_ANALYZER_MODE = deep; + CLANG_WARN_COMMA = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4972,6 +4973,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_STATIC_ANALYZER_MODE = deep; + CLANG_WARN_COMMA = NO; GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; @@ -4986,6 +4988,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_WARN_COMMA = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; @@ -5004,6 +5007,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_WARN_COMMA = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; @@ -5023,6 +5027,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_STATIC_ANALYZER_MODE = deep; + CLANG_WARN_COMMA = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5037,6 +5042,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_STATIC_ANALYZER_MODE = deep; + CLANG_WARN_COMMA = NO; GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; @@ -5052,6 +5058,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_WARN_COMMA = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; @@ -5071,6 +5078,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_WARN_COMMA = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; @@ -5259,6 +5267,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_STATIC_ANALYZER_MODE = deep; + CLANG_WARN_COMMA = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5273,6 +5282,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_STATIC_ANALYZER_MODE = deep; + CLANG_WARN_COMMA = NO; GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; @@ -5288,6 +5298,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_WARN_COMMA = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; @@ -5307,6 +5318,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_WARN_COMMA = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; @@ -5325,6 +5337,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_WARN_COMMA = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; @@ -5353,6 +5366,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_WARN_COMMA = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; @@ -5381,6 +5395,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_WARN_COMMA = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; @@ -5409,6 +5424,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_WARN_COMMA = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; @@ -5438,6 +5454,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_STATIC_ANALYZER_MODE = deep; + CLANG_WARN_COMMA = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5452,6 +5469,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_STATIC_ANALYZER_MODE = deep; + CLANG_WARN_COMMA = NO; GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; @@ -5467,6 +5485,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_STATIC_ANALYZER_MODE = deep; + CLANG_WARN_COMMA = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5481,6 +5500,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_STATIC_ANALYZER_MODE = deep; + CLANG_WARN_COMMA = NO; GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; diff --git a/ReactCommon/cxxreact/JSBigString.h b/ReactCommon/cxxreact/JSBigString.h index 497b9f7b5..8e0f2128a 100644 --- a/ReactCommon/cxxreact/JSBigString.h +++ b/ReactCommon/cxxreact/JSBigString.h @@ -133,7 +133,7 @@ public: private: int m_fd; // The file descriptor being mmaped size_t m_size; // The size of the mmaped region - size_t m_pageOff; // The offset in the mmaped region to the data. + off_t m_pageOff; // The offset in the mmaped region to the data. off_t m_mapOff; // The offset in the file to the mmaped region. mutable const char *m_data; // Pointer to the mmaped region. }; diff --git a/ReactCommon/cxxreact/JSExecutor.h b/ReactCommon/cxxreact/JSExecutor.h index 4e8d682c0..f7cfd9752 100644 --- a/ReactCommon/cxxreact/JSExecutor.h +++ b/ReactCommon/cxxreact/JSExecutor.h @@ -103,7 +103,7 @@ public: */ virtual std::string getDescription() = 0; - virtual void handleMemoryPressure(int pressureLevel) {} + virtual void handleMemoryPressure(__unused int pressureLevel) {} virtual void destroy() {} virtual ~JSExecutor() {} diff --git a/ReactCommon/cxxreact/MethodCall.cpp b/ReactCommon/cxxreact/MethodCall.cpp index 79c7f49a2..7141513d1 100644 --- a/ReactCommon/cxxreact/MethodCall.cpp +++ b/ReactCommon/cxxreact/MethodCall.cpp @@ -53,7 +53,7 @@ std::vector parseMethodCalls(folly::dynamic&& jsonData) { throw std::invalid_argument( folly::to(errorPrefix, "invalid callId", jsonData[REQUEST_CALLID].typeName())); } - callId = jsonData[REQUEST_CALLID].asInt(); + callId = (int)jsonData[REQUEST_CALLID].asInt(); } std::vector methodCalls; diff --git a/ReactCommon/cxxreact/NativeToJsBridge.cpp b/ReactCommon/cxxreact/NativeToJsBridge.cpp index b5401267d..27c54a373 100644 --- a/ReactCommon/cxxreact/NativeToJsBridge.cpp +++ b/ReactCommon/cxxreact/NativeToJsBridge.cpp @@ -43,7 +43,7 @@ public: } void callNativeModules( - JSExecutor& executor, folly::dynamic&& calls, bool isEndOfBatch) override { + __unused JSExecutor& executor, folly::dynamic&& calls, bool isEndOfBatch) override { CHECK(m_registry || calls.empty()) << "native module calls cannot be completed with no native modules"; @@ -68,7 +68,7 @@ public: } MethodCallResult callSerializableNativeHook( - JSExecutor& executor, unsigned int moduleId, unsigned int methodId, + __unused JSExecutor& executor, unsigned int moduleId, unsigned int methodId, folly::dynamic&& args) override { return m_registry->callSerializableNativeHook(moduleId, methodId, std::move(args)); } diff --git a/ReactCommon/cxxreact/SampleCxxModule.cpp b/ReactCommon/cxxreact/SampleCxxModule.cpp index 1862c0f08..e1bfb04d2 100644 --- a/ReactCommon/cxxreact/SampleCxxModule.cpp +++ b/ReactCommon/cxxreact/SampleCxxModule.cpp @@ -94,13 +94,13 @@ auto SampleCxxModule::getMethods() -> std::vector { jsArgAsString(args, 1))}); }), Method("repeat", [this](dynamic args, Callback cb) { - cb({sample_->repeat(jsArgAsInt(args, 0), + cb({sample_->repeat((int)jsArgAsInt(args, 0), jsArgAsString(args, 1))}); }), Method("save", this, &SampleCxxModule::save), Method("load", this, &SampleCxxModule::load), Method("call_later", [this](dynamic args, Callback cb) { - sample_->call_later(jsArgAsInt(args, 0), [cb] { + sample_->call_later((int)jsArgAsInt(args, 0), [cb] { cb({}); }); }), @@ -145,7 +145,7 @@ void SampleCxxModule::save(folly::dynamic args) { sample_->save(std::move(m)); } -void SampleCxxModule::load(folly::dynamic args, Callback cb) { +void SampleCxxModule::load(__unused folly::dynamic args, Callback cb) { dynamic d = dynamic::object; for (const auto& p : sample_->load()) { d.insert(p.first, p.second); diff --git a/ReactCommon/cxxreact/SystraceSection.h b/ReactCommon/cxxreact/SystraceSection.h index 381d099c9..1cd6fa92c 100644 --- a/ReactCommon/cxxreact/SystraceSection.h +++ b/ReactCommon/cxxreact/SystraceSection.h @@ -26,7 +26,7 @@ struct ConcreteSystraceSection { public: template explicit - ConcreteSystraceSection(const char* name, ConvertsToStringPiece&&... args) + ConcreteSystraceSection(__unused const char* name, __unused ConvertsToStringPiece&&... args) : m_section(TRACE_TAG_REACT_CXX_BRIDGE, name, args...) {} @@ -39,7 +39,7 @@ struct DummySystraceSection { public: template explicit - DummySystraceSection(const char* name, ConvertsToStringPiece&&... args) + DummySystraceSection(__unused const char* name, __unused ConvertsToStringPiece&&... args) {} }; using SystraceSection = DummySystraceSection; diff --git a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp index ce65d9f83..8025d9672 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp +++ b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp @@ -170,7 +170,7 @@ void JSIExecutor::setBundleRegistry(std::unique_ptr r) { PropNameID::forAscii(*runtime_, "nativeRequire"), 2, [this]( - Runtime& rt, + __unused Runtime& rt, const facebook::jsi::Value&, const facebook::jsi::Value* args, size_t count) { return nativeRequire(args, count); }));