https://gcc.gnu.org/g:ec9a23f1c2447fabb947d91cde4ab26ab6feba32

commit r16-4004-gec9a23f1c2447fabb947d91cde4ab26ab6feba32
Author: Gaius Mulley <[email protected]>
Date:   Sat Sep 20 19:40:32 2025 +0100

    PR modula2/122009: ODR fixes and prototype correction.
    
    This small patch fixes -Wodr warnings and also corrects a prototype.
    
    gcc/m2/ChangeLog:
    
            PR modula2/122009
            * gm2-compiler/M2GenGCC.mod (FromM2WIDESETImport): Assign
            sym to NulSym.
            (CodeMakeAdr): Remove fourth parameter to BuildLogicalOrAddress.
            (FoldMakeAdr): Ditto.
            * gm2-compiler/M2Quads.mod (BuildAssignmentBoolean): Remove
            unused parameter checkTypes.
            (doBuildAssignment): Remove checkTypes parameter when calling
            BuildAssignmentBoolean.
            * gm2-gcc/m2expr.def (BuildLogicalOrAddress): Remove
            needconvert parameter.
            * gm2-gcc/m2statement.def (IfExprJump): Change label type
            to CharStar.
            * gm2-gcc/m2type.cc (m2type_BuildEnumerator): Remove const.
            * gm2-gcc/m2type.h (m2type_BuildEnumerator): Ditto.
    
    Signed-off-by: Gaius Mulley <[email protected]>

Diff:
---
 gcc/m2/gm2-compiler/M2GenGCC.mod | 5 +++--
 gcc/m2/gm2-compiler/M2Quads.mod  | 4 ++--
 gcc/m2/gm2-gcc/m2expr.def        | 2 +-
 gcc/m2/gm2-gcc/m2statement.def   | 2 +-
 gcc/m2/gm2-gcc/m2type.cc         | 2 +-
 gcc/m2/gm2-gcc/m2type.h          | 2 +-
 6 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/gcc/m2/gm2-compiler/M2GenGCC.mod b/gcc/m2/gm2-compiler/M2GenGCC.mod
index 14a4d5d780be..ca1c60316be8 100644
--- a/gcc/m2/gm2-compiler/M2GenGCC.mod
+++ b/gcc/m2/gm2-compiler/M2GenGCC.mod
@@ -2455,7 +2455,7 @@ BEGIN
                tmp := BuildLSL (location, tmp, bits, FALSE)
             END ;
             bits := BuildAdd (location, bits, GetSizeOfInBits (Mod2Gcc 
(type)), FALSE) ;
-            val := BuildLogicalOrAddress (location, val, tmp, FALSE)
+            val := BuildLogicalOrAddress (location, val, tmp)
          END
       END ;
       SubQuad (n) ;
@@ -2548,7 +2548,7 @@ BEGIN
                   tmp := BuildLSL (location, tmp, bits, FALSE)
                END ;
               bits := BuildAdd (location, bits, GetSizeOfInBits (Mod2Gcc 
(type)), FALSE) ;
-               val := BuildLogicalOrAddress (location, val, tmp, FALSE)
+               val := BuildLogicalOrAddress (location, val, tmp)
             END
          END ;
          SubQuad (n) ;
@@ -5762,6 +5762,7 @@ PROCEDURE FromM2WIDESETImport (tokenno: CARDINAL; name: 
Name) : CARDINAL ;
 VAR
    sym, module: CARDINAL ;
 BEGIN
+   sym := NulSym ;
    IF GetWideset ()
    THEN
       module := MakeDefinitionSource (tokenno, MakeKey ("M2WIDESET")) ;
diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod
index 9489bd8d114b..ae7dde0f9b23 100644
--- a/gcc/m2/gm2-compiler/M2Quads.mod
+++ b/gcc/m2/gm2-compiler/M2Quads.mod
@@ -3836,7 +3836,7 @@ END BuildAssignConstant ;
                             A variable maybe an L value so it will require 
dereferencing.
 *)
 
