From a7f64d523d457467e70367ae9745fe3a5eec49d5 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Fri, 14 Aug 1992 08:09:22 +0000 Subject: [PATCH] (finish_decl): Avoid cascading messages for tentative definitions with incomplete types. From-SVN: r1821 --- gcc/c-decl.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 991dee9fcaf..877754d81ec 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3143,19 +3143,19 @@ finish_decl (decl, init, asmspec_tree) if (TREE_CODE (decl) == VAR_DECL) { - if (TREE_STATIC (decl) && DECL_SIZE (decl) == 0) + if (DECL_SIZE (decl) == 0 + && (TREE_STATIC (decl) + ? + /* A static variable with an incomplete type + is an error if it is initialized or `static'. + Otherwise, let it through, but if it is not `extern' + then it may cause an error message later. */ + !TREE_PUBLIC (decl) || DECL_INITIAL (decl) + : + /* An automatic variable with an incomplete type + is an error. */ + !TREE_EXTERNAL (decl))) { - /* A static variable with an incomplete type: - that is an error if it is initialized or `static'. - Otherwise, let it through, but if it is not `extern' - then it may cause an error message later. */ - if (! (TREE_PUBLIC (decl) && DECL_INITIAL (decl) == 0)) - error_with_decl (decl, "storage size of `%s' isn't known"); - } - else if (!DECL_EXTERNAL (decl) && DECL_SIZE (decl) == 0) - { - /* An automatic variable with an incomplete type: - that is an error. */ error_with_decl (decl, "storage size of `%s' isn't known"); TREE_TYPE (decl) = error_mark_node; } -- 2.30.2