From 75a7a52db496bd3892a367372eea25bf50840fc3 Mon Sep 17 00:00:00 2001 From: Anandraj Date: Mon, 9 Sep 2019 07:41:53 -0700 Subject: [PATCH] fixing ATOMIC_VAR_INIT call (#26238) Summary: We're trying to build react-native on Windows (part of the Microsoft\react-native-windows project) with MSVC compiler with WITH_FBSYSTRACE set to true (to route the traces to ETW). This change is to fix a compilation error due to the non standard usage of ATOMIC_VAR_INIT macro called with no parameters. It's not absolutely clear to me the objective of this macro in the standard at all (to be used in c context ?), and which compiler does support this parameterless version (gcc?). Also, I'm more inclined towards changing the statement to just "std::atomic_uint_least32_t m_systraceCookie{};". Please confirm. ## Changelog [General] [Fixed] - Removing the non-standard usage of ATOMIC_VAR_INIT macro from code with systrace enabled Pull Request resolved: https://github.com/facebook/react-native/pull/26238 Test Plan: Build verification should suffice as there is no semantic change introduced by this change. Differential Revision: D17259213 Pulled By: cpojer fbshipit-source-id: 9fe44f9220f18399a58f94f0f01d5fa93e6458e0 --- ReactCommon/cxxreact/NativeToJsBridge.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactCommon/cxxreact/NativeToJsBridge.h b/ReactCommon/cxxreact/NativeToJsBridge.h index bf5746a0e7f5c0..ba3603b04688fc 100644 --- a/ReactCommon/cxxreact/NativeToJsBridge.h +++ b/ReactCommon/cxxreact/NativeToJsBridge.h @@ -107,7 +107,7 @@ class NativeToJsBridge { bool m_applicationScriptHasFailure = false; #ifdef WITH_FBSYSTRACE - std::atomic_uint_least32_t m_systraceCookie = ATOMIC_VAR_INIT(); + std::atomic_uint_least32_t m_systraceCookie = ATOMIC_VAR_INIT(0); #endif };