summaryrefslogtreecommitdiff
path: root/lib/fcntl.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2010-12-25 14:43:05 +0100
committerBruno Haible <bruno@clisp.org>2010-12-25 14:43:05 +0100
commitebc78c6fc2de2f5f80520ee8980adac78ecd7521 (patch)
tree46535a57177a63eb30e065873101a3812f65f50c /lib/fcntl.in.h
parent9e587fbb7b888126ecdf62a2ed968343215df2d0 (diff)
downloadgnulib-ebc78c6fc2de2f5f80520ee8980adac78ecd7521.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>.
Diffstat (limited to 'lib/fcntl.in.h')
-rw-r--r--lib/fcntl.in.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 6d1888de47..73c5f1ef03 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -43,7 +43,13 @@
#ifndef _GL_FCNTL_H
#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 __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
# include <sys/stat.h>
#endif
/* The include_next requires a split double-inclusion guard. */