public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/modula-2] Fixes to remove warnings and rebuild gcc/m2/configure.
@ 2022-09-20 11:41 Gaius Mulley
  0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2022-09-20 11:41 UTC (permalink / raw)
  To: gcc-cvs

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

commit d2e4f24ef5883a24fa31a098665b07c68d8e2226
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Tue Sep 20 12:00:56 2022 +0100

    Fixes to remove warnings and rebuild gcc/m2/configure.
    
    gcc/m2/ChangeLog:
    
            * configure: Rebuilt.
            * gm2-compiler/M2GenGCC.mod (FoldBuiltin): Replace variable op3.
            * gm2-compiler/M2Quads.mod (IsBackReference): Fix spacing.
            (IsBackReferenceConditional): Fix spacing.
            * gm2-gcc/m2color.cc: Correct line breaks and change drop
            const from return to allow modula-2 to build without warning.
            * gm2-gcc/m2color.def: Tidyup comments and use PtrToChar
            as the return result rather than ADDRESS.
            * gm2-gcc/m2color.h: Change return result to char * (avoiding const).
            * gm2-libs-min/libc.c: Correct spacing.
            * gm2-libs/FIO.mod (StringFormat1): Initialize local variables to
            avoid warning.  (FormatError) Correct spacing.
            (FormatError2) Correct spacing.  (CheckAccess) Tidy comments and
            spacing.  (SetEndOfLine) Tidy comments and spacing.
    
    libgm2/ChangeLog:
    
            * libm2pim/wrapc.c (wrapc_fileinode): Avoid a warning by using a
            check whether to assign high to 0 if sizeof (high) in bits <=
            shift length.
    
    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

Diff:
---
 gcc/m2/configure                 |  6 ------
 gcc/m2/gm2-compiler/M2GenGCC.mod |  8 +++++---
 gcc/m2/gm2-compiler/M2Quads.mod  |  6 +++---
 gcc/m2/gm2-gcc/m2color.cc        | 26 ++++++++++++++++----------
 gcc/m2/gm2-gcc/m2color.def       | 19 +++++++++++--------
 gcc/m2/gm2-gcc/m2color.h         |  8 ++++----
 gcc/m2/gm2-libs-min/libc.c       |  2 +-
 gcc/m2/gm2-libs/FIO.mod          | 34 +++++++++++++++++++---------------
 gcc/m2/mc-boot/GFIO.c            | 26 ++++++++++++++++----------
 libgm2/libm2pim/wrapc.c          |  5 ++++-
 10 files changed, 79 insertions(+), 61 deletions(-)

diff --git a/gcc/m2/configure b/gcc/m2/configure
index 0a3adac76c0..13d9f1f3d6f 100755
--- a/gcc/m2/configure
+++ b/gcc/m2/configure
@@ -2236,12 +2236,6 @@ test -n "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-# Determine the noncanonical host name, for Modula-2.
-ACX_NONCANONICAL_HOST
-
-# Determine the noncanonical target name, for directory use.
-ACX_NONCANONICAL_TARGET
-
 for ac_prog in flex
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
diff --git a/gcc/m2/gm2-compiler/M2GenGCC.mod b/gcc/m2/gm2-compiler/M2GenGCC.mod
index 722fb5739c9..ebe64a170fb 100644
--- a/gcc/m2/gm2-compiler/M2GenGCC.mod
+++ b/gcc/m2/gm2-compiler/M2GenGCC.mod
@@ -2371,17 +2371,19 @@ END doParam ;
    FoldBuiltin - attempts to fold the gcc builtin function.
 *)
 
-PROCEDURE FoldBuiltin (tokenno: CARDINAL; p: WalkAction;
-                       q: CARDINAL; op1, op2, op3: CARDINAL) ;
+PROCEDURE FoldBuiltin (tokenno: CARDINAL; p: WalkAction; q: CARDINAL) ;
 VAR
    resolved  : BOOLEAN ;
    procedure,
    r         : CARDINAL ;
    n         : CARDINAL ;
