This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PCH] save/restore C++ operator information
- From: Geoffrey Keating <gkeating at apple dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Sylvain Pion <Sylvain dot Pion at mpi-sb dot mpg dot de>
- Date: Tue, 10 Dec 2002 10:53:15 -0800 (PST)
- Subject: [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));
============================================================