Mercurial > hg > th-libs
diff th_types.h @ 453:efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Introduce optional but default use of stdbool.h.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Jan 2018 22:56:03 +0200 |
parents | 1b3472ba7b23 |
children | 347bfd3e017e |
line wrap: on
line diff
--- a/th_types.h Wed Oct 25 22:32:07 2017 +0300 +++ b/th_types.h Tue Jan 02 22:56:03 2018 +0200 @@ -24,6 +24,11 @@ # endif #endif +#ifdef HAVE_STDBOOL_H +# define HAVE_BOOL 1 +# include <stdbool.h> +#endif + #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif @@ -179,18 +184,17 @@ typedef char char_t; -/* Define a boolean type +/* Define a boolean type, if needed */ -#if !defined(FALSE) && !defined(TRUE) && !defined(BOOL) -typedef enum { FALSE = 0, TRUE = 1 } BOOL; -#endif +#ifndef HAVE_BOOL +# if !defined(false) && !defined(true) && !defined(bool) +typedef enum { false = 0, true = 1 } bool; +# endif +# ifndef bool +# define bool int +# endif -#ifndef BOOL -# ifdef bool -# define BOOL bool -# else -# define BOOL int -# endif -#endif +#endif // !HAVE_BOOL + #endif // TH_TYPES_H