+   op1, op2,
+   op3       : CARDINAL ;
    op        : QuadOperator ;
    val       : Tree ;
    location  : location_t ;
 BEGIN
+   GetQuad (q, op, op1, op2, op3) ;
    resolved := TRUE ;
    procedure := NulSym ;
    n := q ;
@@ -2454,7 +2456,7 @@ BEGIN
          FoldMakeAdr (tokenno, p, q, op1, op2, op3)
       ELSIF IsProcedure (op3) AND IsProcedureBuiltin (op3) AND CanUseBuiltin (op3)
       THEN
-         FoldBuiltin (tokenno, p, q, op1, op2, op3)
+         FoldBuiltin (tokenno, p, q)
       END
    END
 END FoldBuiltinFunction ;
diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod
index 29cc9cd98b1..9f13d8359fa 100644
--- a/gcc/m2/gm2-compiler/M2Quads.mod
+++ b/gcc/m2/gm2-compiler/M2Quads.mod
@@ -550,7 +550,7 @@ VAR
 BEGIN
    i := q ;
    WHILE i#0 DO
-      GetQuad(i, op, op1, op2, op3) ;
+      GetQuad (i, op, op1, op2, op3) ;
       CASE op OF
 
       NewLocalVarOp,
@@ -649,7 +649,7 @@ VAR
 BEGIN
    i := q ;
    WHILE i#0 DO
-      GetQuad(i, op, op1, op2, op3) ;
+      GetQuad (i, op, op1, op2, op3) ;
       CASE op OF
 
       NewLocalVarOp,
@@ -819,7 +819,7 @@ VAR
    op           : QuadOperator ;
    op1, op2, op3: CARDINAL ;
 BEGIN
-   GetQuad(QuadNo, op, op1, op2, op3) ;
+   GetQuad (QuadNo, op, op1, op2, op3) ;
    CASE op OF
 
    InclOp,
diff --git a/gcc/m2/gm2-gcc/m2color.cc b/gcc/m2/gm2-gcc/m2color.cc
index 75f3b5f373e..c73d6ccaf58 100644
--- a/gcc/m2/gm2-gcc/m2color.cc
+++ b/gcc/m2/gm2-gcc/m2color.cc
@@ -26,35 +26,41 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #include "diagnostic-color.h"
 
 
-const char *m2color_colorize_start (bool show_color, char *name, unsigned int name_len)
+char *
+m2color_colorize_start (bool show_color, char *name, unsigned int name_len)
 {
-  return colorize_start (show_color, name, name_len);
+  return const_cast<char*> (colorize_start (show_color, name, name_len));
 }
 
 
-const char *m2color_colorize_stop (bool show_color)
+char *
+m2color_colorize_stop (bool show_color)
 {
-  return colorize_stop (show_color);
+  return const_cast<char*> (colorize_stop (show_color));
 }
 
 
-const char *m2color_open_quote (void)
+char *
+m2color_open_quote (void)
 {
-  return open_quote;
+  return const_cast<char*> (open_quote);
 }
 
 
-const char *m2color_close_quote (void)
+char *
+m2color_close_quote (void)
 {
-  return close_quote;
+  return const_cast<char*> (close_quote);
 }
 
 
-void _M2_m2color_init ()
+void
+_M2_m2color_init ()
 {
 }
 
 
-void _M2_m2color_finish ()
+void
+_M2_m2color_finish ()
 {
 }
diff --git a/gcc/m2/gm2-gcc/m2color.def b/gcc/m2/gm2-gcc/m2color.def
index 411a5e8a9bd..619191ebac6 100644
--- a/gcc/m2/gm2-gcc/m2color.def
+++ b/gcc/m2/gm2-gcc/m2color.def
@@ -23,32 +23,35 @@ DEFINITION MODULE m2color ;
 
 FROM SYSTEM IMPORT ADDRESS ;
 
+TYPE
+   PtrToChar = POINTER TO CHAR ;
 
