summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-08-11 18:41:30 +0200
committerHaru <haru@dotalux.com>2013-08-12 17:25:54 +0200
commitab1fad052cd771e183f496f5db922fa03a13edea (patch)
treece5bc77d2a98eb1a916a0740decb4493457363e3
parentde6602f25485d0ba4c02426ab982fa8ff8a224ae (diff)
downloadhercules-ab1fad052cd771e183f496f5db922fa03a13edea.tar.gz
hercules-ab1fad052cd771e183f496f5db922fa03a13edea.tar.bz2
hercules-ab1fad052cd771e183f496f5db922fa03a13edea.tar.xz
hercules-ab1fad052cd771e183f496f5db922fa03a13edea.zip
Replaced own bool typedef with <stdbool.h> where available
Fixes bugreport:7645 http://hercules.ws/board/tracker/issue-7645-rev-12302-compiler-error-and-warnings-on-gcc-49 Special thanks to Takkun for VS2012 testing and info Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/common/cbasetypes.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index 82ca9df69..05b799045 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -261,9 +261,21 @@ typedef uintptr_t uintptr;
//////////////////////////////
// boolean types for C
+#if !defined(_MSC_VER) || _MSC_VER >= 1800
+// MSVC doesn't have stdbool.h yet as of Visual Studio 2012 (MSVC version 17.00)
+// but it will support it in Visual Studio 2013 (MSVC version 18.00)
+// http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx
+// GCC and Clang are assumed to be C99 compliant
+#include <stdbool.h> // bool, true, false, __bool_true_false_are_defined
+#endif // ! defined(_MSC_VER) || _MSC_VER >= 1800
+
+#ifndef __bool_true_false_are_defined
+// If stdbool.h is not available or does not define this
typedef char bool;
#define false (1==0)
#define true (1==1)
+#define __bool_true_false_are_defined
+#endif // __bool_true_false_are_defined
//////////////////////////////
#endif // not __cplusplus