public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Gaius Mulley <gaius@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/modula-2] Removed unused procedures, parameters and variables.
Date: Mon, 13 Sep 2021 13:47:17 +0000 (GMT)	[thread overview]
Message-ID: <20210913134717.D82FF385741F@sourceware.org> (raw)

https://gcc.gnu.org/g:58352eb7162635abddd642708a3734b945d560ed

commit 58352eb7162635abddd642708a3734b945d560ed
Author: Gaius Mulley <gaius.mulley@southwales.ac.uk>
Date:   Mon Sep 13 14:46:25 2021 +0100

    Removed unused procedures, parameters and variables.
    
    2021-09-13  Gaius Mulley  <gaius.mulley@southwales.ac.uk>
    
    gcc/m2/ChangeLog:
    
            * gm2-compiler/M2ALU.mod (WatchedValue):  Removed.  (stop)
            Removed.  (AddElement) Removed.  (SetNegate) Removed variable j.
            (DisplayElements) Removed variable t.  (WalkConstructorDependants)
            Removed variable r.  (PerformSetIn) Removed variable v.
            (BuildStructBitset) Removed GccField.  (ConstructRecordConstant)
            Removed variables GccFieldType, gccsym, high, low and location.
            (InitialiseArrayOfCharWithString) Removed parameter v.
            (CheckElementString) Remove parameter baseType.  Call
            InitialiseArrayOfCharWithString without the NIL third parameter.
            (InitialiseArrayWith) Remove parameter baseType.  Call
            CheckElementString without baseType.  (InitialiseArrayOfCharWith)
            Remove parameter baseType.  Remove variables Subrange, Subscript
            and seenString.
            * gm2-compiler/M2CaseList.def (OverlappingCaseBounds):  Remove
            unused tokenno parameter.  (MissingCaseBounds) use MetaErrorT2 and
            position the error at tokenno.  (WriteCase) Simplistic
            implmentation.
            * gm2-compiler/M2Range.mod:  (FoldCaseBounds) call
            OverlappingCaseBounds without tokenno parameter.
    
    Signed-off-by: Gaius Mulley <gaius.mulley@southwales.ac.uk>

Diff:
---
 gcc/m2/gm2-compiler/M2ALU.mod      | 47 ++++++++++++--------------------------
 gcc/m2/gm2-compiler/M2CaseList.def |  2 +-
 gcc/m2/gm2-compiler/M2CaseList.mod | 31 +++++++++++++------------
 gcc/m2/gm2-compiler/M2Range.mod    |  4 ++--
 4 files changed, 34 insertions(+), 50 deletions(-)

diff --git a/gcc/m2/gm2-compiler/M2ALU.mod b/gcc/m2/gm2-compiler/M2ALU.mod
index 8356d8bc995..efd37ae4d49 100644
--- a/gcc/m2/gm2-compiler/M2ALU.mod
+++ b/gcc/m2/gm2-compiler/M2ALU.mod
@@ -148,7 +148,7 @@ VAR
    EnumerationValue: Tree ;
    EnumerationField: CARDINAL ;
    CurrentTokenNo  : CARDINAL ;