-(* colorize_start - returns a C string containing the color escape sequences
+
+(* colorize_start returns a C string containing the color escape sequences
    mapped onto, name.  See diagnostic-color.c for the definitive
    list of GCC colors.  The name list includes: error, warning,
    note, range1, range2, quote, locus, fixit-insert, fixit-delete,
    diff-filename, diff-hunk, diff-delete, diff-insert, type-diff.  *)
 
 PROCEDURE colorize_start (show_color: BOOLEAN;
-                          name: ARRAY OF CHAR; name_len: CARDINAL) : ADDRESS ;
+                          name: ARRAY OF CHAR; name_len: CARDINAL) : PtrToChar ;
 
-(* colorize_stop - return a C string containing the escape sequences to
+(* colorize_stop return a C string containing the escape sequences to
    stop text colorization.  *)
 
-PROCEDURE colorize_stop (show_color: BOOLEAN) : ADDRESS ;
+PROCEDURE colorize_stop (show_color: BOOLEAN) : PtrToChar ;
 
 
-(* open_quote - return a C string containing the open quote character which
+(* open_quote return a C string containing the open quote character which
    might be a UTF-8 character if on a UTF-8 supporting host.  *)
 
-PROCEDURE open_quote () : ADDRESS ;
+PROCEDURE open_quote () : PtrToChar ;
 
 
-(* close_quote - return a C string containing the close quote character which
+(* close_quote return a C string containing the close quote character which
    might be a UTF-8 character if on a UTF-8 supporting host.  *)
 
-PROCEDURE close_quote () : ADDRESS ;
+PROCEDURE close_quote () : PtrToChar ;
 
 
 END m2color.
diff --git a/gcc/m2/gm2-gcc/m2color.h b/gcc/m2/gm2-gcc/m2color.h
index ed84989a8f7..0cbd551697b 100644
--- a/gcc/m2/gm2-gcc/m2color.h
+++ b/gcc/m2/gm2-gcc/m2color.h
@@ -36,14 +36,14 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #endif /* !m2color_c.  */
 
 
-EXTERN const char *
+EXTERN char *
 m2color_colorize_start (bool show_color, char *name, unsigned int name_len);
 
-EXTERN const char *m2color_colorize_stop (bool show_color);
+EXTERN char *m2color_colorize_stop (bool show_color);
 
-EXTERN const char *m2color_open_quote (void);
+EXTERN char *m2color_open_quote (void);
 
-EXTERN const char *m2color_close_quote (void);
+EXTERN char *m2color_close_quote (void);
 
 EXTERN void _M2_m2color_init ();
 EXTERN void _M2_m2color_finish ();
diff --git a/gcc/m2/gm2-libs-min/libc.c b/gcc/m2/gm2-libs-min/libc.c
index 44e314120a7..b39bfffb65c 100644
--- a/gcc/m2/gm2-libs-min/libc.c
+++ b/gcc/m2/gm2-libs-min/libc.c
@@ -25,7 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
 void abort (int);
-void exit  (int);
+void exit (int);
 
 void abort (int i)
 {
diff --git a/gcc/m2/gm2-libs/FIO.mod b/gcc/m2/gm2-libs/FIO.mod
index c8a53e43df1..6548bcb0de3 100644
--- a/gcc/m2/gm2-libs/FIO.mod
+++ b/gcc/m2/gm2-libs/FIO.mod
@@ -816,6 +816,8 @@ VAR
 BEGIN
    HighSrc := StrLen(src) ;
    HighDest := HIGH(dest) ;
+   p := NIL ;
+   c := 0 ;
    i := 0 ;
    j := 0 ;
    WHILE (i<HighSrc) AND (src[i]#nul) AND (j<HighDest) AND (src[i]#'%') DO
@@ -883,25 +885,27 @@ END StringFormat1 ;
 
 PROCEDURE FormatError (a: ARRAY OF CHAR) ;
 BEGIN
-   WriteString(StdErr, a)
+   WriteString (StdErr, a)
 END FormatError ;
 
 
 (*
-   FormatError1 - fairly generic error procedure.
+   FormatError1 - generic error procedure taking standard format string
+                  and single parameter.
 *)
 
 PROCEDURE FormatError1 (a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
 VAR
    s: ARRAY [0..MaxErrorString] OF CHAR ;
 BEGIN
-   StringFormat1(s, a, w) ;
-   FormatError(s)
+   StringFormat1 (s, a, w) ;
+   FormatError (s)
 END FormatError1 ;
 
 
 (*
-   FormatError2 - fairly generic error procedure.
+   FormatError2 - generic error procedure taking standard format string
+                  and two parameters.
 *)
 
 PROCEDURE FormatError2 (a: ARRAY OF CHAR;
@@ -909,13 +913,13 @@ PROCEDURE FormatError2 (a: ARRAY OF CHAR;
 VAR
    s: ARRAY [0..MaxErrorString] OF CHAR ;
 BEGIN
-   StringFormat1(s, a, w1) ;
-   FormatError1(s, w2)
+   StringFormat1 (s, a, w1) ;
+   FormatError1 (s, w2)
 END FormatError2 ;
 
 
 (*
-   CheckAccess - checks to see whether a file, f, has been
+   CheckAccess - checks to see whether a file f has been
                  opened for read/write.
 *)
 
@@ -925,20 +929,20 @@ VAR
 BEGIN
    IF f#Error
    THEN
-      fd := GetIndice(FileInfo, f) ;
+      fd := GetIndice (FileInfo, f) ;
       IF fd=NIL
       THEN
          IF f#StdErr
          THEN
-            FormatError('this file has probably been closed and not reopened successfully or alternatively never opened\n')
+            FormatError ('this file has probably been closed and not reopened successfully or alternatively never opened\n')
          END ;
          HALT
       ELSE
          WITH fd^ DO
             IF (use=openedforwrite) AND (usage=openedforread)
             THEN
-               FormatError1('this file (%s) has been opened for reading but is now being written\n',
-                            name.address) ;
+               FormatError1 ('this file (%s) has been opened for reading but is now being written\n',
+                             name.address) ;
                HALT
             ELSIF (use=openedforread) AND (usage=openedforwrite)
             THEN
@@ -973,7 +977,7 @@ END CheckAccess ;
 
 
 (*
-   ReadChar - returns a character read from file, f.
+   ReadChar - returns a character read from file f.
               Sensible to check with IsNoError or EOF after calling
               this function.
 *)
@@ -1018,7 +1022,7 @@ END SetEndOfLine ;
 
 
 (*
-   UnReadChar - replaces a character, ch, back into file, f.
+   UnReadChar - replaces a character, ch, back into file f.
                 This character must have been read by ReadChar
                 and it does not allow successive calls.  It may
                 only be called if the previous read was successful
@@ -1028,7 +1032,7 @@ END SetEndOfLine ;
                 Otherwise it is left alone.
 *)
 
-PROCEDURE UnReadChar (f: File ; ch: CHAR) ;
+PROCEDURE UnReadChar (f: File; ch: CHAR) ;
 VAR
    fd  : FileDescriptor ;
    n   : CARDINAL ;
diff --git a/gcc/m2/mc-boot/GFIO.c b/gcc/m2/mc-boot/GFIO.c
index 039d221f626..aa075c765d7 100644
--- a/gcc/m2/mc-boot/GFIO.c
+++ b/gcc/m2/mc-boot/GFIO.c
@@ -245,7 +245,7 @@ extern "C" unsigned int FIO_EOLN (FIO_File f);
 extern "C" unsigned int FIO_WasEOLN (FIO_File f);
 
 /*
-   ReadChar - returns a character read from file, f.
+   ReadChar - returns a character read from file f.
               Sensible to check with IsNoError or EOF after calling
               this function.
 */
@@ -253,7 +253,7 @@ extern "C" unsigned int FIO_WasEOLN (FIO_File f);
 extern "C" char FIO_ReadChar (FIO_File f);
 
 /*
-   UnReadChar - replaces a character, ch, back into file, f.
+   UnReadChar - replaces a character, ch, back into file f.
                 This character must have been read by ReadChar
                 and it does not allow successive calls.  It may
                 only be called if the previous read was successful
@@ -438,19 +438,21 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
 static void FormatError (const char *a_, unsigned int _a_high);
 
 /*
-   FormatError1 - fairly generic error procedure.
+   FormatError1 - generic error procedure taking standard format string
+                  and single parameter.
 */
 
 static void FormatError1 (const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high);
 
 /*
-   FormatError2 - fairly generic error procedure.
+   FormatError2 - generic error procedure taking standard format string
+                  and two parameters.
 */
 
 static void FormatError2 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high);
 
 /*
-   CheckAccess - checks to see whether a file, f, has been
+   CheckAccess - checks to see whether a file f has been
                  opened for read/write.
 */
 
@@ -1001,6 +1003,8 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
 
   HighSrc = StrLib_StrLen ((const char *) src, _src_high);
   HighDest = _dest_high;
+  p = NULL;
+  c = 0;
   i = 0;
   j = 0;
   while ((((i < HighSrc) && (src[i] != ASCII_nul)) && (j < HighDest)) && (src[i] != '%'))
@@ -1090,7 +1094,8 @@ static void FormatError (const char *a_, unsigned int _a_high)
 
 
 /*
-   FormatError1 - fairly generic error procedure.
+   FormatError1 - generic error procedure taking standard format string
+                  and single parameter.
 */
 
 static void FormatError1 (const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high)
@@ -1112,7 +1117,8 @@ static void FormatError1 (const char *a_, unsigned int _a_high, const unsigned c
 
 
 /*
-   FormatError2 - fairly generic error procedure.
+   FormatError2 - generic error procedure taking standard format string
+                  and two parameters.
 */
 
 static void FormatError2 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high)
@@ -1136,7 +1142,7 @@ static void FormatError2 (const char *a_, unsigned int _a_high, const unsigned c
 
 
 /*
-   CheckAccess - checks to see whether a file, f, has been
+   CheckAccess - checks to see whether a file f has been
                  opened for read/write.
 */
 
@@ -1857,7 +1863,7 @@ extern "C" unsigned int FIO_WasEOLN (FIO_File f)
 
 
 /*
-   ReadChar - returns a character read from file, f.
+   ReadChar - returns a character read from file f.
               Sensible to check with IsNoError or EOF after calling
               this function.
 */
@@ -1882,7 +1888,7 @@ extern "C" char FIO_ReadChar (FIO_File f)
 
 
 /*
-   UnReadChar - replaces a character, ch, back into file, f.
+   UnReadChar - replaces a character, ch, back into file f.
                 This character must have been read by ReadChar
                 and it does not allow successive calls.  It may
                 only be called if the previous read was successful
diff --git a/libgm2/libm2pim/wrapc.c b/libgm2/libm2pim/wrapc.c
index 6269155b62b..5aa491219c4 100644
--- a/libgm2/libm2pim/wrapc.c
+++ b/libgm2/libm2pim/wrapc.c
@@ -130,7 +130,10 @@ wrapc_fileinode (int f, unsigned int *low, unsigned int *high)
   if (fstat (f, (struct stat *)&s) == 0)
     {
       *low = (unsigned int)s.st_ino;
-      *high = (unsigned int)(s.st_ino >> (sizeof (unsigned int) * 8));
+      if ((sizeof (s.st_ino) == (sizeof (unsigned int))))
+	*high = 0;
+      else
+	*high = (unsigned int)(s.st_ino >> (sizeof (unsigned int) * 8));
       return 0;
     }
   else

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-20 11:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20 11:41 [gcc/devel/modula-2] Fixes to remove warnings and rebuild gcc/m2/configure Gaius Mulley

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).