From: Marek Polacek Date: Fri, 29 Jul 2016 17:32:27 +0000 (+0000) Subject: re PR c/71742 (Wrong formulation of "error: flexible array member in otherwise empty... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f618a47208b4cf40ac7567e7b7fc9aeefeecc207;p=gcc.git 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 --- diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index d512a3da482..89ca5aa81ec 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2016-07-29 Marek Polacek + + PR c/71742 + * c-decl.c (finish_struct): Rephrase an error message. + 2016-07-29 Jakub Jelinek PR c/71969 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index f2773c5bb72..9a922cc6f06 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -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; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4fd5e5b6ee2..e2388b1fddd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2016-07-29 Marek Polacek + + 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 * gcc.dg/pr59833.c: Use dg-add-options ieee. diff --git a/gcc/testsuite/gcc.dg/940510-1.c b/gcc/testsuite/gcc.dg/940510-1.c index 2c27e0090f9..1f40d18ef67 100644 --- a/gcc/testsuite/gcc.dg/940510-1.c +++ b/gcc/testsuite/gcc.dg/940510-1.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.dg/c99-flex-array-1.c b/gcc/testsuite/gcc.dg/c99-flex-array-1.c index b14397ad295..f3157095177 100644 --- a/gcc/testsuite/gcc.dg/c99-flex-array-1.c +++ b/gcc/testsuite/gcc.dg/c99-flex-array-1.c @@ -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[]; }; diff --git a/gcc/testsuite/gcc.dg/c99-flex-array-typedef-1.c b/gcc/testsuite/gcc.dg/c99-flex-array-typedef-1.c index 93f91f816a8..8c3b7124742 100644 --- a/gcc/testsuite/gcc.dg/c99-flex-array-typedef-1.c +++ b/gcc/testsuite/gcc.dg/c99-flex-array-typedef-1.c @@ -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; };