From ab1fad052cd771e183f496f5db922fa03a13edea Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 11 Aug 2013 18:41:30 +0200 Subject: Replaced own bool typedef with 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 --- src/common/cbasetypes.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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 // 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 -- cgit v1.2.3-60-g2f50