]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Replace bool as boolean instead of int in libgm2
authorGaius Mulley <gaiusmod2@gmail.com>
Sat, 13 May 2023 14:49:50 +0000 (15:49 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Sat, 13 May 2023 14:49:50 +0000 (15:49 +0100)
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>
libgm2/libm2cor/KeyBoardLEDs.cc
libgm2/libm2iso/RTco.cc
libgm2/libm2pim/sckt.cc
libgm2/libm2pim/wrapc.cc

index e2e8198fb13121ca09ab70a4d1a8eb85c62f5eba..8d2b50bf99ee1a8547be2434418970a406756d5b 100644 (file)
@@ -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)
        {
index 71d4f4b55aecdc3971045113a11a4d02a39122c3..17e8010a496a31c0d0091e2c071cd4edb0517229 100644 (file)
@@ -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);
index cd9d9c558b25d25951b9ed8df53ee01703e35df3..f0b3af0307bf932c59eb0279b7e3929711753111 100644 (file)
@@ -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)                                                              \
index 0412cccb70bb497194423518b9bc23a9b5636151..c24d214649edce8343f6e761592830def34018a3 100644 (file)
@@ -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
 }