home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!crdgw1!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.purdue.edu!gb
- From: gb@cs.purdue.edu (Gerald Baumgartner)
- Newsgroups: gnu.g++.bug
- Subject: GCC 2.3.3, cp-decl.c: changed `vtbl_type_node' (includes fix)
- Message-ID: <1hlhnvINNf8t@ector.cs.purdue.edu>
- Date: 27 Dec 92 14:28:47 GMT
- Sender: gnulists@ai.mit.edu
- Distribution: gnu
- Organization: Department of Computer Sciences, Purdue University
- Lines: 99
- Approved: bug-g++@prep.ai.mit.edu
-
- The type of virtual function tables is declared to be
-
- (void *)[]
-
- in cp-decl.c, init_decl_processing(). Since the type of vtable
- entries is not `void *', it'd be better to use the type
-
- vtable_entry_type[]
-
- for vtables instead.
-
- I needed to change the type of vtables for our implementation of
- signatures for C++, since I need to access vtables without knowing
- their exact type. The fix should not cause any problems.
-
- Here's the ChangeLog entry:
-
- Sun Dec 27 02:57:35 1992 Gerald Baumgartner (gb at cs.purdue.edu)
-
- * cp-decl.c (vtbl_type_node): Changed comment.
- (init_decl_processing): Changed `vtbl_type_node' to type
- `vtbl_entry_type[]' instead of `(void *)[]'. Moved initialization
- of `vtbl_mask' and `vtbl_type_node' after initialization of
- `vtbl_entry_type.'
-
- The patch for cp-decl.c, GCC 2.3.3, is below.
-
- --Gerald
-
- ----------------------------------------------------------------------
- *** cp-decl.c.orig Sun Dec 27 01:20:22 1992
- --- cp-decl.c Sun Dec 27 02:57:35 1992
- ***************
- *** 262,268 ****
- /* Used for virtual function tables. */
- tree vtbl_mask;
-
- ! /* Array type `(void *)[]' */
- tree vtbl_type_node;
-
- #ifdef SOS
- --- 262,268 ----
- /* Used for virtual function tables. */
- tree vtbl_mask;
-
- ! /* Array type `vtable_entry_type[]' */
- tree vtbl_type_node;
-
- #ifdef SOS
- *************** init_decl_processing ()
- *** 4255,4276 ****
- sizetype,
- endlink))));
-
- - #ifdef VTABLE_USES_MASK
- - /* This is primarily for virtual function definition. We
- - declare an array of `void *', which can later be
- - converted to the appropriate function pointer type.
- - To do pointers to members, we need a mask which can
- - distinguish an index value into a virtual function table
- - from an address. */
- - vtbl_mask = build_int_2 (~((HOST_WIDE_INT) VINDEX_MAX - 1), -1);
- - #endif
- -
- - vtbl_type_node
- - = build_array_type (ptr_type_node, NULL_TREE);
- - layout_type (vtbl_type_node);
- - vtbl_type_node = build_type_variant (vtbl_type_node, 1, 0);
- - record_builtin_type (RID_MAX, 0, vtbl_type_node);
- -
- builtin_function ("__builtin_constant_p", int_ftype_int,
- BUILT_IN_CONSTANT_P, 0);
-
- --- 4255,4260 ----
- *************** init_decl_processing ()
- *** 4414,4419 ****
- --- 4398,4419 ----
- TREE_CHAIN (fields[2]) = fields[3];
- vtable_entry_type = build_type_variant (vtable_entry_type, 1, 0);
- record_builtin_type (RID_MAX, VTBL_PTR_TYPE, vtable_entry_type);
- +
- + #ifdef VTABLE_USES_MASK
- + /* This is primarily for virtual function definition. We
- + declare an array of `void *', which can later be
- + converted to the appropriate function pointer type.
- + To do pointers to members, we need a mask which can
- + distinguish an index value into a virtual function table
- + from an address. */
- + vtbl_mask = build_int_2 (~((HOST_WIDE_INT) VINDEX_MAX - 1), -1);
- + #endif
- +
- + vtbl_type_node
- + = build_array_type (vtable_entry_type, NULL_TREE);
- + layout_type (vtbl_type_node);
- + vtbl_type_node = build_type_variant (vtbl_type_node, 1, 0);
- + record_builtin_type (RID_MAX, 0, vtbl_type_node);
-
- if (flag_dossier)
- {
-