Fix the build... Whoops...
[folly.git] / folly / Foreach.h
index 84663ef363604da9fb23f059ed4c0565abe3cb0d..5cc075c7e6aeeeeeb4a476a091da42bfa72e734a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * using rbegin() and rend().
  */
 #define FOR_EACH_R(i, c)                                \
-  if (bool FOR_EACH_R_state1 = false) {} else           \
-    for (auto && FOR_EACH_R_state2 = (c);               \
-         !FOR_EACH_R_state1; FOR_EACH_R_state1 = true)  \
-      for (auto i = FOR_EACH_R_state2.rbegin();         \
-           i != FOR_EACH_R_state2.rend(); ++i)
+  if (bool _FE_ANON(s1_) = false) {} else               \
+    for (auto && _FE_ANON(s2_) = (c);                   \
+         !_FE_ANON(s1_); _FE_ANON(s1_) = true)          \
+      for (auto i = _FE_ANON(s2_).rbegin();             \
+           i != _FE_ANON(s2_).rend(); ++i)
 
 /*
  * Similar to FOR_EACH but also allows client to specify a 'count' variable
  * }
  */
 #define FOR_EACH_ENUMERATE(count, i, c)                                \
-  if (bool FOR_EACH_state1 = false) {} else                            \
+  if (bool _FE_ANON(s1_) = false) {} else                            \
     for (auto && FOR_EACH_state2 = (c);                                \
-         !FOR_EACH_state1; FOR_EACH_state1 = true)                     \
-      if (size_t FOR_EACH_privateCount = 0) {} else                    \
-        if (const size_t& count = FOR_EACH_privateCount) {} else       \
+         !_FE_ANON(s1_); _FE_ANON(s1_) = true)                     \
+      if (size_t _FE_ANON(n1_) = 0) {} else                            \
+        if (const size_t& count = _FE_ANON(n1_)) {} else               \
           for (auto i = FOR_EACH_state2.begin();                       \
-               i != FOR_EACH_state2.end(); ++FOR_EACH_privateCount, ++i)
+               i != FOR_EACH_state2.end(); ++_FE_ANON(n1_), ++i)
 
 /**
  * Similar to FOR_EACH, but gives the user the key and value for each entry in
  *      cout << key << " " << value;
  *   }
  */
-#define FOR_EACH_KV(k, v, c)                                    \
-  if (unsigned int FOR_EACH_state1 = 0) {} else                 \
-    for (auto && FOR_EACH_state2 = (c);                         \
-         !FOR_EACH_state1; FOR_EACH_state1 = 1)                 \
-      for (auto FOR_EACH_state3 = FOR_EACH_state2.begin();      \
-           FOR_EACH_state3 != FOR_EACH_state2.end();            \
-           FOR_EACH_state1 == 2                                 \
-             ? ((FOR_EACH_state1 = 0), ++FOR_EACH_state3)       \
-             : (FOR_EACH_state3 = FOR_EACH_state2.end()))       \
-        for (auto &k = FOR_EACH_state3->first;                  \
-             !FOR_EACH_state1; ++FOR_EACH_state1)               \
-          for (auto &v = FOR_EACH_state3->second;               \
-               !FOR_EACH_state1; ++FOR_EACH_state1)
+#define FOR_EACH_KV(k, v, c)                                  \
+  if (unsigned int _FE_ANON(s1_) = 0) {} else                 \
+    for (auto && _FE_ANON(s2_) = (c);                         \
+         !_FE_ANON(s1_); _FE_ANON(s1_) = 1)                   \
+      for (auto _FE_ANON(s3_) = _FE_ANON(s2_).begin();        \
+           _FE_ANON(s3_) != _FE_ANON(s2_).end();              \
+           _FE_ANON(s1_) == 2                                 \
+             ? ((_FE_ANON(s1_) = 0), ++_FE_ANON(s3_))         \
+             : (_FE_ANON(s3_) = _FE_ANON(s2_).end()))         \
+        for (auto &k = _FE_ANON(s3_)->first;                  \
+             !_FE_ANON(s1_); ++_FE_ANON(s1_))                 \
+          for (auto &v = _FE_ANON(s3_)->second;               \
+               !_FE_ANON(s1_); ++_FE_ANON(s1_))
 
 namespace folly { namespace detail {