summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-09-14 14:03:31 +0200
committerH.Merijn Brand <h.m.brand@xs4all.nl>2011-09-16 13:32:37 +0200
commitbd31be4baa3ee68abdb92c0db3200efe0fad903b (patch)
tree064b376e87748cf3ceee2c1a5fae468146e0b9de /handy.h
parent28051109dbd5d27f591646b8e36a5f6be33854d6 (diff)
downloadperl-bd31be4baa3ee68abdb92c0db3200efe0fad903b.tar.gz
Probe for <stdbool.h>, and if found use it in handy.h
This means that the core uses the compiler's bool type if one exists. This avoids potential problems of clashes between perl's own implementation of bool and the compiler's bool type, which otherwise occur when one attempts to include headers which in turn include <stdbool.h>. Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/handy.h b/handy.h
index b75eafb53f..5e30512104 100644
--- a/handy.h
+++ b/handy.h
@@ -70,10 +70,13 @@ Null SV pointer. (No longer available when C<PERL_CORE> is defined.)
#define MUTABLE_IO(p) ((IO *)MUTABLE_PTR(p))
#define MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p))
-/* XXX Configure ought to have a test for a boolean type, if I can
- just figure out all the headers such a test needs.
- Andy Dougherty August 1996
-*/
+#ifdef I_STDBOOL
+# include <stdbool.h>
+# ifndef HAS_BOOL
+# define HAS_BOOL 1
+# endif
+#endif
+
/* bool is built-in for g++-2.6.3 and later, which might be used
for extensions. <_G_config.h> defines _G_HAVE_BOOL, but we can't
be sure _G_config.h will be included before this file. _G_config.h