Add underscores to local vars in selftest macros
authorRichard Sandiford <richard.sandiford@linaro.org>
Thu, 7 Dec 2017 18:40:06 +0000 (18:40 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 7 Dec 2017 18:40:06 +0000 (18:40 +0000)
Allows functions doing selftests to take parameters with names like
"actual".

2017-12-07  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
* selftest.h (ASSERT_TRUE_AT, ASSERT_FALSE_AT, ASSERT_EQ_AT)
(ASSERT_NE, ASSERT_PRED1): Add underscores to local variable names
* selftest-rtl.h (ASSERT_RTX_EQ, ASSERT_RTX_PTR_EQ): Likewise.

From-SVN: r255473

gcc/ChangeLog
gcc/selftest-rtl.h
gcc/selftest.h

index fd9ae5c5c00a74850d500b7307c01c43b2b0cb22..21aa49b05bfc84e3adf6b3848f7deaf4e8d614c4 100644 (file)
@@ -1,3 +1,9 @@
+2017-12-07  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       * selftest.h (ASSERT_TRUE_AT, ASSERT_FALSE_AT, ASSERT_EQ_AT)
+       (ASSERT_NE, ASSERT_PRED1): Add underscores to local variable names
+       * selftest-rtl.h (ASSERT_RTX_EQ, ASSERT_RTX_PTR_EQ): Likewise.
+
 2017-12-07  Bin Cheng  <bin.cheng@arm.com>
            Richard Biener  <rguenther@suse.de>
 
index fe928e78da8eb8592b89d349b7c26421d7376df5..b96548cf9d166b6b0818c7c99ab9238417495dd3 100644 (file)
@@ -49,8 +49,8 @@ assert_rtl_dump_eq (const location &loc, const char *expected_dump, rtx x,
 
 #define ASSERT_RTX_EQ(EXPECTED, ACTUAL)                                \
   SELFTEST_BEGIN_STMT                                                  \
-  const char *desc = "ASSERT_RTX_EQ (" #EXPECTED ", " #ACTUAL ")";     \
-  ::selftest::assert_rtx_eq_at (SELFTEST_LOCATION, desc, (EXPECTED),   \
+  const char *desc_ = "ASSERT_RTX_EQ (" #EXPECTED ", " #ACTUAL ")";    \
+  ::selftest::assert_rtx_eq_at (SELFTEST_LOCATION, desc_, (EXPECTED),  \
                                (ACTUAL));                              \
   SELFTEST_END_STMT
 
@@ -62,8 +62,8 @@ extern void assert_rtx_eq_at (const location &, const char *, rtx, rtx);
 
 #define ASSERT_RTX_PTR_EQ(EXPECTED, ACTUAL) \
   SELFTEST_BEGIN_STMT                                                  \
-  const char *desc = "ASSERT_RTX_PTR_EQ (" #EXPECTED ", " #ACTUAL ")";  \
-  ::selftest::assert_rtx_ptr_eq_at (SELFTEST_LOCATION, desc, (EXPECTED), \
+  const char *desc_ = "ASSERT_RTX_PTR_EQ (" #EXPECTED ", " #ACTUAL ")";  \
+  ::selftest::assert_rtx_ptr_eq_at (SELFTEST_LOCATION, desc_, (EXPECTED), \
                                    (ACTUAL));                          \
   SELFTEST_END_STMT
 
index d0aa3b217c013e469d74e7dd3ebbe41143a66036..dbb246b9b88f9d4b9b200cdc04a7685cf956eb99 100644 (file)
@@ -220,12 +220,12 @@ extern int num_passes;
 
 #define ASSERT_TRUE_AT(LOC, EXPR)                      \
   SELFTEST_BEGIN_STMT                                  \
-  const char *desc = "ASSERT_TRUE (" #EXPR ")";                \
-  bool actual = (EXPR);                                        \
-  if (actual                                         \
-    ::selftest::pass ((LOC), desc);                    \
+  const char *desc_ = "ASSERT_TRUE (" #EXPR ")";       \
+  bool actual_ = (EXPR);                               \
+  if (actual_)                                         \
+    ::selftest::pass ((LOC), desc_);                   \
   else                                                 \
-    ::selftest::fail ((LOC), desc);                    \
+    ::selftest::fail ((LOC), desc_);                   \
   SELFTEST_END_STMT
 
 /* Evaluate EXPR and coerce to bool, calling
@@ -240,12 +240,12 @@ extern int num_passes;
 
 #define ASSERT_FALSE_AT(LOC, EXPR)                             \
   SELFTEST_BEGIN_STMT                                          \
-  const char *desc = "ASSERT_FALSE (" #EXPR ")";                       \
-  bool actual = (EXPR);                                                        \
-  if (actual)                                                          \
-    ::selftest::fail ((LOC), desc);                    \
-  else                                                                 \
-    ::selftest::pass ((LOC), desc);                                    \
+  const char *desc_ = "ASSERT_FALSE (" #EXPR ")";              \
+  bool actual_ = (EXPR);                                       \
+  if (actual_)                                                 \
+    ::selftest::fail ((LOC), desc_);                           \
+  else                                                         \
+    ::selftest::pass ((LOC), desc_);                           \
   SELFTEST_END_STMT
 
 /* Evaluate EXPECTED and ACTUAL and compare them with ==, calling
@@ -260,11 +260,11 @@ extern int num_passes;
 
 #define ASSERT_EQ_AT(LOC, EXPECTED, ACTUAL)                   \
   SELFTEST_BEGIN_STMT                                         \
-  const char *desc = "ASSERT_EQ (" #EXPECTED ", " #ACTUAL ")"; \
+  const char *desc_ = "ASSERT_EQ (" #EXPECTED ", " #ACTUAL ")"; \
   if ((EXPECTED) == (ACTUAL))                                 \
-    ::selftest::pass ((LOC), desc);                           \
+    ::selftest::pass ((LOC), desc_);                          \
   else                                                        \
-    ::selftest::fail ((LOC), desc);                           \
+    ::selftest::fail ((LOC), desc_);                          \
   SELFTEST_END_STMT
 
 /* Evaluate EXPECTED and ACTUAL and compare them with !=, calling
@@ -273,11 +273,11 @@ extern int num_passes;
 
 #define ASSERT_NE(EXPECTED, ACTUAL)                           \
   SELFTEST_BEGIN_STMT                                         \
-  const char *desc = "ASSERT_NE (" #EXPECTED ", " #ACTUAL ")"; \
+  const char *desc_ = "ASSERT_NE (" #EXPECTED ", " #ACTUAL ")"; \
   if ((EXPECTED) != (ACTUAL))                                 \
-    ::selftest::pass (SELFTEST_LOCATION, desc);                               \
+    ::selftest::pass (SELFTEST_LOCATION, desc_);              \
   else                                                        \
-    ::selftest::fail (SELFTEST_LOCATION, desc);                               \
+    ::selftest::fail (SELFTEST_LOCATION, desc_);              \
   SELFTEST_END_STMT
 
 /* Evaluate EXPECTED and ACTUAL and compare them with strcmp, calling
@@ -313,14 +313,14 @@ extern int num_passes;
 /* Evaluate PRED1 (VAL1), calling ::selftest::pass if it is true,
    ::selftest::fail if it is false.  */
 
-#define ASSERT_PRED1(PRED1, VAL1)                      \
-  SELFTEST_BEGIN_STMT                                  \
-  const char *desc = "ASSERT_PRED1 (" #PRED1 ", " #VAL1 ")";   \
-  bool actual = (PRED1) (VAL1);                                \
-  if (actual)                                          \
-    ::selftest::pass (SELFTEST_LOCATION, desc);                        \
-  else                                                 \
-    ::selftest::fail (SELFTEST_LOCATION, desc);                        \
+#define ASSERT_PRED1(PRED1, VAL1)                              \
+  SELFTEST_BEGIN_STMT                                          \
+  const char *desc_ = "ASSERT_PRED1 (" #PRED1 ", " #VAL1 ")";  \
+  bool actual_ = (PRED1) (VAL1);                               \
+  if (actual_)                                                 \
+    ::selftest::pass (SELFTEST_LOCATION, desc_);               \
+  else                                                         \
+    ::selftest::fail (SELFTEST_LOCATION, desc_);               \
   SELFTEST_END_STMT
 
 #define SELFTEST_BEGIN_STMT do {