bug-gnulib
[Top][All Lists]
Advanced

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

extern "C" for glob.h


From: John W. Eaton
Subject: extern "C" for glob.h
Date: Thu, 7 Jan 2010 13:10:30 -0500

In glob.in.h, we have

  #if @HAVE_SYS_CDEFS_H@
  # include <sys/cdefs.h>
  #endif

  ...

  #ifndef __BEGIN_DECLS
  # define __BEGIN_DECLS
  # define __END_DECLS
  #endif

If HAVE_SYS_CDEFS_H is 0, then __BEGIN_DECLS and __END_DECLS are
likely undefined.  To be C++ friendly, I think this should changed as
in the attached patch.

Thanks,

jwe

>From 1641dbca79baee5b57a3bc691f2050d3da6dd135 Mon Sep 17 00:00:00 2001
From: John W. Eaton <address@hidden>
Date: Thu, 7 Jan 2010 13:08:33 -0500
Subject: [PATCH] glob.in.h: define __BEGIN_DECLS and __END_DECLS for C++

---
 ChangeLog     |    5 +++++
 lib/glob.in.h |    9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index edd55bf..994e8a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-01-07  John W. Eaton  <address@hidden>
 
+       * lib/glob.in.h [__cplusplus]: Define __BEGIN_DECLS and
+       __END_DECLS for C++.
+
+2010-01-07  John W. Eaton  <address@hidden>
+
        * lib/wctype.in.h: Add extern "C" block for C++.
 
 2010-01-06  Eric Blake  <address@hidden>
diff --git a/lib/glob.in.h b/lib/glob.in.h
index 562f1c5..8f32a79 100644
--- a/lib/glob.in.h
+++ b/lib/glob.in.h
@@ -33,8 +33,13 @@
 #include <sys/stat.h>
 
 #ifndef __BEGIN_DECLS
-# define __BEGIN_DECLS
-# define __END_DECLS
+# ifdef __cplusplus
+#  define __BEGIN_DECLS  extern "C" {
+#  define __END_DECLS    }
+# else
+#  define __BEGIN_DECLS
+#  define __END_DECLS
+# endif
 #endif
 #ifndef __THROW
 # define __THROW
-- 
1.6.5


reply via email to

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