re PR c/71742 (Wrong formulation of "error: flexible array member in otherwise empty struct")

PR c/71742
	* c-decl.c (finish_struct): Rephrase an error message.

	* gcc.dg/940510-1.c: Adjust dg-error.
	* gcc.dg/c99-flex-array-1.c: Likewise.
	* gcc.dg/c99-flex-array-typedef-1.c: Likewise.

From-SVN: r238883
This commit is contained in:
Marek Polacek 2016-07-29 17:32:27 +00:00 committed by Marek Polacek
parent ac631cbe70
commit f618a47208
6 changed files with 19 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2016-07-29 Marek Polacek <polacek@redhat.com>
PR c/71742
* c-decl.c (finish_struct): Rephrase an error message.
2016-07-29 Jakub Jelinek <jakub@redhat.com>
PR c/71969

View File

@ -7880,7 +7880,8 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
else if (!saw_named_field)
{
error_at (DECL_SOURCE_LOCATION (x),
"flexible array member in otherwise empty struct");
"flexible array member in a struct with no named "
"members");
TREE_TYPE (x) = error_mark_node;
}
}

View File

@ -1,3 +1,10 @@
2016-07-29 Marek Polacek <polacek@redhat.com>
PR c/71742
* gcc.dg/940510-1.c: Adjust dg-error.
* gcc.dg/c99-flex-array-1.c: Likewise.
* gcc.dg/c99-flex-array-typedef-1.c: Likewise.
2016-07-29 Uros Bizjak <ubizjak@gmail.com>
* gcc.dg/pr59833.c: Use dg-add-options ieee.

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-options "-std=c89 -pedantic" } */
struct { int a[]; } x = { 0 }; /* { dg-warning "ISO C90 does not support flexible array members" } */
/* { dg-error "flexible array member in otherwise empty struct" "" { target *-*-* } 3 } */
/* { dg-error "flexible array member in a struct with no named members" "" { target *-*-* } 3 } */

View File

@ -2,7 +2,7 @@
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
struct s1 { int x[]; }; /* { dg-error "empty struct" "empty" } */
struct s2 { int :1; int x[]; }; /* { dg-error "empty struct" "empty" } */
struct s1 { int x[]; }; /* { dg-error "no named members" "members" } */
struct s2 { int :1; int x[]; }; /* { dg-error "no named members" "members" } */
struct s3 { int x[]; int y; }; /* { dg-error "not at end" "not at end" } */
struct s4 { int x; int y[]; };

View File

@ -3,7 +3,7 @@
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
typedef int A[];
struct s1 { A x; }; /* { dg-error "empty struct" "empty" } */
struct s2 { int :1; A x; }; /* { dg-error "empty struct" "empty" } */
struct s1 { A x; }; /* { dg-error "no named members" "members" } */
struct s2 { int :1; A x; }; /* { dg-error "no named members" "members" } */
struct s3 { A x; int y; }; /* { dg-error "not at end" "not at end" } */
struct s4 { int x; A y; };