From ccc5f10fcaff88ae44ef275bbb47401d6c0bccb9 Mon Sep 17 00:00:00 2001 From: eck Date: Mon, 17 Dec 1990 13:08:05 +0000 Subject: [PATCH] fixed bugs with storage-class and void in prototype --- lang/cem/cemcom.ansi/proto.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lang/cem/cemcom.ansi/proto.c b/lang/cem/cemcom.ansi/proto.c index 309934e52..6e20b6455 100644 --- a/lang/cem/cemcom.ansi/proto.c +++ b/lang/cem/cemcom.ansi/proto.c @@ -77,11 +77,23 @@ add_proto(pl, ds, dc, lvl) if (type->tp_fund != VOID) error("unknown %s-type", symbol2str(type->tp_fund)); else { - if (idf != (struct idf *)0) + if (idf != (struct idf *)0 + || ds->ds_sc_given + || ds->ds_typequal) { error("illegal use of void in argument list"); - else { - pl->pl_flag |= PL_VOID; + pl->pl_flag |= PL_ERRGIVEN; } + /* set PL_VOID anyway */ + pl->pl_flag |= PL_VOID; + } + } + if (ds->ds_sc_given && ds->ds_sc != REGISTER) { + if (!(pl->pl_flag & PL_ERRGIVEN)) { + if (ds->ds_sc != AUTO) { + error("illegal storage class in parameter declaration"); + } else { + warning("illegal storage class in parameter declaration"); + } } } @@ -230,11 +242,6 @@ declare_protos(dc) continue; } - /* Postponed storage class checking. - */ - if (def->df_sc == 0) - error("illegal storage class in parameter declaration"); - def->df_level = L_FORMAL2; stack_idf(pl->pl_idf, stl); pl = pl->next; -- 2.34.1