public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/gaius/heads/devel/modula-2)] Remove unused variables,  parameters and procedures.
@ 2021-08-02  8:47 Gaius Mulley
  0 siblings, 0 replies; 3+ messages in thread
From: Gaius Mulley @ 2021-08-02  8:47 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:48199ff6ed1858039f1116095a5e45905fa48d75

commit 48199ff6ed1858039f1116095a5e45905fa48d75
Author: Gaius Mulley <gaius.mulley@southwales.ac.uk>
Date:   Mon Aug 2 09:44:33 2021 +0100

    Remove unused variables, parameters and procedures.
    
    2021-08-02  Gaius Mulley  <gaius.mulley@southwales.ac.uk>
    
    gcc/m2/
    
            * gm2-compiler/M2BasicBlock.mod (ConvertQuads2BasicBlock): Assign
            CurrentBB to NIL.  (Sub): Commented out.  (DisplayBasicBlocks):
            Commented out.  (DisplayBlock): Commented out.
            * gm2-compiler/M2Code.mod (PrintModule): Commented out.
            (DisplayQuadsInScope): Commented out.  (DisplayQuadNumbers):
            Commented out.
            * gm2-compiler/M2Error.mod: Import NulName. (DoFormat1) initialize
            n.  (DoFormat2) initialize n.
            * gm2-compiler/M2Optimize.mod (DeleteUnReachableProcedures):
            Commented out.
            * gm2-compiler/M2Options.mod:  Commented out string garbage
            debugging procedures.  (SetDebugging) Commented out.
            * gm2-compiler/M2Printf.mod (IsDigit): Commented out.
            * gm2-compiler/P1SymBuild.mod (CheckProcedure): Removed.
            (CheckFileName) Commented out.  (BuildHiddenType) Remove Sym.
            Use Assert to check return value.
            * gm2-compiler/P2SymBuild.def (SeenBoolean): Remove sym parameter.
            (SeenZType): Remove sym parameter.  (SeenRType): Remove sym
            parameter.  (SeenCType): Remove sym parameter.
            * gm2-compiler/P2SymBuild.mod (SeenBoolean): Remove sym parameter.
            (SeenZType): Remove sym parameter.  (SeenRType): Remove sym
            parameter.  (SeenCType): Remove sym parameter.
            (StartBuildEnumeration): Remove name.  (FailParameter) Use default
            ELSE and Assert.  (BuildNulParam) Removed.  (BuildFieldRecord)
            Remove name.  Assign Field to NulSym.  (BuildVarientSelector)
            Remove Parent.
            * gm2-compiler/SymbolTable.def (GCFieldVarient): Removed.
            (FillInUnboundedFields):  Remove field.
            * gm2-compiler/gm2lcc.mod (CollectObjects): remove s.
            (WriteModuleName) Removed.
            * gm2-compiler/gm2lorder.mod (InitRuntimeModules) Remove l.
            * gm2-gcc/m2expr.c (divFloorOverflowPosPos) Remove unused
            parameters.  (divFloorOverflowPosNeg) Remove unused parameters.
            (divFloorOverflowNegPos) Remove unused parameters.
    
    libgm2/
    
            * libm2pim/Makefile.in: (Rebuilt).
    
    Signed-off-by: Gaius Mulley <gaius.mulley@southwales.ac.uk>

Diff:
---
 gcc/m2/gm2-compiler/M2BasicBlock.mod |  5 +++
 gcc/m2/gm2-compiler/M2Code.mod       |  6 ++++
 gcc/m2/gm2-compiler/M2Error.mod      |  5 ++-
 gcc/m2/gm2-compiler/M2Optimize.mod   |  4 ++-
 gcc/m2/gm2-compiler/M2Options.mod    |  7 +++--
 gcc/m2/gm2-compiler/M2Printf.mod     |  2 ++
 gcc/m2/gm2-compiler/P1SymBuild.mod   | 13 +++-----
 gcc/m2/gm2-compiler/P2SymBuild.def   |  8 ++---
 gcc/m2/gm2-compiler/P2SymBuild.mod   | 61 ++++++++++++------------------------
 gcc/m2/gm2-compiler/SymbolTable.def  |  9 ------
 gcc/m2/gm2-compiler/SymbolTable.mod  | 32 ++++---------------
 gcc/m2/gm2-compiler/gm2lcc.mod       |  8 ++---
 gcc/m2/gm2-compiler/gm2lorder.mod    |  6 ++--
 gcc/m2/gm2-gcc/m2expr.c              | 17 +++++-----
 gm2tools/Makefile.in                 |  2 +-
 libgm2/libm2pim/Makefile.in          | 24 +++++++-------
 16 files changed, 87 insertions(+), 122 deletions(-)

diff --git a/gcc/m2/gm2-compiler/M2BasicBlock.mod b/gcc/m2/gm2-compiler/M2BasicBlock.mod
index 3d9f511f6e8..5908eeb5e59 100644
--- a/gcc/m2/gm2-compiler/M2BasicBlock.mod
+++ b/gcc/m2/gm2-compiler/M2BasicBlock.mod
@@ -175,6 +175,7 @@ BEGIN
       since they will never be executed.
    *)
    LastBB := NIL ;
+   CurrentBB := NIL ;
    Quad := Start ;
    LastQuadConditional := TRUE ;  (* Force Rule (i) *)
    LastQuadCall := FALSE ;
@@ -299,6 +300,7 @@ END Add ;
    Sub deletes an element from the specified queue.
 *)
 
+(*
 PROCEDURE Sub (VAR Head: BasicBlock;
                b: BasicBlock) ;
 BEGIN
@@ -314,12 +316,14 @@ BEGIN
       b^.Right^.Left := b^.Left
    END
 END Sub ;
+*)
 
 
 (*
    DisplayBasicBlocks - displays the basic block data structure.
 *)
 
+(*
 PROCEDURE DisplayBasicBlocks (bb: BasicBlock) ;
 VAR
    b: BasicBlock ;
@@ -343,6 +347,7 @@ BEGIN
       WriteString(' end   ') ; WriteCard(EndQuad, 6) ;
    END
 END DisplayBlock ;
+*)
 
 
 BEGIN
diff --git a/gcc/m2/gm2-compiler/M2Code.mod b/gcc/m2/gm2-compiler/M2Code.mod
index 8552b35d899..84208dc3bc0 100644
--- a/gcc/m2/gm2-compiler/M2Code.mod
+++ b/gcc/m2/gm2-compiler/M2Code.mod
@@ -178,6 +178,7 @@ END DoModuleDeclare ;
    PrintModule -
 *)
 
+(*
 PROCEDURE PrintModule (sym: CARDINAL) ;
 VAR
    n: Name ;
@@ -185,6 +186,7 @@ BEGIN
    n := GetSymName (sym) ;
    printf1 ('module %a\n', n)
 END PrintModule ;
+*)
 
 
 (*
@@ -388,12 +390,14 @@ END BasicBlockVariableAnalysis ;
    DisplayQuadsInScope -
 *)
 
+(*
 PROCEDURE DisplayQuadsInScope (sb: ScopeBlock) ;
 BEGIN
    printf0 ('Quads in scope\n') ;
    ForeachScopeBlockDo (sb, DisplayQuadRange) ;
    printf0 ('===============\n')
 END DisplayQuadsInScope ;
+*)
 
 
 (*
@@ -425,6 +429,7 @@ END OptimizeScopeBlock ;
    DisplayQuadNumbers - the range, start..end.
 *)
 
+(*
 PROCEDURE DisplayQuadNumbers (start, end: CARDINAL) ;
 BEGIN
    IF DisplayQuadruples
@@ -432,6 +437,7 @@ BEGIN
       printf2 ('Coding [%d..%d]\n', start, end)
    END
 END DisplayQuadNumbers ;
+*)
 
 
 (*
diff --git a/gcc/m2/gm2-compiler/M2Error.mod b/gcc/m2/gm2-compiler/M2Error.mod
index c29901a0b22..29de1878f34 100644
--- a/gcc/m2/gm2-compiler/M2Error.mod
+++ b/gcc/m2/gm2-compiler/M2Error.mod
@@ -21,7 +21,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 
 IMPLEMENTATION MODULE M2Error ;
 
-FROM NameKey IMPORT Name, KeyToCharStar ;
+FROM NameKey IMPORT NulName, Name, KeyToCharStar ;
 FROM DynamicStrings IMPORT String, InitString, InitStringCharStar, ConCat, ConCatChar, Mark, string, KillString, Dup ;
 FROM FIO IMPORT StdOut, WriteNBytes, Close, FlushBuffer ;
 FROM StrLib IMPORT StrLen, StrEqual ;
@@ -196,6 +196,7 @@ VAR
    s: String ;
    n: Name ;
 BEGIN
+   n := NulName ;
    IF TranslateNameToCharStar(a, 1)
    THEN
       Cast(n, w) ;
@@ -250,6 +251,7 @@ VAR
    b     : BITSET ;
 BEGIN
    b := {} ;
+   n := NulName ;
    IF TranslateNameToCharStar(a, 1)
    THEN
       Cast(n, w1) ;
@@ -298,6 +300,7 @@ VAR
    b            : BITSET ;
 BEGIN
    b := {} ;
+   n := NulName ;
    IF TranslateNameToCharStar(a, 1)
    THEN
       Cast(n, w1) ;
diff --git a/gcc/m2/gm2-compiler/M2Optimize.mod b/gcc/m2/gm2-compiler/M2Optimize.mod
index 4c2cc1db00d..4369ad03db7 100644
--- a/gcc/m2/gm2-compiler/M2Optimize.mod
+++ b/gcc/m2/gm2-compiler/M2Optimize.mod
@@ -220,7 +220,7 @@ BEGIN
          From := GetNextQuad (From)
       END
    END ;
-   RETURN TRUE 
+   RETURN TRUE
 END IsBasicBlock ;
 
 
@@ -383,6 +383,7 @@ END KnownReach ;
    DeleteUnReachableProcedures - Deletes all procedures that are unreachable.
 *)
 
