From: Richard Sandiford Date: Thu, 7 Dec 2017 18:40:06 +0000 (+0000) Subject: Add underscores to local vars in selftest macros X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a0e7e36ebfe748057a6a6e105dbaa315eb0e46ac;p=gcc.git Add underscores to local vars in selftest macros Allows functions doing selftests to take parameters with names like "actual". 2017-12-07 Richard Sandiford 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fd9ae5c5c00..21aa49b05bf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-12-07 Richard Sandiford + + * 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 Richard Biener diff --git a/gcc/selftest-rtl.h b/gcc/selftest-rtl.h index fe928e78da8..b96548cf9d1 100644 --- a/gcc/selftest-rtl.h +++ b/gcc/selftest-rtl.h @@ -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 diff --git a/gcc/selftest.h b/gcc/selftest.h index d0aa3b217c0..dbb246b9b88 100644 --- a/gcc/selftest.h +++ b/gcc/selftest.h @@ -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 {