From 73ac23824b43f9606ad6e6a9989c87614071d702 Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 28 Nov 1988 12:54:38 +0000 Subject: [PATCH] changed error messages, initialize bss with funny value, and be somewhat more conservative with memory usage --- lang/m2/comp/Version.c | 2 +- lang/m2/comp/statement.g | 16 +++++++++------- lang/m2/comp/walk.c | 3 +++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lang/m2/comp/Version.c b/lang/m2/comp/Version.c index ac4938748..1c0dcdce7 100644 --- a/lang/m2/comp/Version.c +++ b/lang/m2/comp/Version.c @@ -1 +1 @@ -static char Version[] = "ACK Modula-2 compiler Version 0.43"; +static char Version[] = "ACK Modula-2 compiler Version 0.44"; diff --git a/lang/m2/comp/statement.g b/lang/m2/comp/statement.g index 0e43d9ee8..06ead2d16 100644 --- a/lang/m2/comp/statement.g +++ b/lang/m2/comp/statement.g @@ -111,10 +111,12 @@ StatementSequence(register t_node **pnd;) [ %persistent ';' statement(&nd) - { nd1 = dot2node(Link, *pnd, nd); - *pnd = nd1; - nd1->nd_symb = ';'; - pnd = &(nd1->nd_right); + { if (nd != EmptyStatement) { + nd1 = dot2node(Link, *pnd, nd); + *pnd = nd1; + nd1->nd_symb = ';'; + pnd = &(nd1->nd_right); + } } ]* ; @@ -262,15 +264,15 @@ ReturnStatement(t_node **pnd;) [ expression(&(nd->nd_right)) { if (scopeclosed(CurrentScope)) { -error("a module body has no result value"); +error("a module body cannot return a value"); } else if (! ResultType(df->df_type)) { -error("procedure \"%s\" has no result value", df->df_idf->id_text); +error("procedure \"%s\" is not a function, so cannot return a value", df->df_idf->id_text); } } | { if (ResultType(df->df_type)) { -error("procedure \"%s\" must return a value", df->df_idf->id_text); +error("function procedure \"%s\" must return a value", df->df_idf->id_text); } } ] diff --git a/lang/m2/comp/walk.c b/lang/m2/comp/walk.c index 82fa46bcb..10576f8a4 100644 --- a/lang/m2/comp/walk.c +++ b/lang/m2/comp/walk.c @@ -181,6 +181,9 @@ WalkModule(module) C_zne(RETURN_LABEL); C_ine_dlb(data_label, (arith) 0); } + else if (! options['R']) { + C_cal("killbss"); + } for (; nd; nd = nd->nd_left) { C_cal(nd->nd_def->mod_vis->sc_scope->sc_name);