From 7c58479500f1caf6085662ead8702cf06127deb0 Mon Sep 17 00:00:00 2001
From: Peter Williams <peter@newton.cx>
Date: Mon, 3 Sep 2018 17:54:36 -0400
Subject: [PATCH 7/8] Add missing 'extern "C"' protectors

Various files are missing 'extern "C"' blocks around C declarations.

The context here is that on Windows, some files are compiled as C++ code even
though they're written as pretty much straight C. The motivation seems to be
that MSVC doesn't fully support C99 or C11, specifically non-constant
initializers. But C++ allows this, so the code will come out fine if compiled
as C++. However, without proper 'extern "C"' protection, you get linkage
errors.
---
 gettext-tools/gnulib-lib/exitfail.h   | 8 ++++++++
 gettext-tools/libgettextpo/exitfail.h | 8 ++++++++
 gettext-tools/src/plural-table.h      | 8 ++++++++
 gettext-tools/src/po-gram-gen2.h      | 9 +++++++++
 4 files changed, 33 insertions(+)

diff --git a/gettext-tools/gnulib-lib/exitfail.h b/gettext-tools/gnulib-lib/exitfail.h
index 4514fb0..b5760f9 100644
--- a/gettext-tools/gnulib-lib/exitfail.h
+++ b/gettext-tools/gnulib-lib/exitfail.h
@@ -15,4 +15,12 @@
    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern DLL_VARIABLE int volatile exit_failure;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gettext-tools/libgettextpo/exitfail.h b/gettext-tools/libgettextpo/exitfail.h
index 4514fb0..b5760f9 100644
--- a/gettext-tools/libgettextpo/exitfail.h
+++ b/gettext-tools/libgettextpo/exitfail.h
@@ -15,4 +15,12 @@
    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern DLL_VARIABLE int volatile exit_failure;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gettext-tools/src/plural-table.h b/gettext-tools/src/plural-table.h
index e6c52bb..d736ef0 100644
--- a/gettext-tools/src/plural-table.h
+++ b/gettext-tools/src/plural-table.h
@@ -20,6 +20,10 @@
 
 #include <stddef.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct plural_table_entry
 {
   const char *lang;
@@ -30,4 +34,8 @@ struct plural_table_entry
 extern DLL_VARIABLE struct plural_table_entry plural_table[];
 extern DLL_VARIABLE const size_t plural_table_size;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _PLURAL_TABLE_H */
diff --git a/gettext-tools/src/po-gram-gen2.h b/gettext-tools/src/po-gram-gen2.h
index 5fbf6b8..de41183 100644
--- a/gettext-tools/src/po-gram-gen2.h
+++ b/gettext-tools/src/po-gram-gen2.h
@@ -37,6 +37,11 @@
 
 #ifndef YY_PO_GRAM_PO_GRAM_GEN_TAB_H_INCLUDED
 # define YY_PO_GRAM_PO_GRAM_GEN_TAB_H_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Debug traces.  */
 #ifndef PO_GRAM_DEBUG
 # if defined YYDEBUG
@@ -109,4 +114,8 @@ extern DLL_VARIABLE PO_GRAM_STYPE po_gram_lval;
 int po_gram_parse (void);
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* !YY_PO_GRAM_PO_GRAM_GEN_TAB_H_INCLUDED  */
