summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaius Mulley <gaiusmod2@gmail.com>2023-05-13 15:49:50 +0100
committerGaius Mulley <gaiusmod2@gmail.com>2023-05-13 15:49:50 +0100
commit2415442489d35a70953e11ac723452f39eb06e26 (patch)
tree647137763f12302c373683bffdedd5284be2180d
parent8b18714fbb1ca9812b33b3de75fe6ba4a57d4946 (diff)
downloadgcc-2415442489d35a70953e11ac723452f39eb06e26.tar.gz
Replace bool as boolean instead of int in libgm2
This patch tidies KeyBoardLEDs.cc, RTco.cc, sckt.cc and wrapc.cc by removing the TRUE/FALSE macros and using bool, true and false. libgm2/ChangeLog: * libm2cor/KeyBoardLEDs.cc (TRUE): Remove. (FALSE): Remove. (init): Replace TRUE with true. * libm2iso/RTco.cc (TRUE): Remove. (FALSE): Remove. (initSem): Replace int with bool. (init): Replace FALSE with false. * libm2pim/sckt.cc (TRUE): Remove. (FALSE): Remove. * libm2pim/wrapc.cc: Replace TRUE with true and FALSE with false. (FALSE): Remove. (TRUE): Remove. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
-rw-r--r--libgm2/libm2cor/KeyBoardLEDs.cc11
-rw-r--r--libgm2/libm2iso/RTco.cc20
-rw-r--r--libgm2/libm2pim/sckt.cc7
-rw-r--r--libgm2/libm2pim/wrapc.cc18
4 files changed, 14 insertions, 42 deletions
diff --git a/libgm2/libm2cor/KeyBoardLEDs.cc b/libgm2/libm2cor/KeyBoardLEDs.cc
index e2e8198fb13..8d2b50bf99e 100644
--- a/libgm2/libm2cor/KeyBoardLEDs.cc
+++ b/libgm2/libm2cor/KeyBoardLEDs.cc
@@ -40,17 +40,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <sys/ioctl.h>
#include <stdio.h>
-#if !defined(TRUE)
-# define TRUE (1==1)
-#endif
-#if !defined(FALSE)
-# define FALSE (1==0)
-#endif
-
#include <stdlib.h>
static int fd;
-static int initialized = FALSE;
+static bool initialized = false;
extern "C" void
@@ -102,7 +95,7 @@ M2EXPORT(init) (int, char **, char **)
{
if (! initialized)
{
- initialized = TRUE;
+ initialized = true;
fd = open ("/dev/tty", O_RDONLY);
if (fd == -1)
{
diff --git a/libgm2/libm2iso/RTco.cc b/libgm2/libm2iso/RTco.cc
index 71d4f4b55ae..17e8010a496 100644
--- a/libgm2/libm2iso/RTco.cc
+++ b/libgm2/libm2iso/RTco.cc
@@ -61,14 +61,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define gm2_printf __printf__
#endif
-#if !defined(TRUE)
-#define TRUE (1 == 1)
-#endif
-
-#if !defined(FALSE)
-#define FALSE (1 == 0)
-#endif
-
#if defined(TRACEON)
#define tprintf printf
#else
@@ -92,7 +84,7 @@ typedef struct threadCB_s
typedef struct threadSem_s
{
__gthread_cond_t counter;
- int waiting;
+ bool waiting;
int sem_value;
} threadSem;
@@ -104,7 +96,7 @@ static threadSem **semArray = NULL;
/* These are used to lock the above module data structures. */
static __gthread_mutex_t lock; /* This is the only mutex for
the whole module. */
-static int initialized = FALSE;
+static int initialized = false;
extern "C" int EXPORT(init) (void);
@@ -128,7 +120,7 @@ static void
initSem (threadSem *sem, int value)
{
__GTHREAD_COND_INIT_FUNCTION (&sem->counter);
- sem->waiting = FALSE;
+ sem->waiting = false;
sem->sem_value = value;
}
@@ -138,9 +130,9 @@ waitSem (threadSem *sem)
__gthread_mutex_lock (&lock);
if (sem->sem_value == 0)
{
- sem->waiting = TRUE;
+ sem->waiting = true;
__gthread_cond_wait (&sem->counter, &lock);
- sem->waiting = FALSE;
+ sem->waiting = false;
}
else
sem->sem_value--;
@@ -495,7 +487,7 @@ EXPORT(init) (void)
tprintf ("checking init\n");
if (! initialized)
{
- initialized = TRUE;
+ initialized = true;
tprintf ("RTco initialized\n");
__GTHREAD_MUTEX_INIT_FUNCTION (&lock);
diff --git a/libgm2/libm2pim/sckt.cc b/libgm2/libm2pim/sckt.cc
index cd9d9c558b2..f0b3af0307b 100644
--- a/libgm2/libm2pim/sckt.cc
+++ b/libgm2/libm2pim/sckt.cc
@@ -85,13 +85,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#undef DEBUGGING
-#if !defined(TRUE)
-#define TRUE (1 == 1)
-#endif
-#if !defined(FALSE)
-#define FALSE (1 == 0)
-#endif
-
#if defined(HAVE_SYS_SOCKET_H)
#define ERROR(X) \
diff --git a/libgm2/libm2pim/wrapc.cc b/libgm2/libm2pim/wrapc.cc
index 0412cccb70b..c24d214649e 100644
--- a/libgm2/libm2pim/wrapc.cc
+++ b/libgm2/libm2pim/wrapc.cc
@@ -59,12 +59,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <time.h>
#endif
-/* Define FALSE if one hasn't already been defined. */
-
-#if !defined(FALSE)
-#define FALSE (1 == 0)
-#endif
-
/* Define a generic NULL if one hasn't already been defined. */
#if !defined(NULL)
@@ -214,7 +208,7 @@ EXPORT(signbit) (double r)
sizeof(double). */
return signbit (r);
#else
- return FALSE;
+ return false;
#endif
}
@@ -227,7 +221,7 @@ EXPORT(signbitl) (long double r)
sizeof(double). */
return signbitl (r);
#else
- return FALSE;
+ return false;
#endif
}
@@ -240,7 +234,7 @@ EXPORT(signbitf) (float r)
sizeof(double). */
return signbitf (r);
#else
- return FALSE;
+ return false;
#endif
}
@@ -253,7 +247,7 @@ EXPORT(isfinite) (double x)
#if defined(FP_NAN) && defined(FP_INFINITE)
return (fpclassify (x) != FP_NAN && fpclassify (x) != FP_INFINITE);
#else
- return FALSE;
+ return false;
#endif
}
@@ -266,7 +260,7 @@ EXPORT(isfinitel) (long double x)
#if defined(FP_NAN) && defined(FP_INFINITE)
return (fpclassify (x) != FP_NAN && fpclassify (x) != FP_INFINITE);
#else
- return FALSE;
+ return false;
#endif
}
@@ -279,7 +273,7 @@ EXPORT(isfinitef) (float x)
#if defined(FP_NAN) && defined(FP_INFINITE)
return (fpclassify (x) != FP_NAN && fpclassify (x) != FP_INFINITE);
#else
- return FALSE;
+ return false;
#endif
}