This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Allow Tru64 UNIX bootstrap with C++
- From: Ian Lance Taylor <iant at google dot com>
- To: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 21 Jul 2011 22:52:24 -0700
- Subject: Re: Allow Tru64 UNIX bootstrap with C++
- References: <yddd3h3lrk3.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> diff --git a/gcc/system.h b/gcc/system.h
> --- a/gcc/system.h
> +++ b/gcc/system.h
> @@ -24,6 +24,10 @@ along with GCC; see the file COPYING3.
> #ifndef GCC_SYSTEM_H
> #define GCC_SYSTEM_H
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> /* We must include stdarg.h before stdio.h. */
> #include <stdarg.h>
>
> @@ -969,4 +973,8 @@ helper_const_non_const_cast (const char
> #define DEBUG_VARIABLE
> #endif
>
> +#ifdef __cplusplus
> +}
> +#endif
> +
> #endif /* ! GCC_SYSTEM_H */
I agree with Joseph that this is wrong. We must never wrap the #include
of a system header file with extern "C". That will simply break on some
systems. You should only wrap extern "C" around the various HAVE_DECL
declarations.
> diff --git a/include/xregex2.h b/include/xregex2.h
> --- a/include/xregex2.h
> +++ b/include/xregex2.h
> @@ -399,7 +399,11 @@ struct re_pattern_buffer
> typedef struct re_pattern_buffer regex_t;
>
> /* Type for byte offsets within the string. POSIX mandates this. */
> +#if defined(__osf__) && defined(__cplusplus)
> +typedef off_t regoff_t;
> +#else
> typedef int regoff_t;
> +#endif
No, the right way to handle this is to add regoff_t to include/xregex.h.
Ian