Bug 1073828 - Fix variable generation in RestyleLogging.h. r=dbaron
authorCameron McCormack <cam@mcc.id.au>
Sun, 28 Sep 2014 19:19:26 +1000
changeset 223032 9dcdf878b422cdc190e945a8637a135528911833
parent 223031 800de79a433af143a73454a330254c0c08a1ca1a
child 223033 d71444b752910f2987993a0a0d9fe1465ccf682d
push id7107
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 17:43:31 +0000
treeherdermozilla-aurora@b4b34e0acc75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1073828
milestone35.0a1
Bug 1073828 - Fix variable generation in RestyleLogging.h. r=dbaron
layout/base/RestyleLogging.h
--- a/layout/base/RestyleLogging.h
+++ b/layout/base/RestyleLogging.h
@@ -12,34 +12,37 @@
 
 #include "mozilla/AutoRestore.h"
 
 #ifdef DEBUG
 #define RESTYLE_LOGGING
 #endif
 
 #ifdef RESTYLE_LOGGING
+#define LOG_RESTYLE_VAR2(prefix_, suffix_) prefix_##suffix_
+#define LOG_RESTYLE_VAR(prefix_, suffix_) LOG_RESTYLE_VAR2(prefix_, suffix_)
+#define LOG_RESTYLE_DEPTH LOG_RESTYLE_VAR(restyle_depth_, __LINE__)
 #define LOG_RESTYLE_IF(object_, cond_, message_, ...)                         \
   PR_BEGIN_MACRO                                                              \
     if (object_->ShouldLogRestyle() && (cond_)) {                             \
       nsCString line;                                                         \
-      for (int32_t restyle_depth_##__LINE__ = 0;                              \
-           restyle_depth_##__LINE__ < object_->LoggingDepth();                \
-           restyle_depth_##__LINE__++) {                                      \
+      for (int32_t LOG_RESTYLE_VAR(rs_depth_, __LINE__) = 0;                  \
+           LOG_RESTYLE_VAR(rs_depth_, __LINE__) < object_->LoggingDepth();    \
+           LOG_RESTYLE_VAR(rs_depth_, __LINE__)++) {                          \
         line.AppendLiteral("  ");                                             \
       }                                                                       \
       line.AppendPrintf(message_, ##__VA_ARGS__);                             \
       printf_stderr("%s\n", line.get());                                      \
     }                                                                         \
   PR_END_MACRO
 #define LOG_RESTYLE(message_, ...)                                            \
   LOG_RESTYLE_IF(this, true, message_, ##__VA_ARGS__)
 // Beware that LOG_RESTYLE_INDENT is two statements not wrapped in a block.
 #define LOG_RESTYLE_INDENT()                                                  \
-  AutoRestore<int32_t> ar_depth_##__LINE__(LoggingDepth());                   \
+  AutoRestore<int32_t> LOG_RESTYLE_VAR(ar_depth_, __LINE__)(LoggingDepth());  \
   ++LoggingDepth();
 #else
 #define LOG_RESTYLE_IF(cond_, message_, ...) /* nothing */
 #define LOG_RESTYLE(message_, ...) /* nothing */
 #define LOG_RESTYLE_INDENT() /* nothing */
 #endif
 
 #endif /* mozilla_RestyleLogging_h */