bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] fts: allow compilation with C++


From: Giuseppe Scrivano
Subject: [PATCH] fts: allow compilation with C++
Date: Sun, 22 Aug 2010 02:35:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hello,

this patch fixes a linker problem when the file is used with C++,
forcing a C linkage.  I got this problem under mingw.

Also, I could not use extern "C" around <fts_.h> because it breaks
verify.h:

In file included from ../lib/i-ring.h:18,
                 from ../lib/fts_.h:66:
../lib/verify.h:147: error: template with C linkage

Cheers,
Giuseppe



>From 7cf0da716e9283b2a77d714e73df735702edbef2 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <address@hidden>
Date: Sun, 22 Aug 2010 02:18:31 +0200
Subject: [PATCH] fts: allow compilation with C++

* lib/fts_.h: Specify extern "C" linkage with C++.
---
 ChangeLog  |    5 +++++
 lib/fts_.h |    9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 20a5adc..d7943d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-22  Giuseppe Scrivano  <address@hidden>
+
+       fts: allow compilation with C++
+       * lib/fts_.h: Specify extern "C" linkage with C++.
+
 2010-08-17  Eric Blake  <address@hidden>
 
        test-stddef: test for (some) offsetof bugs
diff --git a/lib/fts_.h b/lib/fts_.h
index 75324d4..1d532b4 100644
--- a/lib/fts_.h
+++ b/lib/fts_.h
@@ -55,9 +55,14 @@
 #  undef __THROW
 #  define __THROW
 #  undef __BEGIN_DECLS
-#  define __BEGIN_DECLS
 #  undef __END_DECLS
-#  define __END_DECLS
+#  ifdef __cplusplus
+#   define __BEGIN_DECLS extern "C" {
+#   define __END_DECLS }
+#  else
+#   define __BEGIN_DECLS
+#   define __END_DECLS
+#  endif
 # endif
 
 # include <stddef.h>
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]