aboutsummaryrefslogtreecommitdiff
path: root/gcc/m2
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/m2')
-rw-r--r--gcc/m2/ChangeLog33
-rw-r--r--gcc/m2/gm2-compiler/M2GenGCC.mod5
-rw-r--r--gcc/m2/gm2-compiler/M2Range.mod2
-rw-r--r--gcc/m2/gm2-compiler/M2Students.def2
-rw-r--r--gcc/m2/gm2-compiler/M2Students.mod16
-rw-r--r--gcc/m2/gm2-compiler/P2SymBuild.mod2
-rw-r--r--gcc/m2/gm2-libs-iso/LowLong.mod10
-rw-r--r--gcc/m2/gm2-libs-iso/LowReal.mod14
-rw-r--r--gcc/m2/gm2-libs-iso/LowShort.mod14
-rw-r--r--gcc/m2/gm2-libs-iso/Processes.mod8
-rw-r--r--gcc/m2/gm2-libs-iso/RndFile.mod10
-rw-r--r--gcc/m2/gm2-libs/SCmdArgs.mod36
12 files changed, 91 insertions, 61 deletions
diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog
index 6babeb9..2406b95 100644
--- a/gcc/m2/ChangeLog
+++ b/gcc/m2/ChangeLog
@@ -1,3 +1,36 @@
+2025-07-29 Gaius Mulley <gaiusmod2@gmail.com>
+
+ * gm2-compiler/M2GenGCC.mod (FoldBecomes): Remove all
+ local variables.
+ (CodeIndrX): Remove length.
+ Remove newstr.
+ * gm2-compiler/M2Range.mod (FoldTypeIndrX): Remove desType.
+
+2025-07-29 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/121289
+ * gm2-compiler/M2Students.def (CheckVariableAgainstKeyword): New
+ parameter tok.
+ * gm2-compiler/M2Students.mod (CheckVariableAgainstKeyword): New
+ parameter tok.
+ Pass tok to PerformVariableKeywordCheck.
+ (PerformVariableKeywordCheck): New parameter tok.
+ Pass tok to MetaErrorStringT0.
+ * gm2-compiler/P2SymBuild.mod (BuildVariable): Pass tok to
+ CheckVariableAgainstKeyword.
+ * gm2-libs-iso/LowLong.mod (except): Replace with ...
+ (exceptSrc): ... this.
+ * gm2-libs-iso/LowReal.mod (except): Replace with ...
+ (exceptSrc): ... this.
+ * gm2-libs-iso/LowShort.mod (except): Replace with ...
+ (exceptSrc): ... this.
+ * gm2-libs-iso/Processes.mod (Wait): Replace from with fromCor.
+ * gm2-libs-iso/RndFile.mod (EndPos): Replace end with endP.
+ * gm2-libs/SCmdArgs.mod (GetArg): Replace start with startPos.
+ Replace end with endPos.
+ (NArg): Replace start with startPos.
+ Replace end with endPos.
+
2025-07-25 David Malcolm <dmalcolm@redhat.com>
* gm2-gcc/m2linemap.cc: Update usage of "diagnostic_info" to
diff --git a/gcc/m2/gm2-compiler/M2GenGCC.mod b/gcc/m2/gm2-compiler/M2GenGCC.mod
index 4a9ced3..2507c53 100644
--- a/gcc/m2/gm2-compiler/M2GenGCC.mod
+++ b/gcc/m2/gm2-compiler/M2GenGCC.mod
@@ -2903,9 +2903,6 @@ END CheckStop ;
*)
PROCEDURE FoldBecomes (p: WalkAction; bb: BasicBlock; quad: CARDINAL) ;
-VAR
- op : QuadOperator ;
- des, op2, expr: CARDINAL ;
BEGIN
IF DeclaredOperandsBecomes (p, quad)
THEN
@@ -8154,8 +8151,6 @@ VAR
rightpos,
typepos,
indrxpos : CARDINAL ;
- length,
- newstr : tree ;
location : location_t ;
BEGIN
GetQuadOtok (quad, indrxpos, op, left, type, right,
diff --git a/gcc/m2/gm2-compiler/M2Range.mod b/gcc/m2/gm2-compiler/M2Range.mod
index dcac2ba..f1516d3 100644
--- a/gcc/m2/gm2-compiler/M2Range.mod
+++ b/gcc/m2/gm2-compiler/M2Range.mod
@@ -1869,14 +1869,12 @@ END FoldTypeAssign ;
PROCEDURE FoldTypeIndrX (q: CARDINAL; tokenNo: CARDINAL; des, expr: CARDINAL; r: CARDINAL) ;
VAR
- desType,
exprType: CARDINAL ;
BEGIN
(* Need to skip over a variable or temporary in des and expr so
long as expr is not a procedure. In the case of des = *expr,
both expr and des will be variables due to the property of
indirection. *)
- desType := GetType (des) ;
IF IsProcedure (expr)
THEN
(* Must not GetType for a procedure as it gives the return type. *)
diff --git a/gcc/m2/gm2-compiler/M2Students.def b/gcc/m2/gm2-compiler/M2Students.def
index 7d67a0a..a3ecdcd 100644
--- a/gcc/m2/gm2-compiler/M2Students.def
+++ b/gcc/m2/gm2-compiler/M2Students.def
@@ -39,7 +39,7 @@ EXPORT QUALIFIED StudentVariableCheck, CheckVariableAgainstKeyword ;
as a keyword except for its case.
*)
-PROCEDURE CheckVariableAgainstKeyword (name: Name) ;
+PROCEDURE CheckVariableAgainstKeyword (tok: CARDINAL; name: Name) ;
(*
diff --git a/gcc/m2/gm2-compiler/M2Students.mod b/gcc/m2/gm2-compiler/M2Students.mod
index e539eb0..3df160a 100644
--- a/gcc/m2/gm2-compiler/M2Students.mod
+++ b/gcc/m2/gm2-compiler/M2Students.mod
@@ -25,7 +25,7 @@ IMPLEMENTATION MODULE M2Students ;
FROM SymbolTable IMPORT FinalSymbol, IsVar, IsProcedure, IsModule,
GetMainModule, IsType, NulSym, IsRecord, GetSymName, GetNth, GetNthProcedure, GetDeclaredMod, NoOfParam ;
FROM NameKey IMPORT GetKey, WriteKey, MakeKey, IsSameExcludingCase, NulName, makekey, KeyToCharStar ;
-FROM M2MetaError IMPORT MetaErrorString0, MetaError2 ;
+FROM M2MetaError IMPORT MetaErrorStringT0, MetaError2 ;
FROM Lists IMPORT List, InitList, IsItemInList, IncludeItemIntoList ;
FROM M2Reserved IMPORT IsReserved, toktype ;
FROM DynamicStrings IMPORT String, InitString, KillString, ToUpper, InitStringCharStar, string, Mark, ToUpper, Dup ;
@@ -78,11 +78,11 @@ END IsNotADuplicateName ;
as a keyword except for its case.
*)
-PROCEDURE CheckVariableAgainstKeyword (name: Name) ;
+PROCEDURE CheckVariableAgainstKeyword (tok: CARDINAL; name: Name) ;
BEGIN
IF StyleChecking
THEN
- PerformVariableKeywordCheck (name)
+ PerformVariableKeywordCheck (tok, name)
END
END CheckVariableAgainstKeyword ;
@@ -91,7 +91,7 @@ END CheckVariableAgainstKeyword ;
PerformVariableKeywordCheck - performs the check and constructs the metaerror notes if appropriate.
*)
-PROCEDURE PerformVariableKeywordCheck (name: Name) ;
+PROCEDURE PerformVariableKeywordCheck (tok: CARDINAL; name: Name) ;
VAR
upper : Name ;
token : toktype ;
@@ -105,9 +105,11 @@ BEGIN
THEN
IF IsNotADuplicateName (name)
THEN
- MetaErrorString0 (Sprintf2 (Mark (InitString ('either the identifier has the same name as a keyword or alternatively a keyword has the wrong case ({%%K%s} and {!%%O:{%%K%s}})')),
- upperS, orig)) ;
- MetaErrorString0 (Sprintf1 (Mark (InitString ('the symbol name {!%%O:{%%K%s}} is legal as an identifier, however as such it might cause confusion and is considered bad programming practice')), orig))
+ MetaErrorStringT0 (tok,
+ Sprintf2 (Mark (InitString ('either the identifier has the same name as a keyword or alternatively a keyword has the wrong case ({%%K%s} and {!%%O:{%%K%s}})')),
+ upperS, orig)) ;
+ MetaErrorStringT0 (tok,
+ Sprintf1 (Mark (InitString ('the symbol name {!%%O:{%%K%s}} is legal as an identifier, however as such it might cause confusion and is considered bad programming practice')), orig))
END
END ;
upperS := KillString (upperS) ;
diff --git a/gcc/m2/gm2-compiler/P2SymBuild.mod b/gcc/m2/gm2-compiler/P2SymBuild.mod
index 3bb3e47..54e624f 100644
--- a/gcc/m2/gm2-compiler/P2SymBuild.mod
+++ b/gcc/m2/gm2-compiler/P2SymBuild.mod
@@ -1179,8 +1179,8 @@ BEGIN
PopT (n) ;
i := 1 ;
WHILE i <= n DO
- CheckVariableAgainstKeyword (OperandT (n+1-i)) ;
tok := OperandTok (n+1-i) ;
+ CheckVariableAgainstKeyword (tok, OperandT (n+1-i)) ;
Var := MakeVar (tok, OperandT (n+1-i)) ;
AtAddress := OperandA (n+1-i) ;
IF AtAddress # NulSym
diff --git a/gcc/m2/gm2-libs-iso/LowLong.mod b/gcc/m2/gm2-libs-iso/LowLong.mod
index 92c7d91..f611923 100644
--- a/gcc/m2/gm2-libs-iso/LowLong.mod
+++ b/gcc/m2/gm2-libs-iso/LowLong.mod
@@ -182,7 +182,7 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
+ RAISE(exceptSrc, ORD(badparam),
'LowLong.trunc: cannot truncate to a negative number of digits') ;
RETURN x
ELSE
@@ -230,7 +230,7 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
+ RAISE(exceptSrc, ORD(badparam),
'LowLong.round: cannot round to a negative number of digits') ;
RETURN x
ELSE
@@ -287,12 +287,12 @@ END currentMode ;
PROCEDURE IsLowException () : BOOLEAN ;
BEGIN
- RETURN( IsExceptionalExecution() AND IsCurrentSource(except) )
+ RETURN( IsExceptionalExecution () AND IsCurrentSource (exceptSrc) )
END IsLowException ;
VAR
- except: ExceptionSource ;
+ exceptSrc: ExceptionSource ;
BEGIN
- AllocateSource(except)
+ AllocateSource (exceptSrc)
END LowLong.
diff --git a/gcc/m2/gm2-libs-iso/LowReal.mod b/gcc/m2/gm2-libs-iso/LowReal.mod
index 580f36b..6d9ea00 100644
--- a/gcc/m2/gm2-libs-iso/LowReal.mod
+++ b/gcc/m2/gm2-libs-iso/LowReal.mod
@@ -183,8 +183,8 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
- 'LowReal.trunc: cannot truncate to a negative number of digits') ;
+ RAISE (exceptSrc, ORD(badparam),
+ 'LowReal.trunc: cannot truncate to a negative number of digits') ;
RETURN x
ELSE
r := dtoa(x, maxsignificant, 100, point, sign) ;
@@ -231,8 +231,8 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
- 'LowReal.round: cannot round to a negative number of digits') ;
+ RAISE (exceptSrc, ORD(badparam),
+ 'LowReal.round: cannot round to a negative number of digits') ;
RETURN x
ELSE
s := RealToFloatString(x, n) ;
@@ -288,12 +288,12 @@ END currentMode ;
PROCEDURE IsLowException () : BOOLEAN ;
BEGIN
- RETURN( IsExceptionalExecution() AND IsCurrentSource(except) )
+ RETURN( IsExceptionalExecution () AND IsCurrentSource (exceptSrc) )
END IsLowException ;
VAR
- except: ExceptionSource ;
+ exceptSrc: ExceptionSource ;
BEGIN
- AllocateSource(except)
+ AllocateSource (exceptSrc)
END LowReal.
diff --git a/gcc/m2/gm2-libs-iso/LowShort.mod b/gcc/m2/gm2-libs-iso/LowShort.mod
index 8531a88..62e4887 100644
--- a/gcc/m2/gm2-libs-iso/LowShort.mod
+++ b/gcc/m2/gm2-libs-iso/LowShort.mod
@@ -183,8 +183,8 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
- 'LowLong.trunc: cannot truncate to a negative number of digits') ;
+ RAISE (exceptSrc, ORD(badparam),
+ 'LowLong.trunc: cannot truncate to a negative number of digits') ;
RETURN x
ELSE
r := dtoa(x, maxsignificant, 100, point, sign) ;
@@ -231,8 +231,8 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
- 'LowLong.round: cannot round to a negative number of digits') ;
+ RAISE (exceptSrc, ORD(badparam),
+ 'LowLong.round: cannot round to a negative number of digits') ;
RETURN x
ELSE
s := RealToFloatString(x, n) ;
@@ -288,12 +288,12 @@ END currentMode ;
PROCEDURE IsLowException () : BOOLEAN ;
BEGIN
- RETURN( IsExceptionalExecution() AND IsCurrentSource(except) )
+ RETURN( IsExceptionalExecution () AND IsCurrentSource (exceptSrc) )
END IsLowException ;
VAR
- except: ExceptionSource ;
+ exceptSrc: ExceptionSource ;
BEGIN
- AllocateSource(except)
+ AllocateSource (exceptSrc)
END LowShort.
diff --git a/gcc/m2/gm2-libs-iso/Processes.mod b/gcc/m2/gm2-libs-iso/Processes.mod
index 8ef22c0..b0c1b69 100644
--- a/gcc/m2/gm2-libs-iso/Processes.mod
+++ b/gcc/m2/gm2-libs-iso/Processes.mod
@@ -441,7 +441,7 @@ PROCEDURE Wait ;
VAR
calling,
best : ProcessId ;
- from : COROUTINE ;
+ fromCor: COROUTINE ;
BEGIN
IF debugging
THEN
@@ -451,17 +451,17 @@ BEGIN
OnWaitingQueue (calling) ;
best := chooseProcess () ;
currentId := best ;
- from := calling^.context ;
+ fromCor := calling^.context ;
IF debugging
THEN
displayProcesses ("Wait about to perform IOTRANSFER")
END ;
- IOTRANSFER (from, currentId^.context) ;
+ IOTRANSFER (fromCor, currentId^.context) ;
IF debugging
THEN
displayProcesses ("Wait after IOTRANSFER")
END ;
- currentId^.context := from ;
+ currentId^.context := fromCor ;
currentId := calling ;
OnReadyQueue (calling) ;
IF debugging
diff --git a/gcc/m2/gm2-libs-iso/RndFile.mod b/gcc/m2/gm2-libs-iso/RndFile.mod
index e04cd8f..0a2264a 100644
--- a/gcc/m2/gm2-libs-iso/RndFile.mod
+++ b/gcc/m2/gm2-libs-iso/RndFile.mod
@@ -398,9 +398,9 @@ PROCEDURE EndPos (cid: ChanId): FilePos;
position after which there have been no writes.
*)
VAR
- d : DeviceTablePtr ;
- end,
- old: FilePos ;
+ d : DeviceTablePtr ;
+ endP,
+ old : FilePos ;
BEGIN
IF IsRndFile(cid)
THEN
@@ -410,9 +410,9 @@ BEGIN
old := CurrentPos(cid) ;
FIO.SetPositionFromEnd(RTio.GetFile(cid), 0) ;
checkErrno(dev, d) ;
- end := CurrentPos(cid) ;
+ endP := CurrentPos(cid) ;
FIO.SetPositionFromBeginning(RTio.GetFile(cid), old) ;
- RETURN( end )
+ RETURN( endP )
END
ELSE
RAISEdevException(cid, did, IOChan.wrongDevice,
diff --git a/gcc/m2/gm2-libs/SCmdArgs.mod b/gcc/m2/gm2-libs/SCmdArgs.mod
index ed76fc4..8443d5f 100644
--- a/gcc/m2/gm2-libs/SCmdArgs.mod
+++ b/gcc/m2/gm2-libs/SCmdArgs.mod
@@ -132,26 +132,27 @@ PROCEDURE GetArg (CmdLine: String;
VAR
i : CARDINAL ;
sn,
- start, end: INTEGER ;
+ startPos,
+ endPos : INTEGER ;
ch : CHAR ;
BEGIN
i := 0 ;
- start := 0 ;
- end := Length(CmdLine) ;
+ startPos := 0 ;
+ endPos := Length(CmdLine) ;
WHILE i<n DO
- start := skipWhite(CmdLine, start, end) ;
- sn := skipNextArg(CmdLine, start, end) ;
- IF sn<end
+ startPos := skipWhite(CmdLine, startPos, endPos) ;
+ sn := skipNextArg(CmdLine, startPos, endPos) ;
+ IF sn<endPos
THEN
- start := sn ;
+ startPos := sn ;
INC(i)
ELSE
RETURN( FALSE )
END
END ;
- start := skipWhite(CmdLine, start, end) ;
- sn := skipNextArg(CmdLine, start, end) ;
- Argi := Slice(CmdLine, start, sn) ;
+ startPos := skipWhite(CmdLine, startPos, endPos) ;
+ sn := skipNextArg(CmdLine, startPos, endPos) ;
+ Argi := Slice(CmdLine, startPos, sn) ;
RETURN( TRUE )
END GetArg ;
@@ -165,17 +166,18 @@ PROCEDURE Narg (CmdLine: String) : CARDINAL ;
VAR
n : CARDINAL ;
s,
- start, end: INTEGER ;
+ startPos,
+ endPos : INTEGER ;
BEGIN
n := 0 ;
- start := 0 ;
- end := Length(CmdLine) ;
+ startPos := 0 ;
+ endPos := Length(CmdLine) ;
LOOP
- start := skipWhite(CmdLine, start, end) ;
- s := skipNextArg(CmdLine, start, end) ;
- IF s<end
+ startPos := skipWhite(CmdLine, startPos, endPos) ;
+ s := skipNextArg(CmdLine, startPos, endPos) ;
+ IF s<endPos
THEN
- start := s ;
+ startPos := s ;
INC(n)
ELSE
RETURN( n )