aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-08-14 08:09:22 +0000
committerRichard Stallman <rms@gnu.org>1992-08-14 08:09:22 +0000
commita7f64d523d457467e70367ae9745fe3a5eec49d5 (patch)
tree744bf0f826293a967ef49d793759afa589e173d5 /gcc
parent8c31e6b602fe470308b4777289f3ce81e34f62a1 (diff)
downloadgcc-a7f64d523d457467e70367ae9745fe3a5eec49d5.zip
gcc-a7f64d523d457467e70367ae9745fe3a5eec49d5.tar.gz
gcc-a7f64d523d457467e70367ae9745fe3a5eec49d5.tar.bz2
(finish_decl): Avoid cascading messages for tentative
definitions with incomplete types. From-SVN: r1821
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-decl.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 991dee9..877754d 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;
}