aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/c.h1
-rw-r--r--src/pl/plperl/plperl.h18
2 files changed, 14 insertions, 5 deletions
diff --git a/src/include/c.h b/src/include/c.h
index 107f4f6bcd7..95e9aeded9d 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -268,6 +268,7 @@
#if defined(HAVE_STDBOOL_H) && SIZEOF_BOOL == 1
#include <stdbool.h>
+#define USE_STDBOOL 1
#else
#ifndef bool
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index a85aefea6c1..05bdf7c1157 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -50,11 +50,6 @@
#define __inline__ inline
#endif
-/*
- * Prevent perl from redefining "bool".
- */
-#define HAS_BOOL 1
-
/*
* Get the basic Perl API. We use PERL_NO_GET_CONTEXT mode so that our code
@@ -96,6 +91,19 @@
#define NEED_sv_2pv_flags
#include "ppport.h"
+/*
+ * perl might have included stdbool.h. If we also did that earlier (see c.h),
+ * then that's fine. If not, we probably rejected it for some reason. In
+ * that case, undef bool and proceed with our own bool. (Note that stdbool.h
+ * makes bool a macro, but our own replacement is a typedef, so the undef
+ * makes ours visible again).
+ */
+#ifndef USE_STDBOOL
+#ifdef bool
+#undef bool
+#endif
+#endif
+
/* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */
#ifndef HeUTF8
#define HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \