]> Savannah Git Hosting - gnulib.git/commitdiff
strerror_r-posix: support compilation with C++
authorWerner LEMBERG <wl@gnu.org>
Mon, 15 Sep 2014 12:41:57 +0000 (13:41 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 15 Sep 2014 12:44:35 +0000 (13:44 +0100)
* lib/strerror_r.c: Add necessary C linkage declarations.

ChangeLog
lib/strerror_r.c

index fa7f84ff3deb13b89df82ca6b021a142679fce76..3748237150d68532bbfa1068893f31c77ea8cd50 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-15  Werner LEMBERG  <wl@gnu.org>
+
+       strerror_r-posix: support compilation with C++
+       * lib/strerror_r.c: Add necessary C linkage declarations.
+
 2014-09-11  Johannes Zarl  <johannes.zarl@jku.at>
 
        fcntl-h: fix compilation with Intel C++ compiler (trivial)
index 4aa96cbbcf1945256d139e755b658da6a9aba882..58e9a12d77b45fd525123610ef4b08303df90823 100644 (file)
 #if (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) && HAVE___XPG_STRERROR_R /* glibc >= 2.3.4, cygwin >= 1.7.9 */
 
 # define USE_XPG_STRERROR_R 1
-extern int __xpg_strerror_r (int errnum, char *buf, size_t buflen);
+extern
+#ifdef __cplusplus
+"C"
+#endif
+int __xpg_strerror_r (int errnum, char *buf, size_t buflen);
 
 #elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__)
 
@@ -63,6 +67,10 @@ extern int __xpg_strerror_r (int errnum, char *buf, size_t buflen);
 #   include <nl_types.h>
 #  endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Get sys_nerr, sys_errlist on HP-UX (otherwise only declared in C++ mode).
    Get sys_nerr, sys_errlist on IRIX (otherwise only declared with _SGIAPI).  */
 #  if defined __hpux || defined __sgi
@@ -75,6 +83,10 @@ extern char *sys_errlist[];
 extern int sys_nerr;
 #  endif
 
+#ifdef __cplusplus
+}
+#endif
+
 # else
 
 #  include "glthread/lock.h"