changed error messages, initialize bss with funny value, and be

somewhat more conservative with memory usage
This commit is contained in:
ceriel 1988-11-28 12:54:38 +00:00
parent da11deeece
commit 73ac23824b
3 changed files with 13 additions and 8 deletions

View file

@ -1 +1 @@
static char Version[] = "ACK Modula-2 compiler Version 0.43"; static char Version[] = "ACK Modula-2 compiler Version 0.44";

View file

@ -111,10 +111,12 @@ StatementSequence(register t_node **pnd;)
[ %persistent [ %persistent
';' ';'
statement(&nd) statement(&nd)
{ nd1 = dot2node(Link, *pnd, nd); { if (nd != EmptyStatement) {
*pnd = nd1; nd1 = dot2node(Link, *pnd, nd);
nd1->nd_symb = ';'; *pnd = nd1;
pnd = &(nd1->nd_right); nd1->nd_symb = ';';
pnd = &(nd1->nd_right);
}
} }
]* ]*
; ;
@ -262,15 +264,15 @@ ReturnStatement(t_node **pnd;)
[ [
expression(&(nd->nd_right)) expression(&(nd->nd_right))
{ if (scopeclosed(CurrentScope)) { { 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)) { 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)) { { 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);
} }
} }
] ]

View file

@ -181,6 +181,9 @@ WalkModule(module)
C_zne(RETURN_LABEL); C_zne(RETURN_LABEL);
C_ine_dlb(data_label, (arith) 0); C_ine_dlb(data_label, (arith) 0);
} }
else if (! options['R']) {
C_cal("killbss");
}
for (; nd; nd = nd->nd_left) { for (; nd; nd = nd->nd_left) {
C_cal(nd->nd_def->mod_vis->sc_scope->sc_name); C_cal(nd->nd_def->mod_vis->sc_scope->sc_name);