diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1996-01-15 20:05:06 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1996-01-15 20:05:06 -0500 |
commit | 5cfac96e553f6b6affdf9bc53e15a231034ebf63 (patch) | |
tree | 86886a89c97131d5ebd282a7c59ea0d594fdab5e /gcc | |
parent | 3c71736a3c7676f2a61b788a4a37daa9f2c73bee (diff) | |
download | gcc-5cfac96e553f6b6affdf9bc53e15a231034ebf63.zip gcc-5cfac96e553f6b6affdf9bc53e15a231034ebf63.tar.gz gcc-5cfac96e553f6b6affdf9bc53e15a231034ebf63.tar.bz2 |
(finish_incomplete_decl): Warn if completing an array that wasn't declared extern.
(finish_incomplete_decl): Warn if completing an array that wasn't
declared extern. Simplify test for whether completion is needed.
From-SVN: r11003
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-decl.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 121424d..0afbcd0 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -772,13 +772,16 @@ void finish_incomplete_decl (decl) tree decl; { - if (TREE_CODE (decl) == VAR_DECL && TREE_TYPE (decl) != error_mark_node) + if (TREE_CODE (decl) == VAR_DECL) { tree type = TREE_TYPE (decl); - if (TREE_CODE (type) == ARRAY_TYPE - && TYPE_DOMAIN (type) == 0 - && TREE_CODE (decl) != TYPE_DECL) + if (type != error_mark_node + && TREE_CODE (type) == ARRAY_TYPE + && TYPE_DOMAIN (type) == 0) { + if (! DECL_EXTERNAL (decl)) + warning_with_decl (decl, "array `%s' assumed to have one element"); + complete_array_type (type, NULL_TREE, 1); layout_decl (decl, 0); |