Commit f3199c1a authored by Blake Matheny's avatar Blake Matheny Committed by facebook-github-bot-4

Suppress -Wshadow for SYNCHRONIZED

Summary: SYNCHRONIZED warns with -Wshadow due to `for (auto&
FB_ARG_1(__VA_ARGS__) =`. This diff just suppresses that warning.

Reviewed By: djwatson

Differential Revision: D2587348

fb-gh-sync-id: 3a2e39fb6ce28da014950ca94e4b62ea80deb65f
parent 8281c7fa
......@@ -673,13 +673,16 @@ void swap(Synchronized<T, M>& lhs, Synchronized<T, M>& rhs) {
* examples.
*/
#define SYNCHRONIZED(...) \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
if (bool SYNCHRONIZED_state = false) {} else \
for (auto SYNCHRONIZED_lockedPtr = \
(FB_ARG_2_OR_1(__VA_ARGS__)).operator->(); \
!SYNCHRONIZED_state; SYNCHRONIZED_state = true) \
for (auto& FB_ARG_1(__VA_ARGS__) = \
*SYNCHRONIZED_lockedPtr.operator->(); \
!SYNCHRONIZED_state; SYNCHRONIZED_state = true)
!SYNCHRONIZED_state; SYNCHRONIZED_state = true) \
_Pragma("GCC diagnostic pop")
#define TIMED_SYNCHRONIZED(timeout, ...) \
if (bool SYNCHRONIZED_state = false) {} else \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment