From a7cdd1612565549e74c50c08bb35aba8b48534ab Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 22 Jan 1988 12:04:27 +0000 Subject: [PATCH] Allow the checking of definition modules --- lang/m2/comp/Version.c | 2 +- lang/m2/comp/options.c | 4 ++-- lang/m2/comp/program.g | 10 +++++++--- lang/m2/comp/warning.h | 5 +++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lang/m2/comp/Version.c b/lang/m2/comp/Version.c index 1f37d6dc0..ae1bb5d9e 100644 --- a/lang/m2/comp/Version.c +++ b/lang/m2/comp/Version.c @@ -1 +1 @@ -static char Version[] = "ACK Modula-2 compiler Version 0.30"; +static char Version[] = "ACK Modula-2 compiler Version 0.31"; diff --git a/lang/m2/comp/options.c b/lang/m2/comp/options.c index 4f5b742df..8290a18bb 100644 --- a/lang/m2/comp/options.c +++ b/lang/m2/comp/options.c @@ -71,7 +71,7 @@ DoOption(text) } } } - else warning_classes = 0; + else warning_classes = W_ALWAYS; break; case 'W': @@ -94,7 +94,7 @@ DoOption(text) } } } - else warning_classes = W_OLDFASHIONED|W_STRICT|W_ORDINARY; + else warning_classes = W_ALL; break; case 'M': { /* maximum identifier length */ diff --git a/lang/m2/comp/program.g b/lang/m2/comp/program.g index 31fbf66e8..0f4672c42 100644 --- a/lang/m2/comp/program.g +++ b/lang/m2/comp/program.g @@ -137,7 +137,7 @@ DefinitionModule df->df_flags |= ForeignFlag; if (!Defined) Defined = df; CurrentScope->sc_definedby = df; - if (df->df_idf != DefId) { + if (DefId && df->df_idf != DefId) { error("DEFINITION MODULE name is \"%s\", not \"%s\"", df->df_idf->id_text, DefId->id_text); } @@ -239,8 +239,12 @@ ProgramModule ; Module: - DEFINITION - { fatal("Compiling a definition module"); } + { error("Compiling a definition module"); + open_scope(CLOSEDSCOPE); + state = DEFINITION; + } + DefinitionModule + { close_scope(SC_CHKFORW); } | %default [ IMPLEMENTATION { state = IMPLEMENTATION; } diff --git a/lang/m2/comp/warning.h b/lang/m2/comp/warning.h index 0486bcafc..a5771910e 100644 --- a/lang/m2/comp/warning.h +++ b/lang/m2/comp/warning.h @@ -20,10 +20,11 @@ #define W_ORDINARY 1 #define W_STRICT 2 #define W_OLDFASHIONED 4 +#define W_ALWAYS 010 /* always given */ -#define W_ALL (W_ORDINARY|W_STRICT|W_OLDFASHIONED) +#define W_ALL (W_ORDINARY|W_STRICT|W_OLDFASHIONED|W_ALWAYS) -#define W_INITIAL (W_ORDINARY | W_OLDFASHIONED) +#define W_INITIAL (W_ORDINARY | W_OLDFASHIONED | W_ALWAYS) /* The bit mask itself: */ extern int warning_classes;