From 89519c00088b67536eab48f8a17d0eb0c0309b86 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 21 Mar 2010 01:14:37 +0100 Subject: [PATCH] Ensure no #include statements inside extern "C" { ... }. --- ChangeLog | 7 +++++++ lib/obstack.h | 8 ++++---- lib/time.in.h | 16 +++++++++------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71bd014c7..23c4f63d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2010-03-20 Bruno Haible + 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 + 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. diff --git a/lib/obstack.h b/lib/obstack.h index 27b732d5d..2e4ad3c0a 100644 --- a/lib/obstack.h +++ b/lib/obstack.h @@ -103,10 +103,6 @@ Summary: #ifndef _OBSTACK_H #define _OBSTACK_H 1 - -#ifdef __cplusplus -extern "C" { -#endif /* 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 +#ifdef __cplusplus +extern "C" { +#endif + struct _obstack_chunk /* Lives at front of each chunk. */ { char *limit; /* 1 past end of this chunk */ diff --git a/lib/time.in.h b/lib/time.in.h index a5d3ae456..7fa228a8e 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -46,10 +46,6 @@ /* 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 (e.g., FreeBSD circa 1997). */ @@ -57,6 +53,11 @@ extern "C" { # if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ # include # 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, -- 2.11.0