[Piglit] [PATCH v3 01/19] Only define bool in non-C++ builds.

Paul Berry stereotype441 at gmail.com
Wed Mar 21 08:58:00 PDT 2012


On MSVC builds, piglit-util.h defines "bool", "true" and "false" to
appropriate C equivalents, to work around the fact that MSVC does not
have a "stdbool.h" header.  This patch limits the workaround to only
apply when building pure C sources.

This allows piglit-util.h to be included safely by C++ source files,
such as those in Glean.
---
 tests/util/piglit-util.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index ea35e64..ea15150 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -42,9 +42,11 @@ typedef unsigned __int8 uint8_t;
 typedef unsigned __int16 uint16_t;
 typedef unsigned __int32 uint32_t;
 typedef unsigned __int64 uint64_t;
+#ifndef __cplusplus
 #define bool BOOL
 #define true 1
 #define false 0
+#endif
 #define log2(x) (log(x) / log(2))
 #else
 #include <stdint.h>
-- 
1.7.7.6



More information about the Piglit mailing list