From 5cfac96e553f6b6affdf9bc53e15a231034ebf63 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Mon, 15 Jan 1996 20:05:06 -0500 Subject: [PATCH] (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 --- gcc/c-decl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 121424db032..0afbcd00ba6 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); -- 2.30.2