From: ceriel Date: Mon, 5 Oct 1987 10:17:44 +0000 (+0000) Subject: fixed some bugs: X-Git-Tag: release-5-5~3818 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=efcb9468f4d4d964b5a048dc3cefa540e96e9196;p=ack.git fixed some bugs: - switch with BIG difference between lower and upper now handled correctly - made sure an added error production is never chosen as the default one - don't allow AUTO as specification for a parameter --- diff --git a/lang/cem/cemcom/.distr b/lang/cem/cemcom/.distr index ce6f64bbb..a1a035dc8 100644 --- a/lang/cem/cemcom/.distr +++ b/lang/cem/cemcom/.distr @@ -86,3 +86,5 @@ tokenname.c tokenname.h type.c type.str +util.str +util.c diff --git a/lang/cem/cemcom/Makefile b/lang/cem/cemcom/Makefile index 334fc6396..6ed03e2f6 100644 --- a/lang/cem/cemcom/Makefile +++ b/lang/cem/cemcom/Makefile @@ -10,7 +10,7 @@ CID = $(EMHOME)/bin/cid # Libraries and EM interface definitions SYSLIB = $(EMHOME)/modules/lib/libsystem.a EMKLIB = $(EMHOME)/modules/lib/libemk.a -EMELIB = $(EMHOME)/modules/lib/libeme.a +EMELIB = $(EMHOME)/modules/lib/libeme.a $(EMHOME)/lib/em_data.a STRLIB = $(EMHOME)/modules/lib/libstring.a PRTLIB = $(EMHOME)/modules/lib/libprint.a EMMESLIB = $(EMHOME)/modules/lib/libem_mes.a diff --git a/lang/cem/cemcom/Makefile.erik b/lang/cem/cemcom/Makefile.erik index a4d8f5af8..43f7070c3 100644 --- a/lang/cem/cemcom/Makefile.erik +++ b/lang/cem/cemcom/Makefile.erik @@ -13,7 +13,7 @@ LINT = /usr/new/lint # Libraries and EM interface definitions SYSLIB = $(EMHOME)/modules/lib/libsystem.a EMKLIB = $(EMHOME)/modules/lib/libemk.a -EMELIB = $(EMHOME)/modules/lib/libeme.a +EMELIB = $(EMHOME)/modules/lib/libeme.a $(EMHOME)/lib/em_data.a STRLIB = $(EMHOME)/modules/lib/libstring.a PRTLIB = $(EMHOME)/modules/lib/libprint.a EMMESLIB = $(EMHOME)/modules/lib/libem_mes.a diff --git a/lang/cem/cemcom/declar.g b/lang/cem/cemcom/declar.g index fe5c0d65d..1ede96394 100644 --- a/lang/cem/cemcom/declar.g +++ b/lang/cem/cemcom/declar.g @@ -120,14 +120,17 @@ type_specifier(struct type **tpp;) ; single_type_specifier(register struct decspecs *ds;): - TYPE_IDENTIFIER /* this includes INT, CHAR, etc. */ + %default TYPE_IDENTIFIER /* this includes INT, CHAR, etc. */ {idf2type(dot.tk_idf, &ds->ds_type);} | IDENTIFIER - {error("%s is not a type identifier", dot.tk_idf->id_text); - dot.tk_idf->id_def->df_type = error_type; - dot.tk_idf->id_def->df_sc = TYPEDEF; - ds->ds_type = error_type; + { + error("%s is not a type identifier", dot.tk_idf->id_text); + ds->ds_type = error_type; + if (dot.tk_idf->id_def) { + dot.tk_idf->id_def->df_type = error_type; + dot.tk_idf->id_def->df_sc = TYPEDEF; + } } | struct_or_union_specifier(&ds->ds_type) diff --git a/lang/cem/cemcom/decspecs.c b/lang/cem/cemcom/decspecs.c index 1b0c3f679..a452d5d1c 100644 --- a/lang/cem/cemcom/decspecs.c +++ b/lang/cem/cemcom/decspecs.c @@ -40,7 +40,7 @@ do_decspecs(ds) } if (level == L_FORMAL2) { - if (ds->ds_sc_given && ds->ds_sc != AUTO && + if (ds->ds_sc_given && ds->ds_sc != REGISTER){ extern char *symbol2str(); error("%s formal illegal", symbol2str(ds->ds_sc)); diff --git a/lang/cem/cemcom/domacro.c b/lang/cem/cemcom/domacro.c index 2639f73d4..9b9fc9697 100644 --- a/lang/cem/cemcom/domacro.c +++ b/lang/cem/cemcom/domacro.c @@ -242,7 +242,7 @@ do_include() inctable[0] = WorkingDir; if (filenm) { if (!InsertFile(filenm, &inctable[tok==FILESPECIFIER],&result)){ - fatal("cannot find include file \"%s\"", filenm); + fatal("cannot open include file \"%s\"", filenm); } else { WorkingDir = getwdir(result); diff --git a/lang/cem/cemcom/switch.c b/lang/cem/cemcom/switch.c index f85b88d98..80b6a96ee 100644 --- a/lang/cem/cemcom/switch.c +++ b/lang/cem/cemcom/switch.c @@ -24,7 +24,17 @@ extern char options[]; -#define compact(nr, low, up) (nr != 0 && (up - low) / nr <= (DENSITY - 1)) +compact(nr, low, up) + arith low, up; +{ + /* Careful! up - low might not fit in an arith. And then, + the test "up-low < 0" might also not work to detect this + situation! Or is this just a bug in the M68020/M68000? + */ + arith diff = up - low; + + return (nr != 0 && diff >= 0 && diff / nr <= (DENSITY - 1)); +} static struct switch_hdr *switch_stack = 0;