Skip to content

Commit

Permalink
Remove compiler warning (facebook#23588)
Browse files Browse the repository at this point in the history
Summary:
Fixed compiler warning, after this, seems we have no warning for framework in debug mode.
<img width="1280" alt="image" src="https://user-images.githubusercontent.com/5061845/53224564-2d14e980-36b0-11e9-85f4-46304513b18d.png">

[iOS] [Fixed] - Remove compiler warning
Pull Request resolved: facebook#23588

Differential Revision: D14181748

Pulled By: cpojer

fbshipit-source-id: 8b633e7cdb7b3b8029f4145a1155e540ac516191
  • Loading branch information
zhongwuzw authored and facebook-github-bot committed Feb 22, 2019
1 parent 8ce3c1b commit 81860c5
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 12 deletions.
3 changes: 2 additions & 1 deletion React/Base/RCTBridge+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
20 changes: 20 additions & 0 deletions React/React.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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)";
Expand All @@ -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";
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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)";
Expand All @@ -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";
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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)";
Expand All @@ -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";
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)";
Expand All @@ -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";
Expand All @@ -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)";
Expand All @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/cxxreact/JSBigString.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class RN_EXPORT JSBigFileString : public JSBigString {
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.
};
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/cxxreact/JSExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class RN_EXPORT JSExecutor {
*/
virtual std::string getDescription() = 0;

virtual void handleMemoryPressure(int pressureLevel) {}
virtual void handleMemoryPressure(__unused int pressureLevel) {}

virtual void destroy() {}
virtual ~JSExecutor() {}
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/cxxreact/MethodCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ std::vector<MethodCall> parseMethodCalls(folly::dynamic&& jsonData) {
throw std::invalid_argument(
folly::to<std::string>(errorPrefix, "invalid callId", jsonData[REQUEST_CALLID].typeName()));
}
callId = jsonData[REQUEST_CALLID].asInt();
callId = (int)jsonData[REQUEST_CALLID].asInt();
}

std::vector<MethodCall> methodCalls;
Expand Down
4 changes: 2 additions & 2 deletions ReactCommon/cxxreact/NativeToJsBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class JsToNativeBridge : public react::ExecutorDelegate {
}

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";
Expand All @@ -68,7 +68,7 @@ class JsToNativeBridge : public react::ExecutorDelegate {
}

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));
}
Expand Down
6 changes: 3 additions & 3 deletions ReactCommon/cxxreact/SampleCxxModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ auto SampleCxxModule::getMethods() -> std::vector<Method> {
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({});
});
}),
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions ReactCommon/cxxreact/SystraceSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct ConcreteSystraceSection {
public:
template<typename... ConvertsToStringPiece>
explicit
ConcreteSystraceSection(const char* name, ConvertsToStringPiece&&... args)
ConcreteSystraceSection(__unused const char* name, __unused ConvertsToStringPiece&&... args)
: m_section(TRACE_TAG_REACT_CXX_BRIDGE, name, args...)
{}

Expand All @@ -39,7 +39,7 @@ struct DummySystraceSection {
public:
template<typename... ConvertsToStringPiece>
explicit
DummySystraceSection(const char* name, ConvertsToStringPiece&&... args)
DummySystraceSection(__unused const char* name, __unused ConvertsToStringPiece&&... args)
{}
};
using SystraceSection = DummySystraceSection;
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void JSIExecutor::setBundleRegistry(std::unique_ptr<RAMBundleRegistry> 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); }));
Expand Down

0 comments on commit 81860c5

Please sign in to comment.