-   WatchedValue    : PtrToValue ;
+   (* WatchedValue    : PtrToValue ;  *)
 
 
 (*
@@ -360,9 +360,6 @@ BEGIN
 END DisposeElements ;
 
 
-PROCEDURE stop ; BEGIN END stop ;
-
-
 (*
    CheckNotAlreadyOnFreeList - checks to see whether, v, is already on the free list
                                and aborts if this is the case.
@@ -2476,7 +2473,6 @@ END AddElements ;
 
 (*
    AddElement -
-*)
 
 PROCEDURE AddElement (v: listOfElements;
                       e, b: CARDINAL) : listOfElements ;
@@ -2497,6 +2493,7 @@ BEGIN
    v^.next := el ;
    RETURN( v )
 END AddElement ;
+*)
 
 
 (*
@@ -2684,7 +2681,7 @@ VAR
    max : CARDINAL ;
    r, s: listOfRange ;
    v   : PtrToValue ;
-   i, j: CARDINAL ;
+   i   : CARDINAL ;
 BEGIN
    v := Pop() ;
    Eval(tokenno, v) ;
@@ -2975,8 +2972,6 @@ END Swap ;
 *)
 
 PROCEDURE DisplayElements (i: listOfRange) ;
-VAR
-   t: Tree ;
 BEGIN
    WHILE i#NIL DO
       PushValue(i^.low) ;
@@ -3240,7 +3235,6 @@ END IsArrayValueDependants ;
 PROCEDURE IsConstructorDependants (sym: CARDINAL; q: IsAction) : BOOLEAN ;
 VAR
    v         : PtrToValue ;
-   r         : listOfRange ;
    typeResult,
    result    : BOOLEAN ;
 BEGIN
@@ -3279,7 +3273,6 @@ END IsConstructorDependants ;
 PROCEDURE WalkConstructorDependants (sym: CARDINAL; p: WalkAction) ;
 VAR
    v: PtrToValue ;
-   r: listOfRange ;
 BEGIN
    PushValue(sym) ;
    IF IsValueTypeNone()
@@ -3696,8 +3689,6 @@ END SubBit ;
 *)
 
 PROCEDURE PerformSetIn (tokenno: CARDINAL; op1: CARDINAL; h: listOfRange) : BOOLEAN ;
-VAR
-   v: listOfRange ;
 BEGIN
    WHILE h#NIL DO
       WITH h^ DO
@@ -4371,8 +4362,7 @@ END GetRange ;
 
 PROCEDURE BuildStructBitset (tokenno: CARDINAL; v: PtrToValue; low, high: Tree) : Tree ;
 VAR
-   BitsInSet,
-   GccField  : Tree ;
+   BitsInSet : Tree ;
    bpw       : CARDINAL ;
    cons      : Constructor ;
 BEGIN
@@ -4522,16 +4512,11 @@ END ConvertConstToType ;
 PROCEDURE ConstructRecordConstant (tokenno: CARDINAL; v: PtrToValue) : Tree ;
 VAR
    n1, n2      : Name ;
-   GccFieldType,
-   gccsym      : Tree ;
    i,
    Field,
-   baseType,
-   high, low   : CARDINAL ;
+   baseType    : CARDINAL ;
    cons        : Constructor ;
-   location    : location_t ;
 BEGIN
-   location := TokenToLocation(tokenno) ;
    WITH v^ DO
       IF constructorType=NulSym
       THEN
@@ -4716,7 +4701,7 @@ END GetArrayLimits ;
 *)
 
 PROCEDURE InitialiseArrayOfCharWithString (tokenno: CARDINAL; cons: Tree;
-                                           v: PtrToValue; el, baseType, arrayType: CARDINAL) : Tree ;
+                                           el, baseType, arrayType: CARDINAL) : Tree ;
 VAR
    isChar   : BOOLEAN ;
    s, letter: String ;
@@ -4799,15 +4784,14 @@ END InitialiseArrayOfCharWithString ;
    CheckElementString -
 *)
 
-PROCEDURE CheckElementString (el, arrayType, baseType: CARDINAL;
-                              tokenno: CARDINAL) : Tree ;
+PROCEDURE CheckElementString (el, arrayType: CARDINAL; tokenno: CARDINAL) : Tree ;
 VAR
    cons: Tree ;
 BEGIN
    IF IsString(arrayType) AND IsString(el)
    THEN
       cons := BuildStartArrayConstructor(Mod2Gcc(arrayType)) ;
