changeset 14660:fc75a382e7cd

sys_uio: Protect definition of 'struct iovec'. * lib/sys_uio.in.h (struct iovec): Avoid redefinition. In C++, define it as a C struct.
author Bruno Haible <bruno@clisp.org>
date Sat, 30 Apr 2011 13:19:55 +0200
parents e71d1b99c2f4
children b98c01416471
files ChangeLog lib/sys_uio.in.h
diffstat 2 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-04-30  Bruno Haible  <bruno@clisp.org>
+
+	sys_uio: Protect definition of 'struct iovec'.
+	* lib/sys_uio.in.h (struct iovec): Avoid redefinition. In C++, define
+	it as a C struct.
+
 2011-04-30  Bruno Haible  <bruno@clisp.org>
 
 	manywarnings: fix indentation
--- a/lib/sys_uio.in.h
+++ b/lib/sys_uio.in.h
@@ -37,12 +37,24 @@
 /* Get 'ssize_t'.  */
 # include <sys/types.h>
 
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if !GNULIB_defined_struct_iovec
 /* All known platforms that lack <sys/uio.h> also lack any declaration
    of struct iovec in any other header.  */
 struct iovec {
   void *iov_base;
   size_t iov_len;
 };
+#  define GNULIB_defined_struct_iovec 1
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
 #endif
 
 #endif /* _GL_SYS_UIO_H */