diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-01 16:47:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-01 16:47:58 +0400 |
commit | 80ff313495ed739851dbd15d3e31506904503d5e (patch) | |
tree | 9a80a4983ccc829ac98bca931276b38c1acab961 /source/blender/blenlib/BLI_utildefines.h | |
parent | e4f65749f9c522476f646004c06556b0fc5c4b4d (diff) |
patch [#33331] Time To Start Moving To Stdbool
by Lawrence D'Oliveiro (ldo)
so BKE_utildefines.h allows use of C99's bool type and true/false.
currently scons wont try to use stdbool.h, and works as if its never found.
Diffstat (limited to 'source/blender/blenlib/BLI_utildefines.h')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 7c3b70545d6..1774ef3d2b7 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -32,12 +32,34 @@ * \ingroup bli */ -#ifndef FALSE -# define FALSE 0 +/* note: use of (int, TRUE / FALSE) is deprecated, + * use (bool, true / false) instead */ +#ifdef HAVE_STDBOOL_H +# include <stdbool.h> +#else +# ifndef HAVE__BOOL +# ifdef __cplusplus +typedef bool _Bool; +# else +# define _Bool signed char +# endif +# endif +# define bool _Bool +# define false 0 +# define true 1 +# define __bool_true_false_are_defined 1 #endif -#ifndef TRUE -# define TRUE 1 +/* remove this when we're ready to remove TRUE/FALSE completely */ +#ifdef WITH_BOOL_COMPAT +/* interim until all occurrences of these can be updated to stdbool */ +# ifndef FALSE +# define FALSE 0 +# endif + +# ifndef TRUE +# define TRUE 1 +# endif #endif /* useful for finding bad use of min/max */ |