+(*
 PROCEDURE DeleteUnReachableProcedures ;
 VAR
    ProcName: Name ;
@@ -464,6 +465,7 @@ BEGIN
       END
    END
 END Delete ;
+*)
 
 
 (*
diff --git a/gcc/m2/gm2-compiler/M2Options.mod b/gcc/m2/gm2-compiler/M2Options.mod
index 2624514d051..a26435d9d1f 100644
--- a/gcc/m2/gm2-compiler/M2Options.mod
+++ b/gcc/m2/gm2-compiler/M2Options.mod
@@ -58,6 +58,8 @@ VAR
    ForcedLocationValue: location_t ;
 
 
+(* String garbage collection debugging routines.
+
 (*
    doDSdbEnter -
 *)
@@ -94,7 +96,7 @@ END DSdbEnter ;
 PROCEDURE DSdbExit (s: String) ;
 BEGIN
 END DSdbExit ;
-
+*)
 
 (*
 #define DSdbEnter doDSdbEnter
@@ -465,6 +467,7 @@ BEGIN
 END SetUnboundedByReference ;
 
 
+(*
 (*
    SetDebugging - sets the debugging flag to, v.
 *)
@@ -474,7 +477,7 @@ BEGIN
    GenerateDebugging := value
 END SetDebugging ;
 
-(*
+
 (*
    SetProfiling - dummy procedure, as profiling is implemented in the gcc backend.
 *)
diff --git a/gcc/m2/gm2-compiler/M2Printf.mod b/gcc/m2/gm2-compiler/M2Printf.mod
index 9bd62ab63af..f7e0973f71b 100644
--- a/gcc/m2/gm2-compiler/M2Printf.mod
+++ b/gcc/m2/gm2-compiler/M2Printf.mod
@@ -33,10 +33,12 @@ FROM NameKey IMPORT Name, KeyToCharStar ;
    IsDigit - returns TRUE if, ch, is a character 0..9
 *)
 
+(*
 PROCEDURE IsDigit (ch: CHAR) : BOOLEAN ;
 BEGIN
    RETURN (ch>='0') AND (ch<='9')
 END IsDigit ;
+*)
 
 
 (*
diff --git a/gcc/m2/gm2-compiler/P1SymBuild.mod b/gcc/m2/gm2-compiler/P1SymBuild.mod
index 5cb9808b77e..9060ee5de57 100644
--- a/gcc/m2/gm2-compiler/P1SymBuild.mod
+++ b/gcc/m2/gm2-compiler/P1SymBuild.mod
@@ -96,15 +96,12 @@ FROM M2Comp IMPORT CompilingDefinitionModule,
 CONST
    Debugging = FALSE ;
 
-VAR
-   CheckProcedure: BOOLEAN ;  (* Set if currently implementing a defined *)
-                              (* procedure.                              *)
-
 
 (*
-   CheckName - checks to see that the module name matches the file name.
+   CheckFileName - checks to see that the module name matches the file name.
 *)
 
+(*
 PROCEDURE CheckFileName (tok: CARDINAL; name: Name; ModuleType: ARRAY OF CHAR) ;
 VAR
    ext,
@@ -133,6 +130,7 @@ BEGIN
       MetaErrorString2 (s, MakeError (tok, name), MakeErrorS (tok, FileName))
    END
 END CheckFileName ;
+*)
 
 
 (*
@@ -888,12 +886,11 @@ PROCEDURE BuildHiddenType ;
 VAR
    name : Name ;
    tokno: CARDINAL ;
-   Sym  : CARDINAL ;
 BEGIN
-   PopTtok(name, tokno) ;
+   PopTtok (name, tokno) ;
    (* WriteString('Hidden type encountered: ') ; *)
    (* WriteKey(Name) ; WriteLn ; *)
-   Sym := MakeHiddenType(tokno, name)
+   Assert (MakeHiddenType (tokno, name) # NulSym)
 END BuildHiddenType ;
 
 
diff --git a/gcc/m2/gm2-compiler/P2SymBuild.def b/gcc/m2/gm2-compiler/P2SymBuild.def
index 6caede99f1c..109120d82b2 100644
--- a/gcc/m2/gm2-compiler/P2SymBuild.def
+++ b/gcc/m2/gm2-compiler/P2SymBuild.def
@@ -1216,28 +1216,28 @@ PROCEDURE SeenString ;
    SeenBoolean - sets the operand type to a BOOLEAN.
 *)
 
-PROCEDURE SeenBoolean (sym: CARDINAL) ;
+PROCEDURE SeenBoolean ;
 
 
 (*
    SeenZType - sets the operand type to a Z type.
 *)
 
-PROCEDURE SeenZType (sym: CARDINAL) ;
+PROCEDURE SeenZType ;
 
 
 (*
    SeenRType - sets the operand type to a R type.
 *)
 
-PROCEDURE SeenRType (sym: CARDINAL) ;
+PROCEDURE SeenRType ;
 
 
 (*
    SeenCType - sets the operand type to a C type.
 *)
 
-PROCEDURE SeenCType (sym: CARDINAL) ;
+PROCEDURE SeenCType ;
 
 
 (*
diff --git a/gcc/m2/gm2-compiler/P2SymBuild.mod b/gcc/m2/gm2-compiler/P2SymBuild.mod
index 9695a47ee0c..dab4cb2124a 100644
--- a/gcc/m2/gm2-compiler/P2SymBuild.mod
+++ b/gcc/m2/gm2-compiler/P2SymBuild.mod
@@ -70,7 +70,7 @@ FROM SymbolTable IMPORT NulSym,
                         GetExported,
                         PutExported, PutExportQualified, PutExportUnQualified,
                         PutExportUnImplemented,
-                        PutFieldVarient, GCFieldVarient, PutVarientTag,
+                        PutFieldVarient, PutVarientTag,
                         IsFieldVarient, IsVarient,
                         CheckForEnumerationInCurrentModule,
                         CheckForExportedImplementation,
@@ -734,19 +734,18 @@ END BuildConst ;
 
 PROCEDURE StartBuildEnumeration ;
 VAR
-   name: Name ;
    n,
    Type: CARDINAL ;
    tok : CARDINAL ;
 BEGIN
-   PopT(n) ;       (* n := # *)
-   name := OperandT(n+1) ;
-   tok := OperandTok(n+1) ;
-   GetEnumerationFromFifoQueue(Type) ;
-   CheckForExportedImplementation(Type) ;   (* May be an exported hidden type *)
-   PopN(n) ;
-   PushTtok(Type, tok) ;
-   Annotate("%1s(%1d)|%3d||enumerated type")
+   PopT (n) ;       (* n := # *)
+   (* name is in OperandT(n+1) but we dont need it here.  *)
+   tok := OperandTok (n+1) ;
+   GetEnumerationFromFifoQueue (Type) ;
+   CheckForExportedImplementation (Type) ;   (* May be an exported hidden type *)
+   PopN (n) ;
+   PushTtok (Type, tok) ;
+   Annotate ("%1s(%1d)|%3d||enumerated type")
 END StartBuildEnumeration ;
 
 
@@ -1795,8 +1794,8 @@ BEGIN
    THEN
       FirstModule := InitString('implementation module') ;
       SecondModule := InitString('definition module')
-   ELSIF CompilingProgramModule()
-   THEN
+   ELSE
+      Assert (CompilingProgramModule ()) ;
       FirstModule := InitString('program module') ;
       SecondModule := InitString('definition module')
    END ;
@@ -1983,24 +1982,6 @@ BEGIN
 END BuildOptFunction ;
 
 
-(*
-   BuildNulParam - Builds a nul parameter on the stack.
-                   The Stack:
-
-                   Entry             Exit
-
-                                                    <- Ptr
-                   Empty             +------------+
-                                     | 0          |
-                                     |------------|
-*)
-
-PROCEDURE BuildNulParam ;
-BEGIN
-   PushT(0)
-END BuildNulParam ;
-
-
 (*
    BuildPointerType - builds a pointer type.
                       The Stack:
@@ -2205,7 +2186,7 @@ END HandleRecordFieldPragmas ;
 
 PROCEDURE BuildFieldRecord ;
 VAR
-   name, n1   : Name ;
+   n1         : Name ;
    tok,
    fsym,
    Field,
@@ -2219,7 +2200,7 @@ VAR
 BEGIN
    PopT(NoOfPragmas) ;
    Type := OperandT(NoOfPragmas*2+1) ;
-   name := OperandF(NoOfPragmas*2+1) ;
+   (* name := OperandF(NoOfPragmas*2+1) ;  *)
    NoOfFields := OperandT(NoOfPragmas*2+2) ;
    Record := OperandT(NoOfPragmas*2+NoOfFields+3) ;
    IF IsRecord(Record)
@@ -2243,6 +2224,7 @@ BEGIN
          WriteKey(n1) ; WriteLn
       END
    END ;
+   Field := NulSym ;
    i := 1 ;
    WHILE i<=NoOfFields DO
       IF Debugging
@@ -2265,7 +2247,7 @@ BEGIN
       END ;
       (* adjust the location of declaration to the one on the stack (rather than GetTokenNo).  *)
       tok := OperandTok(NoOfPragmas*2+NoOfFields+3-i) ;
-      IF tok # UnknownTokenNo
+      IF (tok # UnknownTokenNo) AND (Field # NulSym)
       THEN
          PutDeclared (tok, Field)
       END ;
@@ -2308,7 +2290,6 @@ VAR
    Field,
    Type,
    Varient,
-   Parent,
    VarField,
    Record    : CARDINAL ;
 BEGIN
@@ -2317,7 +2298,6 @@ BEGIN
    Record := OperandT(1) ;
    IF IsRecord(Record)
    THEN
-      Parent := Record ;
       Varient := NulSym ;
       InternalError ('not expecting a record symbol')
    ELSIF IsVarient(Record)
@@ -2341,7 +2321,6 @@ BEGIN
       END
    ELSE
       (* Record maybe FieldVarient *)
-      Parent := GetParent(Record) ;
       Assert(IsFieldVarient(Record)) ;
       Varient := OperandT(1+2) ;
       Assert(IsVarient(Varient)) ;
@@ -2687,7 +2666,7 @@ BEGIN
    name := OperandT (1) ;
    tok := OperandTok (1) ;
    ProcTypeSym := MakeProcType (tok, name) ;
-   CheckForExportedImplementation (ProcTypeSym) ;   (* May be an exported hidden type *)   
+   CheckForExportedImplementation (ProcTypeSym) ;   (* May be an exported hidden type *)
    Annotate ("%1n||procedure type name") ;
    PushTtok (ProcTypeSym, tok) ;
    Annotate ("%1s(%1d)|%3d||proc type|token no")
@@ -2848,7 +2827,7 @@ END SeenCast ;
    SeenBoolean - sets the operand type to a BOOLEAN.
 *)
 
-PROCEDURE SeenBoolean (sym: CARDINAL) ;
+PROCEDURE SeenBoolean ;
 BEGIN
    type := boolean
 END SeenBoolean ;
@@ -2858,7 +2837,7 @@ END SeenBoolean ;
    SeenZType - sets the operand type to a Z type.
 *)
 
-PROCEDURE SeenZType (sym: CARDINAL) ;
+PROCEDURE SeenZType ;
 BEGIN
    type := ztype
 END SeenZType ;
@@ -2868,7 +2847,7 @@ END SeenZType ;
    SeenRType - sets the operand type to a R type.
 *)
 
-PROCEDURE SeenRType (sym: CARDINAL) ;
+PROCEDURE SeenRType ;
 BEGIN
    type := rtype
 END SeenRType ;
@@ -2878,7 +2857,7 @@ END SeenRType ;
    SeenCType - sets the operand type to a C type.
 *)
 
-PROCEDURE SeenCType (sym: CARDINAL) ;
+PROCEDURE SeenCType ;
 BEGIN
    type := ctype
 END SeenCType ;
diff --git a/gcc/m2/gm2-compiler/SymbolTable.def b/gcc/m2/gm2-compiler/SymbolTable.def
index 34f8b399743..a5187a6c38c 100644
--- a/gcc/m2/gm2-compiler/SymbolTable.def
+++ b/gcc/m2/gm2-compiler/SymbolTable.def
@@ -149,7 +149,6 @@ EXPORT QUALIFIED NulSym,
                  PutFieldRecord,
                  PutFieldVarient,
                  GetVarient,
-                 GCFieldVarient,
                  GetVarientTag,
 
                  PutVarientTag,
@@ -1351,14 +1350,6 @@ PROCEDURE PutFieldVarient (Field, Sym: CARDINAL) ;
 PROCEDURE GetVarient (Field: CARDINAL) : CARDINAL ;
 
 
-(*
-   GCFieldVarient - garbage collect the field varient symbol, Sym.
-                    This must only be called once per Sym.
-*)
-
-PROCEDURE GCFieldVarient (Sym: CARDINAL) ;
-
-
 (*
    IsRecordFieldAVarientTag - returns TRUE if record field, sym, is
                               a varient tag.
diff --git a/gcc/m2/gm2-compiler/SymbolTable.mod b/gcc/m2/gm2-compiler/SymbolTable.mod
index 833b164eb22..49dd55c1f84 100644
--- a/gcc/m2/gm2-compiler/SymbolTable.mod
+++ b/gcc/m2/gm2-compiler/SymbolTable.mod
@@ -5902,25 +5902,6 @@ BEGIN
 END GetVarient ;
 
 
-(*
-   GCFieldVarient - garbage collect the field varient symbol, Sym.
-                    This must only be called once per Sym.
-*)
-
-PROCEDURE GCFieldVarient (Sym: CARDINAL) ;
-BEGIN
-(*
-   IF IsItemInList(UsedFVarientList, Sym)
-   THEN
-      RemoveItemFromList(UsedFVarientList, Sym)
-   ELSE
-      RemoveItemFromList(UsedFVarientList, Sym) ;
-      PutItemIntoList(FreeFVarientList, Sym)
-   END
-*)
-END GCFieldVarient ;
-
-
 (*
    EnsureOrder - providing that both symbols, a, and, b, exist in
                  list, l.  Ensure that, b, is placed after a.
@@ -10282,7 +10263,6 @@ PROCEDURE FillInUnboundedFields (tok: CARDINAL;
                                  sym: CARDINAL; SimpleType: CARDINAL; ndim: CARDINAL) ;
 VAR
    pSym    : PtrToSymbol ;
-   field   : CARDINAL ;
    Contents: CARDINAL ;
    i       : CARDINAL ;
 BEGIN
@@ -10302,15 +10282,15 @@ BEGIN
             FillInPointerFields(Contents, NulName, GetScope(SimpleType), NulSym) ;
             PutPointer(Contents, SimpleType) ;
 	    (* create the contents field for the unbounded array.  *)
-            field := PutFieldRecord(RecordType,
-                                    MakeKey(UnboundedAddressName),
-                                    Contents, NulSym) ;
+            Assert (PutFieldRecord(RecordType,
+                                   MakeKey(UnboundedAddressName),
+                                   Contents, NulSym) # NulSym) ;
 	    (* create all the high fields for the unbounded array.  *)
             i := 1 ;
             WHILE i<=ndim DO
-               field := PutFieldRecord(RecordType,
-                                       makekey(string(Mark(Sprintf1(Mark(InitString(UnboundedHighName)), i)))),
-                                       Cardinal, NulSym) ;
+               Assert (PutFieldRecord(RecordType,
+                                      makekey(string(Mark(Sprintf1(Mark(InitString(UnboundedHighName)), i)))),
+                                      Cardinal, NulSym) # NulSym) ;
                INC(i)
             END ;
             Dimensions := ndim
diff --git a/gcc/m2/gm2-compiler/gm2lcc.mod b/gcc/m2/gm2-compiler/gm2lcc.mod
index b5c096c1971..5ef2f78aaa7 100644
--- a/gcc/m2/gm2-compiler/gm2lcc.mod
+++ b/gcc/m2/gm2-compiler/gm2lcc.mod
@@ -63,7 +63,6 @@ VAR
    ProfileFound  : BOOLEAN ;
    LibrariesFound: BOOLEAN ;
    TargetFound   : BOOLEAN ;
-   PathFound     : BOOLEAN ;
    ExecCommand   : BOOLEAN ;    (* should we execute the final cmd *)
    UseAr         : BOOLEAN ;    (* use 'ar' and create archive     *)
    UseRanlib     : BOOLEAN ;    (* use 'ranlib' to index archive   *)
@@ -333,8 +332,7 @@ END FindModulesInFileList ;
 PROCEDURE CollectObjects (Command: String) : String ;
 VAR
    i, h: CARDINAL ;
-   name,
-   s   : String ;
+   name: String ;
 BEGIN
    i := 1 ;
    h := HighIndice (CmdLineObjects) ;
@@ -438,6 +436,7 @@ END GenCC ;
                      after the string.
 *)
 
+(*
 PROCEDURE WriteModuleName (ModuleName: String) ;
 BEGIN
    ModuleName := WriteS (fo, ModuleName) ;
@@ -445,6 +444,7 @@ BEGIN
    THEN
    END
 END WriteModuleName ;
+*)
 
 
 (*
@@ -641,7 +641,7 @@ END AdditionalFOptions ;
 
 
 (*
-   DisplayHelp - 
+   DisplayHelp -
 *)
 
 PROCEDURE DisplayHelp ;
diff --git a/gcc/m2/gm2-compiler/gm2lorder.mod b/gcc/m2/gm2-compiler/gm2lorder.mod
index d1a7b1006ad..025a0f851cd 100644
--- a/gcc/m2/gm2-compiler/gm2lorder.mod
+++ b/gcc/m2/gm2-compiler/gm2lorder.mod
@@ -62,15 +62,13 @@ VAR
 PROCEDURE InitRuntimeModules (s: String) ;
 VAR
    a   : CARDINAL ;
-   i, l,
-   j   : INTEGER ;
+   i, j: INTEGER ;
 BEGIN
    IF runTime # NIL
    THEN
       runTime := KillIndex (runTime)
    END ;
    runTime := InitIndex (0) ;
-   l := Length (s) ;
    i := 0 ;
    a := 0 ;
    REPEAT
@@ -252,7 +250,7 @@ END ScanArgs ;
 
 
 (*
-   Init - 
+   Init -
 *)
 
 PROCEDURE Init ;
diff --git a/gcc/m2/gm2-gcc/m2expr.c b/gcc/m2/gm2-gcc/m2expr.c
index 6e114e22d83..90060736bcc 100644
--- a/gcc/m2/gm2-gcc/m2expr.c
+++ b/gcc/m2/gm2-gcc/m2expr.c
@@ -2212,8 +2212,8 @@ END divFloorOverflowNegNeg ;
 
 (*
    divFloorOverflowNegPos - precondition:  i, j are in range values.  i < 0, j >= 0.
-                           postcondition:  TRUE is returned if i divfloor will
-                                           result in an overflow/underflow.
+                            postcondition:  TRUE is returned if i divfloor will
+                                            result in an overflow/underflow.
 *)
 
 PROCEDURE divFloorOverflowNegPos (i, j: INTEGER) : BOOLEAN ;
@@ -2252,8 +2252,7 @@ END divFloorOverflowPosNeg ;
    RETURN i < j_mult_min.  */
 
 static tree
-divFloorOverflowPosPos (location_t location, tree i, tree j, tree lowest,
-		       tree min, tree max)
+divFloorOverflowPosPos (location_t location, tree i, tree j, tree min)
 {
   tree j_mult_min = m2expr_BuildMult (location, j, min, FALSE);
   tree i_lt_j_mult_min = m2expr_BuildLessThan (location, i, j_mult_min);
@@ -2316,7 +2315,7 @@ divFloorOverflowNegNeg (location_t location, tree i, tree j, tree lowest,
    return i_ge_j_mult_min_sub_j.  */
 
 static tree
-divFloorOverflowPosNeg (location_t location, tree i, tree j, tree lowest, tree min, tree max)
+divFloorOverflowPosNeg (location_t location, tree i, tree j, tree min)
 {
   tree j_mult_min = m2expr_BuildMult (location, j, min, FALSE);
   tree j_mult_min_sub_j = m2expr_BuildSub (location, j_mult_min, j, FALSE);
@@ -2337,7 +2336,7 @@ divFloorOverflowPosNeg (location_t location, tree i, tree j, tree lowest, tree m
    RETURN i < j_mult_min.  */
 
 static tree
-divFloorOverflowNegPos (location_t location, tree i, tree j, tree lowest, tree min, tree max)
+divFloorOverflowNegPos (location_t location, tree i, tree j, tree min)
 {
   tree j_mult_min = m2expr_BuildMult (location, j, min, FALSE);
   tree i_lt_j_mult_min = m2expr_BuildLessThan (location, i, j_mult_min);
@@ -2372,13 +2371,13 @@ divFloorOverflowCases (location_t location, tree i, tree j, tree lowest,
   tree i_lt_zero = m2expr_BuildLessThanZero (location, i, lowest, min, max);
   tree j_lt_zero = m2expr_BuildLessThanZero (location, j, lowest, min, max);
   tree a = m2expr_Build3TruthAndIf (location, i_gt_zero, j_gt_zero,
-				    divFloorOverflowPosPos (location, i, j, lowest, min, max));
+				    divFloorOverflowPosPos (location, i, j, min));
   tree b = m2expr_Build3TruthAndIf (location, i_lt_zero, j_lt_zero,
 				    divFloorOverflowNegNeg (location, i, j, lowest, min, max));
   tree c = m2expr_Build3TruthAndIf (location, i_gt_zero, j_lt_zero,
-				    divFloorOverflowPosNeg (location, i, j, lowest, min, max));
+				    divFloorOverflowPosNeg (location, i, j, min));
   tree d = m2expr_Build3TruthAndIf (location, i_lt_zero, j_gt_zero,
-				    divFloorOverflowNegPos (location, i, j, lowest, min, max));
+				    divFloorOverflowNegPos (location, i, j, min));
   return m2expr_Build4TruthOrIf (location, a, b, c, d);
 }
 
diff --git a/gm2tools/Makefile.in b/gm2tools/Makefile.in
index c9845041b2c..af4f623a5ca 100644
--- a/gm2tools/Makefile.in
+++ b/gm2tools/Makefile.in
@@ -647,8 +647,8 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-@NATIVE_FALSE@uninstall-local:
 @NATIVE_FALSE@install-exec-local:
+@NATIVE_FALSE@uninstall-local:
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
diff --git a/libgm2/libm2pim/Makefile.in b/libgm2/libm2pim/Makefile.in
index 42068db161d..80e9bd6bb5c 100644
--- a/libgm2/libm2pim/Makefile.in
+++ b/libgm2/libm2pim/Makefile.in
@@ -175,7 +175,7 @@ libm2pim_la_LIBADD =
 @BUILD_PIMLIB_TRUE@	libm2pim_la-termios.lo \
 @BUILD_PIMLIB_TRUE@	libm2pim_la-SysExceptions.lo \
 @BUILD_PIMLIB_TRUE@	libm2pim_la-target.lo libm2pim_la-wrapc.lo \
-@BUILD_PIMLIB_TRUE@	libm2pim_la-getopt.lo
+@BUILD_PIMLIB_TRUE@	libm2pim_la-cgetopt.lo
 libm2pim_la_OBJECTS = $(am_libm2pim_la_OBJECTS)
 @BUILD_PIMLIB_TRUE@am_libm2pim_la_rpath = -rpath $(toolexeclibdir)
 AM_V_P = $(am__v_P_@AM_V@)
@@ -196,9 +196,9 @@ am__maybe_remake_depfiles = depfiles
 am__depfiles_remade = ./$(DEPDIR)/libm2pim_la-Selective.Plo \
 	./$(DEPDIR)/libm2pim_la-SysExceptions.Plo \
 	./$(DEPDIR)/libm2pim_la-UnixArgs.Plo \
+	./$(DEPDIR)/libm2pim_la-cgetopt.Plo \
 	./$(DEPDIR)/libm2pim_la-dtoa.Plo \
 	./$(DEPDIR)/libm2pim_la-errno.Plo \
-	./$(DEPDIR)/libm2pim_la-getopt.Plo \
 	./$(DEPDIR)/libm2pim_la-ldtoa.Plo \
 	./$(DEPDIR)/libm2pim_la-sckt.Plo \
 	./$(DEPDIR)/libm2pim_la-target.Plo \
@@ -516,7 +516,7 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
 @BUILD_PIMLIB_TRUE@         termios.def  TimeString.def \
 @BUILD_PIMLIB_TRUE@         UnixArgs.def  wrapc.def  \
 @BUILD_PIMLIB_TRUE@         GetOpt.def OptLib.def \
-@BUILD_PIMLIB_TRUE@         getopt.def
+@BUILD_PIMLIB_TRUE@         cgetopt.def
 
 @BUILD_PIMLIB_TRUE@libm2pim_la_SOURCES = $(M2MODS) \
 @BUILD_PIMLIB_TRUE@                      UnixArgs.c \
@@ -524,7 +524,7 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
 @BUILD_PIMLIB_TRUE@                      errno.c dtoa.c \
 @BUILD_PIMLIB_TRUE@                      ldtoa.c termios.c \
 @BUILD_PIMLIB_TRUE@                      SysExceptions.c target.c \
-@BUILD_PIMLIB_TRUE@                      wrapc.c getopt.c
+@BUILD_PIMLIB_TRUE@                      wrapc.c cgetopt.c
 
 @BUILD_PIMLIB_TRUE@libm2pimdir = libm2pim
 @BUILD_PIMLIB_TRUE@libm2pim_la_DEPENDENCIES = SYSTEM.def
@@ -616,9 +616,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libm2pim_la-Selective.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libm2pim_la-SysExceptions.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libm2pim_la-UnixArgs.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libm2pim_la-cgetopt.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libm2pim_la-dtoa.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libm2pim_la-errno.Plo@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libm2pim_la-getopt.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libm2pim_la-ldtoa.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libm2pim_la-sckt.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libm2pim_la-target.Plo@am__quote@ # am--include-marker
@@ -722,12 +722,12 @@ libm2pim_la-wrapc.lo: wrapc.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libm2pim_la_CFLAGS) $(CFLAGS) -c -o libm2pim_la-wrapc.lo `test -f 'wrapc.c' || echo '$(srcdir)/'`wrapc.c
 
-libm2pim_la-getopt.lo: getopt.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libm2pim_la_CFLAGS) $(CFLAGS) -MT libm2pim_la-getopt.lo -MD -MP -MF $(DEPDIR)/libm2pim_la-getopt.Tpo -c -o libm2pim_la-getopt.lo `test -f 'getopt.c' || echo '$(srcdir)/'`getopt.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libm2pim_la-getopt.Tpo $(DEPDIR)/libm2pim_la-getopt.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='getopt.c' object='libm2pim_la-getopt.lo' libtool=yes @AMDEPBACKSLASH@
+libm2pim_la-cgetopt.lo: cgetopt.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libm2pim_la_CFLAGS) $(CFLAGS) -MT libm2pim_la-cgetopt.lo -MD -MP -MF $(DEPDIR)/libm2pim_la-cgetopt.Tpo -c -o libm2pim_la-cgetopt.lo `test -f 'cgetopt.c' || echo '$(srcdir)/'`cgetopt.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libm2pim_la-cgetopt.Tpo $(DEPDIR)/libm2pim_la-cgetopt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='cgetopt.c' object='libm2pim_la-cgetopt.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libm2pim_la_CFLAGS) $(CFLAGS) -c -o libm2pim_la-getopt.lo `test -f 'getopt.c' || echo '$(srcdir)/'`getopt.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libm2pim_la_CFLAGS) $(CFLAGS) -c -o libm2pim_la-cgetopt.lo `test -f 'cgetopt.c' || echo '$(srcdir)/'`cgetopt.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -837,9 +837,9 @@ distclean: distclean-am
 		-rm -f ./$(DEPDIR)/libm2pim_la-Selective.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-SysExceptions.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-UnixArgs.Plo
+	-rm -f ./$(DEPDIR)/libm2pim_la-cgetopt.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-dtoa.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-errno.Plo
-	-rm -f ./$(DEPDIR)/libm2pim_la-getopt.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-ldtoa.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-sckt.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-target.Plo
@@ -893,9 +893,9 @@ maintainer-clean: maintainer-clean-am
 		-rm -f ./$(DEPDIR)/libm2pim_la-Selective.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-SysExceptions.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-UnixArgs.Plo
+	-rm -f ./$(DEPDIR)/libm2pim_la-cgetopt.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-dtoa.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-errno.Plo
-	-rm -f ./$(DEPDIR)/libm2pim_la-getopt.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-ldtoa.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-sckt.Plo
 	-rm -f ./$(DEPDIR)/libm2pim_la-target.Plo


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gcc(refs/users/gaius/heads/devel/modula-2)] Remove unused variables,  parameters and procedures.
@ 2021-09-02 21:06 Gaius Mulley
  0 siblings, 0 replies; 3+ messages in thread
From: Gaius Mulley @ 2021-09-02 21:06 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:09dc728bdcfed26df3ac1682f6bd10b85b8d4568

commit 09dc728bdcfed26df3ac1682f6bd10b85b8d4568
Author: Gaius Mulley <gaius.mulley@southwales.ac.uk>
Date:   Thu Sep 2 22:03:25 2021 +0100

    Remove unused variables, parameters and procedures.
    
    2021-08-26  Gaius Mulley  <gaius.mulley@southwales.ac.uk>
    
    gcc/m2/ChangeLog
    
            * Make-lang.in (GM2-COMP-BOOT-DEFS): Remove cflex.def from list.
            (GM2-COMP-BOOT-MODS) Remove cflex.mod from list.
            * gm2-compiler/CLexBuf.mod (GetToken):
            Remove unused local variable a.  Use AdvanceToken
            instead of GetToken.  (AddTokToList) Remove unused variable b.
            (IsLastTokenEof) Remove unused variable t.
            * gm2-compiler/M2ALU.mod (Reduce): New procedure.
            (PrintValue) Use Reduce rather than PopIntegerTree.
            * gm2-compiler/M2Base.mod (Param): Remove unused
            global variable.  (IsVarientSame) Initialize ga at the procedure
            start.  Initialize gb at the procedure start.
            * gm2-compiler/M2CaseList.def (CaseBoundsResolved): tokenno
            parameter removed.
            * gm2-compiler/M2CaseList.mod (RangePair): Data type
            simplified.  (ConflictingPair) Data type simplified.  (CaseList)
            Data type simplified.  (SetRange) Data type simplified.
            (Overlaps) Reformatted.  (OverlappingCaseBound) Remove tokenno
            parameter.
            * gm2-compiler/M2GenGCC.mod (ConvertForComparison):
            Commented out.  (IsWord) Removed.  (HaveDifferentTypes) Removed.
            (FoldSetLogicalDifference) Commented out.  (DetermineFieldOf)
            Commented out.  (CodeMath) Commented out.
            * gm2-compiler/M2Range.mod  (FoldCaseBounds) remove
            first parameter to TypeCaseBounds.  (CodeCaseBounds) remove
            first parameter to TypeCaseBounds.
            * gm2-compiler/M2Search.mod (Assert): Imported.
            (GarbageDebugging) Declared.  (doDSdbEnter) Commented out.
            (doDSdbExit) Commented out.  (DSdbEnter) Commented out.
            (DSdbExit) Commented out.  (DSdbExit) Assert s # NIL.
            * gm2-compiler/M2Swig.mod (Doresolveorder): Remove
            parameter main.  (DetermineParameter) Remove annotate parameter.
            * gm2-compiler/ObjectFiles.mod (RegisterModuleObject):
            Remove local variable r as libc.close and libc.read procedure
            functions have an optional return result.  (IsRegistered)
            Remove local variable r as libc.close and libc.read procedure
            functions have an optional return result.
            * gm2-compiler/PCSymBuild.mod (WalkConst): Commented out.
            * gm2-compiler/Sets.mod (checkRange): Remove unused
            variable a.  Use Assert to check memset and memcpy results instead
            of assigning to a.  (DuplicateSet): Remove unused variable a.
            Use Assert to check return value of memset and memcpy instead of
            assigning to a.
            * gm2-compiler/SymbolTable.mod (MetaErrorT2): Imported.
            (AlreadyImportedError) Commented out.  (DisplayScopes) Commented
            out.  (GetConstFromTypeTree) Commented out.
            (PutConstIntoTypeTree) Commented out.  (SkipHiddenType) Commented
            out.  (GetLastMainScopeId) Commented out.
            (PutExportUnImplemented) Commented out.  (DumpSymbols) Commented out.
            * gm2-compiler/cflex.def (AdvanceToken): New procedure.
            * gm2-libs-min/libc.c (abort): Add infinite loop.
            (exit) Add infinite loop.
            * gm2-libs/libc.def (read): Define return value as
            optional.  (write) Define return value as optional.
            (close) Define return value as optional.
            (system) Define return value as optional.
            (readv) Define return value as optional.
            (writev) Define return value as optional.
            (chown) Define return value as optional.
            (strcpy) Define return value as optional.
            (strncpy) Define return value as optional.
            (unlink) Define return value as optional.
            (memcpy) Define return value as optional.
            (memset) Define return value as optional.
            (memmove) Define return value as optional.
            (setenv) Define return value as optional.
            (ftime) Define return value as optional.
            (shutdown) Define return value as optional.
            (rename) Define return value as optional.
            (atexit) Sefine return value as optional.
            (Makefile.in): Rebuilt.
    
    Signed-off-by: Gaius Mulley <gaius.mulley@southwales.ac.uk>

Diff:
---
 gcc/m2/Make-lang.in                 |  4 +--
 gcc/m2/gm2-compiler/CLexBuf.mod     |  8 ++---
 gcc/m2/gm2-compiler/M2ALU.mod       | 14 +++++++--
 gcc/m2/gm2-compiler/M2Base.mod      |  3 +-
 gcc/m2/gm2-compiler/M2CaseList.def  |  2 +-
 gcc/m2/gm2-compiler/M2CaseList.mod  | 55 ++++++++++++++++-------------------
 gcc/m2/gm2-compiler/M2GenGCC.mod    | 58 ++++---------------------------------
 gcc/m2/gm2-compiler/M2Range.mod     |  4 +--
 gcc/m2/gm2-compiler/M2Search.mod    | 32 ++++++++++++++------
 gcc/m2/gm2-compiler/M2Swig.mod      | 22 +++++++-------
 gcc/m2/gm2-compiler/ObjectFiles.mod | 10 +++----
 gcc/m2/gm2-compiler/PCSymBuild.mod  |  2 ++
 gcc/m2/gm2-compiler/Sets.mod        |  9 +++---
 gcc/m2/gm2-compiler/SymbolTable.mod | 26 +++++++++++++----
 gcc/m2/gm2-compiler/cflex.def       |  9 +++++-
 gcc/m2/gm2-libs-min/libc.c          |  4 +++
 gcc/m2/gm2-libs/libc.def            | 37 +++++++++++------------
 gm2tools/Makefile.in                |  2 +-
 18 files changed, 150 insertions(+), 151 deletions(-)

diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in
index 32029630a31..5f80c9b7f84 100644
--- a/gcc/m2/Make-lang.in
+++ b/gcc/m2/Make-lang.in
@@ -671,7 +671,7 @@ GM2-COMP-BOOT-DEFS = FifoQueue.def   M2Debug.def     M2Optimize.def  M2Defaults.
                      P0SyntaxCheck.def \
                      P1Build.def     P2Build.def     P3Build.def     PHBuild.def     \
                      M2Printf.def    bnflex.def      M2Quiet.def     M2Preprocess.def \
-                     cflex.def       CLexBuf.def     M2Bitset.def    M2Size.def      \
+                                                     M2Bitset.def    M2Size.def      \
                      M2Scope.def     M2Range.def     M2Swig.def      \
                      M2MetaError.def Sets.def        M2CaseList.def  PCSymBuild.def  \
                      PCBuild.def     M2Const.def     M2DebugStack.def \
@@ -693,7 +693,7 @@ GM2-COMP-BOOT-MODS = FifoQueue.mod   M2LexBuf.mod                             \
                      SymbolConversion.mod            M2Base.mod      \
                      M2ALU.mod       M2System.mod    Lists.mod       \
                      M2Printf.mod    bnflex.mod      M2Quiet.mod     M2Search.mod    \
-                     M2Preprocess.mod                CLexBuf.mod     M2Bitset.mod    \
+                     M2Preprocess.mod                                M2Bitset.mod    \
                      M2Size.mod      M2Scope.mod     M2Range.mod     \
                      M2Swig.mod      M2MetaError.mod Sets.mod        M2CaseList.mod  \
                      PCSymBuild.mod  M2Const.mod     M2DebugStack.mod \
diff --git a/gcc/m2/gm2-compiler/CLexBuf.mod b/gcc/m2/gm2-compiler/CLexBuf.mod
index 947ad7c3081..193fe9376dd 100644
--- a/gcc/m2/gm2-compiler/CLexBuf.mod
+++ b/gcc/m2/gm2-compiler/CLexBuf.mod
@@ -621,7 +621,6 @@ END DisplayToken ;
 
 PROCEDURE GetToken ;
 VAR
-   a: ADDRESS ;
    t: CARDINAL ;
    b: TokenBucket ;
    l: CARDINAL ;
@@ -648,7 +647,7 @@ BEGIN
    ELSE
       IF ListOfTokens.tail=NIL
       THEN
-         a := cflex.GetToken() ;
+         cflex.AdvanceToken ;
          IF ListOfTokens.tail=NIL
          THEN
             HALT
@@ -685,7 +684,7 @@ BEGIN
                END ;
                INC(CurrentTokNo)
             ELSE
-               a := cflex.GetToken() ;
+               cflex.AdvanceToken ;
                GetToken ;
                (* printf0('\n'); cflex.CError(string(InitString('current token'))) ; *)
             END
@@ -903,8 +902,6 @@ END GetFileName ;
 
 PROCEDURE AddTokToList (t: toktype; n: Name;
                         i: INTEGER; l: CARDINAL; f: SourceList) ;
-VAR
-   b: TokenBucket ;
 BEGIN
    IF ListOfTokens.head=NIL
    THEN
@@ -948,7 +945,6 @@ END AddTokToList ;
 
 PROCEDURE IsLastTokenEof () : BOOLEAN ;
 VAR
-   t: CARDINAL ;
    b: TokenBucket ;
 BEGIN
    IF ListOfTokens.tail#NIL
diff --git a/gcc/m2/gm2-compiler/M2ALU.mod b/gcc/m2/gm2-compiler/M2ALU.mod
index fc54c755254..8356d8bc995 100644
--- a/gcc/m2/gm2-compiler/M2ALU.mod
+++ b/gcc/m2/gm2-compiler/M2ALU.mod
@@ -963,6 +963,16 @@ BEGIN
 END Push ;
 
 
+(*
+   Reduce - remove the top element of the stack.
+*)
+
+PROCEDURE Reduce ;
+BEGIN
+   Dispose (Pop ())
+END Reduce ;
+
+
 (*
    PrintValue - debugging procedure to display the value on the top of the stack.
 *)
@@ -2971,10 +2981,10 @@ BEGIN
    WHILE i#NIL DO
       PushValue(i^.low) ;
       PrintValue ;
-      t := PopIntegerTree() ;
+      Reduce ;
       PushValue(i^.high) ;
       PrintValue ;
-      t := PopIntegerTree() ;
+      Reduce ;
       i := i^.next
    END
 END DisplayElements ;
diff --git a/gcc/m2/gm2-compiler/M2Base.mod b/gcc/m2/gm2-compiler/M2Base.mod
index 77b194fd63c..a1df4261039 100644
--- a/gcc/m2/gm2-compiler/M2Base.mod
+++ b/gcc/m2/gm2-compiler/M2Base.mod
@@ -140,7 +140,6 @@ TYPE
    CompatibilityArray = ARRAY MetaType, MetaType OF Compatible ;
 
 VAR
-   Param,
    Expr,
    Ass        : CompatibilityArray ;
    Ord,
@@ -1546,6 +1545,8 @@ VAR
    ga, gb: CARDINAL ;
 BEGIN
    i := 1 ;
+   ga := NulSym ;
+   gb := NulSym ;
    REPEAT
       fa := GetNth(a, i) ;
       fb := GetNth(b, i) ;
diff --git a/gcc/m2/gm2-compiler/M2CaseList.def b/gcc/m2/gm2-compiler/M2CaseList.def
index 8c5d275638a..b5f22b3b09c 100644
--- a/gcc/m2/gm2-compiler/M2CaseList.def
+++ b/gcc/m2/gm2-compiler/M2CaseList.def
@@ -91,7 +91,7 @@ PROCEDURE CaseBoundsResolved (tokenno: CARDINAL; c: CARDINAL) : BOOLEAN ;
                     compatible with the tagged type.
 *)
 
-PROCEDURE TypeCaseBounds (tokenno: CARDINAL; c: CARDINAL) : BOOLEAN ;
+PROCEDURE TypeCaseBounds (c: CARDINAL) : BOOLEAN ;
 
 
 (*
diff --git a/gcc/m2/gm2-compiler/M2CaseList.mod b/gcc/m2/gm2-compiler/M2CaseList.mod
index e8a9cda4510..c2392b7c55b 100644
--- a/gcc/m2/gm2-compiler/M2CaseList.mod
+++ b/gcc/m2/gm2-compiler/M2CaseList.mod
@@ -43,27 +43,23 @@ FROM SymbolTable IMPORT NulSym, IsConst, IsFieldVarient, IsRecord, IsRecordField
                         ForeachLocalSymDo, GetSymName, IsEnumeration, SkipType ;
 
 TYPE
-   RangePair = POINTER TO rangePair ;
-   rangePair = RECORD
+   RangePair = POINTER TO RECORD
                   low, high: CARDINAL ;
                   tokenno  : CARDINAL ;
                END ;
 
-   ConflictingPair = POINTER TO conflictingPair ;
-   conflictingPair = RECORD
+   ConflictingPair = POINTER TO RECORD
                         a, b: RangePair ;
                      END ;
 
-   CaseList = POINTER TO caseList ;
-   caseList = RECORD
+   CaseList = POINTER TO RECORD
                  maxRangeId  : CARDINAL ;
                  rangeArray  : Index ;
                  currentRange: RangePair ;
                  varientField: CARDINAL ;
               END ;
 
-   CaseDescriptor = POINTER TO caseDescriptor ;
-   caseDescriptor = RECORD
+   CaseDescriptor = POINTER TO RECORD
                        elseClause   : BOOLEAN ;
                        elseField    : CARDINAL ;
                        record       : CARDINAL ;
@@ -74,8 +70,7 @@ TYPE
                        next         : CaseDescriptor ;
                     END ;
 
-   SetRange = POINTER TO setRange ;
-   setRange = RECORD
+   SetRange = POINTER TO RECORD
                  low, high: Tree ;
                  next     : SetRange ;
               END ;
@@ -373,7 +368,7 @@ END SeenBefore ;
    Overlaps -
 *)
 
-PROCEDURE Overlaps (tokenno: CARDINAL; r, s: RangePair) : BOOLEAN ;
+PROCEDURE Overlaps (r, s: RangePair) : BOOLEAN ;
 VAR
    a, b, c, d: CARDINAL ;
 BEGIN
@@ -389,8 +384,8 @@ BEGIN
          THEN
             IF NOT SeenBefore(r, s)
             THEN
-               MetaErrorT2(r^.tokenno, 'case label {%1ad} is a duplicate with {%2ad}', a, c) ;
-               MetaErrorT2(s^.tokenno, 'case label {%1ad} is a duplicate with {%2ad}', c, a)
+               MetaErrorT2 (r^.tokenno, 'case label {%1ad} is a duplicate with {%2ad}', a, c) ;
+               MetaErrorT2 (s^.tokenno, 'case label {%1ad} is a duplicate with {%2ad}', c, a)
             END ;
             RETURN( TRUE )
          END
@@ -398,10 +393,10 @@ BEGIN
          d := s^.high ;
          IF OverlapsRange(Mod2Gcc(a), Mod2Gcc(b), Mod2Gcc(c), Mod2Gcc(d))
          THEN
-            IF NOT SeenBefore(r, s)
+            IF NOT SeenBefore (r, s)
             THEN
-               MetaErrorT3(r^.tokenno, 'case label {%1ad} is a duplicate in the range {%2ad}..{%3ad}', a, c, d) ;
-               MetaErrorT3(s^.tokenno, 'case range {%2ad}..{%3ad} is a duplicate of case label {%1ad}', c, d, a)
+               MetaErrorT3 (r^.tokenno, 'case label {%1ad} is a duplicate in the range {%2ad}..{%3ad}', a, c, d) ;
+               MetaErrorT3 (s^.tokenno, 'case range {%2ad}..{%3ad} is a duplicate of case label {%1ad}', c, d, a)
             END ;
             RETURN( TRUE )
          END
@@ -411,12 +406,12 @@ BEGIN
       IF s^.high=NulSym
       THEN
          d := c ;
-         IF OverlapsRange(Mod2Gcc(a), Mod2Gcc(b), Mod2Gcc(c), Mod2Gcc(d))
+         IF OverlapsRange (Mod2Gcc(a), Mod2Gcc(b), Mod2Gcc(c), Mod2Gcc(d))
          THEN
             IF NOT SeenBefore(r, s)
             THEN
-               MetaErrorT3(r^.tokenno, 'case range {%1ad}..{%2ad} is a duplicate with case label {%3ad}', a, b, c) ;
-               MetaErrorT3(s^.tokenno, 'case label {%1ad} is a duplicate with case range %{2ad}..{%3ad}', c, a, b)
+               MetaErrorT3 (r^.tokenno, 'case range {%1ad}..{%2ad} is a duplicate with case label {%3ad}', a, b, c) ;
+               MetaErrorT3 (s^.tokenno, 'case label {%1ad} is a duplicate with case range %{2ad}..{%3ad}', c, a, b)
             END ;
             RETURN( TRUE )
          END
@@ -426,8 +421,8 @@ BEGIN
          THEN
             IF NOT SeenBefore(r, s)
             THEN
-               MetaErrorT4(r^.tokenno, 'case range {%1ad}..{%2ad} overlaps case range {%3ad}..{%4ad}', a, b, c, d) ;
-               MetaErrorT4(s^.tokenno, 'case range {%1ad}..{%2ad} overlaps case range {%3ad}..{%4ad}', c, d, a, b)
+               MetaErrorT4 (r^.tokenno, 'case range {%1ad}..{%2ad} overlaps case range {%3ad}..{%4ad}', a, b, c, d) ;
+               MetaErrorT4 (s^.tokenno, 'case range {%1ad}..{%2ad} overlaps case range {%3ad}..{%4ad}', c, d, a, b)
             END ;
             RETURN( TRUE )
          END
@@ -442,7 +437,7 @@ END Overlaps ;
                           case statement, c.
 *)
 
-PROCEDURE OverlappingCaseBound (tokenno: CARDINAL; r: RangePair; c: CARDINAL) : BOOLEAN ;
+PROCEDURE OverlappingCaseBound (r: RangePair; c: CARDINAL) : BOOLEAN ;
 VAR
    p      : CaseDescriptor ;
    q      : CaseList ;
@@ -450,22 +445,22 @@ VAR
    i, j   : CARDINAL ;
    overlap: BOOLEAN ;
 BEGIN
-   p := GetIndice(caseArray, c) ;
+   p := GetIndice (caseArray, c) ;
    overlap := FALSE ;
    WITH p^ DO
       i := 1 ;
       WHILE i<=maxCaseId DO
-         q := GetIndice(caseListArray, i) ;
+         q := GetIndice (caseListArray, i) ;
          j := 1 ;
          WHILE j<=q^.maxRangeId DO
-            s := GetIndice(q^.rangeArray, j) ;
-            IF (s#r) AND Overlaps(tokenno, r, s)
+            s := GetIndice (q^.rangeArray, j) ;
+            IF (s#r) AND Overlaps (r, s)
             THEN
                overlap := TRUE
             END ;
-            INC(j)
+            INC (j)
          END ;
-         INC(i)
+         INC (i)
       END
    END ;
    RETURN( overlap )
@@ -495,7 +490,7 @@ BEGIN
          j := 1 ;
          WHILE j<=q^.maxRangeId DO
             r := GetIndice(q^.rangeArray, j) ;
-            IF OverlappingCaseBound(tokenno, r, c)
+            IF OverlappingCaseBound (r, c)
             THEN
                overlap := TRUE
             END ;
@@ -865,7 +860,7 @@ END inRange ;
                     compatible with the tagged type.
 *)
 
-PROCEDURE TypeCaseBounds (tokenno: CARDINAL; c: CARDINAL) : BOOLEAN ;
+PROCEDURE TypeCaseBounds (c: CARDINAL) : BOOLEAN ;
 VAR
    p         : CaseDescriptor ;
    q         : CaseList ;
diff --git a/gcc/m2/gm2-compiler/M2GenGCC.mod b/gcc/m2/gm2-compiler/M2GenGCC.mod
index 1d1666508cc..a6bc3fca785 100644
--- a/gcc/m2/gm2-compiler/M2GenGCC.mod
+++ b/gcc/m2/gm2-compiler/M2GenGCC.mod
@@ -2114,6 +2114,7 @@ END ConvertRHS ;
    ConvertForComparison - converts, sym, into a tree which is type compatible with, with.
 *)
 
+(*
 PROCEDURE ConvertForComparison (tokenno: CARDINAL; sym, with: CARDINAL) : Tree ;
 VAR
    symType,
@@ -2145,6 +2146,7 @@ BEGIN
       RETURN( t )
    END
 END ConvertForComparison ;
+*)
 
 
 (*
@@ -3053,29 +3055,6 @@ BEGIN
 END CodeInitAddress ;
 
 
-(*
-   IsWord - return TRUE if type is SYSTEM.WORD, or any of the sized WORD,
-            (SYSTEM.WORD32 etc).
-*)
-
-PROCEDURE IsWord (type: CARDINAL) : BOOLEAN ;
-BEGIN
-   type := SkipType(type) ;
-   RETURN( (type=Word) OR IsWordN(type) )
-END IsWord ;
-
-
-(*
-   HaveDifferentTypes - returns TRUE if consts or variables, l, r,
-                        have different types.
-*)
-
-PROCEDURE HaveDifferentTypes (l, r: CARDINAL) : BOOLEAN ;
-BEGIN
-   RETURN( SkipType(GetType(l))#SkipType(GetType(r)) )
-END HaveDifferentTypes ;
-
-
 (*
    checkRecordTypes - returns TRUE if op1 is not a record or if the record
                       is the same type as op2.
@@ -4699,11 +4678,13 @@ END CodeSetRotate ;
    FoldSetLogicalDifference - check whether we can fold a logical difference.
 *)
 
+(*
 PROCEDURE FoldSetLogicalDifference (tokenno: CARDINAL; p: WalkAction;
                                     quad: CARDINAL; op1, op2, op3: CARDINAL) ;
 BEGIN
    FoldBinarySet(tokenno, p, SetDifference, quad, op1, op2, op3)
 END FoldSetLogicalDifference ;
+*)
 
 
 (*
@@ -5417,6 +5398,7 @@ END CodeSize ;
                       We return the Varient symbol if sym was declared in the second method.
 *)
 
+(*
 PROCEDURE DetermineFieldOf (parent, sym: CARDINAL) : CARDINAL ;
 VAR
    varient: CARDINAL ;
@@ -5435,6 +5417,7 @@ BEGIN
       RETURN( sym )
    END
 END DetermineFieldOf ;
+*)
 
 
 (*
@@ -6410,35 +6393,6 @@ BEGIN
 END FoldCast ;
 
 
-(*
-   CodeMath - translates the MathOp into a GCC tree structure.
-              Op2 := Op1(Op3)
-
-              where:
-
-              Op1    function
-              Op2    return variable
-              Op3    parameter
-*)
-
-PROCEDURE CodeMath (quad: CARDINAL; op1, op2, op3: CARDINAL) ;
-VAR
-   t       : Tree ;
-   location: location_t ;
-BEGIN
-   DeclareConstant(CurrentQuadToken, op3) ;  (* checks to see whether it is a constant literal and declares it *)
-   DeclareConstructor(CurrentQuadToken, quad, op3) ;
-   location := TokenToLocation(CurrentQuadToken) ;
-
-   IF IsTrunc(op1)
-   THEN
-      t := BuildAssignmentTree(location, Mod2Gcc(op2), BuildTrunc(Mod2Gcc(op3)))
-   ELSE
-      InternalError ('unknown math operator')
-   END ;
-END CodeMath ;
-
-
 (*
    CreateLabelProcedureN - creates a label using procedure name and
                            an integer.
diff --git a/gcc/m2/gm2-compiler/M2Range.mod b/gcc/m2/gm2-compiler/M2Range.mod
index a9e3f9baaf6..786472c7956 100644
--- a/gcc/m2/gm2-compiler/M2Range.mod
+++ b/gcc/m2/gm2-compiler/M2Range.mod
@@ -1948,7 +1948,7 @@ BEGIN
    WITH p^ DO
       IF CaseBoundsResolved(tokenno, caseList)
       THEN
-         IF TypeCaseBounds(tokenno, caseList)
+         IF TypeCaseBounds (caseList)
          THEN
             (* nothing to do *)
          END ;
@@ -1982,7 +1982,7 @@ PROCEDURE CodeCaseBounds (tokenno: CARDINAL; caseList: CARDINAL; function, messa
 BEGIN
    IF CaseBoundsResolved(tokenno, caseList)
    THEN
-      IF TypeCaseBounds(tokenno, caseList)
+      IF TypeCaseBounds (caseList)
       THEN
          (* nothing to do *)
       END ;
diff --git a/gcc/m2/gm2-compiler/M2Search.mod b/gcc/m2/gm2-compiler/M2Search.mod
index 9450d0d389a..d6f62904d64 100644
--- a/gcc/m2/gm2-compiler/M2Search.mod
+++ b/gcc/m2/gm2-compiler/M2Search.mod
@@ -24,6 +24,7 @@ IMPLEMENTATION MODULE M2Search ;
 
 FROM SFIO IMPORT Exists ;
 FROM M2FileName IMPORT CalculateFileName ;
+FROM Assertion IMPORT Assert ;
 
 FROM DynamicStrings IMPORT InitString, InitStringChar,
                            KillString, ConCat, ConCatChar, Index, Slice,
@@ -34,13 +35,16 @@ FROM DynamicStrings IMPORT InitString, InitStringChar,
 
 
 CONST
-   Directory    =   '/' ;
+   Directory        =   '/' ;
+   GarbageDebugging = FALSE ;
 
 VAR
    Def, Mod,
    UserPath,
    InitialPath: String ;
 
+(* Internal garbage collection debugging routines.  *)
+
 (*
 #define InitString(X) InitStringDB(X, __FILE__, __LINE__)
 #define InitStringCharStar(X) InitStringCharStarDB(X, __FILE__, __LINE__)
@@ -52,27 +56,32 @@ VAR
 
 
 (*
-   doDSdbEnter -
-*)
+   doDSdbEnter - called when compiled with -fcpp to enable runtime garbage
+                 collection debugging.
 
 PROCEDURE doDSdbEnter ;
 BEGIN
    PushAllocation
 END doDSdbEnter ;
+*)
 
 
 (*
-   doDSdbExit -
-*)
+   doDSdbExit - called when compiled with -fcpp to enable runtime garbage
+                collection debugging.  The parameter string s is exempt from
+                garbage collection analysis.
 
 PROCEDURE doDSdbExit (s: String) ;
 BEGIN
-   s := PopAllocationExemption(TRUE, s)
+   (* Check to see whether no strings have been lost since the PushAllocation.  *)
+   Assert (PopAllocationExemption (TRUE, s) = s)
 END doDSdbExit ;
+*)
 
 
 (*
-   DSdbEnter -
+   DSdbEnter - dummy nop entry code which the preprocessor replaces by
+               doDSsbEnter when debugging garbage collection at runtime.
 *)
 
 PROCEDURE DSdbEnter ;
@@ -81,11 +90,16 @@ END DSdbEnter ;
 
 
 (*
-   DSdbExit -
+   DSdbExit - dummy nop exit code which the preprocessor replaces by
+              doDSsbExit when debugging garbage collection at runtime.
 *)
 
 PROCEDURE DSdbExit (s: String) ;
 BEGIN
+   IF GarbageDebugging
+   THEN
+      Assert (s # NIL)
+   END
 END DSdbExit ;
 
 
@@ -109,7 +123,7 @@ BEGIN
    ELSE
       UserPath := ConCat(ConCatChar(UserPath, ':'), path)
    END ;
-   DSdbExit(UserPath)
+   DSdbExit (UserPath)
 END PrependSearchPath ;
 
 
diff --git a/gcc/m2/gm2-compiler/M2Swig.mod b/gcc/m2/gm2-compiler/M2Swig.mod
index d07ac230598..3b8bac62410 100644
--- a/gcc/m2/gm2-compiler/M2Swig.mod
+++ b/gcc/m2/gm2-compiler/M2Swig.mod
@@ -369,7 +369,7 @@ END TryDependents ;
    DoResolveOrder - resolves the declaration order for swig (C).
 *)
 
-PROCEDURE DoResolveOrder (main: CARDINAL) ;
+PROCEDURE DoResolveOrder ;
 VAR
    sym,
    i, n    : CARDINAL ;
@@ -589,7 +589,7 @@ END DoBasicBlock ;
    DetermineParameter -
 *)
 
-PROCEDURE DetermineParameter (procedure, param: CARDINAL; annotate: BOOLEAN) ;
+PROCEDURE DetermineParameter (procedure, param: CARDINAL) ;
 VAR
    sb: ScopeBlock ;
    bb: BasicBlock ;
@@ -643,7 +643,7 @@ BEGIN
    THEN
       InternalError ('why did we get here')
    ELSE
-      DetermineParameter(procedure, sym, annotate) ;
+      DetermineParameter(procedure, sym) ;
       IF annotate
       THEN
          DoParamName(sym) ;
@@ -931,14 +931,14 @@ END DoWriteFile ;
 PROCEDURE DoGenerateSwig (sym: CARDINAL) ;
 BEGIN
    Init ;
-   name := ConCat(InitStringCharStar(KeyToCharStar(GetSymName(sym))),
-                  Mark(InitString('.i'))) ;
-   f := OpenToWrite(name) ;
-   ForeachExportedDo(sym, DoExported) ;
-   DoResolveOrder(sym) ;
-   DoWriteFile(sym) ;
-   Close(f) ;
-   name := KillString(name) ;
+   name := ConCat (InitStringCharStar (KeyToCharStar (GetSymName (sym))),
+                   Mark (InitString ('.i'))) ;
+   f := OpenToWrite (name) ;
+   ForeachExportedDo (sym, DoExported) ;
+   DoResolveOrder ;
+   DoWriteFile (sym) ;
+   Close (f) ;
+   name := KillString (name) ;
    Kill
 END DoGenerateSwig ;
 
diff --git a/gcc/m2/gm2-compiler/ObjectFiles.mod b/gcc/m2/gm2-compiler/ObjectFiles.mod
index 5f7f1212a61..b495bb56788 100644
--- a/gcc/m2/gm2-compiler/ObjectFiles.mod
+++ b/gcc/m2/gm2-compiler/ObjectFiles.mod
@@ -32,6 +32,7 @@ FROM wrapc IMPORT fileinode ;
 FROM libc IMPORT open, close ;
 FROM M2Printf IMPORT fprintf1, fprintf0 ;
 FROM FIO IMPORT StdErr ;
+FROM Assertion IMPORT Assert ;
 
 
 CONST
@@ -56,7 +57,6 @@ TYPE
 PROCEDURE RegisterModuleObject (fo: FileObjects; location: String) : BOOLEAN ;
 VAR
    p: FileObject ;
-   r,
    f: INTEGER ;
 BEGIN
    IF Debugging
@@ -70,7 +70,7 @@ BEGIN
       f := open (string (location), UNIXREADONLY, 0) ;
       IF fileinode (f, p^.inodeLow, p^.inodeHigh) = 0
       THEN
-         r := close (f) ;
+         close (f) ;
          IncludeIndiceIntoIndex (fo^.objects, p) ;
          IF Debugging
          THEN
@@ -83,7 +83,7 @@ BEGIN
             fprintf0 (StdErr, " fileinode failed\n")
          END
       END ;
-      r := close (f) ;
+      close (f) ;
       DISPOSE (p)
    END ;
    IF Debugging
@@ -132,12 +132,12 @@ END isRegistered ;
 
 PROCEDURE IsRegistered (fo: FileObjects; location: String) : BOOLEAN ;
 VAR
-   f, r  : INTEGER ;
+   f     : INTEGER ;
    result: BOOLEAN ;
 BEGIN
    f := open (string (location), UNIXREADONLY, 0) ;
    result := isRegistered (fo, f) ;
-   r := close (f) ;
+   close (f) ;
    RETURN result
 END IsRegistered ;
 
diff --git a/gcc/m2/gm2-compiler/PCSymBuild.mod b/gcc/m2/gm2-compiler/PCSymBuild.mod
index b0986f25e66..6f5d69d85cc 100644
--- a/gcc/m2/gm2-compiler/PCSymBuild.mod
+++ b/gcc/m2/gm2-compiler/PCSymBuild.mod
@@ -2069,10 +2069,12 @@ END WalkDes ;
                is changed.
 *)
 
+(*
 PROCEDURE WalkConst (sym: CARDINAL) : BOOLEAN ;
 BEGIN
    RETURN( WalkDes(findConstDes(sym)) )
 END WalkConst ;
+*)
 
 
 (*
diff --git a/gcc/m2/gm2-compiler/Sets.mod b/gcc/m2/gm2-compiler/Sets.mod
index c0284b0b7da..b356aaf9649 100644
--- a/gcc/m2/gm2-compiler/Sets.mod
+++ b/gcc/m2/gm2-compiler/Sets.mod
@@ -27,6 +27,7 @@ FROM M2Error IMPORT InternalError ;
 FROM Storage IMPORT ALLOCATE, REALLOCATE, DEALLOCATE ;
 FROM libc IMPORT memset, memcpy ;
 FROM M2Printf IMPORT printf0, printf1, printf2 ;
+FROM Assertion IMPORT Assert ;
 
 
 CONST
@@ -68,7 +69,6 @@ VAR
    bits,
    o, j: CARDINAL ;
    b   : PtrToBitset ;
-   a   : ADDRESS ;
    v   : PtrToByte ;
 BEGIN
    WITH s^ DO
@@ -112,8 +112,8 @@ BEGIN
             (* a := memset(b, 0, bytes) ; *)
             v := PtrToByte(b) ;
             INC(v, o) ;
-            a := memset(v, 0, bytes-o) ;
-            a := memcpy(b, pb, o) ;
+            Assert (memset (v, 0, bytes-o) = v) ;
+            Assert (memcpy (b, pb, o) = b) ;
             IF Debugging
             THEN
                printf1("deallocating old bitset size %d bytes\n", o)
@@ -194,13 +194,12 @@ END KillSet ;
 PROCEDURE DuplicateSet (s: Set) : Set ;
 VAR
    t: Set ;
-   a: ADDRESS ;
 BEGIN
    NEW(t) ;
    t^ := s^ ;
    WITH t^ DO
       ALLOCATE(pb, bytes) ;
-      a := memcpy(pb, s^.pb, bytes)
+      Assert (memcpy (pb, s^.pb, bytes) = pb)
    END ;
    RETURN( t )
 END DuplicateSet ;
diff --git a/gcc/m2/gm2-compiler/SymbolTable.mod b/gcc/m2/gm2-compiler/SymbolTable.mod
index 49dd55c1f84..f3e6b0b5bd6 100644
--- a/gcc/m2/gm2-compiler/SymbolTable.mod
+++ b/gcc/m2/gm2-compiler/SymbolTable.mod
@@ -47,7 +47,7 @@ FROM M2MetaError IMPORT MetaError1, MetaError2, MetaError3, MetaErrors1,
                         MetaErrorT0,
                         MetaErrorString1,
                         MetaErrorStringT0, MetaErrorStringT1,
-                        MetaErrorT1 ;
+                        MetaErrorT1, MetaErrorT2 ;
 
 FROM M2LexBuf IMPORT GetTokenNo ;
 FROM FormatStrings IMPORT Sprintf1 ;
@@ -1114,6 +1114,7 @@ END AlreadyDeclaredError ;
                           the places where the symbols was imported and also declared.
 *)
 
+(*
 PROCEDURE AlreadyImportedError (s: String; name: Name; OtherOccurance: CARDINAL) ;
 VAR
    e: Error ;
@@ -1129,6 +1130,7 @@ BEGIN
       ErrorFormat1(e, 'and symbol (%a) was also seen here', name)
    END
 END AlreadyImportedError ;
+*)
 
 
 (*
@@ -2579,6 +2581,7 @@ END CheckScopeForSym ;
                    a requested symbol.
 *)
 
+(*
 PROCEDURE DisplayScopes ;
 VAR
    pCall: PtrToCallFrame ;
@@ -2606,6 +2609,7 @@ BEGIN
    END ;
    printf0('\n')
 END DisplayScopes ;
+*)
 
 
 (*
@@ -3703,6 +3707,7 @@ END MakeHiddenType ;
                           NulSym is returned if the symbol is unknown.
 *)
 
+(*
 PROCEDURE GetConstFromTypeTree (constName: Name; constType: CARDINAL) : CARDINAL ;
 VAR
    pSym: PtrToSymbol ;
@@ -3726,6 +3731,7 @@ BEGIN
       END
    END
 END GetConstFromTypeTree ;
+*)
 
 
 (*
@@ -3733,6 +3739,7 @@ END GetConstFromTypeTree ;
                           constName is the name of constSym.
 *)
 
+(*
 PROCEDURE PutConstIntoTypeTree (constName: Name; constType: CARDINAL; constSym: CARDINAL) ;
 VAR
    pSym: PtrToSymbol ;
@@ -3756,7 +3763,7 @@ BEGIN
       END
    END
 END PutConstIntoTypeTree ;
-
+*)
 
 (*
    MakeConstLit - returns a constant literal of type, constType, with a constName,
@@ -6795,6 +6802,7 @@ END IsReallyPointer ;
                     it does skip over hidden type.
 *)
 
+(*
 PROCEDURE SkipHiddenType (Sym: CARDINAL) : CARDINAL ;
 BEGIN
    IF (Sym#NulSym) AND IsType(Sym) AND (GetType(Sym)#NulSym)
@@ -6804,6 +6812,7 @@ BEGIN
       RETURN( Sym )
    END
 END SkipHiddenType ;
+*)
 
 
 (*
@@ -6858,6 +6867,7 @@ END CheckHiddenTypeAreAddress ;
    GetLastMainScopeId - returns the, id, containing the last main scope.
 *)
 
+(*
 PROCEDURE GetLastMainScopeId (id: CARDINAL) : CARDINAL ;
 VAR
    pCall: PtrToCallFrame ;
@@ -6878,6 +6888,7 @@ BEGIN
    END ;
    RETURN( 0 )
 END GetLastMainScopeId ;
+*)
 
 
 (*
@@ -8102,8 +8113,7 @@ END UndeclaredSymbolError ;
 
 PROCEDURE PutExportUnImplemented (tokenno: CARDINAL; Sym: CARDINAL) ;
 VAR
-   pSym  : PtrToSymbol ;
-   n1, n2: Name ;
+   pSym: PtrToSymbol ;
 BEGIN
    pSym := GetPsym (CurrentModule) ;
    WITH pSym^ DO
@@ -8111,10 +8121,14 @@ BEGIN
 
       DefImpSym: IF GetSymKey (DefImp.NeedToBeImplemented, GetSymName (Sym)) = Sym
                  THEN
+                    MetaErrorT2 (tokenno, 'symbol {%1a} is already exported from module {%2a}',
+                                 Sym, CurrentModule)
+                    (*
                     n1 := GetSymName (Sym) ;
                     n2 := GetSymName (CurrentModule) ;
                     WriteFormat2 ('symbol (%a) already exported from module (%a)', n1, n2)
-                ELSE
+                    *)
+                 ELSE
                     PutSymKey (DefImp.NeedToBeImplemented, GetSymName(Sym), Sym)
                  END
 
@@ -13213,6 +13227,7 @@ END GetDefaultRecordFieldAlignment ;
    DumpSymbols - display all symbol numbers and their type.
 *)
 
+(*
 PROCEDURE DumpSymbols ;
 VAR
    pSym: PtrToSymbol ;
@@ -13265,6 +13280,7 @@ BEGIN
       INC (sym)
    END
 END DumpSymbols ;
+*)
 
 
 (*
diff --git a/gcc/m2/gm2-compiler/cflex.def b/gcc/m2/gm2-compiler/cflex.def
index ee34a3f279e..5bd1e4fa3fa 100644
--- a/gcc/m2/gm2-compiler/cflex.def
+++ b/gcc/m2/gm2-compiler/cflex.def
@@ -31,7 +31,7 @@ DEFINITION MODULE cflex ;
 *)
 
 FROM SYSTEM IMPORT ADDRESS ;
-EXPORT QUALIFIED GetToken, CError, OpenSource, CloseSource, GetLineNo,
+EXPORT QUALIFIED GetToken, AdvanceToken, CError, OpenSource, CloseSource, GetLineNo,
                  ParsingOn, SetSearchPath, AddTypeDef ;
 
 
@@ -57,6 +57,13 @@ PROCEDURE OpenSource (s: ADDRESS) : BOOLEAN ;
 PROCEDURE GetToken () : ADDRESS ;
 
 
+(*
+   AdvanceToken - move onto the next token.
+*)
+
+PROCEDURE AdvanceToken ;
+
+
 (*
    GetLineNo - returns the current line number.
 *)
diff --git a/gcc/m2/gm2-libs-min/libc.c b/gcc/m2/gm2-libs-min/libc.c
index e15970ab704..44e314120a7 100644
--- a/gcc/m2/gm2-libs-min/libc.c
+++ b/gcc/m2/gm2-libs-min/libc.c
@@ -29,8 +29,12 @@ void exit  (int);
 
 void abort (int i)
 {
+  while (1)
+    ;
 }
 
 void exit (int i)
 {
+  while (1)
+    ;
 }
diff --git a/gcc/m2/gm2-libs/libc.def b/gcc/m2/gm2-libs/libc.def
index 991431bd60e..c23381744f4 100644
--- a/gcc/m2/gm2-libs/libc.def
+++ b/gcc/m2/gm2-libs/libc.def
@@ -78,14 +78,14 @@ TYPE
      ssize_t write (int d, void *buf, size_t nbytes)
 *)
 
-PROCEDURE write (d: INTEGER; buf: ADDRESS; nbytes: CSIZE_T) : CSSIZE_T ;
+PROCEDURE write (d: INTEGER; buf: ADDRESS; nbytes: CSIZE_T) : [ CSSIZE_T ] ;
 
 
 (*
      ssize_t read (int d, void *buf, size_t nbytes)
 *)
 
-PROCEDURE read (d: INTEGER; buf: ADDRESS; nbytes: CSIZE_T) : CSSIZE_T ;
+PROCEDURE read (d: INTEGER; buf: ADDRESS; nbytes: CSIZE_T) : [ CSSIZE_T ] ;
 
 
 (*
@@ -93,7 +93,7 @@ PROCEDURE read (d: INTEGER; buf: ADDRESS; nbytes: CSIZE_T) : CSSIZE_T ;
      char *string;
 *)
 
-PROCEDURE system (a: ADDRESS) : INTEGER ;
+PROCEDURE system (a: ADDRESS) : [ INTEGER ] ;
 
 
 (*
@@ -196,7 +196,7 @@ PROCEDURE dup (d: INTEGER) : INTEGER ;
    close - closes the file descriptor, d.
 *)
 
-PROCEDURE close (d: INTEGER) : INTEGER ;
+PROCEDURE close (d: INTEGER) : [ INTEGER ] ;
 
 
 (*
@@ -233,14 +233,14 @@ PROCEDURE perror (string: ARRAY OF CHAR);
    readv - reads an io vector of bytes.
 *)
 
-PROCEDURE readv (fd: INTEGER; v: ADDRESS; n: INTEGER) : INTEGER ;
+PROCEDURE readv (fd: INTEGER; v: ADDRESS; n: INTEGER) : [ INTEGER ] ;
 
 
 (*
    writev - writes an io vector of bytes.
 *)
 
-PROCEDURE writev (fd: INTEGER; v: ADDRESS; n: INTEGER) : INTEGER ;
+PROCEDURE writev (fd: INTEGER; v: ADDRESS; n: INTEGER) : [ INTEGER ] ;
 
 
 (*
@@ -271,7 +271,7 @@ PROCEDURE getcwd (buf: ADDRESS; size: CSIZE_T) : ADDRESS ;
            and errno is set appropriately.
 *)
 
-PROCEDURE chown (filename: ADDRESS; uid, gid: INTEGER) : INTEGER ;
+PROCEDURE chown (filename: ADDRESS; uid, gid: INTEGER) : [ INTEGER ] ;
 
 
 (*
@@ -286,7 +286,7 @@ PROCEDURE strlen (a: ADDRESS) : CSIZE_T ;
             It returns dest.
 *)
 
-PROCEDURE strcpy (dest, src: ADDRESS) : ADDRESS ;
+PROCEDURE strcpy (dest, src: ADDRESS) : [ ADDRESS ] ;
 
 
 (*
@@ -294,14 +294,14 @@ PROCEDURE strcpy (dest, src: ADDRESS) : ADDRESS ;
              It returns dest.
 *)
 
-PROCEDURE strncpy (dest, src: ADDRESS; n: CARDINAL) : ADDRESS ;
+PROCEDURE strncpy (dest, src: ADDRESS; n: CARDINAL) : [ ADDRESS ] ;
 
 
 (*
    unlink - removes file and returns 0 if successful.
 *)
 
-PROCEDURE unlink (file: ADDRESS) : INTEGER ;
+PROCEDURE unlink (file: ADDRESS) : [ INTEGER ] ;
 
 
 (*
@@ -315,7 +315,7 @@ PROCEDURE unlink (file: ADDRESS) : INTEGER ;
    It returns dest.
 *)
 
-PROCEDURE memcpy (dest, src: ADDRESS; size: CSIZE_T) : ADDRESS ;
+PROCEDURE memcpy (dest, src: ADDRESS; size: CSIZE_T) : [ ADDRESS ] ;
 
 
 (*
@@ -326,9 +326,10 @@ PROCEDURE memcpy (dest, src: ADDRESS; size: CSIZE_T) : ADDRESS ;
    #include <string.h>
 
    void *memset(void *s, int c, size_t n);
+   It returns s.
 *)
 
-PROCEDURE memset (s: ADDRESS; c: INTEGER; size: CSIZE_T) : ADDRESS ;
+PROCEDURE memset (s: ADDRESS; c: INTEGER; size: CSIZE_T) : [ ADDRESS ] ;
 
 
 (*
@@ -342,7 +343,7 @@ PROCEDURE memset (s: ADDRESS; c: INTEGER; size: CSIZE_T) : ADDRESS ;
    It returns dest.
 *)
 
-PROCEDURE memmove (dest, src: ADDRESS; size: CSIZE_T) : ADDRESS ;
+PROCEDURE memmove (dest, src: ADDRESS; size: CSIZE_T) : [ ADDRESS ] ;
 
 
 (*
@@ -358,7 +359,7 @@ PROCEDURE printf (format: ARRAY OF CHAR; ...) : [ INTEGER ] ;
             is true.  It returns 0 on success and -1 for an error.
 *)
 
-PROCEDURE setenv (name: ADDRESS; value: ADDRESS; overwrite: INTEGER) : INTEGER ;
+PROCEDURE setenv (name: ADDRESS; value: ADDRESS; overwrite: INTEGER) : [ INTEGER ] ;
 
 
 (*
@@ -396,7 +397,7 @@ PROCEDURE localtime (VAR t: time_t) : ADDRESS ;
    ftime - return date and time.
 *)
 
-PROCEDURE ftime (VAR t: timeb) : INTEGER ;
+PROCEDURE ftime (VAR t: timeb) : [ INTEGER ] ;
 
 
 (*
@@ -406,14 +407,14 @@ PROCEDURE ftime (VAR t: timeb) : INTEGER ;
               if how = 2, then mo more reads or writes are allowed.
 *)
 
-PROCEDURE shutdown (s: INTEGER; how: INTEGER) : INTEGER ;
+PROCEDURE shutdown (s: INTEGER; how: INTEGER) : [ INTEGER ] ;
 
 
 (*
    rename - change the name or location of a file
 *)
 
-PROCEDURE rename (oldpath, newpath: ADDRESS) : INTEGER ;
+PROCEDURE rename (oldpath, newpath: ADDRESS) : [ INTEGER ] ;
 
 
 (*
@@ -441,7 +442,7 @@ PROCEDURE longjmp (env: ADDRESS; val: INTEGER) ;
    atexit - execute, proc, when the function exit is called.
 *)
 
-PROCEDURE atexit (proc: exitP) : INTEGER ;
+PROCEDURE atexit (proc: exitP) : [ INTEGER ] ;
 
 
 (*
diff --git a/gm2tools/Makefile.in b/gm2tools/Makefile.in
index af4f623a5ca..c9845041b2c 100644
--- a/gm2tools/Makefile.in
+++ b/gm2tools/Makefile.in
@@ -647,8 +647,8 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-@NATIVE_FALSE@install-exec-local:
 @NATIVE_FALSE@uninstall-local:
+@NATIVE_FALSE@install-exec-local:
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic mostlyclean-am


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gcc(refs/users/gaius/heads/devel/modula-2)] Remove unused variables,  parameters and procedures.
@ 2021-08-09 15:29 Gaius Mulley
  0 siblings, 0 replies; 3+ messages in thread
From: Gaius Mulley @ 2021-08-09 15:29 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:965bd756219133a0b101785b63754933b1825129

commit 965bd756219133a0b101785b63754933b1825129
Author: Gaius Mulley <gaius.mulley@southwales.ac.uk>
Date:   Mon Aug 9 16:26:38 2021 +0100

    Remove unused variables, parameters and procedures.
    
    2021-08-09  Gaius Mulley  <gaius.mulley@southwales.ac.uk>
    
    gcc/m2/
    
            * gm2-compiler/M2Quads.mod (doDSdbEnter): Commented out.
            (DSdbExit) Remove parameter.  (GetQF) Cast procedure
            function return result.  (CheckAddVariableReadLeftValue)
            Commented out.  (CheckRemoveVariableReadLeftValue) Commented
            out.  (CheckParameterOrdinals) Remove parameter.
            (CheckProcTypeAndProcedure) Remove tokpos and TypeList parameters.
            (BuildCapFunction) Use local optok instead of erroneous global
            vartok.  (BuildProcedureEnd) Use RemoveTop rather than PopWord.
            (CheckReadBeforeInitialized) Call CheckReadBeforeInitialized
            without Start parameter.  (CheckForLogicalOperator) Renamed
            CheckLogicalOperator.  (CheckGenericNulSet) Renamed
            doCheckGenericNulSet and commented out.  (CheckForGenericNulSet)
            Renamed CheckGenericNulSet and commented out.  (ds) Commented out.
            (DSdbExit) called without a parameter.  (BuildStmtNote)
            Reformatted and INTEGER i is cast to a CARDINAL prior to
            comparison.  (IncOperandD) Commented out.  (PushTrw) Commented
            out.  (StressStack) Commented out.
            * gm2-compiler/M2StackWord.def (RemoveTop): Definition added.
            * gm2-compiler/M2StackWord.mod (RemoveTop): Implementation added.
    
    Signed-off-by: Gaius Mulley <gaius.mulley@southwales.ac.uk>

Diff:
---
 gcc/m2/gm2-compiler/M2Quads.mod     | 114 +++++++++++++++++++++---------------
 gcc/m2/gm2-compiler/M2StackWord.def |   9 ++-
 gcc/m2/gm2-compiler/M2StackWord.mod |  10 ++++
 3 files changed, 85 insertions(+), 48 deletions(-)

diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod
index 8128575b2c3..188034a6143 100644
--- a/gcc/m2/gm2-compiler/M2Quads.mod
+++ b/gcc/m2/gm2-compiler/M2Quads.mod
@@ -204,7 +204,7 @@ FROM M2StackAddress IMPORT StackOfAddress, InitStackAddress, KillStackAddress,
                            IsEmptyAddress, NoOfItemsInStackAddress ;
 
 FROM M2StackWord IMPORT StackOfWord, InitStackWord, KillStackWord,
-                        PushWord, PopWord, PeepWord,
+                        PushWord, PopWord, PeepWord, RemoveTop,
                         IsEmptyWord, NoOfItemsInStackWord ;
 
 FROM Indexing IMPORT Index, InitIndex, GetIndice, PutIndice, InBounds ;
@@ -378,21 +378,23 @@ VAR
    doDSdbEnter -
 *)
 
+(*
 PROCEDURE doDSdbEnter ;
 BEGIN
    PushAllocation
 END doDSdbEnter ;
-
+*)
 
 (*
    doDSdbExit -
 *)
 
+(*
 PROCEDURE doDSdbExit (s: String) ;
 BEGIN
    s := PopAllocationExemption(TRUE, s)
 END doDSdbExit ;
-
+*)
 
 (*
    DSdbEnter -
@@ -407,7 +409,7 @@ END DSdbEnter ;
    DSdbExit -
 *)
 
-PROCEDURE DSdbExit (s: String) ;
+PROCEDURE DSdbExit ;
 BEGIN
 END DSdbExit ;
 
@@ -480,7 +482,7 @@ END SetOptionOptimizing ;
 
 PROCEDURE GetQF (q: CARDINAL) : QuadFrame ;
 BEGIN
-   RETURN( GetIndice(QuadArray, q) )
+   RETURN QuadFrame (GetIndice (QuadArray, q))
 END GetQF ;
 
 
@@ -1419,6 +1421,7 @@ END EraseQuad ;
    CheckAddVariableReadLeftValue -
 *)
 
+(*
 PROCEDURE CheckAddVariableReadLeftValue (sym: CARDINAL; q: CARDINAL) ;
 BEGIN
    IF IsVar(sym)
@@ -1426,12 +1429,14 @@ BEGIN
       PutReadQuad(sym, LeftValue, q)
    END
 END CheckAddVariableReadLeftValue ;
+*)
 
 
 (*
    CheckRemoveVariableReadLeftValue -
 *)
 
+(*
 PROCEDURE CheckRemoveVariableReadLeftValue (sym: CARDINAL; q: CARDINAL) ;
 BEGIN
    IF IsVar(sym)
@@ -1439,6 +1444,7 @@ BEGIN
       RemoveReadQuad(sym, LeftValue, q)
    END
 END CheckRemoveVariableReadLeftValue ;
+*)
 
 
 (*
@@ -2383,6 +2389,7 @@ END CheckForIndex ;
    GetCurrentFunctionName - returns the name for the current __FUNCTION__
 *)
 
+(*
 PROCEDURE GetCurrentFunctionName () : Name ;
 VAR
    s: String ;
@@ -2399,6 +2406,7 @@ BEGIN
       RETURN( GetSymName(CurrentProc) )
    END
 END GetCurrentFunctionName ;
+*)
 
 
 (*
@@ -4546,7 +4554,7 @@ BEGIN
       END
    END ;
    ManipulateParameters (IsForC) ;
-   CheckParameterOrdinals (IsForC) ;
+   CheckParameterOrdinals ;
    PopT(NoOfParameters) ;
    IF IsFunc
    THEN
@@ -4766,7 +4774,7 @@ END CheckProcedureParameters ;
    CheckProcTypeAndProcedure - checks the ProcType with the call.
 *)
 
-PROCEDURE CheckProcTypeAndProcedure (tokpos: CARDINAL; ProcType: CARDINAL; call: CARDINAL; TypeList: List) ;
+PROCEDURE CheckProcTypeAndProcedure (ProcType: CARDINAL; call: CARDINAL) ;
 VAR
    n1, n2          : Name ;
    i, n, t         : CARDINAL ;
@@ -5000,7 +5008,7 @@ BEGIN
          END
       END ;
       (* now to check each parameter of the proc type *)
-      CheckProcTypeAndProcedure(tokpos, FormalType, Actual, TypeList)
+      CheckProcTypeAndProcedure (FormalType, Actual)
    ELSIF (ActualType#FormalType) AND (ActualType#NulSym)
    THEN
       IF IsUnknown(FormalType)
@@ -5302,6 +5310,7 @@ END WarnParameter ;
                     If not then it generates an error message.
 *)
 
+(*
 PROCEDURE ExpectVariable (a: ARRAY OF CHAR; sym: CARDINAL) ;
 VAR
    e         : Error ;
@@ -5325,6 +5334,7 @@ BEGIN
       END
    END
 END ExpectVariable ;
+*)
 
 
 (*
@@ -5688,7 +5698,7 @@ END ManipulateParameters ;
    CheckParameterOrdinals - check that ordinal values are within type range.
 *)
 
-PROCEDURE CheckParameterOrdinals (IsForC: BOOLEAN) ;
+PROCEDURE CheckParameterOrdinals ;
 VAR
    Proc,
    ProcSym   : CARDINAL ;
@@ -5697,9 +5707,9 @@ VAR
    ParamTotal,
    pi, i     : CARDINAL ;
 BEGIN
-   PopT(ParamTotal) ;
-   PushT(ParamTotal) ;  (* Restore stack to origional state *)
-   ProcSym := OperandT(ParamTotal+1+1) ;
+   PopT (ParamTotal) ;
+   PushT (ParamTotal) ;  (* Restore stack to origional state *)
+   ProcSym := OperandT (ParamTotal+1+1) ;
    IF IsVar(ProcSym) AND IsProcType(GetDType(ProcSym))
    THEN
       (* Indirect procedure call.  *)
@@ -7919,9 +7929,9 @@ END BuildAbsFunction ;
 
 PROCEDURE BuildCapFunction ;
 VAR
+   optok,
    functok,
-   combinedtok,
-   optok      : CARDINAL ;
+   combinedtok: CARDINAL ;
    NoOfParam,
    ProcSym,
    Res, Var : CARDINAL ;
@@ -7937,7 +7947,7 @@ BEGIN
          ProcSym := OperandT (NoOfParam + 1) ;
          PopN (NoOfParam + 1) ;
 
-         combinedtok := MakeVirtualTok (functok, functok, vartok) ;
+         combinedtok := MakeVirtualTok (functok, functok, optok) ;
          Res := MakeTemporary (combinedtok, AreConstant (IsConst (Var))) ;
          PutVar (Res, Char) ;
          GenQuadO (combinedtok, StandardFunctionOp, Res, ProcSym, Var, FALSE) ;
@@ -8154,7 +8164,7 @@ BEGIN
          PushT (2) ;          (* Two parameters *)
          BuildConvertFunction
       ELSE
-         combinedtok := MakeVirtualTok (functok, vartok, vartok) ;
+         combinedtok := MakeVirtualTok (functok, optok, optok) ;
          MetaErrorT2 (combinedtok,
                       'the parameter to {%E1k%a} must be a variable or constant, seen {%2ad}',
                       Sym, Var) ;
@@ -9864,7 +9874,6 @@ END BuildProcedureBegin ;
 PROCEDURE BuildProcedureEnd ;
 VAR
    tok    : CARDINAL ;
-   t,
    ProcSym: CARDINAL ;
 BEGIN
    PopTtok(ProcSym, tok) ;
@@ -9886,8 +9895,8 @@ BEGIN
    GenQuad(ReturnOp, NulSym, NulSym, ProcSym) ;
    CheckFunctionReturn(ProcSym) ;
    CheckVariablesInBlock(ProcSym) ;
-   t := PopWord(CatchStack) ;
-   t := PopWord(TryStack) ;
+   RemoveTop (CatchStack) ;
+   RemoveTop (TryStack) ;
    PushT(ProcSym)
 END BuildProcedureEnd ;
 
@@ -9896,7 +9905,7 @@ END BuildProcedureEnd ;
    CheckReadBeforeInitialized -
 *)
 
-PROCEDURE CheckReadBeforeInitialized (ProcSym: CARDINAL; Start, End: CARDINAL) ;
+PROCEDURE CheckReadBeforeInitialized (ProcSym: CARDINAL; End: CARDINAL) ;
 VAR
    s1, s2              : String ;
    i, n, ParamNo,
@@ -9950,7 +9959,7 @@ BEGIN
       GetQuad(Start, Op, Op1, Op2, Op3) ;
       CASE Op OF
 
-      NewLocalVarOp:  CheckReadBeforeInitialized(Op3, Start, End)
+      NewLocalVarOp:  CheckReadBeforeInitialized(Op3, End)
 
       ELSE
       END
@@ -10422,12 +10431,11 @@ VAR
    Field,
    FieldType,
    RecordSym,
-   RecordType,
    Res        : CARDINAL ;
 BEGIN
    PopT(n) ;
    RecordSym := OperandT (n+1) ;
-   RecordType := SkipType (OperandF (n+1)) ;
+   (* RecordType could be found by:  SkipType (OperandF (n+1)).  *)
    RecordTok := OperandTok (n+1) ;
    rw := OperandMergeRW (n+1) ;
    Assert (IsLegal (rw)) ;
@@ -11579,17 +11587,17 @@ END RecordOp ;
 
 
 (*
-   CheckForLogicalOperator - returns a logical operator if the operands imply
-                             a logical operation should be performed.
+   CheckLogicalOperator - returns a logical operator if the operands imply
+                          a logical operation should be performed.
 *)
 
-PROCEDURE CheckForLogicalOperator (Tok: Name; e1, t1, e2, t2: CARDINAL) : Name ;
+PROCEDURE CheckLogicalOperator (Tok: Name; left, lefttype: CARDINAL) : Name ;
 BEGIN
    IF (Tok=PlusTok) OR (Tok=TimesTok) OR (Tok=DivideTok) OR (Tok=MinusTok)
    THEN
-      (* --fixme-- when we add complex arithmetic, we must check constructor is not a complex constant *)
-      IF ((t2#NulSym) AND IsSet(SkipType(t2))) OR
-         IsConstSet(e2) OR IsConstructor(e2)
+      (* --fixme-- when we add complex arithmetic, we must check constructor is not a complex constant.  *)
+      IF ((lefttype#NulSym) AND IsSet(SkipType(lefttype))) OR
+         IsConstSet(left) OR IsConstructor(left)
       THEN
          IF Tok=PlusTok
          THEN
@@ -11607,15 +11615,16 @@ BEGIN
       END
    END ;
    RETURN( Tok )
-END CheckForLogicalOperator ;
+END CheckLogicalOperator ;
 
 
 (*
-   CheckGenericNulSet - checks to see whether e1 is a generic nul set and if so it alters it
-                        to the nul set of t2.
+   doCheckGenericNulSet - checks to see whether e1 is a generic nul set and if so it alters it
+                          to the nul set of t2.
 *)
 
-PROCEDURE CheckGenericNulSet (e1: CARDINAL; VAR t1: CARDINAL; t2: CARDINAL) ;
+(*
+PROCEDURE doCheckGenericNulSet (e1: CARDINAL; VAR t1: CARDINAL; t2: CARDINAL) ;
 BEGIN
    IF IsConstSet (e1)
    THEN
@@ -11633,22 +11642,25 @@ BEGIN
       END ;
       PopValue (e1)
    END
-END CheckGenericNulSet ;
+END doCheckGenericNulSet ;
+*)
 
 
 (*
-   CheckForGenericNulSet - if e1 or e2 is the generic nul set then
-                           alter it to the nul set of the other operands type.
+   CheckGenericNulSet - if e1 or e2 is the generic nul set then
+                        alter it to the nul set of the other operands type.
 *)
 
-PROCEDURE CheckForGenericNulSet (e1, e2: CARDINAL; VAR t1, t2: CARDINAL) ;
+(*
+PROCEDURE CheckGenericNulSet (e1, e2: CARDINAL; VAR t1, t2: CARDINAL) ;
 BEGIN
    IF t1#t2
    THEN
-      CheckGenericNulSet(e1, t1, t2) ;
-      CheckGenericNulSet(e2, t2, t1)
+      doCheckGenericNulSet(e1, t1, t2) ;
+      doCheckGenericNulSet(e2, t2, t1)
    END
-END CheckForGenericNulSet ;
+END CheckGenericNulSet ;
+*)
 
 
 (*
@@ -11790,7 +11802,7 @@ BEGIN
       PopTFrwtok (left, lefttype, leftrw, leftpos) ;
       MarkAsRead (rightrw) ;
       MarkAsRead (leftrw) ;
-      NewOp := CheckForLogicalOperator (Operator, right, righttype, left, lefttype) ;
+      NewOp := CheckLogicalOperator (Operator, (* right, righttype, *) left, lefttype) ;
       IF NewOp = Operator
       THEN
          (*
@@ -12609,10 +12621,12 @@ END DisplayStack ;
    ds - tiny procedure name, useful for calling from the gdb shell.
 *)
 
+(*
 PROCEDURE ds ;
 BEGIN
    DisplayStack
 END ds ;
+*)
 
 
 (*
@@ -12623,7 +12637,7 @@ PROCEDURE DisplayQuad (QuadNo: CARDINAL) ;
 BEGIN
    DSdbEnter ;
    printf1('%4d  ', QuadNo) ; WriteQuad(QuadNo) ; printf0('\n') ;
-   DSdbExit(NIL)
+   DSdbExit
 END DisplayQuad ;
 
 
@@ -13417,14 +13431,14 @@ VAR
 BEGIN
    IF NextQuad#Head
    THEN
-      f := GetQF(NextQuad-1) ;
+      f := GetQF (NextQuad-1) ;
       i := offset ;
-      INC (i, GetTokenNo()) ;
+      INC (i, GetTokenNo ()) ;
       (* no need to have multiple notes at the same position.  *)
-      IF (f^.Operator#StatementNoteOp) OR (f^.Operand3#i)
+      IF (f^.Operator # StatementNoteOp) OR (f^.Operand3 # VAL (CARDINAL, i))
       THEN
-         filename := makekey(string(GetFileName())) ;
-         GenQuad(StatementNoteOp, WORD(filename), NulSym, i)
+         filename := makekey (string (GetFileName ())) ;
+         GenQuad (StatementNoteOp, WORD (filename), NulSym, i)
       END
    END
 END BuildStmtNote ;
@@ -13625,6 +13639,7 @@ END AddVarientEquality ;
                  at, pos, on the boolean stack.
 *)
 
+(*
 PROCEDURE IncOperandD (pos: CARDINAL) ;
 VAR
    f: BoolFrame ;
@@ -13632,6 +13647,7 @@ BEGIN
    f := PeepAddress(BoolStack, pos) ;
    INC(f^.Dimension)
 END IncOperandD ;
+*)
 
 
 (*
@@ -14001,6 +14017,7 @@ END PopTtok ;
    PushTrw - Push an item onto the True/False stack. The False value will be zero.
 *)
 
+(*
 PROCEDURE PushTrw (True: WORD; rw: WORD) ;
 VAR
    f: BoolFrame ;
@@ -14012,6 +14029,7 @@ BEGIN
    END ;
    PushAddress(BoolStack, f)
 END PushTrw ;
+*)
 
 
 (*
@@ -14290,6 +14308,7 @@ END MustCheckOverflow ;
    StressStack -
 *)
 
+(*
 PROCEDURE StressStack ;
 CONST
    Maxtries = 1000 ;
@@ -14328,6 +14347,7 @@ BEGIN
       END
    END
 END StressStack ;
+*)
 
 
 (*
diff --git a/gcc/m2/gm2-compiler/M2StackWord.def b/gcc/m2/gm2-compiler/M2StackWord.def
index 749aa29b07d..cca2fd288de 100644
--- a/gcc/m2/gm2-compiler/M2StackWord.def
+++ b/gcc/m2/gm2-compiler/M2StackWord.def
@@ -32,7 +32,7 @@ DEFINITION MODULE M2StackWord ;
 
 FROM SYSTEM IMPORT WORD ;
 EXPORT QUALIFIED StackOfWord, InitStackWord, KillStackWord, PushWord,
-                 ReduceWord, PopWord, PeepWord, IsEmptyWord,
+                 ReduceWord, RemoveTop, PopWord, PeepWord, IsEmptyWord,
                  NoOfItemsInStackWord ;
 
 TYPE
@@ -89,6 +89,13 @@ PROCEDURE PeepWord (s: StackOfWord; n: CARDINAL) : WORD ;
 PROCEDURE ReduceWord (s: StackOfWord; n: CARDINAL) ;
 
 
+(*
+   RemoveTop - throw away the top element of the stack.
+*)
+
+PROCEDURE RemoveTop (s: StackOfWord) ;
+
+
 (*
    NoOfItemsInStackWord - returns the number of items held in the stack, s.
 *)
diff --git a/gcc/m2/gm2-compiler/M2StackWord.mod b/gcc/m2/gm2-compiler/M2StackWord.mod
index 3f411b48a8b..0507380165f 100644
--- a/gcc/m2/gm2-compiler/M2StackWord.mod
+++ b/gcc/m2/gm2-compiler/M2StackWord.mod
@@ -263,6 +263,16 @@ BEGIN
 END ReduceWord ;
 
 
+(*
+   RemoveTop - throw away the top element of the stack.
+*)
+
+PROCEDURE RemoveTop (s: StackOfWord) ;
+BEGIN
+   ReduceWord (s, 1)
+END RemoveTop ;
+
+
 (*
    NoOfItemsInStackWord - returns the number of items held in the stack, s.
 *)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-02 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02  8:47 [gcc(refs/users/gaius/heads/devel/modula-2)] Remove unused variables, parameters and procedures Gaius Mulley
2021-08-09 15:29 Gaius Mulley
2021-09-02 21:06 Gaius Mulley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).