On 12/2/2022 3:07 AM, Joseph Myers wrote:
On Fri, 2 Dec 2022, Longjun Luo via Gcc-patches wrote:

On 12/2/2022 1:01 AM, Joseph Myers wrote:
On Thu, 1 Dec 2022, Longjun Luo via Gcc-patches wrote:

diff --git a/gcc/testsuite/gcc.dg/builtin-redefine.c
b/gcc/testsuite/gcc.dg/builtin-redefine.c
index 882b2210992..9d5b42252ee 100644
--- a/gcc/testsuite/gcc.dg/builtin-redefine.c
+++ b/gcc/testsuite/gcc.dg/builtin-redefine.c
@@ -71,7 +71,6 @@
   /* { dg-bogus "Expected built-in is not defined" "" { target *-*-* } .-1
} */
   #endif
   -#define __LINE__ 0           /* { dg-warning "-:\"__LINE__\" redef" }
*/
   #define __INCLUDE_LEVEL__ 0  /* { dg-warning "-:\"__INCLUDE_LEVEL__\"
redef" } */
   #define __COUNTER__ 0        /* { dg-warning "-:\"__COUNTER__\" redef" }
*/
Is there some existing test that verifies that this redefinition is still
diagnosed by default (in the absence of -Wno-builtin-macro-redefined)?
I am not sure I have fully understood your meaning. The problem here is that
if I try to redefine __LINE__ macro in the situation that projects use the
option '-Werror', the compile will fail.
There are two cases:

(a) Is redefinition of __LINE__ diagnosed *without*
-Wno-builtin-macro-redefined?

(b) Is redefinition of __LINE__ diagnosed *with*
-Wno-builtin-macro-redefined?

My understanding is that both (a) and (b) have answer "yes" at present,
and your patch would change the answer to (b) to "no", without changing
the answer to (a).

My question is about whether there is a test verifying the answer to (a).
If not, I think the patch should add one.


After some check for the source code, two similiar exist test cases for the situation (a).

They are ./gcc/testsuite/gcc.dg/cpp/warn-redefined.c and ./gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c

These two cases redefine the __TIME__ macro when using the option '-Wbuiltin-macro-redefined'.

I think I shoud add a test to verify __LINE__ macro in these two cases.

I will write a complete test for situation (a) and situation (b). But I need a little time to be familar with the gcc testcases.

So, the patch itself has no problem. What I need do is to rich its test cases and update change log, right?



Reply via email to