Ensure no #include statements inside extern "C" { ... }.
authorBruno Haible <bruno@clisp.org>
Sun, 21 Mar 2010 00:14:37 +0000 (01:14 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Mar 2010 00:14:37 +0000 (01:14 +0100)
ChangeLog
lib/obstack.h
lib/time.in.h

index 71bd014..23c4f63 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-03-20  Bruno Haible  <bruno@clisp.org>
 
+       Ensure no #include statements inside extern "C" { ... }.
+       * lib/obstack.h: Shrink extern "C" { ... } region so that it does not
+       contain #include statements.
+       * lib/time.in.h: Likewise.
+
+2010-03-20  Bruno Haible  <bruno@clisp.org>
+
        Make _GL_WARN_ON_USE usable in C++ and C mode in the same compilation.
        * build-aux/warn-on-use.h (_GL_WARN_EXTERN_C): New macro.
        (_GL_WARN_ON_USE, _GL_WARN_ON_USE_CXX): Likewise.
index 27b732d..2e4ad3c 100644 (file)
@@ -103,10 +103,6 @@ Summary:
 
 #ifndef _OBSTACK_H
 #define _OBSTACK_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
 \f
 /* We need the type of a pointer subtraction.  If __PTRDIFF_TYPE__ is
    defined, as with GNU C, use that; that way we don't pollute the
@@ -139,6 +135,10 @@ extern "C" {
 
 #include <string.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct _obstack_chunk           /* Lives at front of each chunk. */
 {
   char  *limit;                 /* 1 past end of this chunk */
index a5d3ae4..7fa228a 100644 (file)
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
-# ifdef __cplusplus
-extern "C" {
-# endif
-
 /* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
    Or they define it with the wrong member names or define it in <sys/time.h>
    (e.g., FreeBSD circa 1997).  */
@@ -57,6 +53,11 @@ extern "C" {
 #  if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
 #   include <sys/time.h>
 #  else
+
+#   ifdef __cplusplus
+extern "C" {
+#   endif
+
 #   undef timespec
 #   define timespec rpl_timespec
 struct timespec
@@ -64,11 +65,12 @@ struct timespec
   time_t tv_sec;
   long int tv_nsec;
 };
-#  endif
-# endif
 
-# ifdef __cplusplus
+#   ifdef __cplusplus
 }
+#   endif
+
+#  endif
 # endif
 
 /* Sleep for at least RQTP seconds unless interrupted,  If interrupted,