diff mbox series

gm2: fix bad programming practice identifier warning

Message ID Zp9ivF5P5PkG3ejP@monster.localdomain
State New
Headers show
Series gm2: fix bad programming practice identifier warning | expand

Commit Message

Wilken Gottwalt July 23, 2024, 7:58 a.m. UTC
Fix using keywords as identifiers to prevent warnings coming from
Modula-2's own libraries.

m2pim/DynamicStrings.mod:1358:27: note: In procedure ‘Slice’: the symbol
name ‘end’ is legal as an identifier, however as such it might cause
confusion and is considered bad programming practice
 1358 |    start, end, o: INTEGER ;

m2pim/DynamicStrings.mod:1358:27: note: either the identifier has the
same name as a keyword or alternatively a keyword has the wrong case
(‘END’ and ‘end’)

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

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
---
 gcc/m2/gm2-libs/DynamicStrings.mod | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Gaius Mulley July 23, 2024, 5:47 p.m. UTC | #1
Wilken Gottwalt <wilken.gottwalt@posteo.net> writes:

> Fix using keywords as identifiers to prevent warnings coming from
> Modula-2's own libraries.
>
> m2pim/DynamicStrings.mod:1358:27: note: In procedure ‘Slice’: the symbol
> name ‘end’ is legal as an identifier, however as such it might cause
> confusion and is considered bad programming practice
>  1358 |    start, end, o: INTEGER ;
>
> m2pim/DynamicStrings.mod:1358:27: note: either the identifier has the
> same name as a keyword or alternatively a keyword has the wrong case
> (‘END’ and ‘end’)
>
> gcc/gm2:
>         * gm2-libs/DynamicStrings.mod: Fix bad identifier warning.
>
> Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>

thank you!
Wilken Gottwalt Aug. 12, 2024, 3:08 p.m. UTC | #2
On Tue, 23 Jul 2024 09:58:56 +0200
Wilken Gottwalt <wilken.gottwalt@posteo.net> wrote:

> Fix using keywords as identifiers to prevent warnings coming from
> Modula-2's own libraries.
> 
> m2pim/DynamicStrings.mod:1358:27: note: In procedure ‘Slice’: the symbol
> name ‘end’ is legal as an identifier, however as such it might cause
> confusion and is considered bad programming practice
>  1358 |    start, end, o: INTEGER ;
> 
> m2pim/DynamicStrings.mod:1358:27: note: either the identifier has the
> same name as a keyword or alternatively a keyword has the wrong case
> (‘END’ and ‘end’)

Hi Gaius,

did you forget to add this patch?

greetings,
Wilken
Gaius Mulley Aug. 15, 2024, 1:17 a.m. UTC | #3
Wilken Gottwalt <wilken.gottwalt@posteo.net> writes:

> On Tue, 23 Jul 2024 09:58:56 +0200
> Wilken Gottwalt <wilken.gottwalt@posteo.net> wrote:
>
>> Fix using keywords as identifiers to prevent warnings coming from
>> Modula-2's own libraries.
>> 
>> m2pim/DynamicStrings.mod:1358:27: note: In procedure ‘Slice’: the symbol
>> name ‘end’ is legal as an identifier, however as such it might cause
>> confusion and is considered bad programming practice
>>  1358 |    start, end, o: INTEGER ;
>> 
>> m2pim/DynamicStrings.mod:1358:27: note: either the identifier has the
>> same name as a keyword or alternatively a keyword has the wrong case
>> (‘END’ and ‘end’)
>
> Hi Gaius,
>
> did you forget to add this patch?
>
> greetings,
> Wilken

Hi Wilken,

ah many thanks for the reminder - I'll commit the patch once the darwin
m2 bootstrap issue is resolved,

regards,
Gaius
diff mbox series

Patch

diff --git a/gcc/m2/gm2-libs/DynamicStrings.mod b/gcc/m2/gm2-libs/DynamicStrings.mod
index b53f0f285b5..982284d3629 100644
--- a/gcc/m2/gm2-libs/DynamicStrings.mod
+++ b/gcc/m2/gm2-libs/DynamicStrings.mod
@@ -1354,8 +1354,8 @@  END Mult ;
 
 PROCEDURE Slice (s: String; low, high: INTEGER) : String ;
 VAR
-   d, t         : String ;
-   start, end, o: INTEGER ;
+   d, t          : String ;
+   start, stop, o: INTEGER ;
 BEGIN
    IF PoisonOn
    THEN
@@ -1390,7 +1390,7 @@  BEGIN
             ELSE
                start := low - o
             END ;
-            end := Max (Min (MaxBuf, high - o), 0) ;
+            stop := Max (Min (MaxBuf, high - o), 0) ;
             WHILE t^.contents.len = MaxBuf DO
                IF t^.contents.next = NIL
                THEN
@@ -1408,7 +1408,7 @@  BEGIN
                t := t^.contents.next
             END ;
             ConcatContentsAddress (t^.contents,
-                                   ADR (s^.contents.buf[start]), end - start) ;
+                                   ADR (s^.contents.buf[start]), stop - start) ;
             INC (o, s^.contents.len) ;
             s := s^.contents.next
          END