From: ceriel Date: Thu, 7 Mar 1991 12:01:34 +0000 (+0000) Subject: be a bit more tolerant about external definitions X-Git-Tag: release-5-5~1197 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=b4aaa8824e4a108b9db205a8355baffeb6b3ab61;p=ack.git be a bit more tolerant about external definitions --- diff --git a/lang/cem/cemcom.ansi/.distr b/lang/cem/cemcom.ansi/.distr index f13181741..b41f18da6 100644 --- a/lang/cem/cemcom.ansi/.distr +++ b/lang/cem/cemcom.ansi/.distr @@ -31,7 +31,7 @@ declar.g declar.str declarator.c decspecs.c -decspecs.str +decspecs.h def.str domacro.c dumpidf.c diff --git a/lang/cem/cemcom.ansi/Makefile b/lang/cem/cemcom.ansi/Makefile index 86158d67d..476b3829f 100644 --- a/lang/cem/cemcom.ansi/Makefile +++ b/lang/cem/cemcom.ansi/Makefile @@ -103,12 +103,12 @@ GOBJ = char.o symbol2str.o next.o # The Sun-3 version is faster when the text-size exceeds 180K! ARRGH EXTRA_O = -STRSRC = code.str declar.str decspecs.str def.str expr.str field.str \ +STRSRC = code.str declar.str def.str expr.str field.str \ estack.str util.str proto.str replace.str \ idf.str macro.str stack.str stmt.str struct.str switch.str type.str \ l_brace.str l_state.str l_outdef.str # generated source files -GHSTRSRC = code.h declar.h decspecs.h def.h expr.h field.h \ +GHSTRSRC = code.h declar.h def.h expr.h field.h \ estack.h util.h proto.h replace.h \ idf.h macro.h stack.h stmt.h struct.h switch.h type.h \ l_brace.h l_state.h l_outdef.h @@ -124,7 +124,7 @@ GHSRC = botch_free.h dataflow.h debug.h density.h errout.h \ HSRC = LLlex.h align.h arith.h assert.h atw.h class.h \ input.h interface.h label.h level.h mes.h sizes.h specials.h \ - file_info.h tokenname.h l_em.h l_lint.h + file_info.h tokenname.h l_em.h l_lint.h decspecs.h HFILES = $(HSRC) $(GHSRC) $(GHSTRSRC) @@ -228,7 +228,6 @@ next.c: make.next $(STRSRC) code.h: make.allocd declar.h: make.allocd -decspecs.h: make.allocd def.h: make.allocd expr.h: make.allocd field.h: make.allocd diff --git a/lang/cem/cemcom.ansi/code.c b/lang/cem/cemcom.ansi/code.c index c9b111e33..37c6dbdc9 100644 --- a/lang/cem/cemcom.ansi/code.c +++ b/lang/cem/cemcom.ansi/code.c @@ -53,7 +53,9 @@ extern arith NewLocal(); /* util.c */ /* global function info */ char *func_name; struct type *func_type; +#ifdef LINT int func_notypegiven; +#endif #ifdef USE_TMP static int tmp_id; @@ -264,7 +266,9 @@ begin_proc(ds, idf) /* to be called when entering a procedure */ else { func_type = def->df_type->tp_up; } +#ifdef LINT func_notypegiven = ds->ds_notypegiven; +#endif func_size = ATW(func_type->tp_size); sp_occurred[SP_SETJMP] = 0; diff --git a/lang/cem/cemcom.ansi/decspecs.c b/lang/cem/cemcom.ansi/decspecs.c index 8a4555860..83f081b95 100644 --- a/lang/cem/cemcom.ansi/decspecs.c +++ b/lang/cem/cemcom.ansi/decspecs.c @@ -30,11 +30,6 @@ do_decspecs(ds) ASSERT(level != L_FORMAL1); - /* - if (ds->ds_notypegiven && !ds->ds_sc_given) - strict("data definition lacking type or storage class"); - */ - if ( level == L_GLOBAL && (ds->ds_sc == AUTO || ds->ds_sc == REGISTER) ) { diff --git a/lang/cem/cemcom.ansi/decspecs.h b/lang/cem/cemcom.ansi/decspecs.h new file mode 100644 index 000000000..0895f9720 --- /dev/null +++ b/lang/cem/cemcom.ansi/decspecs.h @@ -0,0 +1,21 @@ +/* + * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. + * See the copyright notice in the ACK home directory, in the file "Copyright". + */ +/* $Header$ */ +/* DECLARATION SPECIFIER DEFINITION */ + +struct decspecs { + struct decspecs *next; + struct type *ds_type; /* single type */ + int ds_notypegiven; /* set if type not given explicitly */ + int ds_typedef; /* 1 if type was a user typedef */ + int ds_sc_given; /* 1 if the st. class is explicitly given */ + int ds_sc; /* storage class, given or implied */ + int ds_size; /* LONG, SHORT or 0 */ + int ds_unsigned; /* SIGNED, UNSIGNED or 0 */ + int ds_typequal; /* type qualifiers - see type.str */ +}; + +extern struct type *qualifier_type(); +extern struct decspecs null_decspecs; diff --git a/lang/cem/cemcom.ansi/program.g b/lang/cem/cemcom.ansi/program.g index f361d3f8c..38333d521 100644 --- a/lang/cem/cemcom.ansi/program.g +++ b/lang/cem/cemcom.ansi/program.g @@ -141,24 +141,10 @@ external_definition } [ %if (DOT != IDENTIFIER || AHEAD == IDENTIFIER) decl_specifiers(&Ds) - [ - declarator(&Dc) - { - declare_idf(&Ds, &Dc, level); -#ifdef LINT - lint_ext_def(Dc.dc_idf, Ds.ds_sc); -#endif LINT - } - [ - function(&Ds, &Dc) - | - non_function(&Ds, &Dc) - ] - | - ';' - ] | {do_decspecs(&Ds);} + ] + [ declarator(&Dc) { declare_idf(&Ds, &Dc, level); @@ -166,7 +152,21 @@ external_definition lint_ext_def(Dc.dc_idf, Ds.ds_sc); #endif LINT } - function(&Ds, &Dc) + [ + function(&Ds, &Dc) + | + { if (! Ds.ds_sc_given && Ds.ds_notypegiven) { + strict("declaration specifiers missing"); + } + } + non_function(&Ds, &Dc) + ] + | + { if (! Ds.ds_sc_given && Ds.ds_notypegiven) { + strict("declaration missing"); + } + } + ';' ] {remove_declarator(&Dc); flush_strings(); } ;