diff mbox

Cleaning up incomplete type warning.

Message ID 20141224180733.GB19129@Luiss-MacBook-Air-2.local
State New
Headers show

Commit Message

Luis Felipe Strano Moraes Dec. 24, 2014, 6:07 p.m. UTC
This removes an unnecessary static variable from the code and also makes it a single
warning instead of two. Patch originally proposed by Manuel López-Ibáñez.

Luis Strano
gcc/c/ChangeLog:

2014-12-24  Luis Felipe Strano Moraes  <luis.strano@gmail.com>

	* c-decl.c (get_parm_info): cleaning up incomplete type warning.

Comments

Jeff Law Jan. 5, 2015, 8:14 p.m. UTC | #1
On 12/24/14 11:07, Luis Felipe Strano Moraes wrote:
> This removes an unnecessary static variable from the code and also makes it a single
> warning instead of two. Patch originally proposed by Manuel López-Ibáñez.
>
> Luis Strano
>
>
> clean_incomplete_warning.log
>
>
> gcc/c/ChangeLog:
>
> 2014-12-24  Luis Felipe Strano Moraes<luis.strano@gmail.com>
>
> 	* c-decl.c (get_parm_info): cleaning up incomplete type warning.
OK for the trunk assuming it passed bootstrap and regression testing.

Jeff

ps.  I'm sure someone will complain that we've changed this warning 
message ever-so-slightly mucking up whatever code out there that parses 
warning/error messages.
Manuel López-Ibáñez Jan. 6, 2015, 1:09 a.m. UTC | #2
On 5 January 2015 at 21:14, Jeff Law <law@redhat.com> wrote:
>
> ps.  I'm sure someone will complain that we've changed this warning message
> ever-so-slightly mucking up whatever code out there that parses
> warning/error messages.

I honestly wonder what could be the purpose of parsing specific
warning/error messages outside of GCC's own testsuite.

Cheers,

Manuel.
Manuel López-Ibáñez July 27, 2015, 10:31 p.m. UTC | #3
On 5 January 2015 at 21:14, Jeff Law <law@redhat.com> wrote:
> On 12/24/14 11:07, Luis Felipe Strano Moraes wrote:
>>
>> This removes an unnecessary static variable from the code and also makes
>> it a single
>> warning instead of two. Patch originally proposed by Manuel López-Ibáñez.
>>
>> Luis Strano
>>
>>
>> clean_incomplete_warning.log
>>
>>
>> gcc/c/ChangeLog:
>>
>> 2014-12-24  Luis Felipe Strano Moraes<luis.strano@gmail.com>
>>
>>         * c-decl.c (get_parm_info): cleaning up incomplete type warning.
>
> OK for the trunk assuming it passed bootstrap and regression testing.

This was never committed. I regtested it and committed as
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=226274

Cheers,

Manuel.
diff mbox

Patch

Index: gcc/c/c-decl.c
===================================================================
--- gcc/c/c-decl.c	(revision 219059)
+++ gcc/c/c-decl.c	(working copy)
@@ -6897,7 +6897,6 @@  get_parm_info (bool ellipsis, tree expr)
   tree types    = 0;
   tree others   = 0;
 
-  static bool explained_incomplete_types = false;
   bool gave_void_only_once_err = false;
 
   arg_info->had_vla_unspec = current_scope->had_vla_unspec;
@@ -7000,19 +6999,15 @@  get_parm_info (bool ellipsis, tree expr)
 	    {
 	      if (b->id)
 		/* The %s will be one of 'struct', 'union', or 'enum'.  */
-		warning (0, "%<%s %E%> declared inside parameter list",
-			 keyword, b->id);
+		warning (0, "%<%s %E%> declared inside parameter list and will"
+			 " not be visible outside of this definition or"
+			 " declaration", keyword, b->id);
 	      else
 		/* The %s will be one of 'struct', 'union', or 'enum'.  */
-		warning (0, "anonymous %s declared inside parameter list",
-			 keyword);
+		warning (0, "anonymous %s declared inside parameter list and"
+			 " will not be visible outside of this definition or"
+			 " declaration", keyword);
 
-	      if (!explained_incomplete_types)
-		{
-		  warning (0, "its scope is only this definition or declaration,"
-			   " which is probably not what you want");
-		  explained_incomplete_types = true;
-		}
 	    }
 
 	  tag.id = b->id;
Index: gcc/testsuite/gcc.dg/parm-incomplete-1.c
===================================================================
--- gcc/testsuite/gcc.dg/parm-incomplete-1.c	(revision 219059)
+++ gcc/testsuite/gcc.dg/parm-incomplete-1.c	(working copy)
@@ -17,7 +17,6 @@  struct s { int b; };
 void h (struct s x) { }
 
 void j(struct t2); /* { dg-warning "'struct t2' declared inside parameter list" } */
-/* { dg-warning "its scope is only" "explanation" { target *-*-* } 19 } */
 
 union u;
 
Index: gcc/testsuite/gcc.dg/pr18809-1.c
===================================================================
--- gcc/testsuite/gcc.dg/pr18809-1.c	(revision 219059)
+++ gcc/testsuite/gcc.dg/pr18809-1.c	(working copy)
@@ -5,6 +5,5 @@ 
 
 void foo(enum E e) {}   /* { dg-error "forward ref" "forward" } */
 			/* { dg-warning "declared" "declared" { target *-*-* } 6 } */
-			/* { dg-warning "scope" "scope" { target *-*-* } 6 } */
 			/* { dg-error "incomplete" "incomplete" { target *-*-* } 6 } */
 void bar() { foo(0); }
Index: gcc/testsuite/gcc.dg/pr27953.c
===================================================================
--- gcc/testsuite/gcc.dg/pr27953.c	(revision 219059)
+++ gcc/testsuite/gcc.dg/pr27953.c	(working copy)
@@ -1,7 +1,6 @@ 
 /* PR c/27953 */
 
 void foo(struct A a) {}  /* { dg-warning "declared inside parameter list" "inside" } */
-/* { dg-warning "its scope is only" "scope" { target *-*-* } 3 } */
 /* { dg-error "incomplete type" "incomplete" { target *-*-* } 3 } */
 
 void foo() {}            /* { dg-error "redefinition" "redef" } */
Index: gcc/testsuite/gcc.dg/vla-11.c
===================================================================
--- gcc/testsuite/gcc.dg/vla-11.c	(revision 219059)
+++ gcc/testsuite/gcc.dg/vla-11.c	(working copy)
@@ -10,4 +10,3 @@  void foo11a(int x[sizeof(int *(*)[*])]);	/* { dg-w
 void foo11b(__SIZE_TYPE__ x, int y[(__UINTPTR_TYPE__)(int (*)[*])x]);	/* { dg-warning "not in a declaration" } */
 void foo11c(struct s { int (*x)[*]; } *y);	/* { dg-error "a member of a structure or union cannot have a variably modified type" "variably modified" } */
 /* { dg-warning "'struct s' declared inside parameter list" "struct decl" { target *-*-* } 11 } */
-/* { dg-warning "its scope is only this definition or declaration" "struct scope" { target *-*-* } 11 } */