From b4b89c2ab0cc5325a41360c25ef9d2ccbe617e5c Mon Sep 17 00:00:00 2001 From: Jose Date: Wed, 23 Aug 2017 11:33:12 +0200 Subject: [PATCH] Fix compile error with Visual Studio 2012 The standard header stdbool.h is not available with old Visual Studio compilers --- expat/lib/xmltok.c | 11 ++++++++++- expat/tests/runtests.c | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c index f105a493..f6c7ecd5 100644 --- a/expat/lib/xmltok.c +++ b/expat/lib/xmltok.c @@ -31,9 +31,18 @@ */ #include -#include #include // memcpy +#if defined(_MSC_VER) && (_MSC_VER <= 1700) + /* for vs2012/11.0/1700 and earlier Visual Studio compilers */ +# define bool int +# define false 0 +# define true 1 +#else +# include +#endif + + #ifdef _WIN32 #include "winconfig.h" #else diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index cd0c0dce..b2b0fa11 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -41,11 +41,20 @@ #include #include /* ptrdiff_t */ #include -#ifndef __cplusplus -# include -#endif #include +#if ! defined(__cplusplus) +# if defined(_MSC_VER) && (_MSC_VER <= 1700) + /* for vs2012/11.0/1700 and earlier Visual Studio compilers */ +# define bool int +# define false 0 +# define true 1 +# else +# include +# endif +#endif + + #include "expat.h" #include "chardata.h" #include "internal.h" /* for UNUSED_P only */