From 5f83d64832d71fe271b8f27898b33e83c8cee4b8 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Tue, 30 Aug 2016 12:00:00 -0400
Subject: [PATCH 13/27] Avoid C++ key words

This is not a long-term solution, because C header files that are
included somewhere might have C++ awareness and will break if the key
word is defined away.  But this shows the list of words that would have
to be renamed around the code.
---
 src/include/c.h                                  | 16 ++++++++++++++++
 src/interfaces/ecpg/include/ecpg-pthread-win32.h |  2 ++
 src/interfaces/libpq/libpq-int.h                 |  2 ++
 src/pl/plperl/plperl.h                           |  2 ++
 4 files changed, 22 insertions(+)

diff --git a/src/include/c.h b/src/include/c.h
index 4ab3f80..a9515d1 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -45,6 +45,22 @@
 #ifndef C_H
 #define C_H
 
+#ifdef __cplusplus
+#define class class_
+#define constexpr constexpr_
+#define delete delete_
+#define friend friend_
+#define namespace namespace_
+#define new new_
+#define operator operator_
+#define private private_
+#define public public_
+#define template template_
+#define this this_
+#define typeid typeid_
+#define typename typename_
+#endif
+
 #include "postgres_ext.h"
 
 /* Must undef pg_config_ext.h symbols before including pg_config.h */
diff --git a/src/interfaces/ecpg/include/ecpg-pthread-win32.h b/src/interfaces/ecpg/include/ecpg-pthread-win32.h
index 7e59357..505838f 100644
--- a/src/interfaces/ecpg/include/ecpg-pthread-win32.h
+++ b/src/interfaces/ecpg/include/ecpg-pthread-win32.h
@@ -9,6 +9,8 @@
 
 #ifndef WIN32
 
+#undef class
+#undef public
 #include <pthread.h>
 #else
 
diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h
index a94ead0..b2f2d74 100644
--- a/src/interfaces/libpq/libpq-int.h
+++ b/src/interfaces/libpq/libpq-int.h
@@ -34,6 +34,8 @@
 #ifdef WIN32
 #include "pthread-win32.h"
 #else
+#undef class
+#undef public
 #include <pthread.h>
 #endif
 #include <signal.h>
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index 0146d60..1ed68a4 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -43,6 +43,8 @@
 #endif
 
 
+#undef class
+#undef public
 /* required for perl API */
 #include "EXTERN.h"
 #include "perl.h"
-- 
2.9.3

