changeset 14171:97273629690f

filemode: Make function declarations usable in C++ mode. * lib/filemode.h: Enclose function declarations in extern "C" block. Reported by John W. Eaton <jwe@gnu.org>.
author Bruno Haible <bruno@clisp.org>
date Fri, 14 Jan 2011 10:01:04 +0100
parents d256c4a2fbf1
children 6545767c5c6d
files ChangeLog lib/filemode.h
diffstat 2 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-14  Bruno Haible  <bruno@clisp.org>
+
+	filemode: Make function declarations usable in C++ mode.
+	* lib/filemode.h: Enclose function declarations in extern "C" block.
+	Reported by John W. Eaton <jwe@gnu.org>.
+
 2011-01-12  Rob Vermaas  <rob.vermaas@gmail.com>
 
 	save-cwd: no longer include "xgetcwd.h"
--- a/lib/filemode.h
+++ b/lib/filemode.h
@@ -21,13 +21,24 @@
 # include <sys/types.h>
 # include <sys/stat.h>
 
+/* Get the declaration of strmode.  */
 # if HAVE_DECL_STRMODE
-#  include <string.h> /* FreeBSD, OpenBSD */
+#  include <string.h> /* MacOS X, FreeBSD, OpenBSD */
 #  include <unistd.h> /* NetBSD */
-# else
-void strmode (mode_t mode, char *str);
+# endif
+
+# ifdef __cplusplus
+extern "C" {
 # endif
 
-void filemodestring (struct stat const *statp, char *str);
+# if !HAVE_DECL_STRMODE
+extern void strmode (mode_t mode, char *str);
+# endif
+
+extern void filemodestring (struct stat const *statp, char *str);
+
+# ifdef __cplusplus
+}
+# endif
 
 #endif