summarylogtreecommitdiffstats
path: root/0001-gm2-fix-bad-programming-practice-warning.patch
blob: 55c0fba830e488534bb0577788dee6746c0eb921 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
From da04c5f72dfae5cbbaae54f0b0a6d94fbcdfd1bb Mon Sep 17 00:00:00 2001
From: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Date: Sun, 8 Dec 2024 14:46:52 +0100
Subject: [PATCH] gm2: fix bad programming practice warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
To: gcc-patches@gcc.gnu.org
Cc: Gaius Mulley <gaiusmod2@gmail.com>, Gerald Pfeifer <gerald@pfeifer.com>

Fix identifier names to be too similar to Modula-2 keywords and causing
warnings coming from Modula-2's own libraries.

m2/m2log/InOut.mod:51:18: note: In implementation module ‘InOut’:
either the identifier has the same name as a keyword or alternatively a
keyword has the wrong case (‘IN’ and ‘in’)
   51 |    in, out: File ;

m2/m2log/InOut.mod:51:18: note: the symbol name ‘in’ is legal as an
identifier, however as such it might cause confusion and is considered
bad programming practice

gcc/gm2:
	* gm2-libs-log/InOut.mod: Fix bad identifier warning.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
---
 gcc/m2/gm2-libs-log/InOut.mod | 53 +++++++++++++++++------------------
 1 file changed, 26 insertions(+), 27 deletions(-)

diff --git a/gcc/m2/gm2-libs-log/InOut.mod b/gcc/m2/gm2-libs-log/InOut.mod
index 6e21fdcb6c1..12fdfe6b753 100644
--- a/gcc/m2/gm2-libs-log/InOut.mod
+++ b/gcc/m2/gm2-libs-log/InOut.mod
@@ -48,9 +48,8 @@ TYPE
    CharSet = SET OF CHAR ;
 
 VAR
-   in, out: File ;
-   inUsed,
-   outUsed: BOOLEAN ;
+   inFile, outFile: File ;
+   inUsed, outUsed: BOOLEAN ;
 
 
 (*
@@ -71,8 +70,8 @@ BEGIN
    END ;
    IF SFIO.Exists(s)
    THEN
-      in := SFIO.OpenToRead(s) ;
-      Done := FIO.IsNoError(in) ;
+      inFile := SFIO.OpenToRead(s) ;
+      Done := FIO.IsNoError(inFile) ;
       inUsed := TRUE
    ELSE
       Done := FALSE ;
@@ -91,8 +90,8 @@ PROCEDURE CloseInput ;
 BEGIN
    IF inUsed
    THEN
-      FIO.Close(in) ;
-      in := StdIn ;
+      FIO.Close(inFile) ;
+      inFile := StdIn ;
       inUsed := FALSE
    END
 END CloseInput ;
@@ -116,8 +115,8 @@ BEGIN
    END ;
    IF SFIO.Exists(s)
    THEN
-      out := SFIO.OpenToWrite(s) ;
-      Done := FIO.IsNoError(out) ;
+      outFile := SFIO.OpenToWrite(s) ;
+      Done := FIO.IsNoError(outFile) ;
       outUsed := TRUE
    ELSE
       Done := FALSE ;
@@ -136,8 +135,8 @@ PROCEDURE CloseOutput ;
 BEGIN
    IF outUsed
    THEN
-      FIO.Close(out) ;
-      out := StdOut ;
+      FIO.Close(outFile) ;
+      outFile := StdOut ;
       outUsed := FALSE
    END
 END CloseOutput ;
@@ -149,8 +148,8 @@ END CloseOutput ;
 
 PROCEDURE LocalRead (VAR ch: CHAR) ;
 BEGIN
-   ch := FIO.ReadChar(in) ;
-   Done := FIO.IsNoError(in) AND (NOT FIO.EOF(in))
+   ch := FIO.ReadChar(inFile) ;
+   Done := FIO.IsNoError(inFile) AND (NOT FIO.EOF(inFile))
 END LocalRead ;
 
 
@@ -246,8 +245,8 @@ END ReadString ;
 
 PROCEDURE WriteString (s: ARRAY OF CHAR) ;
 BEGIN
-   FIO.WriteString(out, s) ;
-   Done := FIO.IsNoError(out)
+   FIO.WriteString(outFile, s) ;
+   Done := FIO.IsNoError(outFile)
 END WriteString ;
 
 
@@ -257,13 +256,13 @@ END WriteString ;
 
 PROCEDURE LocalWrite (ch: CHAR) ;
 BEGIN
-   FIO.WriteChar(out, ch) ;
-   Done := FIO.IsNoError(out)
+   FIO.WriteChar(outFile, ch) ;
+   Done := FIO.IsNoError(outFile)
 (*
    IF outUsed
    THEN
-      FIO.WriteChar(out, ch) ;
-      Done := FIO.IsNoError(out)
+      FIO.WriteChar(outFile, ch) ;
+      Done := FIO.IsNoError(outFile)
    ELSE
       Done := (write(stdout, ADR(ch), 1) = 1)
    END
@@ -308,8 +307,8 @@ PROCEDURE WriteLn ;
 BEGIN
    IF outUsed
    THEN
-      FIO.WriteLine(out) ;
-      Done := FIO.IsNoError(out)
+      FIO.WriteLine(outFile) ;
+      Done := FIO.IsNoError(outFile)
    ELSE
       Terminal.WriteLn
    END
@@ -366,7 +365,7 @@ END ReadCard ;
 
 PROCEDURE WriteCard (x, n: CARDINAL) ;
 BEGIN
-   IF KillString(SFIO.WriteS(out, ctos(x, n, ' ')))=NIL
+   IF KillString(SFIO.WriteS(outFile, ctos(x, n, ' ')))=NIL
    THEN
    END
 END WriteCard ;
@@ -380,7 +379,7 @@ END WriteCard ;
 
 PROCEDURE WriteInt (x: INTEGER; n: CARDINAL) ;
 BEGIN
-   IF KillString(SFIO.WriteS(out, itos(x, n, ' ', FALSE)))=NIL
+   IF KillString(SFIO.WriteS(outFile, itos(x, n, ' ', FALSE)))=NIL
    THEN
    END
 END WriteInt ;
@@ -394,7 +393,7 @@ END WriteInt ;
 
 PROCEDURE WriteOct (x, n: CARDINAL) ;
 BEGIN
-   IF KillString(SFIO.WriteS(out, CardinalToString(x, n, ' ', 8, FALSE)))=NIL
+   IF KillString(SFIO.WriteS(outFile, CardinalToString(x, n, ' ', 8, FALSE)))=NIL
    THEN
    END
 END WriteOct ;
@@ -408,7 +407,7 @@ END WriteOct ;
 
 PROCEDURE WriteHex (x, n: CARDINAL) ;
 BEGIN
-   IF KillString(SFIO.WriteS(out, CardinalToString(x, n, ' ', 16, TRUE)))=NIL
+   IF KillString(SFIO.WriteS(outFile, CardinalToString(x, n, ' ', 16, TRUE)))=NIL
    THEN
    END
 END WriteHex ;
@@ -420,8 +419,8 @@ END WriteHex ;
 
 PROCEDURE Init ;
 BEGIN
-   in := FIO.StdIn ;
-   out := FIO.StdOut ;
+   inFile := FIO.StdIn ;
+   outFile := FIO.StdOut ;
    inUsed := FALSE ;
    outUsed := FALSE ;
    AssignRead(LocalRead, LocalStatus, Done) ;
-- 
2.47.1