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>
This commit is contained in:
Gaius Mulley 2023-03-14 19:52:11 +00:00
parent 71b33f8fb8
commit 19c5dfc29d
10 changed files with 786 additions and 807 deletions

View file

@ -120,7 +120,7 @@ cgetopt_KillOptions (cgetopt_Options *o)
void
cgetopt_SetOption (cgetopt_Options *o, unsigned int index,
char *name, unsigned int has_arg,
char *name, bool has_arg,
int *flag, int val)
{
if (index > o->high)

File diff suppressed because it is too large Load diff

View file

@ -59,7 +59,7 @@ END memcpy ;
PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_isfinite)) isfinitef (x: SHORTREAL) : INTEGER ;
BEGIN
RETURN wrapc.isfinitef
RETURN wrapc.isfinitef (x)
END isfinitef ;
PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_isfinite)) isfinite (x: REAL) : INTEGER ;

View file

@ -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
}

View file

@ -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). */

View file

@ -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

View file

@ -113,7 +113,7 @@ EXPORT(KillOptions) (cgetopt_Options *o)
extern "C" void
EXPORT(SetOption) (cgetopt_Options *o, unsigned int index, char *name,
unsigned int has_arg, int *flag, int val)
bool has_arg, int *flag, int val)
{
if (index > o->high)
{

View file

@ -198,20 +198,20 @@ EXPORT(calcdecimal) (char *p, int str_size, int ndigits)
return x;
}
extern "C" int
extern "C" bool
EXPORT(calcsign) (char *p, int str_size)
{
if (p[0] == '-')
{
memmove (p, p + 1, str_size - 1);
return TRUE;
return true;
}
else
return FALSE;
return false;
}
extern "C" char *
EXPORT(dtoa) (double d, int mode, int ndigits, int *decpt, int *sign)
EXPORT(dtoa) (double d, int mode, int ndigits, int *decpt, bool *sign)
{
char format[50];
char *p;

View file

@ -139,7 +139,7 @@ EXPORT(strtold) (const char *s, int *error)
}
extern "C" char *
EXPORT(ldtoa) (long double d, int mode, int ndigits, int *decpt, int *sign)
EXPORT(ldtoa) (long double d, int mode, int ndigits, int *decpt, bool *sign)
{
char format[50];
char *p;

File diff suppressed because it is too large Load diff