-      RETURN( InitialiseArrayOfCharWithString(tokenno, cons, NIL, el, arrayType, SkipType(GetType(arrayType))) )
+      RETURN( InitialiseArrayOfCharWithString(tokenno, cons, el, arrayType, SkipType(GetType(arrayType))) )
    ELSE
       RETURN( Mod2Gcc(el) )
    END
@@ -4819,7 +4803,7 @@ END CheckElementString ;
 *)
 
 PROCEDURE InitialiseArrayWith (tokenno: CARDINAL; cons: Tree;
-                               v: PtrToValue; el, high, low, baseType, arrayType: CARDINAL) : Tree ;
+                               v: PtrToValue; el, high, low, arrayType: CARDINAL) : Tree ;
 VAR
    location: location_t ;
    i       : CARDINAL ;
@@ -4834,7 +4818,7 @@ BEGIN
       PushInt (i) ;
       Addn ;
       indice := PopIntegerTree () ;
-      value := CheckElementString (el, arrayType, baseType, tokenno) ;
+      value := CheckElementString (el, arrayType, tokenno) ;
       IF value = NIL
       THEN
          MetaErrorT0 (tokenno, '{%W}too few characters found when trying to construct a compound literal array') ;
@@ -4911,7 +4895,7 @@ END CheckGetCharFromString ;
 *)
 
 PROCEDURE InitialiseArrayOfCharWith (tokenno: CARDINAL; cons: Tree;
-                                     constDecl: PtrToValue; el, high, low, baseType, arrayType: CARDINAL) : Tree ;
+                                     constDecl: PtrToValue; el, high, low, arrayType: CARDINAL) : Tree ;
 VAR
    location  : location_t ;
    arrayIndex: CARDINAL ;      (* arrayIndex is the char position index of the final string.  *)
@@ -4954,11 +4938,8 @@ VAR
    n1, n2    : Name ;
    el1, el2,
    baseType,
-   Subrange,
-   Subscript,
    arrayType,
    high, low : CARDINAL ;
-   seenString: BOOLEAN ;
    cons      : Constructor ;
 BEGIN
    WITH v^ DO
@@ -4983,12 +4964,12 @@ BEGIN
          IF (el2 = NulSym) AND IsString(baseType) AND IsString(el1)
          THEN
             (* constructorType is ARRAY [low..high] OF CHAR and using a string to initialise it *)
-            RETURN InitialiseArrayOfCharWithString (tokenno, cons, v, el1, baseType, arrayType)
+            RETURN InitialiseArrayOfCharWithString (tokenno, cons, el1, baseType, arrayType)
          ELSIF SkipType(arrayType)=Char
          THEN
-            RETURN InitialiseArrayOfCharWith (tokenno, cons, v, el1, high, low, baseType, arrayType)
+            RETURN InitialiseArrayOfCharWith (tokenno, cons, v, el1, high, low, arrayType)
          ELSE
-            RETURN InitialiseArrayWith (tokenno, cons, v, el1, high, low, baseType, arrayType)
+            RETURN InitialiseArrayWith (tokenno, cons, v, el1, high, low, arrayType)
          END
       END
    END
diff --git a/gcc/m2/gm2-compiler/M2CaseList.def b/gcc/m2/gm2-compiler/M2CaseList.def
index b5f22b3b09c..88f27e0f60e 100644
--- a/gcc/m2/gm2-compiler/M2CaseList.def
+++ b/gcc/m2/gm2-compiler/M2CaseList.def
@@ -100,7 +100,7 @@ PROCEDURE TypeCaseBounds (c: CARDINAL) : BOOLEAN ;
                            messages for each overlapping bound found.
 *)
 
