From 19c5dfc29d83101e415590e778b99e7c37d9b730 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Tue, 14 Mar 2023 19:52:11 +0000 Subject: 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 --- libgm2/libm2iso/wrapsock.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'libgm2/libm2iso/wrapsock.c') diff --git a/libgm2/libm2iso/wrapsock.c b/libgm2/libm2iso/wrapsock.c index 1582f24..805271e 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 . */ #include "config.h" +#include #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). */ -- cgit v1.1