From: Blake Matheny Date: Wed, 28 Oct 2015 18:07:40 +0000 (-0700) Subject: Suppress -Wshadow for SYNCHRONIZED X-Git-Tag: deprecate-dynamic-initializer~290 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f3199c1a9236f6d89fcbfcb7da4d58c9863f8928;p=folly.git 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 --- diff --git a/folly/Synchronized.h b/folly/Synchronized.h index 312d3374..dcc5f7dd 100644 --- a/folly/Synchronized.h +++ b/folly/Synchronized.h @@ -673,13 +673,16 @@ void swap(Synchronized& lhs, Synchronized& 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 \