From ca59d69b93eb0a0aa5d67e86876fe3eac0632835 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@enterprisedb.com>
Date: Sat, 5 May 2018 22:35:54 +1200
Subject: [PATCH] Fix const warnings when building with --enable-dtrace.

Unlike macOS, other operating systems' versions of dtrace -h don't generate
const qualifiers when generating the declarations of probe functions.  This
causes compiler warnings when we pass in pointers to const.  Repair by
post-processing the probes.h file.

Thomas Munro
---
 src/backend/utils/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/Makefile b/src/backend/utils/Makefile
index 966e3bc2ed3..1ff39eee4ba 100644
--- a/src/backend/utils/Makefile
+++ b/src/backend/utils/Makefile
@@ -52,7 +52,9 @@ endif
 probes.h: probes.d
 ifeq ($(enable_dtrace), yes)
 	$(DTRACE) -C -h -s $< -o $@.tmp
-	sed -e 's/POSTGRESQL_/TRACE_POSTGRESQL_/g' $@.tmp >$@
+	sed -e 's/POSTGRESQL_/TRACE_POSTGRESQL_/g' \
+	    -e 's/(char \*/(const char */g' \
+	    -e 's/, char \*/, const char */g' $@.tmp >$@
 	rm $@.tmp
 else
 	sed -f $(srcdir)/Gen_dummy_probes.sed $< >$@
-- 
2.17.0