-PROCEDURE BuildAssignmentBoolean (becomesTokNo: CARDINAL; checkTypes, 
checkOverflow: BOOLEAN;
+PROCEDURE BuildAssignmentBoolean (becomesTokNo: CARDINAL; checkOverflow: 
BOOLEAN;
                                   t, f: CARDINAL; Des: CARDINAL; destok: 
CARDINAL) ;
 BEGIN
       PutVarConditional (Des, TRUE) ;  (* Des will contain the result of a 
boolean relop.  *)
@@ -3885,7 +3885,7 @@ BEGIN
       PopTtok (Des, destok) ;
       IF IsVar (Des) OR IsConstVar (Des)
       THEN
-         BuildAssignmentBoolean (becomesTokNo, checkTypes, checkOverflow,
+         BuildAssignmentBoolean (becomesTokNo, checkOverflow,
                                  t, f, Des, destok)
       ELSE
          MetaErrorT1 (destok, 'expecting the designator {%1Ead} to be a 
constant or a variable and not a {%1dv}', Des)
diff --git a/gcc/m2/gm2-gcc/m2expr.def b/gcc/m2/gm2-gcc/m2expr.def
index 6842724ef8c3..722a3c9ef7e4 100644
--- a/gcc/m2/gm2-gcc/m2expr.def
+++ b/gcc/m2/gm2-gcc/m2expr.def
@@ -417,7 +417,7 @@ PROCEDURE BuildOffset (location: location_t; record: tree; 
field: tree; needconv
     BuildLogicalOrAddress - build a logical or expressions and return the tree.
 *)
 
-PROCEDURE BuildLogicalOrAddress (location: location_t; op1: tree; op2: tree; 
needconvert: BOOLEAN) : tree ;
+PROCEDURE BuildLogicalOrAddress (location: location_t; op1: tree; op2: tree) : 
tree ;
 
 
 (*
diff --git a/gcc/m2/gm2-gcc/m2statement.def b/gcc/m2/gm2-gcc/m2statement.def
index fbb578f40aa6..e96005dcf4a9 100644
--- a/gcc/m2/gm2-gcc/m2statement.def
+++ b/gcc/m2/gm2-gcc/m2statement.def
@@ -31,7 +31,7 @@ FROM SYSTEM IMPORT ADDRESS ;
    IfExprJump - if expr then jump to the label.
 *)
 
-PROCEDURE IfExprJump (location: location_t; exp: tree; label: ADDRESS) ;
+PROCEDURE IfExprJump (location: location_t; exp: tree; label: CharStar) ;
 
 
 (*
diff --git a/gcc/m2/gm2-gcc/m2type.cc b/gcc/m2/gm2-gcc/m2type.cc
index 184b506aa693..535ab143053f 100644
--- a/gcc/m2/gm2-gcc/m2type.cc
+++ b/gcc/m2/gm2-gcc/m2type.cc
@@ -2213,7 +2213,7 @@ gm2_build_enumerator (location_t location, tree name, 
tree value)
    enumvalues, list.  It returns a copy of the value.  */
 
 tree
-m2type_BuildEnumerator (location_t location, const char *name, tree value,
+m2type_BuildEnumerator (location_t location, char *name, tree value,
                         tree *enumvalues)
 {
   tree id = get_identifier (name);
diff --git a/gcc/m2/gm2-gcc/m2type.h b/gcc/m2/gm2-gcc/m2type.h
index 68015a01e145..afd97f763143 100644
--- a/gcc/m2/gm2-gcc/m2type.h
+++ b/gcc/m2/gm2-gcc/m2type.h
@@ -183,7 +183,7 @@ EXTERN tree m2type_BuildStartEnumeration (location_t 
location, char *name,
                                           bool ispacked);
 EXTERN tree m2type_BuildEndEnumeration (location_t location, tree enumtype,
                                         tree enumvalues);
-EXTERN tree m2type_BuildEnumerator (location_t location, const char *name,
+EXTERN tree m2type_BuildEnumerator (location_t location, char *name,
                                     tree value, tree *enumvalues);
 EXTERN tree m2type_BuildPointerType (tree totype);
 EXTERN tree m2type_BuildConstPointerType (tree totype);

Reply via email to