Patchwork Allow Tru64 UNIX bootstrap with C++

login
register
mail settings
Submitter Rainer Orth
Date July 25, 2011, 2:30 p.m.
Message ID <ydd7h76h1qh.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/106680/
State New
Headers show

Comments

Rainer Orth - July 25, 2011, 2:30 p.m.
Ian Lance Taylor <iant@google.com> writes:

> I'll preapprove a similar patch to libcpp/system.h if you want to take a
> look at that.

Sure.  The following patch has been bootstrapped successfully on
i386-pc-solaris2.11, installed on mainline.

	Rainer


2011-07-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* system.h [__cplusplus]: Wrap C function declarations in extern "C".

Patch

diff --git a/libcpp/system.h b/libcpp/system.h
--- a/libcpp/system.h
+++ b/libcpp/system.h
@@ -84,6 +84,10 @@  along with GCC; see the file COPYING3.  
 #  define fputc(C, Stream) fputc_unlocked (C, Stream)
 # endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 # ifdef HAVE_CLEARERR_UNLOCKED
 #  undef clearerr
 #  define clearerr(Stream) clearerr_unlocked (Stream)
@@ -164,6 +168,10 @@  extern int fprintf_unlocked (FILE *, con
 #  endif
 # endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 /* ??? Glibc's fwrite/fread_unlocked macros cause
@@ -286,10 +294,18 @@  extern int errno;
    here.  These checks will be in the undefined state while configure
    is running so be careful to test "defined (HAVE_DECL_*)".  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #if defined (HAVE_DECL_ABORT) && !HAVE_DECL_ABORT
 extern void abort (void);
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #if HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif