From 4fe14a678bf99a068e26e014b0d25d9594e54c46 Mon Sep 17 00:00:00 2001 From: Stuart Brady Date: Mon, 30 Apr 2012 23:30:57 +0100 Subject: [PATCH] Use a consistent definition of bool Since _Bool is only ever a keyword and not a macro, and we can't test for HAVE_STDBOOL_H in the headers, remove the #ifdef for it in and instead, simply define it as 'int'. Replace inclusion of with so that a consistent definition of bool is used. Signed-off-by: Natalia Portillo --- include/cdio/types.h | 27 +++++++++------------------ lib/driver/FreeBSD/freebsd.h | 5 +---- lib/driver/MSWindows/win32.c | 5 +---- lib/driver/aix.c | 5 +---- lib/driver/netbsd.c | 5 +---- lib/driver/os2.c | 5 +---- lib/driver/osx.c | 5 +---- 7 files changed, 15 insertions(+), 42 deletions(-) diff --git a/include/cdio/types.h b/include/cdio/types.h index 7499884e..b046842b 100644 --- a/include/cdio/types.h +++ b/include/cdio/types.h @@ -104,24 +104,15 @@ typedef uint8_t ubyte; #endif #ifndef __cplusplus - -/* All the stdbool.h seem to define those */ -#ifndef __bool_true_false_are_defined -#define __bool_true_false_are_defined 1 - -#undef bool -#undef true -#undef false - -#ifdef _Bool -#define bool _Bool -#else -#define bool int -#endif -#define true 1 -#define false 0 - -#endif /* __bool_true_false_are_defined */ +# if defined(HAVE_STDBOOL_H) +# include +# else + /* ISO/IEC 9899:1999 missing -- enabling workaround */ + +# define false 0 +# define true 1 +# define bool uint8_t +# endif /*HAVE_STDBOOL_H*/ #endif /*C++*/ /* some GCC optimizations -- gcc 2.5+ */ diff --git a/lib/driver/FreeBSD/freebsd.h b/lib/driver/FreeBSD/freebsd.h index 7f20a463..b8e8fca9 100644 --- a/lib/driver/FreeBSD/freebsd.h +++ b/lib/driver/FreeBSD/freebsd.h @@ -25,11 +25,8 @@ # include "config.h" #endif -#ifdef HAVE_STDBOOL_H -# include -#endif - #include +#include #include "cdio_assert.h" #include "cdio_private.h" diff --git a/lib/driver/MSWindows/win32.c b/lib/driver/MSWindows/win32.c index b15afef6..3a1456dd 100644 --- a/lib/driver/MSWindows/win32.c +++ b/lib/driver/MSWindows/win32.c @@ -24,13 +24,10 @@ # include "config.h" #endif -#ifdef HAVE_STDBOOL_H -# include -#endif - #include #include #include +#include #include #include #include "cdio_assert.h" diff --git a/lib/driver/aix.c b/lib/driver/aix.c index 54270262..bd6862e7 100644 --- a/lib/driver/aix.c +++ b/lib/driver/aix.c @@ -20,10 +20,6 @@ # include "config.h" #endif -#ifdef HAVE_STDBOOL_H -# include -#endif - #ifdef HAVE_STRING_H #include #endif @@ -31,6 +27,7 @@ #include #include #include +#include #include #include "cdio_assert.h" #include "cdio_private.h" diff --git a/lib/driver/netbsd.c b/lib/driver/netbsd.c index 91139029..77073943 100644 --- a/lib/driver/netbsd.c +++ b/lib/driver/netbsd.c @@ -45,12 +45,9 @@ # include "config.h" #endif -#ifdef HAVE_STDBOOL_H -# include -#endif - #include #include +#include #include "cdio_assert.h" #include "cdio_private.h" diff --git a/lib/driver/os2.c b/lib/driver/os2.c index d8f9af44..3b13f078 100644 --- a/lib/driver/os2.c +++ b/lib/driver/os2.c @@ -24,13 +24,10 @@ # include "config.h" #endif -#ifdef HAVE_STDBOOL_H -# include -#endif - #include #include #include +#include #include #include #include "cdio_assert.h" diff --git a/lib/driver/osx.c b/lib/driver/osx.c index d981ecfa..ea8f47ad 100644 --- a/lib/driver/osx.c +++ b/lib/driver/osx.c @@ -32,13 +32,10 @@ # include "config.h" #endif -#ifdef HAVE_STDBOOL_H -# include -#endif - #include #include #include +#include /* For SCSI TR_* enumerations */ typedef enum {