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]

[PCH] save/restore C++ operator information


This fixes this error message when using overloaded C++ operators
(like '<<') from a PCH:

pch_1.C:6: error: no match for `std::ostream& << const char[5]'
operator

(It doesn't fix the next problem, which is a crash; that's a later
patch.)

Bootstrapped and tested on powerpc-darwin.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/pchbranch-cpoperator.patch================
2002-12-03  Geoffrey Keating  <geoffk@apple.com>

	* cp-tree.h (struct operator_name_info_t): Mark for GTY machinery.
	(operator_name_info): Mark to be saved for PCH, specify size.
	(assignment_operator_name_info): Likewise.

Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.671.2.20
diff -u -p -u -p -r1.671.2.20 cp-tree.h
--- cp/cp-tree.h	26 Nov 2002 22:29:59 -0000	1.671.2.20
+++ cp/cp-tree.h	10 Dec 2002 18:49:53 -0000
@@ -3496,7 +3496,7 @@ extern void init_reswords PARAMS ((void)
    opname_tab[(int) MINUS_EXPR] == "-".  */
 extern const char **opname_tab, **assignop_tab;
 
-typedef struct operator_name_info_t
+typedef struct operator_name_info_t GTY(())
 {
   /* The IDENTIFIER_NODE for the operator.  */
   tree identifier;
@@ -3509,9 +3509,11 @@ typedef struct operator_name_info_t
 } operator_name_info_t;
 
 /* A mapping from tree codes to operator name information.  */
-extern operator_name_info_t operator_name_info[];
+extern GTY(()) operator_name_info_t operator_name_info
+  [(int) LAST_CPLUS_TREE_CODE];
 /* Similar, but for assignment operators.  */
-extern operator_name_info_t assignment_operator_name_info[];
+extern GTY(()) operator_name_info_t assignment_operator_name_info
+  [(int) LAST_CPLUS_TREE_CODE];
 
 /* in call.c */
 extern int check_dtor_name			PARAMS ((tree, tree));
============================================================


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