From b54a3ee6a52ea6766b958372827aad4650859ccd Mon Sep 17 00:00:00 2001
From: Mike Palmiotto <mike.palmiotto@crunchydata.com>
Date: Wed, 5 Apr 2017 14:27:01 +0000
Subject: [PATCH 1/3] Deal with stdbool re-definition of bool

selinux/label.h includes stdbool.h, which redefines the bool type and results in
a warning: assignment from incompatible pointer type for sepgsql_fmgr_hook. Make
sure we clean up the bool definition after label.h is included.
---
 contrib/sepgsql/label.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c
index 1a8f884..f7d79ab 100644
--- a/contrib/sepgsql/label.c
+++ b/contrib/sepgsql/label.c
@@ -10,6 +10,18 @@
  */
 #include "postgres.h"
 
+#include <selinux/label.h>
+
+/*
+ * selinux/label.h includes stdbool.h, which #defines bool. This #define
+ * obscures the postgres definition of bool from c.h. #undef here to keep the
+ * postgres definition. This is not necessary for true/false re-definitions.
+ * Those are close enough in stdbool.h.
+ */
+#ifdef bool
+#undef bool
+#endif
+
 #include "access/heapam.h"
 #include "access/htup_details.h"
 #include "access/genam.h"
@@ -37,8 +49,6 @@
 
 #include "sepgsql.h"
 
-#include <selinux/label.h>
-
 /*
  * Saved hook entries (if stacked)
  */
-- 
1.8.3.1

