home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / g / bug / 2083 < prev    next >
Encoding:
Internet Message Format  |  1992-12-27  |  3.5 KB

  1. Path: sparky!uunet!crdgw1!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.purdue.edu!gb
  2. From: gb@cs.purdue.edu (Gerald Baumgartner)
  3. Newsgroups: gnu.g++.bug
  4. Subject: GCC 2.3.3, cp-decl.c: changed `vtbl_type_node' (includes fix)
  5. Message-ID: <1hlhnvINNf8t@ector.cs.purdue.edu>
  6. Date: 27 Dec 92 14:28:47 GMT
  7. Sender: gnulists@ai.mit.edu
  8. Distribution: gnu
  9. Organization: Department of Computer Sciences, Purdue University
  10. Lines: 99
  11. Approved: bug-g++@prep.ai.mit.edu
  12.  
  13. The type of virtual function tables is declared to be
  14.  
  15.     (void *)[]
  16.  
  17. in cp-decl.c, init_decl_processing().  Since the type of vtable
  18. entries is not `void *', it'd be better to use the type
  19.  
  20.     vtable_entry_type[]
  21.  
  22. for vtables instead.
  23.  
  24. I needed to change the type of vtables for our implementation of
  25. signatures for C++, since I need to access vtables without knowing
  26. their exact type.  The fix should not cause any problems.
  27.  
  28. Here's the ChangeLog entry:
  29.  
  30. Sun Dec 27 02:57:35 1992  Gerald Baumgartner  (gb at cs.purdue.edu)
  31.  
  32.     * cp-decl.c (vtbl_type_node): Changed comment.
  33.     (init_decl_processing): Changed `vtbl_type_node' to type
  34.     `vtbl_entry_type[]' instead of `(void *)[]'.  Moved initialization
  35.     of `vtbl_mask' and `vtbl_type_node' after initialization of
  36.     `vtbl_entry_type.'
  37.  
  38. The patch for cp-decl.c, GCC 2.3.3, is below.
  39.  
  40. --Gerald
  41.  
  42. ----------------------------------------------------------------------
  43. *** cp-decl.c.orig    Sun Dec 27 01:20:22 1992
  44. --- cp-decl.c    Sun Dec 27 02:57:35 1992
  45. ***************
  46. *** 262,268 ****
  47.   /* Used for virtual function tables.  */
  48.   tree vtbl_mask;
  49.   
  50. ! /* Array type `(void *)[]' */
  51.   tree vtbl_type_node;
  52.   
  53.   #ifdef SOS
  54. --- 262,268 ----
  55.   /* Used for virtual function tables.  */
  56.   tree vtbl_mask;
  57.   
  58. ! /* Array type `vtable_entry_type[]' */
  59.   tree vtbl_type_node;
  60.   
  61.   #ifdef SOS
  62. *************** init_decl_processing ()
  63. *** 4255,4276 ****
  64.                                   sizetype,
  65.                                   endlink))));
  66.   
  67. - #ifdef VTABLE_USES_MASK
  68. -   /* This is primarily for virtual function definition.  We
  69. -      declare an array of `void *', which can later be
  70. -      converted to the appropriate function pointer type.
  71. -      To do pointers to members, we need a mask which can
  72. -      distinguish an index value into a virtual function table
  73. -      from an address.  */
  74. -   vtbl_mask = build_int_2 (~((HOST_WIDE_INT) VINDEX_MAX - 1), -1);
  75. - #endif
  76. -   vtbl_type_node
  77. -     = build_array_type (ptr_type_node, NULL_TREE);
  78. -   layout_type (vtbl_type_node);
  79. -   vtbl_type_node = build_type_variant (vtbl_type_node, 1, 0);
  80. -   record_builtin_type (RID_MAX, 0, vtbl_type_node);
  81.     builtin_function ("__builtin_constant_p", int_ftype_int,
  82.               BUILT_IN_CONSTANT_P, 0);
  83.   
  84. --- 4255,4260 ----
  85. *************** init_decl_processing ()
  86. *** 4414,4419 ****
  87. --- 4398,4419 ----
  88.     TREE_CHAIN (fields[2]) = fields[3];
  89.     vtable_entry_type = build_type_variant (vtable_entry_type, 1, 0);
  90.     record_builtin_type (RID_MAX, VTBL_PTR_TYPE, vtable_entry_type);
  91. + #ifdef VTABLE_USES_MASK
  92. +   /* This is primarily for virtual function definition.  We
  93. +      declare an array of `void *', which can later be
  94. +      converted to the appropriate function pointer type.
  95. +      To do pointers to members, we need a mask which can
  96. +      distinguish an index value into a virtual function table
  97. +      from an address.  */
  98. +   vtbl_mask = build_int_2 (~((HOST_WIDE_INT) VINDEX_MAX - 1), -1);
  99. + #endif
  100. +   vtbl_type_node
  101. +     = build_array_type (vtable_entry_type, NULL_TREE);
  102. +   layout_type (vtbl_type_node);
  103. +   vtbl_type_node = build_type_variant (vtbl_type_node, 1, 0);
  104. +   record_builtin_type (RID_MAX, 0, vtbl_type_node);
  105.   
  106.     if (flag_dossier)
  107.       {
  108.