From 2838d446efb7d062b95acbbecf2d41dd6d03e5eb Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 27 May 1991 15:06:36 +0000 Subject: [PATCH] Did not detect redeclaration of formal as local --- lang/cem/cemcom.ansi/idf.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lang/cem/cemcom.ansi/idf.c b/lang/cem/cemcom.ansi/idf.c index 080935a91..b758c9f37 100644 --- a/lang/cem/cemcom.ansi/idf.c +++ b/lang/cem/cemcom.ansi/idf.c @@ -293,15 +293,17 @@ declare_idf(ds, dc, lvl) #ifdef LINT check_hiding(idf, lvl, sc); /* of some idf by this idf */ #endif LINT + if (def && lvl == L_LOCAL && def->df_level == L_FORMAL2) { + error("%s redeclared", idf->id_text); + } - if ((def && + if (def && ( def->df_level == lvl || - ( lvl != L_GLOBAL && def->df_level > lvl ) - )) - || (lvl == L_GLOBAL - && def && def->df_level == L_PROTO + ( lvl != L_GLOBAL && def->df_level > lvl ) || + (lvl == L_GLOBAL + && def->df_level == L_PROTO && def->next && def->next->df_level == L_GLOBAL) - ) { + )) { /* There is already a declaration for idf on this level, or even more inside. The rules differ for different levels.