From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1499) id 0D34E38582A3; Sun, 25 Feb 2024 11:09:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D34E38582A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708859356; bh=3egHgjLoB5DqRXjqe5dRbVPL1frtSOjY6rpYIhgPXoU=; h=From:To:Subject:Date:From; b=Ih5T76GnJggQBMAU7EekdY3CkLq+C1PqSdENUi1IQMCuSPieuqthfLuTK+dSgot5G d+x8c2FjJry626TggZ8SlIQHdbfGfH4OQgKhWqBEpOuJQhksrrF8Y9f8/pYpXvoGnC 1tAaGsIqYp4G3nxGt8N0683XOBns81IojxOFbTww= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Gaius Mulley To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-9167] PR modula2/113749 m2 enabled build times out on i686-gnu-hurd X-Act-Checkin: gcc X-Git-Author: Gaius Mulley X-Git-Refname: refs/heads/master X-Git-Oldrev: 5c45dc1b97890afe7a977cea8069214ccdc42384 X-Git-Newrev: d1b241b9506cdc0ebd3f43d12cf77d7c33271342 Message-Id: <20240225110916.0D34E38582A3@sourceware.org> Date: Sun, 25 Feb 2024 11:09:16 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d1b241b9506cdc0ebd3f43d12cf77d7c33271342 commit r14-9167-gd1b241b9506cdc0ebd3f43d12cf77d7c33271342 Author: Gaius Mulley Date: Sun Feb 25 11:08:37 2024 +0000 PR modula2/113749 m2 enabled build times out on i686-gnu-hurd The bug fix changes the FIO module to use the target O_RDONLY, O_WRONLY, SEEK_SET and SEEK_END (now available from the module wrapc). Also rebuilt are the bootstrap tools mc and pge as they have their own wrapc and C translations of FIO. gcc/m2/ChangeLog: PR modula2/113749 * Make-lang.in (BUILD-PGE-O): Add m2/pge-boot/Gwrapc.o. * gm2-libs-ch/wrapc.c (wrapc_SeekSet): New function. (wrapc_SeekEnd): Ditto. (wrapc_ReadOnly): Ditto. (wrapc_WriteOnly): Ditto. * gm2-libs/FIO.mod (SEEK_SET): Remove. (SEEK_END): Remove. (UNIXREADONLY): Remove. (UNIXWRITEONLY): Remove. (ConnectToUnix): Replace UNIXWRITEONLY with a call to WriteOnly. Replace UNIXREADONLY with a call to ReadOnly. (SetPositionFromBeginning): Replace SEEK_SET with a call to SeekSet. (SetPositionFromEnd): Replace SEEK_END with a call to SeekEnd. * gm2-libs/wrapc.def (SeekSet): New procedure function. (SeekEnd): New procedure function. (ReadOnly): New procedure function. (WriteOnly): New procedure function. * mc-boot-ch/Glibc.c (BUILD_MC_LIBC_TRACE): Undef. (check_init): New function. (tracedb): Ditto. (tracedb_open): Ditto. (tracedb_result): Ditto. (libc_read): Ditto. (libc_write): Ditto. (libc_close): Ditto. (libc_creat): Ditto. (libc_open): Ditto. (libc_lseek): Ditto. * mc-boot-ch/Gwrapc.c (wrapc_SeekSet): New function. (wrapc_SeekEnd): Ditto. (wrapc_ReadOnly): Ditto. (wrapc_WriteOnly): Ditto. * mc-boot/GDynamicStrings.cc: Rebuilt. * mc-boot/GFIO.cc: Ditto. * mc-boot/GIndexing.cc: Ditto. * mc-boot/GM2Dependent.cc: Ditto. * mc-boot/GM2EXCEPTION.cc: Ditto. * mc-boot/GPushBackInput.cc: Ditto. * mc-boot/GRTExceptions.cc: Ditto. * mc-boot/GRTint.cc: Ditto. * mc-boot/GSArgs.cc: Ditto. * mc-boot/GStdIO.cc: Ditto. * mc-boot/GStringConvert.cc: Ditto. * mc-boot/GSysStorage.cc: Ditto. * mc-boot/Gdecl.cc: Ditto. * mc-boot/Gkeyc.cc: Ditto. * mc-boot/Glibc.h: Ditto. * mc-boot/GmcComment.cc: Ditto. * mc-boot/GmcComp.cc: Ditto. * mc-boot/GmcDebug.cc: Ditto. * mc-boot/GmcMetaError.cc: Ditto. * mc-boot/GmcStack.cc: Ditto. * mc-boot/GmcStream.cc: Ditto. * mc-boot/GnameKey.cc: Ditto. * mc-boot/GsymbolKey.cc: Ditto. * mc-boot/Gvarargs.cc: Ditto. * mc-boot/Gwrapc.h: Ditto. * mc/decl.mod (getSymName): Add pointerref clause. * mc/mcStream.mod (copy): Check for an error after every read. * mc/varargs.mod (copy): Rewrite pointer arithmetic using INC to avoid type incompatibility. * pge-boot/GDynamicStrings.cc: Rebuilt. * pge-boot/GDynamicStrings.h: Ditto. * pge-boot/GFIO.cc: Ditto. * pge-boot/GFIO.h: Ditto. * pge-boot/GIO.cc: Ditto. * pge-boot/GIndexing.cc: Ditto. * pge-boot/GM2Dependent.cc: Ditto. * pge-boot/GM2EXCEPTION.cc: Ditto. * pge-boot/GNameKey.cc: Ditto. * pge-boot/GPushBackInput.cc: Ditto. * pge-boot/GRTExceptions.cc: Ditto. * pge-boot/GStdIO.cc: Ditto. * pge-boot/GSymbolKey.cc: Ditto. * pge-boot/GSysStorage.cc: Ditto. * pge-boot/Glibc.h: Ditto. * pge-boot/Gwrapc.cc: Ditto. * pge-boot/Gwrapc.h: Ditto. libgm2/ChangeLog: PR modula2/113749 * libm2pim/wrapc.cc: Include fcntl.h. (SeekSet): New function. (SeekEnd): Ditto. (ReadOnly): Ditto. (WriteOnly): Ditto. Signed-off-by: Gaius Mulley Diff: --- gcc/m2/Make-lang.in | 1 + gcc/m2/gm2-libs-ch/wrapc.c | 32 +++++++++ gcc/m2/gm2-libs/FIO.mod | 18 +++-- gcc/m2/gm2-libs/wrapc.def | 28 ++++++++ gcc/m2/mc-boot-ch/Glibc.c | 112 ++++++++++++++++++++++++++++-- gcc/m2/mc-boot-ch/Gwrapc.c | 32 +++++++++ gcc/m2/mc-boot/GDynamicStrings.cc | 32 ++++----- gcc/m2/mc-boot/GFIO.cc | 19 +++-- gcc/m2/mc-boot/GIndexing.cc | 6 +- gcc/m2/mc-boot/GM2Dependent.cc | 23 ++++++- gcc/m2/mc-boot/GM2EXCEPTION.cc | 4 +- gcc/m2/mc-boot/GPushBackInput.cc | 6 +- gcc/m2/mc-boot/GRTExceptions.cc | 34 ++++----- gcc/m2/mc-boot/GRTint.cc | 20 +++--- gcc/m2/mc-boot/GSArgs.cc | 6 +- gcc/m2/mc-boot/GStdIO.cc | 4 +- gcc/m2/mc-boot/GStringConvert.cc | 4 +- gcc/m2/mc-boot/GSysStorage.cc | 6 +- gcc/m2/mc-boot/Gdecl.cc | 138 +++++++++++++++++++------------------ gcc/m2/mc-boot/Gkeyc.cc | 2 +- gcc/m2/mc-boot/Glibc.h | 2 +- gcc/m2/mc-boot/GmcComment.cc | 2 +- gcc/m2/mc-boot/GmcComp.cc | 4 +- gcc/m2/mc-boot/GmcDebug.cc | 2 +- gcc/m2/mc-boot/GmcMetaError.cc | 8 +-- gcc/m2/mc-boot/GmcStack.cc | 4 +- gcc/m2/mc-boot/GmcStream.cc | 13 +++- gcc/m2/mc-boot/GnameKey.cc | 4 +- gcc/m2/mc-boot/GsymbolKey.cc | 6 +- gcc/m2/mc-boot/Gvarargs.cc | 3 +- gcc/m2/mc-boot/Gwrapc.h | 45 ++++++++++++ gcc/m2/mc/decl.mod | 1 + gcc/m2/mc/mcStream.mod | 16 +++-- gcc/m2/mc/varargs.mod | 3 +- gcc/m2/pge-boot/GDynamicStrings.cc | 67 +++++++++++++----- gcc/m2/pge-boot/GDynamicStrings.h | 7 ++ gcc/m2/pge-boot/GFIO.cc | 64 +++++++++-------- gcc/m2/pge-boot/GFIO.h | 4 +- gcc/m2/pge-boot/GIO.cc | 13 ++-- gcc/m2/pge-boot/GIndexing.cc | 6 +- gcc/m2/pge-boot/GM2Dependent.cc | 23 ++++++- gcc/m2/pge-boot/GM2EXCEPTION.cc | 4 +- gcc/m2/pge-boot/GNameKey.cc | 15 ++-- gcc/m2/pge-boot/GPushBackInput.cc | 6 +- gcc/m2/pge-boot/GRTExceptions.cc | 34 ++++----- gcc/m2/pge-boot/GStdIO.cc | 4 +- gcc/m2/pge-boot/GSymbolKey.cc | 6 +- gcc/m2/pge-boot/GSysStorage.cc | 6 +- gcc/m2/pge-boot/Glibc.h | 2 +- gcc/m2/pge-boot/Gwrapc.cc | 32 +++++++++ gcc/m2/pge-boot/Gwrapc.h | 45 ++++++++++++ libgm2/libm2pim/wrapc.cc | 37 ++++++++++ 52 files changed, 735 insertions(+), 280 deletions(-) diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in index 45bfa933dca0..33b9ce8d8e88 100644 --- a/gcc/m2/Make-lang.in +++ b/gcc/m2/Make-lang.in @@ -1786,6 +1786,7 @@ BUILD-PGE-O = \ m2/pge-boot/GSymbolKey.o \ m2/pge-boot/GSysStorage.o \ m2/pge-boot/Glibc.o \ + m2/pge-boot/Gwrapc.o \ m2/pge-boot/Gerrno.o \ m2/pge-boot/GUnixArgs.o \ m2/pge-boot/Gtermios.o \ diff --git a/gcc/m2/gm2-libs-ch/wrapc.c b/gcc/m2/gm2-libs-ch/wrapc.c index ed80cbdd4c4c..24b65a99babb 100644 --- a/gcc/m2/gm2-libs-ch/wrapc.c +++ b/gcc/m2/gm2-libs-ch/wrapc.c @@ -252,6 +252,38 @@ wrapc_isnanl (long double x) return isnan (x); } +/* SeekSet return the system libc SEEK_SET value. */ + +int +wrapc_SeekSet (void) +{ + return SEEK_SET; +} + +/* SeekEnd return the system libc SEEK_END value. */ + +int +wrapc_SeekEnd (void) +{ + return SEEK_END; +} + +/* ReadOnly return the system value of O_RDONLY. */ + +int +wrapc_ReadOnly (void) +{ + return O_RDONLY; +} + +/* WriteOnly return the system value of O_WRONLY. */ + +int +wrapc_WriteOnly (void) +{ + return O_WRONLY; +} + /* init - init/finish functions for the module */ void diff --git a/gcc/m2/gm2-libs/FIO.mod b/gcc/m2/gm2-libs/FIO.mod index 6755d3d649d9..8347e8289a34 100644 --- a/gcc/m2/gm2-libs/FIO.mod +++ b/gcc/m2/gm2-libs/FIO.mod @@ -41,18 +41,16 @@ FROM ASCII IMPORT nl, nul, tab ; FROM StrLib IMPORT StrLen, StrConCat, StrCopy ; FROM Storage IMPORT ALLOCATE, DEALLOCATE ; FROM NumberIO IMPORT CardToStr ; -FROM libc IMPORT exit, open, creat, read, write, close, lseek, strncpy, memcpy ; FROM Indexing IMPORT Index, InitIndex, InBounds, HighIndice, PutIndice, GetIndice ; FROM M2RTS IMPORT InstallTerminationProcedure ; +FROM libc IMPORT exit, open, creat, read, write, close, lseek, strncpy, memcpy ; +FROM wrapc IMPORT SeekSet, SeekEnd, ReadOnly, WriteOnly ; + CONST - SEEK_SET = 0 ; (* relative from beginning of the file *) - SEEK_END = 2 ; (* relative to the end of the file *) - UNIXREADONLY = 0 ; - UNIXWRITEONLY = 1 ; - CreatePermissions = 666B; MaxBufferLength = 1024*16 ; MaxErrorString = 1024* 8 ; + CreatePermissions = 666B; TYPE FileUsage = (unused, openedforread, openedforwrite, openedforrandom) ; @@ -428,10 +426,10 @@ BEGIN THEN unixfd := creat(name.address, CreatePermissions) ELSE - unixfd := open(name.address, UNIXWRITEONLY, 0) + unixfd := open(name.address, INTEGER (WriteOnly ()), 0) END ELSE - unixfd := open(name.address, UNIXREADONLY, 0) + unixfd := open(name.address, INTEGER (ReadOnly ()), 0) END ; IF unixfd<0 THEN @@ -1448,7 +1446,7 @@ BEGIN filled := 0 END END ; - offset := lseek (unixfd, VAL (CSSIZE_T, pos), SEEK_SET) ; + offset := lseek (unixfd, VAL (CSSIZE_T, pos), SeekSet ()) ; IF (offset>=0) AND (pos=offset) THEN abspos := pos @@ -1497,7 +1495,7 @@ BEGIN filled := 0 END END ; - offset := lseek (unixfd, VAL (CSSIZE_T, pos), SEEK_END) ; + offset := lseek (unixfd, VAL (CSSIZE_T, pos), SeekEnd ()) ; IF offset>=0 THEN abspos := offset ; diff --git a/gcc/m2/gm2-libs/wrapc.def b/gcc/m2/gm2-libs/wrapc.def index 0daf7c3ebc11..244baa33b9d3 100644 --- a/gcc/m2/gm2-libs/wrapc.def +++ b/gcc/m2/gm2-libs/wrapc.def @@ -140,4 +140,32 @@ PROCEDURE isnanf (x: SHORTREAL) : INTEGER ; PROCEDURE isnanl (x: LONGREAL) : INTEGER ; +(* + SeekSet - return the system libc SEEK_SET value. +*) + +PROCEDURE SeekSet () : INTEGER ; + + +(* + SeekEnd - return the system libc SEEK_END value. +*) + +PROCEDURE SeekEnd () : INTEGER ; + + +(* + ReadOnly - return the system value of O_RDONLY. +*) + +PROCEDURE ReadOnly () : BITSET ; + + +(* + WriteOnly - return the system value of O_WRONLY. +*) + +PROCEDURE WriteOnly () : BITSET ; + + END wrapc. diff --git a/gcc/m2/mc-boot-ch/Glibc.c b/gcc/m2/mc-boot-ch/Glibc.c index 6154934799b0..23a490571ff9 100644 --- a/gcc/m2/mc-boot-ch/Glibc.c +++ b/gcc/m2/mc-boot-ch/Glibc.c @@ -28,25 +28,116 @@ along with GNU Modula-2; see the file COPYING3. If not see #define EXTERN #endif +#undef BUILD_MC_LIBC_TRACE + +#if defined(BUILD_MC_LIBC_TRACE) +static bool initialzed_trace = false; +static bool trace_on = false; + +static +void +check_init (void) +{ + if (! initialzed_trace) + { + initialzed_trace = true; + trace_on = ((getenv ("MC_LIBC_TRACE") != NULL)); + } +} +#endif + +static +void +tracedb (const char *format, ...) +{ +#if defined(BUILD_MC_LIBC_TRACE) + check_init (); + if (trace_on) + { + va_list arg; + va_start (arg, format); + { + vfprintf (stdout, format, arg); + fflush (stdout); + } + va_end (arg); + } +#endif +} + +static +void +tracedb_open (const char *p, int flags, mode_t mode) +{ +#if defined(BUILD_MC_LIBC_TRACE) + bool item_written = false; + tracedb ("libc_open (%s, flags = 0x%x = ", p, flags); + + int bits = (flags & O_ACCMODE); + tracedb ("bits = 0x%x", bits); + if (bits == O_RDONLY) + { + tracedb ("O_RDONLY"); + item_written = true; + } + if ((flags & O_WRONLY) != 0) + { + if (item_written) + tracedb (" | "); + tracedb ("O_WRONLY"); + item_written = true; + } + if ((flags & O_RDWR) != 0) + { + if (item_written) + tracedb (" | "); + tracedb ("O_RDWR"); + item_written = true; + } + tracedb (", 0x%x)\n", mode); +#endif +} + +static +void +tracedb_result (int result) +{ +#if defined(BUILD_MC_LIBC_TRACE) + tracedb (" result = %d", result); + if (result == -1) + tracedb (", errno = %s", strerror (errno)); + tracedb ("\n"); +#endif +} + EXTERN int libc_read (int fd, void *a, int nbytes) { - return read (fd, a, nbytes); + tracedb ("libc_read (%d, %p, %d)\n", fd, a, nbytes); + int result = read (fd, a, nbytes); + tracedb_result (result); + return result; } EXTERN int libc_write (int fd, void *a, int nbytes) { - return write (fd, a, nbytes); + tracedb ("libc_write (%d, %p, %d)\n", fd, a, nbytes); + int result = write (fd, a, nbytes); + tracedb_result (result); + return result; } EXTERN int libc_close (int fd) { - return close (fd); + tracedb ("libc_close (%d)\n", fd); + int result = close (fd); + tracedb_result (result); + return result; } EXTERN @@ -232,21 +323,30 @@ EXTERN int libc_creat (char *p, mode_t mode) { - return creat (p, mode); + tracedb ("libc_creat (%s, 0x%x)\n", p, mode); + int result = creat (p, mode); + tracedb_result (result); + return result; } EXTERN int libc_open (char *p, int flags, mode_t mode) { - return open (p, flags, mode); + tracedb_open (p, flags, mode); + int result = open (p, flags, mode); + tracedb_result (result); + return result; } EXTERN off_t libc_lseek (int fd, off_t offset, int whence) { - return lseek (fd, offset, whence); + tracedb ("libc_lseek (%s, %p, %d)\n", fd, offset, whence); + int result = lseek (fd, offset, whence); + tracedb_result (result); + return result; } EXTERN diff --git a/gcc/m2/mc-boot-ch/Gwrapc.c b/gcc/m2/mc-boot-ch/Gwrapc.c index f9397eb230ef..5e27e313d1a1 100644 --- a/gcc/m2/mc-boot-ch/Gwrapc.c +++ b/gcc/m2/mc-boot-ch/Gwrapc.c @@ -164,6 +164,38 @@ wrapc_signbitf (float r) #endif } +/* SeekSet return the system libc SEEK_SET value. */ + +int +wrapc_SeekSet (void) +{ + return SEEK_SET; +} + +/* SeekEnd return the system libc SEEK_END value. */ + +int +wrapc_SeekEnd (void) +{ + return SEEK_END; +} + +/* ReadOnly return the system value of O_RDONLY. */ + +int +wrapc_ReadOnly (void) +{ + return O_RDONLY; +} + +/* WriteOnly return the system value of O_WRONLY. */ + +int +wrapc_WriteOnly (void) +{ + return O_WRONLY; +} + /* init constructor for the module. */ void diff --git a/gcc/m2/mc-boot/GDynamicStrings.cc b/gcc/m2/mc-boot/GDynamicStrings.cc index e9d75ee4fc5c..7f61778af64a 100644 --- a/gcc/m2/mc-boot/GDynamicStrings.cc +++ b/gcc/m2/mc-boot/GDynamicStrings.cc @@ -1225,7 +1225,7 @@ static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned (*c).next->contents.next = NULL; ConcatContents (&(*c).next->contents, (const char *) a, _a_high, h, o); AddDebugInfo ((*c).next); - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 722, (const char *) "ConcatContents", 14); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 722, (const char *) "ConcatContents", 14); } else { @@ -1323,7 +1323,7 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne AddDebugInfo ((*c).next); if (TraceOn) { - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 917, (const char *) "ConcatContentsAddress", 21); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 917, (const char *) "ConcatContentsAddress", 21); } } else @@ -1548,7 +1548,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsi AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 758, (const char *) "InitString", 10); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 758, (const char *) "InitString", 10); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1651,7 +1651,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a) AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 957, (const char *) "InitStringCharStar", 18); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 957, (const char *) "InitStringCharStar", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1676,7 +1676,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch) s = DynamicStrings_InitString ((const char *) &a.array[0], 1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 977, (const char *) "InitStringChar", 14); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 977, (const char *) "InitStringChar", 14); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1863,7 +1863,7 @@ extern "C" DynamicStrings_String DynamicStrings_Dup (DynamicStrings_String s) s = DynamicStrings_Assign (DynamicStrings_InitString ((const char *) "", 0), s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1198, (const char *) "Dup", 3); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1198, (const char *) "Dup", 3); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1885,7 +1885,7 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy a = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "", 0), a), b); if (TraceOn) { - a = AssignDebug (a, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1218, (const char *) "Add", 3); + a = AssignDebug (a, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1218, (const char *) "Add", 3); } return a; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1950,7 +1950,7 @@ extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a) t = DynamicStrings_InitStringCharStar (a); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1275, (const char *) "EqualCharStar", 13); + t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1275, (const char *) "EqualCharStar", 13); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1988,7 +1988,7 @@ extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char * t = DynamicStrings_InitString ((const char *) a, _a_high); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1305, (const char *) "EqualArray", 10); + t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1305, (const char *) "EqualArray", 10); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -2026,7 +2026,7 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1337, (const char *) "Mult", 4); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1337, (const char *) "Mult", 4); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2105,7 +2105,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, AddDebugInfo (t->contents.next); if (TraceOn) { - t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1405, (const char *) "Slice", 5); + t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1405, (const char *) "Slice", 5); } } t = t->contents.next; @@ -2123,7 +2123,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, } if (TraceOn) { - d = AssignDebug (d, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1422, (const char *) "Slice", 5); + d = AssignDebug (d, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1422, (const char *) "Slice", 5); } return d; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2251,7 +2251,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveComment (DynamicStrings_St } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1534, (const char *) "RemoveComment", 13); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1534, (const char *) "RemoveComment", 13); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2276,7 +2276,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePrefix (DynamicString s = DynamicStrings_Slice (s, (int ) (i), 0); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1646, (const char *) "RemoveWhitePrefix", 17); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1646, (const char *) "RemoveWhitePrefix", 17); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2301,7 +2301,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePostfix (DynamicStrin s = DynamicStrings_Slice (s, 0, i+1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1668, (const char *) "RemoveWhitePostfix", 18); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1668, (const char *) "RemoveWhitePostfix", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2668,7 +2668,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool hal if (frameHead == NULL) { stop (); - M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, (const char *) "PopAllocationExemption", 22, 174); + M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, (const char *) "PopAllocationExemption", 22, 174); } else { diff --git a/gcc/m2/mc-boot/GFIO.cc b/gcc/m2/mc-boot/GFIO.cc index 8de4c4f2de00..3f05b35e6e21 100644 --- a/gcc/m2/mc-boot/GFIO.cc +++ b/gcc/m2/mc-boot/GFIO.cc @@ -56,22 +56,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # include "GStrLib.h" # include "GStorage.h" # include "GNumberIO.h" -# include "Glibc.h" # include "GIndexing.h" # include "GM2RTS.h" +# include "Glibc.h" +# include "Gwrapc.h" typedef unsigned int FIO_File; FIO_File FIO_StdErr; FIO_File FIO_StdOut; FIO_File FIO_StdIn; -# define SEEK_SET 0 -# define SEEK_END 2 -# define UNIXREADONLY 0 -# define UNIXWRITEONLY 1 -# define CreatePermissions 0666 # define MaxBufferLength (1024*16) # define MaxErrorString (1024*8) +# define CreatePermissions 0666 typedef struct FIO_NameInfo_r FIO_NameInfo; typedef struct FIO_buf_r FIO_buf; @@ -556,7 +553,7 @@ static FIO_File GetNextFreeDescriptor (void) return f; /* create new slot */ } } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/FIO.def", 25, 1); __builtin_unreachable (); } @@ -673,12 +670,12 @@ static void ConnectToUnix (FIO_File f, bool towrite, bool newfile) } else { - fd->unixfd = libc_open (fd->name.address, UNIXWRITEONLY, 0); + fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_WriteOnly ()), 0); } } else { - fd->unixfd = libc_open (fd->name.address, UNIXREADONLY, 0); + fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_ReadOnly ()), 0); } if (fd->unixfd < 0) { @@ -2093,7 +2090,7 @@ extern "C" void FIO_SetPositionFromBeginning (FIO_File f, long int pos) fd->buffer->position = 0; fd->buffer->filled = 0; } - offset = libc_lseek (fd->unixfd, pos, SEEK_SET); + offset = static_cast (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekSet ())); if ((offset >= 0) && (pos == offset)) { fd->abspos = pos; @@ -2142,7 +2139,7 @@ extern "C" void FIO_SetPositionFromEnd (FIO_File f, long int pos) fd->buffer->position = 0; fd->buffer->filled = 0; } - offset = libc_lseek (fd->unixfd, pos, SEEK_END); + offset = static_cast (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekEnd ())); if (offset >= 0) { fd->abspos = offset; diff --git a/gcc/m2/mc-boot/GIndexing.cc b/gcc/m2/mc-boot/GIndexing.cc index ac184be3a44e..894b8cbea1fc 100644 --- a/gcc/m2/mc-boot/GIndexing.cc +++ b/gcc/m2/mc-boot/GIndexing.cc @@ -223,7 +223,7 @@ extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n) { return (n >= i->Low) && (n <= i->High); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1); + ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1); __builtin_unreachable (); } @@ -243,7 +243,7 @@ extern "C" unsigned int Indexing_HighIndice (Indexing_Index i) { return i->High; } - ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1); + ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1); __builtin_unreachable (); } @@ -263,7 +263,7 @@ extern "C" unsigned int Indexing_LowIndice (Indexing_Index i) { return i->Low; } - ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1); + ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GM2Dependent.cc b/gcc/m2/mc-boot/GM2Dependent.cc index 198d2e8b5a7f..cda07e8460be 100644 --- a/gcc/m2/mc-boot/GM2Dependent.cc +++ b/gcc/m2/mc-boot/GM2Dependent.cc @@ -134,6 +134,12 @@ extern "C" void M2Dependent_RegisterModule (void * modulename, void * libname, M extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname); +/* + InitDependencyList - initialize all fields of DependencyList. +*/ + +static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state); + /* CreateModule - creates a new module entry and returns the ModuleChain. @@ -354,6 +360,20 @@ static void Init (void); static void CheckInitialized (void); +/* + InitDependencyList - initialize all fields of DependencyList. +*/ + +static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state) +{ + (*depList).proc = proc; + (*depList).forced = false; + (*depList).forc = false; + (*depList).appl = false; + (*depList).state = state; +} + + /* CreateModule - creates a new module entry and returns the ModuleChain. @@ -368,8 +388,7 @@ static M2Dependent_ModuleChain CreateModule (void * name, void * libname, M2Depe mptr->libname = libname; mptr->init = init; mptr->fini = fini; - mptr->dependency.proc = dependencies; - mptr->dependency.state = M2Dependent_unregistered; + InitDependencyList (&mptr->dependency, dependencies, M2Dependent_unregistered); mptr->prev = NULL; mptr->next = NULL; if (HexTrace) diff --git a/gcc/m2/mc-boot/GM2EXCEPTION.cc b/gcc/m2/mc-boot/GM2EXCEPTION.cc index 2f9d61a5f345..2e268317765f 100644 --- a/gcc/m2/mc-boot/GM2EXCEPTION.cc +++ b/gcc/m2/mc-boot/GM2EXCEPTION.cc @@ -58,13 +58,13 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void) n = RTExceptions_GetNumber (e); if (n == (UINT_MAX)) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); } else { return (M2EXCEPTION_M2Exceptions) (n); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GPushBackInput.cc b/gcc/m2/mc-boot/GPushBackInput.cc index 715a7d4fbb48..4e0b41e491ed 100644 --- a/gcc/m2/mc-boot/GPushBackInput.cc +++ b/gcc/m2/mc-boot/GPushBackInput.cc @@ -275,7 +275,7 @@ extern "C" char PushBackInput_PutCh (char ch) } else { - Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutCh", 5, 151); + Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutCh", 5, 151); } return ch; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -301,7 +301,7 @@ extern "C" void PushBackInput_PutString (const char *a_, unsigned int _a_high) l -= 1; if ((PushBackInput_PutCh (a[l])) != a[l]) { - Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutString", 9, 132); + Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutString", 9, 132); } } } @@ -322,7 +322,7 @@ extern "C" void PushBackInput_PutStr (DynamicStrings_String s) i -= 1; if ((PushBackInput_PutCh (DynamicStrings_char (s, static_cast (i)))) != (DynamicStrings_char (s, static_cast (i)))) { - Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutStr", 6, 113); + Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutStr", 6, 113); } } } diff --git a/gcc/m2/mc-boot/GRTExceptions.cc b/gcc/m2/mc-boot/GRTExceptions.cc index 99e364c61d94..e7b35cfeed8a 100644 --- a/gcc/m2/mc-boot/GRTExceptions.cc +++ b/gcc/m2/mc-boot/GRTExceptions.cc @@ -722,7 +722,7 @@ static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h) static void indexf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); } @@ -732,7 +732,7 @@ static void indexf (void * a) static void range (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); } @@ -742,7 +742,7 @@ static void range (void * a) static void casef (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); } @@ -752,7 +752,7 @@ static void casef (void * a) static void invalidloc (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); } @@ -762,7 +762,7 @@ static void invalidloc (void * a) static void function (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ } @@ -772,7 +772,7 @@ static void function (void * a) static void wholevalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -782,7 +782,7 @@ static void wholevalue (void * a) static void wholediv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -792,7 +792,7 @@ static void wholediv (void * a) static void realvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); } @@ -802,7 +802,7 @@ static void realvalue (void * a) static void realdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); } @@ -812,7 +812,7 @@ static void realdiv (void * a) static void complexvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); } @@ -822,7 +822,7 @@ static void complexvalue (void * a) static void complexdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); } @@ -832,7 +832,7 @@ static void complexdiv (void * a) static void protection (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); } @@ -842,7 +842,7 @@ static void protection (void * a) static void systemf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); } @@ -852,7 +852,7 @@ static void systemf (void * a) static void coroutine (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); } @@ -862,7 +862,7 @@ static void coroutine (void * a) static void exception (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); } @@ -1180,13 +1180,13 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void) { if (currentEHB == NULL) { - M2RTS_Halt ((const char *) "currentEHB has not been initialized yet", 39, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod", 53, (const char *) "GetBaseExceptionBlock", 21, 600); + M2RTS_Halt ((const char *) "currentEHB has not been initialized yet", 39, (const char *) "../../gcc/m2/gm2-libs/RTExceptions.mod", 38, (const char *) "GetBaseExceptionBlock", 21, 600); } else { return currentEHB; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/RTExceptions.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GRTint.cc b/gcc/m2/mc-boot/GRTint.cc index 8e83b1ff569d..236dbf4af651 100644 --- a/gcc/m2/mc-boot/GRTint.cc +++ b/gcc/m2/mc-boot/GRTint.cc @@ -585,7 +585,7 @@ static bool activatePending (bool untilInterrupt, RTint_DispatchVector call, uns default: - CaseException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); + CaseException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } vec = vec->pending; @@ -698,7 +698,7 @@ extern "C" unsigned int RTint_InitOutputVector (int fd, unsigned int pri) RTco_signal (lock); return vptr->no; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } @@ -755,7 +755,7 @@ extern "C" void RTint_ReArmTimeVector (unsigned int vec, unsigned int micro, uns vptr = FindVectorNo (vec); if (vptr == NULL) { - M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "ReArmTimeVector", 15, 287); + M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "ReArmTimeVector", 15, 287); } else { @@ -780,7 +780,7 @@ extern "C" void RTint_GetTimeVector (unsigned int vec, unsigned int *micro, unsi vptr = FindVectorNo (vec); if (vptr == NULL) { - M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "GetTimeVector", 13, 313); + M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "GetTimeVector", 13, 313); } else { @@ -806,7 +806,7 @@ extern "C" void * RTint_AttachVector (unsigned int vec, void * ptr) vptr = FindVectorNo (vec); if (vptr == NULL) { - M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "AttachVector", 12, 340); + M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "AttachVector", 12, 340); } else { @@ -820,7 +820,7 @@ extern "C" void * RTint_AttachVector (unsigned int vec, void * ptr) RTco_signal (lock); return prevArg; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } @@ -845,7 +845,7 @@ extern "C" void RTint_IncludeVector (unsigned int vec) vptr = FindVectorNo (vec); if (vptr == NULL) { - M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "IncludeVector", 13, 374); + M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "IncludeVector", 13, 374); } else { @@ -891,7 +891,7 @@ extern "C" void RTint_ExcludeVector (unsigned int vec) vptr = FindPendingVector (vec); if (vptr == NULL) { - M2RTS_Halt ((const char *) "cannot find pending vector supplied", 35, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "ExcludeVector", 13, 416); + M2RTS_Halt ((const char *) "cannot find pending vector supplied", 35, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "ExcludeVector", 13, 416); } else { @@ -989,7 +989,7 @@ extern "C" void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, un default: - CaseException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); + CaseException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } vec = vec->pending; @@ -1002,7 +1002,7 @@ extern "C" void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, un } if ((untilInterrupt && (((inSet == NULL) && (outSet == NULL)) || (maxFd == -1))) && ! found) { - M2RTS_Halt ((const char *) "deadlock found, no more processes to run and no interrupts active", 65, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "Listen", 6, 733); + M2RTS_Halt ((const char *) "deadlock found, no more processes to run and no interrupts active", 65, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "Listen", 6, 733); } /* printf('} ') ; */ diff --git a/gcc/m2/mc-boot/GSArgs.cc b/gcc/m2/mc-boot/GSArgs.cc index d69c47d46280..3424fbcc9988 100644 --- a/gcc/m2/mc-boot/GSArgs.cc +++ b/gcc/m2/mc-boot/GSArgs.cc @@ -85,13 +85,15 @@ extern "C" unsigned int SArgs_Narg (void); extern "C" bool SArgs_GetArg (DynamicStrings_String *s, unsigned int n) { int i; + void * a; SArgs_PtrToPtrToChar ppc; i = (int ) (n); if (i < (UnixArgs_GetArgC ())) { - /* ppc := ADDRESS (VAL (PtrToPtrToChar, ArgV) + (i * CARDINAL (TSIZE(PtrToChar)))) ; */ - ppc = static_cast ((void *) (((SArgs_PtrToChar) (UnixArgs_GetArgV ()))+(n*sizeof (SArgs_PtrToChar)))); + a = (void *) (UnixArgs_GetArgV ()); + a = reinterpret_cast (reinterpret_cast (a)+n*sizeof (SArgs_PtrToChar)); + ppc = static_cast (a); (*s) = DynamicStrings_InitStringCharStar (reinterpret_cast ((*ppc))); return true; } diff --git a/gcc/m2/mc-boot/GStdIO.cc b/gcc/m2/mc-boot/GStdIO.cc index b3ab5c90ecaa..bf25ba25ee35 100644 --- a/gcc/m2/mc-boot/GStdIO.cc +++ b/gcc/m2/mc-boot/GStdIO.cc @@ -194,7 +194,7 @@ extern "C" StdIO_ProcWrite StdIO_GetCurrentOutput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } @@ -253,7 +253,7 @@ extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GStringConvert.cc b/gcc/m2/mc-boot/GStringConvert.cc index 4178d8910fe1..5d07bd133bab 100644 --- a/gcc/m2/mc-boot/GStringConvert.cc +++ b/gcc/m2/mc-boot/GStringConvert.cc @@ -1915,7 +1915,7 @@ extern "C" DynamicStrings_String StringConvert_ToSigFig (DynamicStrings_String s int point; unsigned int poTen; - Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/StringConvert.mod", 54, 1220, (const char *) "ToSigFig", 8); + Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc/m2/gm2-libs/StringConvert.mod", 39, 1220, (const char *) "ToSigFig", 8); point = DynamicStrings_Index (s, '.', 0); if (point < 0) { @@ -1967,7 +1967,7 @@ extern "C" DynamicStrings_String StringConvert_ToDecimalPlaces (DynamicStrings_S { int point; - Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/StringConvert.mod", 54, 1069, (const char *) "ToDecimalPlaces", 15); + Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc/m2/gm2-libs/StringConvert.mod", 39, 1069, (const char *) "ToDecimalPlaces", 15); point = DynamicStrings_Index (s, '.', 0); if (point < 0) { diff --git a/gcc/m2/mc-boot/GSysStorage.cc b/gcc/m2/mc-boot/GSysStorage.cc index b5c22752eff2..d1d958df7792 100644 --- a/gcc/m2/mc-boot/GSysStorage.cc +++ b/gcc/m2/mc-boot/GSysStorage.cc @@ -94,7 +94,7 @@ extern "C" void SysStorage_ALLOCATE (void * *a, unsigned int size) (*a) = libc_malloc (static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "ALLOCATE", 8, 51); + Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "ALLOCATE", 8, 51); } if (enableTrace && trace) { @@ -119,7 +119,7 @@ extern "C" void SysStorage_DEALLOCATE (void * *a, unsigned int size) } if ((libc_memset ((*a), 0, static_cast (size))) != (*a)) { - Debug_Halt ((const char *) "memset should have returned the first parameter", 47, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "DEALLOCATE", 10, 78); + Debug_Halt ((const char *) "memset should have returned the first parameter", 47, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "DEALLOCATE", 10, 78); } } if (enableDeallocation) @@ -164,7 +164,7 @@ extern "C" void SysStorage_REALLOCATE (void * *a, unsigned int size) (*a) = libc_realloc ((*a), static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "REALLOCATE", 10, 122); + Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "REALLOCATE", 10, 122); } if (enableTrace && trace) { diff --git a/gcc/m2/mc-boot/Gdecl.cc b/gcc/m2/mc-boot/Gdecl.cc index f96d2f99a94c..654cb0f3120c 100644 --- a/gcc/m2/mc-boot/Gdecl.cc +++ b/gcc/m2/mc-boot/Gdecl.cc @@ -2781,7 +2781,7 @@ extern "C" int libc_dup (int d); extern "C" int libc_close (int d); extern "C" int libc_open (void * filename, int oflag, ...); extern "C" int libc_creat (void * filename, unsigned int mode); -extern "C" long int libc_lseek (int fd, long int offset, int whence); +extern "C" ssize_t libc_lseek (int fd, ssize_t offset, int whence); extern "C" void libc_perror (const char *string_, unsigned int _string_high); extern "C" int libc_readv (int fd, void * v, int n); extern "C" int libc_writev (int fd, void * v, int n); @@ -6705,7 +6705,7 @@ static decl_node newNode (decl_nodeT k) d->at.firstUsed = 0; return d; } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -7065,7 +7065,7 @@ static decl_node addToScope (decl_node n) } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -7143,7 +7143,7 @@ static void setUnary (decl_node u, decl_nodeT k, decl_node a, decl_node t) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -7426,7 +7426,7 @@ static void putFieldVarient (decl_node f, decl_node v) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } switch (f->kind) @@ -7437,7 +7437,7 @@ static void putFieldVarient (decl_node f, decl_node v) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -7488,7 +7488,7 @@ static decl_node putFieldRecord (decl_node r, nameKey_Name tag, decl_node type, default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* fill in, n. */ @@ -7546,7 +7546,7 @@ static void putVarientTag (decl_node v, decl_node tag) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -7570,7 +7570,7 @@ static decl_node getParent (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7598,7 +7598,7 @@ static decl_node getRecord (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7778,7 +7778,7 @@ static bool getConstExpComplete (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7883,7 +7883,7 @@ static decl_node makeVal (decl_node params) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -7904,7 +7904,7 @@ static decl_node makeCast (decl_node c, decl_node p) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -8414,7 +8414,7 @@ static decl_node makeUnary (decl_nodeT k, decl_node e, decl_node res) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -8508,7 +8508,7 @@ static DynamicStrings_String getStringContents (decl_node n) } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -8644,7 +8644,7 @@ static decl_node doMakeBinary (decl_nodeT k, decl_node l, decl_node r, decl_node default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } return n; @@ -9244,12 +9244,12 @@ static decl_node doGetExprType (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -9388,12 +9388,12 @@ static decl_node getSymScope (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -9705,7 +9705,7 @@ static bool needsParen (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } return true; @@ -9814,7 +9814,7 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -9840,7 +9840,7 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -10118,7 +10118,7 @@ static decl_node doGetLastOp (decl_node a, decl_node b) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -10772,7 +10772,7 @@ static void doExprC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -10977,7 +10977,7 @@ static void doExprM2 (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -11149,7 +11149,7 @@ static DynamicStrings_String replaceChar (DynamicStrings_String s, char ch, cons return s; } } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -11209,7 +11209,7 @@ static unsigned int countChar (DynamicStrings_String s, char ch) return c; } } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -12268,7 +12268,7 @@ static decl_node doMin (decl_node n) M2RTS_HALT (-1); /* finish the cacading elsif statement. */ __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -12349,7 +12349,7 @@ static decl_node doMax (decl_node n) M2RTS_HALT (-1); /* finish the cacading elsif statement. */ __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -12655,7 +12655,7 @@ static void doBaseC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } mcPretty_setNeedSpace (p); @@ -12745,7 +12745,7 @@ static void doSystemC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -16099,7 +16099,7 @@ static void doCreal (mcPretty_pretty p, decl_node t) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -16130,7 +16130,7 @@ static void doCimag (mcPretty_pretty p, decl_node t) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -16261,7 +16261,7 @@ static void doIntrinsicC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } outText (p, (const char *) ";", 1); @@ -17437,7 +17437,7 @@ static void dbs (decl_dependentState s, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } if (n != NULL) @@ -18330,10 +18330,10 @@ static decl_dependentState doDependants (alists_alist l, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -18430,7 +18430,7 @@ static void visitIntrinsicFunction (alists_alist v, decl_node n, decl_nodeProced default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -19429,7 +19429,7 @@ static void visitDependants (alists_alist v, decl_node n, decl_nodeProcedure p) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -19776,12 +19776,12 @@ static DynamicStrings_String genKind (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -20956,7 +20956,7 @@ static void doBaseM2 (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } mcPretty_setNeedSpace (p); @@ -20982,7 +20982,7 @@ static void doSystemM2 (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22193,10 +22193,10 @@ static decl_node doDupExpr (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -22526,7 +22526,7 @@ extern "C" bool decl_isVisited (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -22556,7 +22556,7 @@ extern "C" void decl_unsetVisited (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22584,7 +22584,7 @@ extern "C" void decl_setVisited (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22612,7 +22612,7 @@ extern "C" void decl_setEnumsComplete (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22640,7 +22640,7 @@ extern "C" bool decl_getEnumsComplete (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -22861,7 +22861,7 @@ extern "C" decl_node decl_lookupInScope (decl_node scope, nameKey_Name n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -23236,12 +23236,12 @@ extern "C" decl_node decl_getType (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -23635,7 +23635,7 @@ extern "C" decl_node decl_getScope (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -24290,7 +24290,7 @@ extern "C" decl_node decl_makeVarient (decl_node r) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } return n; @@ -24743,6 +24743,10 @@ extern "C" nameKey_Name decl_getSymName (decl_node n) return nameKey_makeKey ((const char *) "MIN", 3); break; + case decl_pointerref: + return nameKey_NulName; + break; + case decl_funccall: return nameKey_NulName; break; @@ -24757,7 +24761,7 @@ extern "C" nameKey_Name decl_getSymName (decl_node n) __builtin_unreachable (); break; } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -24795,7 +24799,7 @@ extern "C" decl_node decl_import (decl_node m, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } importEnumFields (m, n); @@ -24924,7 +24928,7 @@ extern "C" void decl_setSource (decl_node n, nameKey_Name s) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -24952,7 +24956,7 @@ extern "C" nameKey_Name decl_getSource (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -25395,7 +25399,7 @@ extern "C" void decl_addParameter (decl_node proc, decl_node param) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -25488,7 +25492,7 @@ extern "C" decl_node decl_makeBinaryTok (mcReserved_toktype op, decl_node l, dec M2RTS_HALT (-1); /* most likely op needs a clause as above. */ __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -25520,7 +25524,7 @@ extern "C" decl_node decl_makeUnaryTok (mcReserved_toktype op, decl_node e) M2RTS_HALT (-1); /* most likely op needs a clause as above. */ __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -25958,7 +25962,7 @@ extern "C" void decl_setConstExpComplete (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -26323,7 +26327,7 @@ extern "C" void decl_putBegin (decl_node b, decl_node s) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -26350,7 +26354,7 @@ extern "C" void decl_putFinally (decl_node b, decl_node s) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -26978,7 +26982,7 @@ extern "C" void decl_out (void) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } closeOutput (); diff --git a/gcc/m2/mc-boot/Gkeyc.cc b/gcc/m2/mc-boot/Gkeyc.cc index 24744ff0330d..0deb633d6b44 100644 --- a/gcc/m2/mc-boot/Gkeyc.cc +++ b/gcc/m2/mc-boot/Gkeyc.cc @@ -928,7 +928,7 @@ static bool mangleN (nameKey_Name n, DynamicStrings_String *m, bool scopes) return true; } } - ReturnException ("../../gcc-read-write/gcc/m2/mc/keyc.def", 20, 1); + ReturnException ("../../gcc/m2/mc/keyc.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/Glibc.h b/gcc/m2/mc-boot/Glibc.h index 9b3e005f3665..382b737e4b8f 100644 --- a/gcc/m2/mc-boot/Glibc.h +++ b/gcc/m2/mc-boot/Glibc.h @@ -192,7 +192,7 @@ EXTERN int libc_creat (void * filename, unsigned int mode); off_t lseek(int fildes, off_t offset, int whence); */ -EXTERN long int libc_lseek (int fd, long int offset, int whence); +EXTERN ssize_t libc_lseek (int fd, ssize_t offset, int whence); /* perror - writes errno and string. (ARRAY OF CHAR is translated onto ADDRESS). diff --git a/gcc/m2/mc-boot/GmcComment.cc b/gcc/m2/mc-boot/GmcComment.cc index c1a14c81a65f..f17fb19a8e65 100644 --- a/gcc/m2/mc-boot/GmcComment.cc +++ b/gcc/m2/mc-boot/GmcComment.cc @@ -258,7 +258,7 @@ static void dumpComment (mcComment_commentDesc cd) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/mcComment.def", 20, 1); + CaseException ("../../gcc/m2/mc/mcComment.def", 20, 1); __builtin_unreachable (); } if (cd->used) diff --git a/gcc/m2/mc-boot/GmcComp.cc b/gcc/m2/mc-boot/GmcComp.cc index 70b1a7102ddf..33c8201d8ad4 100644 --- a/gcc/m2/mc-boot/GmcComp.cc +++ b/gcc/m2/mc-boot/GmcComp.cc @@ -295,7 +295,7 @@ static decl_node examineCompilationUnit (void) } mcflex_mcError (DynamicStrings_string (DynamicStrings_InitString ((const char *) "failed to find module name", 26))); libc_exit (1); - ReturnException ("../../gcc-read-write/gcc/m2/mc/mcComp.def", 20, 1); + ReturnException ("../../gcc/m2/mc/mcComp.def", 20, 1); __builtin_unreachable (); } @@ -325,7 +325,7 @@ static decl_node peepInto (DynamicStrings_String s) mcPrintf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &s, (sizeof (s)-1)); libc_exit (1); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/mcComp.def", 20, 1); + ReturnException ("../../gcc/m2/mc/mcComp.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GmcDebug.cc b/gcc/m2/mc-boot/GmcDebug.cc index 0d134b658e87..f89195931993 100644 --- a/gcc/m2/mc-boot/GmcDebug.cc +++ b/gcc/m2/mc-boot/GmcDebug.cc @@ -55,7 +55,7 @@ extern "C" void mcDebug_assert (bool q) { if (! q) { - mcError_internalError ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/mc/mcDebug.mod", 42, 35); + mcError_internalError ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/mc/mcDebug.mod", 27, 35); } } diff --git a/gcc/m2/mc-boot/GmcMetaError.cc b/gcc/m2/mc-boot/GmcMetaError.cc index 32f6efa50f4a..b4f483bdb187 100644 --- a/gcc/m2/mc-boot/GmcMetaError.cc +++ b/gcc/m2/mc-boot/GmcMetaError.cc @@ -409,7 +409,7 @@ static void internalFormat (DynamicStrings_String s, int i, const char *m_, unsi s = DynamicStrings_ConCatChar (s, '^'); s = SFIO_WriteS (FIO_StdOut, s); FIO_WriteLine (FIO_StdOut); - mcError_internalError ((const char *) m, _m_high, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 97); + mcError_internalError ((const char *) m, _m_high, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 97); } @@ -421,7 +421,7 @@ static DynamicStrings_String x (DynamicStrings_String a, DynamicStrings_String b { if (a != b) { - mcError_internalError ((const char *) "different string returned", 25, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 109); + mcError_internalError ((const char *) "different string returned", 25, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 109); } return a; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -735,7 +735,7 @@ static mcError_error doError (mcError_error e, mcMetaError_errorType t, unsigned case mcMetaError_chained: if (e == NULL) { - mcError_internalError ((const char *) "should not be chaining an error onto an empty error note", 56, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 355); + mcError_internalError ((const char *) "should not be chaining an error onto an empty error note", 56, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 355); } else { @@ -759,7 +759,7 @@ static mcError_error doError (mcError_error e, mcMetaError_errorType t, unsigned default: - mcError_internalError ((const char *) "unexpected enumeration value", 28, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 369); + mcError_internalError ((const char *) "unexpected enumeration value", 28, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 369); break; } return e; diff --git a/gcc/m2/mc-boot/GmcStack.cc b/gcc/m2/mc-boot/GmcStack.cc index b08e9185a171..c35fef32f112 100644 --- a/gcc/m2/mc-boot/GmcStack.cc +++ b/gcc/m2/mc-boot/GmcStack.cc @@ -166,7 +166,7 @@ extern "C" void * mcStack_pop (mcStack_stack s) Indexing_DeleteIndice (s->list, Indexing_HighIndice (s->list)); return a; } - ReturnException ("../../gcc-read-write/gcc/m2/mc/mcStack.def", 20, 1); + ReturnException ("../../gcc/m2/mc/mcStack.def", 20, 1); __builtin_unreachable (); } @@ -216,7 +216,7 @@ extern "C" void * mcStack_access (mcStack_stack s, unsigned int i) { return Indexing_GetIndice (s->list, i); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/mcStack.def", 20, 1); + ReturnException ("../../gcc/m2/mc/mcStack.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GmcStream.cc b/gcc/m2/mc-boot/GmcStream.cc index 81597b65a336..baf301aff61d 100644 --- a/gcc/m2/mc-boot/GmcStream.cc +++ b/gcc/m2/mc-boot/GmcStream.cc @@ -181,10 +181,19 @@ static void copy (mcStream_ptrToFile p) s = DynamicStrings_InitStringCharStar (FIO_getFileName (f)); FIO_Close (f); f = SFIO_OpenToRead (s); - while (! (FIO_EOF (f))) + while ((! (FIO_EOF (f))) && (FIO_IsNoError (f))) { b = FIO_ReadNBytes (f, maxBuffer, &buffer); - b = FIO_WriteNBytes (destFile, b, &buffer); + if (FIO_IsNoError (f)) + { + b = FIO_WriteNBytes (destFile, b, &buffer); + } + else if (! (FIO_EOF (f))) + { + /* avoid dangling else. */ + libc_printf ((const char *) "mcStream.mod:copy: error seen when reading file fragment: %s\\n", 62, DynamicStrings_string (s)); + libc_exit (1); + } } FIO_Close (f); } diff --git a/gcc/m2/mc-boot/GnameKey.cc b/gcc/m2/mc-boot/GnameKey.cc index 322a6c495796..2b236667ea1b 100644 --- a/gcc/m2/mc-boot/GnameKey.cc +++ b/gcc/m2/mc-boot/GnameKey.cc @@ -324,7 +324,7 @@ extern "C" nameKey_Name nameKey_makeKey (const char *a_, unsigned int _a_high) (*p) = ASCII_nul; return doMakeKey (n, higha); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/nameKey.def", 20, 1); + ReturnException ("../../gcc/m2/mc/nameKey.def", 20, 1); __builtin_unreachable (); } @@ -374,7 +374,7 @@ extern "C" nameKey_Name nameKey_makekey (void * a) return doMakeKey (n, higha); } } - ReturnException ("../../gcc-read-write/gcc/m2/mc/nameKey.def", 20, 1); + ReturnException ("../../gcc/m2/mc/nameKey.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GsymbolKey.cc b/gcc/m2/mc-boot/GsymbolKey.cc index 8b01133bae08..8a396ef1bac0 100644 --- a/gcc/m2/mc-boot/GsymbolKey.cc +++ b/gcc/m2/mc-boot/GsymbolKey.cc @@ -143,7 +143,7 @@ static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, sym (*father) = t; if (t == NULL) { - Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc-read-write/gcc/m2/mc/symbolKey.mod", 44, (const char *) "findNodeAndParentInTree", 23, 203); + Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc/m2/mc/symbolKey.mod", 29, (const char *) "findNodeAndParentInTree", 23, 203); } (*child) = t->left; if ((*child) != NULL) @@ -286,7 +286,7 @@ extern "C" void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name, } else { - Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc-read-write/gcc/m2/mc/symbolKey.mod", 44, (const char *) "putSymKey", 9, 119); + Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc/m2/mc/symbolKey.mod", 29, (const char *) "putSymKey", 9, 119); } } @@ -353,7 +353,7 @@ extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name) } else { - Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, (const char *) "../../gcc-read-write/gcc/m2/mc/symbolKey.mod", 44, (const char *) "delSymKey", 9, 186); + Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, (const char *) "../../gcc/m2/mc/symbolKey.mod", 29, (const char *) "delSymKey", 9, 186); } } diff --git a/gcc/m2/mc-boot/Gvarargs.cc b/gcc/m2/mc-boot/Gvarargs.cc index 22aef2b39602..23bd7cd1644b 100644 --- a/gcc/m2/mc-boot/Gvarargs.cc +++ b/gcc/m2/mc-boot/Gvarargs.cc @@ -213,7 +213,8 @@ extern "C" varargs_vararg varargs_copy (varargs_vararg v) for (j=0; j<=c->nArgs; j++) { offset = (unsigned int ) (((varargs_ptrToByte) (v->contents))-((varargs_ptrToByte) (v->arg.array[j].ptr))); - c->arg.array[j].ptr = reinterpret_cast ((varargs_ptrToByte) (((varargs_ptrToByte) (c->contents))+offset)); + c->arg.array[j].ptr = reinterpret_cast ((varargs_ptrToByte) (c->contents)); + c->arg.array[j].ptr = reinterpret_cast (reinterpret_cast (c->arg.array[j].ptr)+offset); c->arg.array[j].len = v->arg.array[j].len; } return c; diff --git a/gcc/m2/mc-boot/Gwrapc.h b/gcc/m2/mc-boot/Gwrapc.h index 0ab5a1dbb4f7..e4db1e2a99f3 100644 --- a/gcc/m2/mc-boot/Gwrapc.h +++ b/gcc/m2/mc-boot/Gwrapc.h @@ -118,6 +118,51 @@ EXTERN int wrapc_isfinitef (float x); */ EXTERN int wrapc_isfinitel (long double x); + +/* + isnan - provide non builtin alternative to the gcc builtin isnan. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnan (double x); + +/* + isnanf - provide non builtin alternative to the gcc builtin isnanf. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnanf (float x); + +/* + isnanl - provide non builtin alternative to the gcc builtin isnanl. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnanl (long double x); + +/* + SeekSet - return the system libc SEEK_SET value. +*/ + +EXTERN int wrapc_SeekSet (void); + +/* + SeekEnd - return the system libc SEEK_END value. +*/ + +EXTERN int wrapc_SeekEnd (void); + +/* + ReadOnly - return the system value of O_RDONLY. +*/ + +EXTERN unsigned int wrapc_ReadOnly (void); + +/* + WriteOnly - return the system value of O_WRONLY. +*/ + +EXTERN unsigned int wrapc_WriteOnly (void); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc/decl.mod b/gcc/m2/mc/decl.mod index 084942fbee18..3d1b57fb4aef 100644 --- a/gcc/m2/mc/decl.mod +++ b/gcc/m2/mc/decl.mod @@ -4243,6 +4243,7 @@ BEGIN im : RETURN makeKey ('IM') | max : RETURN makeKey ('MAX') | min : RETURN makeKey ('MIN') | + pointerref : RETURN NulName | funccall : RETURN NulName | identlist : RETURN NulName diff --git a/gcc/m2/mc/mcStream.mod b/gcc/m2/mc/mcStream.mod index 066d3acb05e7..b29045e1eece 100644 --- a/gcc/m2/mc/mcStream.mod +++ b/gcc/m2/mc/mcStream.mod @@ -22,8 +22,8 @@ along with GNU Modula-2; see the file COPYING3. If not see IMPLEMENTATION MODULE mcStream ; -FROM FIO IMPORT File, OpenToWrite, OpenToRead, EOF, ReadNBytes, WriteNBytes, Close, getFileName ; -FROM libc IMPORT unlink, printf, getpid ; +FROM FIO IMPORT File, OpenToWrite, OpenToRead, EOF, ReadNBytes, WriteNBytes, Close, getFileName, IsNoError ; +FROM libc IMPORT unlink, printf, getpid, exit ; FROM Indexing IMPORT InitIndex, InBounds, HighIndice, LowIndice, PutIndice, GetIndice, Index, ForeachIndiceInIndexDo ; FROM DynamicStrings IMPORT String, InitString, InitStringCharStar, string ; FROM FormatStrings IMPORT Sprintf2 ; @@ -134,9 +134,17 @@ BEGIN s := InitStringCharStar(getFileName (f)) ; Close (f) ; f := SFIO.OpenToRead (s) ; - WHILE NOT EOF (f) DO + WHILE (NOT EOF (f)) AND IsNoError (f) DO b := ReadNBytes (f, HIGH (buffer), ADR (buffer)) ; - b := WriteNBytes (destFile, b, ADR (buffer)) + IF IsNoError (f) + THEN + b := WriteNBytes (destFile, b, ADR (buffer)) + ELSIF NOT EOF (f) + THEN + printf ("mcStream.mod:copy: error seen when reading file fragment: %s\n", + string (s)) ; + exit (1) + END END ; Close (f) END diff --git a/gcc/m2/mc/varargs.mod b/gcc/m2/mc/varargs.mod index 7e4bcf35fe28..1a99f70a6736 100644 --- a/gcc/m2/mc/varargs.mod +++ b/gcc/m2/mc/varargs.mod @@ -108,7 +108,8 @@ BEGIN contents := memcpy (contents, v^.contents, size) ; FOR j := 0 TO nArgs DO offset := VAL (CARDINAL, VAL (ptrToByte, v^.contents) - VAL (ptrToByte, v^.arg[j].ptr)) ; - arg[j].ptr := VAL (ptrToByte, VAL (ptrToByte, contents) + offset) ; + arg[j].ptr := VAL (ptrToByte, contents) ; + INC (arg[j].ptr, offset) ; arg[j].len := v^.arg[j].len ; END END ; diff --git a/gcc/m2/pge-boot/GDynamicStrings.cc b/gcc/m2/pge-boot/GDynamicStrings.cc index 542c51596c6e..997802b3f844 100644 --- a/gcc/m2/pge-boot/GDynamicStrings.cc +++ b/gcc/m2/pge-boot/GDynamicStrings.cc @@ -190,6 +190,12 @@ extern "C" DynamicStrings_String DynamicStrings_ConCatChar (DynamicStrings_Strin extern "C" DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a, DynamicStrings_String b); +/* + ReplaceChar - returns string s after it has changed all occurances of from to to. +*/ + +extern "C" DynamicStrings_String DynamicStrings_ReplaceChar (DynamicStrings_String s, char from, char to); + /* Dup - duplicate a String, s, returning the copy of s. */ @@ -1222,7 +1228,7 @@ static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned (*c).next->contents.next = NULL; ConcatContents (&(*c).next->contents, (const char *) a, _a_high, h, o); AddDebugInfo ((*c).next); - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 722, (const char *) "ConcatContents", 14); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 722, (const char *) "ConcatContents", 14); } else { @@ -1320,7 +1326,7 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne AddDebugInfo ((*c).next); if (TraceOn) { - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 917, (const char *) "ConcatContentsAddress", 21); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 917, (const char *) "ConcatContentsAddress", 21); } } else @@ -1545,7 +1551,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsi AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 758, (const char *) "InitString", 10); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 758, (const char *) "InitString", 10); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1648,7 +1654,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a) AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 957, (const char *) "InitStringCharStar", 18); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 957, (const char *) "InitStringCharStar", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1673,7 +1679,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch) s = DynamicStrings_InitString ((const char *) &a.array[0], 1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 977, (const char *) "InitStringChar", 14); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 977, (const char *) "InitStringChar", 14); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1818,6 +1824,35 @@ extern "C" DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a, } +/* + ReplaceChar - returns string s after it has changed all occurances of from to to. +*/ + +extern "C" DynamicStrings_String DynamicStrings_ReplaceChar (DynamicStrings_String s, char from, char to) +{ + DynamicStrings_String t; + unsigned int i; + + t = s; + while (t != NULL) + { + i = 0; + while (i < t->contents.len) + { + if (t->contents.buf.array[i] == from) + { + t->contents.buf.array[i] = to; + } + i += 1; + } + t = t->contents.next; + } + return s; + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + + /* Dup - duplicate a String, s, returning the copy of s. */ @@ -1831,7 +1866,7 @@ extern "C" DynamicStrings_String DynamicStrings_Dup (DynamicStrings_String s) s = DynamicStrings_Assign (DynamicStrings_InitString ((const char *) "", 0), s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1173, (const char *) "Dup", 3); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1198, (const char *) "Dup", 3); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1853,7 +1888,7 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy a = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "", 0), a), b); if (TraceOn) { - a = AssignDebug (a, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1193, (const char *) "Add", 3); + a = AssignDebug (a, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1218, (const char *) "Add", 3); } return a; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1918,7 +1953,7 @@ extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a) t = DynamicStrings_InitStringCharStar (a); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1250, (const char *) "EqualCharStar", 13); + t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1275, (const char *) "EqualCharStar", 13); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1956,7 +1991,7 @@ extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char * t = DynamicStrings_InitString ((const char *) a, _a_high); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1280, (const char *) "EqualArray", 10); + t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1305, (const char *) "EqualArray", 10); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1994,7 +2029,7 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1312, (const char *) "Mult", 4); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1337, (const char *) "Mult", 4); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2073,7 +2108,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, AddDebugInfo (t->contents.next); if (TraceOn) { - t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1380, (const char *) "Slice", 5); + t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1405, (const char *) "Slice", 5); } } t = t->contents.next; @@ -2091,7 +2126,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, } if (TraceOn) { - d = AssignDebug (d, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1397, (const char *) "Slice", 5); + d = AssignDebug (d, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1422, (const char *) "Slice", 5); } return d; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2219,7 +2254,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveComment (DynamicStrings_St } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1509, (const char *) "RemoveComment", 13); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1534, (const char *) "RemoveComment", 13); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2244,7 +2279,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePrefix (DynamicString s = DynamicStrings_Slice (s, (int ) (i), 0); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1621, (const char *) "RemoveWhitePrefix", 17); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1646, (const char *) "RemoveWhitePrefix", 17); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2269,7 +2304,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePostfix (DynamicStrin s = DynamicStrings_Slice (s, 0, i+1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1643, (const char *) "RemoveWhitePostfix", 18); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1668, (const char *) "RemoveWhitePostfix", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2636,7 +2671,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool hal if (frameHead == NULL) { stop (); - M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, (const char *) "PopAllocationExemption", 22, 174); + M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, (const char *) "PopAllocationExemption", 22, 174); } else { diff --git a/gcc/m2/pge-boot/GDynamicStrings.h b/gcc/m2/pge-boot/GDynamicStrings.h index 4484df2f27c4..76f4cea6c819 100644 --- a/gcc/m2/pge-boot/GDynamicStrings.h +++ b/gcc/m2/pge-boot/GDynamicStrings.h @@ -124,6 +124,13 @@ EXTERN DynamicStrings_String DynamicStrings_ConCatChar (DynamicStrings_String a, EXTERN DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a, DynamicStrings_String b); +/* + ReplaceChar - returns string s after it has changed all + occurances of from to to. +*/ + +EXTERN DynamicStrings_String DynamicStrings_ReplaceChar (DynamicStrings_String s, char from, char to); + /* Dup - duplicate a String, s, returning the copy of s. */ diff --git a/gcc/m2/pge-boot/GFIO.cc b/gcc/m2/pge-boot/GFIO.cc index e9fbc1250319..3e56792f20f6 100644 --- a/gcc/m2/pge-boot/GFIO.cc +++ b/gcc/m2/pge-boot/GFIO.cc @@ -47,6 +47,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # include "GStorage.h" # include "Gmcrts.h" #include +# include #if defined(__cplusplus) # undef NULL # define NULL 0 @@ -59,22 +60,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # include "GStrLib.h" # include "GStorage.h" # include "GNumberIO.h" -# include "Glibc.h" # include "GIndexing.h" # include "GM2RTS.h" +# include "Glibc.h" +# include "Gwrapc.h" typedef unsigned int FIO_File; FIO_File FIO_StdErr; FIO_File FIO_StdOut; FIO_File FIO_StdIn; -# define SEEK_SET 0 -# define SEEK_END 2 -# define UNIXREADONLY 0 -# define UNIXWRITEONLY 1 -# define CreatePermissions 0666 # define MaxBufferLength (1024*16) # define MaxErrorString (1024*8) +# define CreatePermissions 0666 typedef struct FIO_NameInfo_r FIO_NameInfo; typedef struct FIO_buf_r FIO_buf; @@ -198,7 +196,7 @@ extern "C" void FIO_FlushBuffer (FIO_File f); extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * dest); /* - ReadAny - reads HIGH(a) bytes into, a. All input + ReadAny - reads HIGH (a) + 1 bytes into, a. All input is fully buffered, unlike ReadNBytes and thus is more suited to small reads. */ @@ -216,7 +214,7 @@ extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high) extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * src); /* - WriteAny - writes HIGH(a) bytes onto, file, f. All output + WriteAny - writes HIGH (a) + 1 bytes onto, file, f. All output is fully buffered, unlike WriteNBytes and thus is more suited to small writes. */ @@ -413,7 +411,7 @@ static int ReadFromBuffer (FIO_File f, void * a, unsigned int nBytes); Useful when performing small reads. */ -static int BufferedRead (FIO_File f, unsigned int nBytes, void * a); +static int BufferedRead (FIO_File f, unsigned int nBytes, void * dest); /* HandleEscape - translates @@ -476,7 +474,7 @@ static void SetEndOfLine (FIO_File f, char ch); Useful when performing small writes. */ -static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a); +static int BufferedWrite (FIO_File f, unsigned int nBytes, void * src); /* PreInitialize - preinitialize the file descriptor. @@ -559,7 +557,7 @@ static FIO_File GetNextFreeDescriptor (void) return f; /* create new slot */ } } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/FIO.def", 25, 1); __builtin_unreachable (); } @@ -676,12 +674,12 @@ static void ConnectToUnix (FIO_File f, bool towrite, bool newfile) } else { - fd->unixfd = libc_open (fd->name.address, UNIXWRITEONLY, 0); + fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_WriteOnly ()), 0); } } else { - fd->unixfd = libc_open (fd->name.address, UNIXREADONLY, 0); + fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_ReadOnly ()), 0); } if (fd->unixfd < 0) { @@ -812,11 +810,11 @@ static int ReadFromBuffer (FIO_File f, void * a, unsigned int nBytes) Useful when performing small reads. */ -static int BufferedRead (FIO_File f, unsigned int nBytes, void * a) +static int BufferedRead (FIO_File f, unsigned int nBytes, void * dest) { typedef unsigned char *BufferedRead__T3; - void * t; + void * src; int total; int n; BufferedRead__T3 p; @@ -838,7 +836,7 @@ static int BufferedRead (FIO_File f, unsigned int nBytes, void * a) if (nBytes == 1) { /* too expensive to call memcpy for 1 character */ - p = static_cast (a); + p = static_cast (dest); (*p) = static_cast ((*fd->buffer->contents).array[fd->buffer->position]); fd->buffer->left -= 1; /* remove consumed byte */ fd->buffer->position += 1; /* move onwards n byte */ @@ -848,13 +846,13 @@ static int BufferedRead (FIO_File f, unsigned int nBytes, void * a) else { n = Min (fd->buffer->left, nBytes); - t = fd->buffer->address; - t = reinterpret_cast (reinterpret_cast (t)+fd->buffer->position); - p = static_cast (libc_memcpy (a, t, static_cast (n))); + src = fd->buffer->address; + src = reinterpret_cast (reinterpret_cast (src)+fd->buffer->position); + p = static_cast (libc_memcpy (dest, src, static_cast (n))); fd->buffer->left -= n; /* remove consumed bytes */ fd->buffer->position += n; /* move onwards n bytes */ /* move onwards ready for direct reads */ - a = reinterpret_cast (reinterpret_cast (a)+n); + dest = reinterpret_cast (reinterpret_cast (dest)+n); nBytes -= n; /* reduce the amount for future direct */ /* read */ total += n; @@ -1239,11 +1237,11 @@ static void SetEndOfLine (FIO_File f, char ch) Useful when performing small writes. */ -static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a) +static int BufferedWrite (FIO_File f, unsigned int nBytes, void * src) { typedef unsigned char *BufferedWrite__T5; - void * t; + void * dest; int total; int n; BufferedWrite__T5 p; @@ -1265,7 +1263,7 @@ static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a) if (nBytes == 1) { /* too expensive to call memcpy for 1 character */ - p = static_cast (a); + p = static_cast (src); (*fd->buffer->contents).array[fd->buffer->position] = static_cast ((*p)); fd->buffer->left -= 1; /* reduce space */ fd->buffer->position += 1; /* move onwards n byte */ @@ -1275,13 +1273,13 @@ static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a) else { n = Min (fd->buffer->left, nBytes); - t = fd->buffer->address; - t = reinterpret_cast (reinterpret_cast (t)+fd->buffer->position); - p = static_cast (libc_memcpy (a, t, static_cast ((unsigned int ) (n)))); + dest = fd->buffer->address; + dest = reinterpret_cast (reinterpret_cast (dest)+fd->buffer->position); + p = static_cast (libc_memcpy (dest, src, static_cast ((unsigned int ) (n)))); fd->buffer->left -= n; /* remove consumed bytes */ fd->buffer->position += n; /* move onwards n bytes */ /* move ready for further writes */ - a = reinterpret_cast (reinterpret_cast (a)+n); + src = reinterpret_cast (reinterpret_cast (src)+n); nBytes -= n; /* reduce the amount for future writes */ total += n; /* reduce the amount for future writes */ } @@ -1689,7 +1687,7 @@ extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * /* - ReadAny - reads HIGH(a) bytes into, a. All input + ReadAny - reads HIGH (a) + 1 bytes into, a. All input is fully buffered, unlike ReadNBytes and thus is more suited to small reads. */ @@ -1697,7 +1695,7 @@ extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high) { CheckAccess (f, FIO_openedforread, false); - if ((BufferedRead (f, _a_high, a)) == ((int ) (_a_high))) + if ((BufferedRead (f, _a_high+1, a)) == ((int ) (_a_high+1))) { SetEndOfLine (f, static_cast (a[_a_high])); } @@ -1748,7 +1746,7 @@ extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * /* - WriteAny - writes HIGH(a) bytes onto, file, f. All output + WriteAny - writes HIGH (a) + 1 bytes onto, file, f. All output is fully buffered, unlike WriteNBytes and thus is more suited to small writes. */ @@ -1756,7 +1754,7 @@ extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * extern "C" void FIO_WriteAny (FIO_File f, unsigned char *a, unsigned int _a_high) { CheckAccess (f, FIO_openedforwrite, true); - if ((BufferedWrite (f, _a_high, a)) == ((int ) (_a_high))) + if ((BufferedWrite (f, _a_high+1, a)) == ((int ) (_a_high+1))) {} /* empty. */ } @@ -2096,7 +2094,7 @@ extern "C" void FIO_SetPositionFromBeginning (FIO_File f, long int pos) fd->buffer->position = 0; fd->buffer->filled = 0; } - offset = libc_lseek (fd->unixfd, pos, SEEK_SET); + offset = static_cast (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekSet ())); if ((offset >= 0) && (pos == offset)) { fd->abspos = pos; @@ -2145,7 +2143,7 @@ extern "C" void FIO_SetPositionFromEnd (FIO_File f, long int pos) fd->buffer->position = 0; fd->buffer->filled = 0; } - offset = libc_lseek (fd->unixfd, pos, SEEK_END); + offset = static_cast (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekEnd ())); if (offset >= 0) { fd->abspos = offset; diff --git a/gcc/m2/pge-boot/GFIO.h b/gcc/m2/pge-boot/GFIO.h index 8404d4b96e5a..d82396449ffe 100644 --- a/gcc/m2/pge-boot/GFIO.h +++ b/gcc/m2/pge-boot/GFIO.h @@ -135,7 +135,7 @@ EXTERN void FIO_FlushBuffer (FIO_File f); EXTERN unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * dest); /* - ReadAny - reads HIGH(a) bytes into, a. All input + ReadAny - reads HIGH (a) + 1 bytes into, a. All input is fully buffered, unlike ReadNBytes and thus is more suited to small reads. */ @@ -153,7 +153,7 @@ EXTERN void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high); EXTERN unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * src); /* - WriteAny - writes HIGH(a) bytes onto, file, f. All output + WriteAny - writes HIGH (a) + 1 bytes onto, file, f. All output is fully buffered, unlike WriteNBytes and thus is more suited to small writes. */ diff --git a/gcc/m2/pge-boot/GIO.cc b/gcc/m2/pge-boot/GIO.cc index 4e650c8e8846..7d391bb72ff6 100644 --- a/gcc/m2/pge-boot/GIO.cc +++ b/gcc/m2/pge-boot/GIO.cc @@ -286,12 +286,13 @@ static void dononraw (termios_TERMIOS term) static void Init (void) { - fdState.array[0].IsEof = false; - fdState.array[0].IsRaw = false; - fdState.array[1].IsEof = false; - fdState.array[1].IsRaw = false; - fdState.array[2].IsEof = false; - fdState.array[2].IsRaw = false; + unsigned int fdi; + + for (fdi=0; fdi<=MaxDefaultFd; fdi++) + { + fdState.array[fdi].IsEof = false; + fdState.array[fdi].IsRaw = false; + } } diff --git a/gcc/m2/pge-boot/GIndexing.cc b/gcc/m2/pge-boot/GIndexing.cc index 61973107192a..c898a2465987 100644 --- a/gcc/m2/pge-boot/GIndexing.cc +++ b/gcc/m2/pge-boot/GIndexing.cc @@ -228,7 +228,7 @@ extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n) { return (n >= i->Low) && (n <= i->High); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1); __builtin_unreachable (); } @@ -248,7 +248,7 @@ extern "C" unsigned int Indexing_HighIndice (Indexing_Index i) { return i->High; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1); __builtin_unreachable (); } @@ -268,7 +268,7 @@ extern "C" unsigned int Indexing_LowIndice (Indexing_Index i) { return i->Low; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GM2Dependent.cc b/gcc/m2/pge-boot/GM2Dependent.cc index a623a048d189..4a4492ad2924 100644 --- a/gcc/m2/pge-boot/GM2Dependent.cc +++ b/gcc/m2/pge-boot/GM2Dependent.cc @@ -137,6 +137,12 @@ extern "C" void M2Dependent_RegisterModule (void * modulename, void * libname, M extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname); +/* + InitDependencyList - initialize all fields of DependencyList. +*/ + +static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state); + /* CreateModule - creates a new module entry and returns the ModuleChain. @@ -357,6 +363,20 @@ static void Init (void); static void CheckInitialized (void); +/* + InitDependencyList - initialize all fields of DependencyList. +*/ + +static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state) +{ + (*depList).proc = proc; + (*depList).forced = false; + (*depList).forc = false; + (*depList).appl = false; + (*depList).state = state; +} + + /* CreateModule - creates a new module entry and returns the ModuleChain. @@ -371,8 +391,7 @@ static M2Dependent_ModuleChain CreateModule (void * name, void * libname, M2Depe mptr->libname = libname; mptr->init = init; mptr->fini = fini; - mptr->dependency.proc = dependencies; - mptr->dependency.state = M2Dependent_unregistered; + InitDependencyList (&mptr->dependency, dependencies, M2Dependent_unregistered); mptr->prev = NULL; mptr->next = NULL; if (HexTrace) diff --git a/gcc/m2/pge-boot/GM2EXCEPTION.cc b/gcc/m2/pge-boot/GM2EXCEPTION.cc index 43f1acbc6133..274f29a9553b 100644 --- a/gcc/m2/pge-boot/GM2EXCEPTION.cc +++ b/gcc/m2/pge-boot/GM2EXCEPTION.cc @@ -57,13 +57,13 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void) n = RTExceptions_GetNumber (e); if (n == (UINT_MAX)) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); } else { return (M2EXCEPTION_M2Exceptions) (n); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GNameKey.cc b/gcc/m2/pge-boot/GNameKey.cc index 9adf98497095..52b90a03cf67 100644 --- a/gcc/m2/pge-boot/GNameKey.cc +++ b/gcc/m2/pge-boot/GNameKey.cc @@ -331,7 +331,7 @@ extern "C" NameKey_Name NameKey_MakeKey (const char *a_, unsigned int _a_high) (*p) = ASCII_nul; return DoMakeKey (n, higha); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-compiler/NameKey.def", 20, 1); + ReturnException ("../../gcc/m2/gm2-compiler/NameKey.def", 20, 1); __builtin_unreachable (); } @@ -381,7 +381,7 @@ extern "C" NameKey_Name NameKey_makekey (void * a) return DoMakeKey (n, higha); } } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-compiler/NameKey.def", 20, 1); + ReturnException ("../../gcc/m2/gm2-compiler/NameKey.def", 20, 1); __builtin_unreachable (); } @@ -421,12 +421,15 @@ extern "C" unsigned int NameKey_LengthKey (NameKey_Name Key) unsigned int i; NameKey_PtrToChar p; - p = static_cast (NameKey_KeyToCharStar (Key)); i = 0; - while ((*p) != ASCII_nul) + if (Key != NameKey_NulName) { - i += 1; - p += 1; + p = static_cast (NameKey_KeyToCharStar (Key)); + while ((*p) != ASCII_nul) + { + i += 1; + p += 1; + } } return i; /* static analysis guarentees a RETURN statement will be used before here. */ diff --git a/gcc/m2/pge-boot/GPushBackInput.cc b/gcc/m2/pge-boot/GPushBackInput.cc index e0da0cbe1591..6fb0fbea9d30 100644 --- a/gcc/m2/pge-boot/GPushBackInput.cc +++ b/gcc/m2/pge-boot/GPushBackInput.cc @@ -276,7 +276,7 @@ extern "C" char PushBackInput_PutCh (char ch) } else { - Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutCh", 5, 151); + Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutCh", 5, 151); } return ch; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -302,7 +302,7 @@ extern "C" void PushBackInput_PutString (const char *a_, unsigned int _a_high) l -= 1; if ((PushBackInput_PutCh (a[l])) != a[l]) { - Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutString", 9, 132); + Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutString", 9, 132); } } } @@ -323,7 +323,7 @@ extern "C" void PushBackInput_PutStr (DynamicStrings_String s) i -= 1; if ((PushBackInput_PutCh (DynamicStrings_char (s, static_cast (i)))) != (DynamicStrings_char (s, static_cast (i)))) { - Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutStr", 6, 113); + Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutStr", 6, 113); } } } diff --git a/gcc/m2/pge-boot/GRTExceptions.cc b/gcc/m2/pge-boot/GRTExceptions.cc index d4d0b1c1d88a..2b6557eb7be9 100644 --- a/gcc/m2/pge-boot/GRTExceptions.cc +++ b/gcc/m2/pge-boot/GRTExceptions.cc @@ -725,7 +725,7 @@ static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h) static void indexf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); } @@ -735,7 +735,7 @@ static void indexf (void * a) static void range (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); } @@ -745,7 +745,7 @@ static void range (void * a) static void casef (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); } @@ -755,7 +755,7 @@ static void casef (void * a) static void invalidloc (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); } @@ -765,7 +765,7 @@ static void invalidloc (void * a) static void function (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ } @@ -775,7 +775,7 @@ static void function (void * a) static void wholevalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -785,7 +785,7 @@ static void wholevalue (void * a) static void wholediv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -795,7 +795,7 @@ static void wholediv (void * a) static void realvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); } @@ -805,7 +805,7 @@ static void realvalue (void * a) static void realdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); } @@ -815,7 +815,7 @@ static void realdiv (void * a) static void complexvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); } @@ -825,7 +825,7 @@ static void complexvalue (void * a) static void complexdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); } @@ -835,7 +835,7 @@ static void complexdiv (void * a) static void protection (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); } @@ -845,7 +845,7 @@ static void protection (void * a) static void systemf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); } @@ -855,7 +855,7 @@ static void systemf (void * a) static void coroutine (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); } @@ -865,7 +865,7 @@ static void coroutine (void * a) static void exception (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); } @@ -1183,13 +1183,13 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void) { if (currentEHB == NULL) { - M2RTS_Halt ((const char *) "currentEHB has not been initialized yet", 39, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod", 53, (const char *) "GetBaseExceptionBlock", 21, 600); + M2RTS_Halt ((const char *) "currentEHB has not been initialized yet", 39, (const char *) "../../gcc/m2/gm2-libs/RTExceptions.mod", 38, (const char *) "GetBaseExceptionBlock", 21, 600); } else { return currentEHB; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/RTExceptions.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GStdIO.cc b/gcc/m2/pge-boot/GStdIO.cc index 24faf201e52d..cf02566757dc 100644 --- a/gcc/m2/pge-boot/GStdIO.cc +++ b/gcc/m2/pge-boot/GStdIO.cc @@ -192,7 +192,7 @@ extern "C" StdIO_ProcWrite StdIO_GetCurrentOutput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } @@ -251,7 +251,7 @@ extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GSymbolKey.cc b/gcc/m2/pge-boot/GSymbolKey.cc index d1495e4b3c18..5f22ae2be645 100644 --- a/gcc/m2/pge-boot/GSymbolKey.cc +++ b/gcc/m2/pge-boot/GSymbolKey.cc @@ -184,7 +184,7 @@ static void FindNodeParentInTree (SymbolKey_SymbolTree t, NameKey_Name n, Symbol (*parent) = t; if (t == NULL) { - Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54, (const char *) "FindNodeParentInTree", 20, 241); + Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc/m2/gm2-compiler/SymbolKey.mod", 39, (const char *) "FindNodeParentInTree", 20, 241); } Assertion_Assert (t->Right == NULL); (*child) = t->Left; @@ -393,7 +393,7 @@ extern "C" void SymbolKey_PutSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKe } else { - Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54, (const char *) "PutSymKey", 9, 156); + Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc/m2/gm2-compiler/SymbolKey.mod", 39, (const char *) "PutSymKey", 9, 156); } } @@ -460,7 +460,7 @@ extern "C" void SymbolKey_DelSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKe } else { - Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54, (const char *) "DelSymKey", 9, 223); + Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, (const char *) "../../gcc/m2/gm2-compiler/SymbolKey.mod", 39, (const char *) "DelSymKey", 9, 223); } } diff --git a/gcc/m2/pge-boot/GSysStorage.cc b/gcc/m2/pge-boot/GSysStorage.cc index 8b7bc115b068..9449a3e2b968 100644 --- a/gcc/m2/pge-boot/GSysStorage.cc +++ b/gcc/m2/pge-boot/GSysStorage.cc @@ -94,7 +94,7 @@ extern "C" void SysStorage_ALLOCATE (void * *a, unsigned int size) (*a) = libc_malloc (static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "ALLOCATE", 8, 51); + Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "ALLOCATE", 8, 51); } if (enableTrace && trace) { @@ -119,7 +119,7 @@ extern "C" void SysStorage_DEALLOCATE (void * *a, unsigned int size) } if ((libc_memset ((*a), 0, static_cast (size))) != (*a)) { - Debug_Halt ((const char *) "memset should have returned the first parameter", 47, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "DEALLOCATE", 10, 78); + Debug_Halt ((const char *) "memset should have returned the first parameter", 47, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "DEALLOCATE", 10, 78); } } if (enableDeallocation) @@ -164,7 +164,7 @@ extern "C" void SysStorage_REALLOCATE (void * *a, unsigned int size) (*a) = libc_realloc ((*a), static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "REALLOCATE", 10, 122); + Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "REALLOCATE", 10, 122); } if (enableTrace && trace) { diff --git a/gcc/m2/pge-boot/Glibc.h b/gcc/m2/pge-boot/Glibc.h index 9b3e005f3665..382b737e4b8f 100644 --- a/gcc/m2/pge-boot/Glibc.h +++ b/gcc/m2/pge-boot/Glibc.h @@ -192,7 +192,7 @@ EXTERN int libc_creat (void * filename, unsigned int mode); off_t lseek(int fildes, off_t offset, int whence); */ -EXTERN long int libc_lseek (int fd, long int offset, int whence); +EXTERN ssize_t libc_lseek (int fd, ssize_t offset, int whence); /* perror - writes errno and string. (ARRAY OF CHAR is translated onto ADDRESS). diff --git a/gcc/m2/pge-boot/Gwrapc.cc b/gcc/m2/pge-boot/Gwrapc.cc index 24a6f3583aba..41ceac8a0279 100644 --- a/gcc/m2/pge-boot/Gwrapc.cc +++ b/gcc/m2/pge-boot/Gwrapc.cc @@ -164,6 +164,38 @@ wrapc_signbitf (float r) #endif } +/* SeekSet return the system libc SEEK_SET value. */ + +int +wrapc_SeekSet (void) +{ + return SEEK_SET; +} + +/* SeekEnd return the system libc SEEK_END value. */ + +int +wrapc_SeekEnd (void) +{ + return SEEK_END; +} + +/* ReadOnly return the system value of O_RDONLY. */ + +int +wrapc_ReadOnly (void) +{ + return O_RDONLY; +} + +/* WriteOnly return the system value of O_WRONLY. */ + +int +wrapc_WriteOnly (void) +{ + return O_WRONLY; +} + /* init constructor for the module. */ void diff --git a/gcc/m2/pge-boot/Gwrapc.h b/gcc/m2/pge-boot/Gwrapc.h index 0ab5a1dbb4f7..e4db1e2a99f3 100644 --- a/gcc/m2/pge-boot/Gwrapc.h +++ b/gcc/m2/pge-boot/Gwrapc.h @@ -118,6 +118,51 @@ EXTERN int wrapc_isfinitef (float x); */ EXTERN int wrapc_isfinitel (long double x); + +/* + isnan - provide non builtin alternative to the gcc builtin isnan. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnan (double x); + +/* + isnanf - provide non builtin alternative to the gcc builtin isnanf. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnanf (float x); + +/* + isnanl - provide non builtin alternative to the gcc builtin isnanl. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnanl (long double x); + +/* + SeekSet - return the system libc SEEK_SET value. +*/ + +EXTERN int wrapc_SeekSet (void); + +/* + SeekEnd - return the system libc SEEK_END value. +*/ + +EXTERN int wrapc_SeekEnd (void); + +/* + ReadOnly - return the system value of O_RDONLY. +*/ + +EXTERN unsigned int wrapc_ReadOnly (void); + +/* + WriteOnly - return the system value of O_WRONLY. +*/ + +EXTERN unsigned int wrapc_WriteOnly (void); # ifdef __cplusplus } # endif diff --git a/libgm2/libm2pim/wrapc.cc b/libgm2/libm2pim/wrapc.cc index 4d9305090372..5c31f1e26870 100644 --- a/libgm2/libm2pim/wrapc.cc +++ b/libgm2/libm2pim/wrapc.cc @@ -59,6 +59,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include #endif +#ifdef HAVE_FCNTL_H +#include +#endif + /* Define a generic NULL if one hasn't already been defined. */ #if !defined(NULL) @@ -316,6 +320,39 @@ EXPORT(isnanl) (long double x) #endif } +/* SeekSet return the system libc SEEK_SET value. */ + +extern "C" int +EXPORT(SeekSet) (void) +{ + return SEEK_SET; +} + +/* SeekEnd return the system libc SEEK_END value. */ + +extern "C" int +EXPORT(SeekEnd) (void) +{ + return SEEK_END; +} + +/* ReadOnly return the system value of O_RDONLY. */ + +extern "C" int +EXPORT(ReadOnly) (void) +{ + return O_RDONLY; +} + +/* WriteOnly return the system value of O_WRONLY. */ + +extern "C" int +EXPORT(WriteOnly) (void) +{ + return O_WRONLY; +} + + /* GNU Modula-2 linking hooks. */ extern "C" void