From 0c0540965ad9e3cdd9af16f606e141eca8ab2193 Mon Sep 17 00:00:00 2001 From: empyrical Date: Fri, 16 Nov 2018 10:32:42 -0800 Subject: [PATCH] CxxReact: Silence 'unused lambda capture' warnings in open-source (#22240) Summary: This pull request silences build warnings like this in open-source: ``` {snip}/ReactCommon/cxxreact/CxxNativeModule.cpp:134:85: warning: lambda capture 'callId' is not used [-Wunused-lambda-capture] messageQueueThread_->runOnQueue([method, params=std::move(params), first, second, callId] () { ``` These are variables used by "fbsystrace", which is not open-sourced. An unused statement has been added to the affected files in the `#else` for the `#ifdef WITH_FBSYSTRACE` conditionals Pull Request resolved: https://github.com/facebook/react-native/pull/22240 Differential Revision: D13031358 Pulled By: shergin fbshipit-source-id: 8ccfc226b65e32abda6abb573f77a6589bd19dcd --- ReactCommon/cxxreact/CxxNativeModule.cpp | 2 ++ ReactCommon/cxxreact/NativeToJsBridge.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/ReactCommon/cxxreact/CxxNativeModule.cpp b/ReactCommon/cxxreact/CxxNativeModule.cpp index cca885fc5..2b674c0c1 100644 --- a/ReactCommon/cxxreact/CxxNativeModule.cpp +++ b/ReactCommon/cxxreact/CxxNativeModule.cpp @@ -136,6 +136,8 @@ void CxxNativeModule::invoke(unsigned int reactMethodId, folly::dynamic&& params if (callId != -1) { fbsystrace_end_async_flow(TRACE_TAG_REACT_APPS, "native", callId); } + #else + (void)(callId); #endif SystraceSection s(method.name.c_str()); try { diff --git a/ReactCommon/cxxreact/NativeToJsBridge.cpp b/ReactCommon/cxxreact/NativeToJsBridge.cpp index cfd5634f4..a9b7161df 100644 --- a/ReactCommon/cxxreact/NativeToJsBridge.cpp +++ b/ReactCommon/cxxreact/NativeToJsBridge.cpp @@ -161,6 +161,8 @@ void NativeToJsBridge::callFunction( "JSCall", systraceCookie); SystraceSection s("NativeToJsBridge::callFunction", "module", module, "method", method); + #else + (void)(systraceCookie); #endif // This is safe because we are running on the executor's thread: it won't // destruct until after it's been unregistered (which we check above) and @@ -191,6 +193,8 @@ void NativeToJsBridge::invokeCallback(double callbackId, folly::dynamic&& argume "", systraceCookie); SystraceSection s("NativeToJsBridge::invokeCallback"); + #else + (void)(systraceCookie); #endif executor->invokeCallback(callbackId, arguments); });