-PROCEDURE OverlappingCaseBounds (tokenno: CARDINAL; c: CARDINAL) : BOOLEAN ;
+PROCEDURE OverlappingCaseBounds (c: CARDINAL) : BOOLEAN ;
 
 
 (*
diff --git a/gcc/m2/gm2-compiler/M2CaseList.mod b/gcc/m2/gm2-compiler/M2CaseList.mod
index c2392b7c55b..480e5859ccd 100644
--- a/gcc/m2/gm2-compiler/M2CaseList.mod
+++ b/gcc/m2/gm2-compiler/M2CaseList.mod
@@ -38,6 +38,7 @@ FROM m2block IMPORT RememberType ;
 FROM m2type IMPORT GetMinFrom ;
 FROM Storage IMPORT ALLOCATE ;
 FROM M2Base IMPORT IsExpressionCompatible ;
+FROM M2Printf IMPORT printf1 ;
 
 FROM SymbolTable IMPORT NulSym, IsConst, IsFieldVarient, IsRecord, IsRecordField, GetVarientTag, GetType,
                         ForeachLocalSymDo, GetSymName, IsEnumeration, SkipType ;
@@ -473,7 +474,7 @@ END OverlappingCaseBound ;
                            messages for each overlapping bound found.
 *)
 
-PROCEDURE OverlappingCaseBounds (tokenno: CARDINAL; c: CARDINAL) : BOOLEAN ;
+PROCEDURE OverlappingCaseBounds (c: CARDINAL) : BOOLEAN ;
 VAR
    p      : CaseDescriptor ;
    q      : CaseList ;
@@ -768,8 +769,9 @@ BEGIN
          IF set#NIL
          THEN
             missing := TRUE ;
-            MetaError2('not all variant record alternatives in the CASE clause are specified, hint you either need to specify each value of {%2ad} or use an ELSE clause {%1U}',
-                        varient, type) ;
+            MetaErrorT2 (tokenno,
+                         'not all variant record alternatives in the CASE clause are specified, hint you either need to specify each value of {%2ad} or use an ELSE clause {%1U}',
+                         varient, type) ;
             ErrorRanges(p, type, set)
          END ;
          set := DisposeRanges(set)
@@ -779,19 +781,8 @@ BEGIN
 END MissingCaseBounds ;
 
 
-(*
-   WriteCase -
-*)
-
-PROCEDURE WriteCase (c: CARDINAL) ;
-BEGIN
-
-END WriteCase ;
-
-
 (*
    InRangeList - returns TRUE if the value, tag, is defined in the case list.
-*)
 
 PROCEDURE InRangeList (cl: CaseList; tag: CARDINAL) : BOOLEAN ;
 VAR
@@ -821,6 +812,18 @@ BEGIN
    END ;
    RETURN( FALSE )
 END InRangeList ;
+*)
+
+
+(*
+   WriteCase - dump out the case list (internal debugging).
+*)
+
+PROCEDURE WriteCase (c: CARDINAL) ;
+BEGIN
+   (* this debugging procedure should be finished.  *)
+   printf1 ("%d", c)
+END WriteCase ;
 
 
 (*
diff --git a/gcc/m2/gm2-compiler/M2Range.mod b/gcc/m2/gm2-compiler/M2Range.mod
index 786472c7956..344d0b7d9f1 100644
--- a/gcc/m2/gm2-compiler/M2Range.mod
+++ b/gcc/m2/gm2-compiler/M2Range.mod
@@ -1952,7 +1952,7 @@ BEGIN
          THEN
             (* nothing to do *)
          END ;
-         IF OverlappingCaseBounds(tokenno, caseList)
+         IF OverlappingCaseBounds(caseList)
          THEN
             PutQuad(q, ErrorOp, NulSym, NulSym, r) ;
             IF VariantValueChecking AND MissingCaseBounds(tokenno, caseList)
@@ -1986,7 +1986,7 @@ BEGIN
       THEN
          (* nothing to do *)
       END ;
-      IF OverlappingCaseBounds(tokenno, caseList)
+      IF OverlappingCaseBounds (caseList)
       THEN
          (* nothing to do *)
       END ;


                 reply	other threads:[~2021-09-13 13:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210913134717.D82FF385741F@sourceware.org \
    --to=gaius@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).