This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH RFA: Add extern "C" to libcpp header files


This patch adds extern "C" to the header files in libcpp.  This is a
stage toward enabling builds with C++.  My present plan is to have gcc
be built using a C++ compiler but libcpp be built with a C compiler.  In
the future, libcpp will probably move to a C++ compiler as well.  It may
or may not be desirable to retain a C interface even when libcpp is
built with a C++ compiler; I don't know.

Bootstrapped on x86_64-unknown-linux-gnu.  OK for mainline?

Ian


2009-05-31  Ian Lance Taylor  <iant@google.com>

	* include/cpp-id-data.h: Add extern "C".
	* include/line-map.h: Likewise.
	* include/mkdeps.h: Likewise.
	* include/symtab.h: Likewise.
	* internal.h: Likewise.


Index: libcpp/include/symtab.h
===================================================================
--- libcpp/include/symtab.h	(revision 148020)
+++ libcpp/include/symtab.h	(working copy)
@@ -20,6 +20,11 @@ along with this program; see the file CO
 #define LIBCPP_SYMTAB_H
 
 #include "obstack.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifndef GTY
 #define GTY(x) /* nothing */
 #endif
@@ -99,4 +104,8 @@ extern void ht_load (hash_table *ht, has
 /* Dump allocation statistics to stderr.  */
 extern void ht_dump_statistics (hash_table *);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LIBCPP_SYMTAB_H */
Index: libcpp/include/line-map.h
===================================================================
--- libcpp/include/line-map.h	(revision 148020)
+++ libcpp/include/line-map.h	(working copy)
@@ -23,6 +23,10 @@ along with this program; see the file CO
 #ifndef LIBCPP_LINE_MAP_H
 #define LIBCPP_LINE_MAP_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifndef GTY
 #define GTY(x) /* nothing */
 #endif
@@ -184,4 +188,9 @@ extern const struct line_map *linemap_lo
 
 extern source_location
 linemap_position_for_column (struct line_maps *set, unsigned int to_column);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* !LIBCPP_LINE_MAP_H  */
Index: libcpp/include/cpp-id-data.h
===================================================================
--- libcpp/include/cpp-id-data.h	(revision 148020)
+++ libcpp/include/cpp-id-data.h	(working copy)
@@ -18,6 +18,10 @@ along with this program; see the file CO
 
 #include "cpplib.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #if !defined (HAVE_UCHAR) && !defined (IN_GCC)
 typedef unsigned char uchar;
 #endif
@@ -79,3 +83,7 @@ struct GTY(()) cpp_macro {
      tokens.  */
   unsigned int extra_tokens : 1;
 };
+
+#ifdef __cplusplus
+}
+#endif
Index: libcpp/include/mkdeps.h
===================================================================
--- libcpp/include/mkdeps.h	(revision 148020)
+++ libcpp/include/mkdeps.h	(working copy)
@@ -23,6 +23,10 @@ along with this program; see the file CO
 #ifndef LIBCPP_MKDEPS_H
 #define LIBCPP_MKDEPS_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* This is the data structure used by all the functions in mkdeps.c.
    It's quite straightforward, but should be treated as opaque.  */
 
@@ -76,4 +80,8 @@ extern int deps_restore (struct deps *, 
    automatic dependency schemes.  */
 extern void deps_phony_targets (const struct deps *, FILE *);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* ! LIBCPP_MKDEPS_H */
Index: libcpp/internal.h
===================================================================
--- libcpp/internal.h	(revision 148020)
+++ libcpp/internal.h	(working copy)
@@ -33,6 +33,10 @@ along with this program; see the file CO
 typedef int iconv_t;  /* dummy */
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct directive;		/* Deliberately incomplete.  */
 struct pending_option;
 struct op;
@@ -702,4 +706,8 @@ ufputs (const unsigned char *s, FILE *f)
   return fputs ((const char *)s, f);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* ! LIBCPP_INTERNAL_H */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]