summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2018-03-23 20:31:49 +0000
committerPeter Eisentraut2018-03-23 20:31:49 +0000
commit66ee8513d10fb207907d61dd6cf42db7d703af5d (patch)
tree7072e217c48bb03d3a0a48e807c348775ba97e12
parent4b538727e2a0e5eae228650c1c145c90471aa521 (diff)
Further fix interaction of Perl and stdbool.h
In the case that PostgreSQL uses stdbool.h but Perl doesn't, we need to prevent Perl from defining bool, to prevent compiler warnings about redefinition.
-rw-r--r--src/pl/plperl/plperl.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index 05bdf7c115..843331e9dd 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -50,6 +50,18 @@
#define __inline__ inline
#endif
+/*
+ * Regarding bool, both PostgreSQL and Perl might use stdbool.h or not,
+ * depending on configuration. If both agree, things are relatively harmless.
+ * If not, things get tricky. If PostgreSQL does but Perl does not, define
+ * HAS_BOOL here so that Perl does not redefine bool; this avoids compiler
+ * warnings. If PostgreSQL does not but Perl does, we need to undefine bool
+ * after we include the Perl headers; see below.
+ */
+#ifdef USE_STDBOOL
+#define HAS_BOOL 1
+#endif
+
/*
* Get the basic Perl API. We use PERL_NO_GET_CONTEXT mode so that our code