Skip to content

Commit

Permalink
fixing ATOMIC_VAR_INIT call (#26238)
Browse files Browse the repository at this point in the history
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: #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
  • Loading branch information
mganandraj authored and facebook-github-bot committed Sep 9, 2019
1 parent cc35d0f commit 75a7a52
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ReactCommon/cxxreact/NativeToJsBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down

0 comments on commit 75a7a52

Please sign in to comment.