summaryrefslogtreecommitdiff
path: root/libgm2/libm2iso
diff options
context:
space:
mode:
authorGaius Mulley <gaiusmod2@gmail.com>2023-03-14 19:52:11 +0000
committerGaius Mulley <gaiusmod2@gmail.com>2023-03-14 19:52:11 +0000
commit19c5dfc29d83101e415590e778b99e7c37d9b730 (patch)
tree44a9e4b644d621b5083c029387285185ee5b5eba /libgm2/libm2iso
parent71b33f8fb8daa6a7a359f322b24365d9016438fc (diff)
downloadgcc-19c5dfc29d83101e415590e778b99e7c37d9b730.tar.gz
PR 109125 Modula2 SIGBUS in m2pim_ldtoa_ldtoa
13 regression failures seen on sparc SIGBUS in m2pim_ldtoa_ldtoa. This patch fixes int bool parameter mismatches between the definition modules and their C/C++ implementations. gcc/m2/ChangeLog: PR modula2/109125 * gm2-libs-ch/cgetopt.c (cgetopt_SetOption): Replace int for bool. * gm2-libs-ch/termios.c (doSetUnset): Replace int for bool. * gm2-libs/Builtins.mod (isfinitef): Correct typo in return statement. libgm2/ChangeLog: PR modula2/109125 * libm2iso/ErrnoCategory.cc (FALSE): Remove. (TRUE): Remove. * libm2iso/wrapsock.c (TRUE): Remove. (FALSE): Remove. * libm2iso/wraptime.cc (TRUE): Remove. (FALSE): Remove. * libm2pim/cgetopt.cc: Replace int for bool for every BOOLEAN parameter in the definition module. * libm2pim/dtoa.cc: Ditto. * libm2pim/ldtoa.cc: Ditto. * libm2pim/termios.cc: Ditto. (doSetUnset): Replace int for bool. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diffstat (limited to 'libgm2/libm2iso')
-rw-r--r--libgm2/libm2iso/ErrnoCategory.cc24
-rw-r--r--libgm2/libm2iso/wrapsock.c24
-rw-r--r--libgm2/libm2iso/wraptime.cc14
3 files changed, 20 insertions, 42 deletions
diff --git a/libgm2/libm2iso/ErrnoCategory.cc b/libgm2/libm2iso/ErrnoCategory.cc
index 55db89df30d..053c75bb11a 100644
--- a/libgm2/libm2iso/ErrnoCategory.cc
+++ b/libgm2/libm2iso/ErrnoCategory.cc
@@ -42,18 +42,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define M2LIBNAME "m2iso"
-#if !defined(FALSE)
-#define FALSE (1 == 0)
-#endif
-
-#if !defined(TRUE)
-#define TRUE (1 == 1)
-#endif
-
-/* IsErrnoHard - returns TRUE if the value of errno is associated
+/* IsErrnoHard returns true if the value of errno is associated
with a hard device error. */
-extern "C" int
+extern "C" bool
EXPORT(IsErrnoHard) (int e)
{
#if defined(HAVE_ERRNO_H) || defined(HAVE_SYS_ERRNO_H)
@@ -61,14 +53,14 @@ EXPORT(IsErrnoHard) (int e)
|| (e == EACCES) || (e == ENOTBLK) || (e == ENODEV) || (e == EINVAL)
|| (e == ENFILE) || (e == EROFS) || (e == EMLINK));
#else
- return FALSE;
+ return false;
#endif
}
-/* IsErrnoSoft - returns TRUE if the value of errno is associated
+/* IsErrnoSoft returns true if the value of errno is associated
with a soft device error. */
-extern "C" int
+extern "C" bool
EXPORT(IsErrnoSoft) (int e)
{
#if defined(HAVE_ERRNO_H) || defined(HAVE_SYS_ERRNO_H)
@@ -78,18 +70,18 @@ EXPORT(IsErrnoSoft) (int e)
|| (e == ENOTDIR) || (e == EISDIR) || (e == EMFILE) || (e == ENOTTY)
|| (e == ETXTBSY) || (e == EFBIG) || (e == ENOSPC) || (e == EPIPE));
#else
- return FALSE;
+ return false;
#endif
}
-extern "C" int
+extern "C" bool
EXPORT(UnAvailable) (int e)
{
#if defined(HAVE_ERRNO_H) || defined(HAVE_SYS_ERRNO_H)
return ((e == ENOENT) || (e == ESRCH) || (e == ENXIO) || (e == ECHILD)
|| (e == ENOTBLK) || (e == ENODEV) || (e == ENOTDIR));
#else
- return FALSE;
+ return false;
#endif
}
diff --git a/libgm2/libm2iso/wrapsock.c b/libgm2/libm2iso/wrapsock.c
index 1582f24c359..805271ef70d 100644
--- a/libgm2/libm2iso/wrapsock.c
+++ b/libgm2/libm2iso/wrapsock.c
@@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "config.h"
+#include <stdbool.h>
#define EXPORT(FUNC) m2iso ## _wrapsock_ ## FUNC
#define IMPORT(MODULE,FUNC) m2iso ## _ ## MODULE ## _ ## FUNC
@@ -88,13 +89,6 @@ extern void m2iso_M2RTS_RegisterModule (const char *modulename, const char *libn
#include "stdlib.h"
#endif
-#if !defined(TRUE)
-#define TRUE (1 == 1)
-#endif
-#if !defined(FALSE)
-#define FALSE (1 == 0)
-#endif
-
#include "ChanConsts.h"
#define MAXHOSTNAME 1024
@@ -213,32 +207,32 @@ EXPORT(getClientIP) (clientInfo *c)
return c->sa.sin_addr.s_addr;
}
-/* getPushBackChar - returns TRUE if a pushed back character is
+/* getPushBackChar returns true if a pushed back character is
available. */
-unsigned int
+bool
EXPORT(getPushBackChar) (clientInfo *c, char *ch)
{
if (c->hasChar > 0)
{
c->hasChar--;
*ch = c->pbChar[c->hasChar];
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-/* setPushBackChar - returns TRUE if it is able to push back a
+/* setPushBackChar returns true if it is able to push back a
character. */
-unsigned int
+bool
EXPORT(setPushBackChar) (clientInfo *c, char ch)
{
if (c->hasChar == MAXPBBUF)
- return FALSE;
+ return false;
c->pbChar[c->hasChar] = ch;
c->hasChar++;
- return TRUE;
+ return true;
}
/* getSizeOfClientInfo - returns the sizeof (opaque data type). */
diff --git a/libgm2/libm2iso/wraptime.cc b/libgm2/libm2iso/wraptime.cc
index 3cdc3856ef1..ffe85f17dca 100644
--- a/libgm2/libm2iso/wraptime.cc
+++ b/libgm2/libm2iso/wraptime.cc
@@ -51,14 +51,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "limits.h"
#endif
-#if !defined(TRUE)
-#define TRUE (1 == 1)
-#endif
-
-#if !defined(FALSE)
-#define FALSE (1 == 0)
-#endif
-
#if !defined(NULL)
#define NULL (void *)0
#endif
@@ -322,16 +314,16 @@ EXPORT(GetSecond) (void *m)
/* wraptime_GetSummerTime - returns true if summer time is in effect. */
#if defined(HAVE_STRUCT_TIMEZONE)
-extern "C" unsigned int
+extern "C" bool
EXPORT(GetSummerTime) (struct timezone *tz)
{
return tz->tz_dsttime != 0;
}
#else
-extern "C" unsigned int
+extern "C" bool
EXPORT(GetSummerTime) (void *tz)
{
- return FALSE;
+ return false;
}
#endif