summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2010-11-12 03:20:13 +0100
committerBruno Haible <bruno@clisp.org>2010-11-12 03:20:13 +0100
commit59cb9127de519fa2db1c704045551ba447d6ffcb (patch)
treedb178bd51e6f468af74100f11008bad9ace90269
parent3ffa8a74ff8edd3a6e2ce5e9fd0ecf670eb9a11e (diff)
downloadgnulib-59cb9127de519fa2db1c704045551ba447d6ffcb.tar.gz
fcntl-h: Fix for use of C++ on glibc systems.
* lib/fcntl.in.h: Include <sys/stat.h> before include_next <fcntl.h> also on glibc systems in C++ mode. Reported by Gary V. Vaughan <gary@gnu.org>.
-rw-r--r--ChangeLog7
-rw-r--r--lib/fcntl.in.h8
2 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c4cde9581..d9e32a88f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-11-11 Bruno Haible <bruno@clisp.org>
+
+ fcntl-h: Fix for use of C++ on glibc systems.
+ * lib/fcntl.in.h: Include <sys/stat.h> before include_next <fcntl.h>
+ also on glibc systems in C++ mode.
+ Reported by Gary V. Vaughan <gary@gnu.org>.
+
2010-11-11 Christian Weisgerber <naddy@mips.inka.de> (tiny change)
mknod: avoid false failure with dash
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 663e49f32b..13f5dde97b 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -26,7 +26,13 @@
/* Special invocation convention. */
#include <sys/types.h>
-#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
+/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
+ <fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
+ But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
+ extern "C" { ... } block, which leads to errors in C++ mode with the
+ overridden <sys/stat.h> from gnulib. These errors are known to be gone
+ with g++ version >= 4.3. */
+#if !defined __GLIBC__ || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
# include <sys/stat.h>
#endif
#@INCLUDE_NEXT@ @NEXT_FCNTL_H@