aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-decl.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2016-01-14 17:46:25 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2016-01-14 17:46:25 +0000
commit00083992a68feb592575464d5be98e281e8a2d8e (patch)
tree44475bf14edc93f3701ba4991f7db8a51048cc53 /gcc/c/c-decl.c
parentb56ed680d4715cfc3cf2c4940aef30daec124a41 (diff)
downloadgcc-00083992a68feb592575464d5be98e281e8a2d8e.zip
gcc-00083992a68feb592575464d5be98e281e8a2d8e.tar.gz
gcc-00083992a68feb592575464d5be98e281e8a2d8e.tar.bz2
re PR c/69262 (Request for better array bounds warning)
PR c/69262 * c-decl.c (grokdeclarator): Provide more information for invalid array declarations. * gcc.dg/array-15.c: New test. From-SVN: r232376
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r--gcc/c/c-decl.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 915376d..5830e22 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -5951,6 +5951,18 @@ grokdeclarator (const struct c_declarator *declarator,
{
error_at (loc, "array type has incomplete element type %qT",
type);
+ /* See if we can be more helpful. */
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ {
+ if (name)
+ inform (loc, "declaration of %qE as multidimensional "
+ "array must have bounds for all dimensions "
+ "except the first", name);
+ else
+ inform (loc, "declaration of multidimensional array "
+ "must have bounds for all dimensions except "
+ "the first");
+ }
type = error_mark_node;
}
else