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]

Re: Patch for include the option " -fno-rtti " (C++ & DirectX finally!!!)


Hello,

Following its orientations (Jason Merrill), I created an entrance in the way
as I found in the files ChangeLog. I removed the alterations of the option
"no-rtti" and I placed in a new option "-fms-abi". I liked this form much
more (thank you for the I aid) and correct again I marry it still lacks some
thing. If you work with the platform Win32, he should be knowing that has a
lot of people wanting that this is soon ready.

Antonio Mendes de Oliveira Neto (anmendes@cruzeironet.com.br)

1998-08-02  Antonio Mendes de Oliveira Neto  <anmendes@cruzeironet.com.br>
    Inclusion of the option " -fms-abi " that modifies the form as the
vtable
    is generated turning it compatible with MS-Windows (Win32). The Use of
    this option implies in the activation of the options vtable-thunks
    and no-rtti.
    * gcc/config/i386/i386.c (i386_valid_type_attribute_p):
         Recognition of the attribute "stdcall" in virtual methods.
    * gcc/cp/class.c
         (set_rtti_entry)
         (add_virtual_function)
         (skip_rtti_stuff)
         (finish_struct_1)
         Changes for elimination of the first two entrances of the vtable
    * gcc/cp/cp-tree.h
         Inclusion of the variable "flag_ms_abi"
    * gcc/cp/decl2.c
         Initialization of the variable "flag_ms_abi"

         (lang_decode_option) Fittings of the variables for the
                              option "flag_ms_abi"
    * gcc/cp/lang-options.h
         Description of the option "ms-abi"
============================================================================
=
diff -c3p egcs-19980721-old/gcc/config/i386/i386.c
egcs-19980721/gcc/config/i386/i386.c
*** egcs-19980721-old/gcc/config/i386/i386.c Mon Jul 06 20:42:47 1998
--- egcs-19980721/gcc/config/i386/i386.c Sun Aug 02 12:40:57 1998
*************** i386_valid_type_attribute_p (type, attri
*** 546,551 ****
--- 546,552 ----
       tree args;
  {
    if (TREE_CODE (type) != FUNCTION_TYPE
+       && TREE_CODE (type) != METHOD_TYPE
        && TREE_CODE (type) != FIELD_DECL
        && TREE_CODE (type) != TYPE_DECL)
      return 0;
diff -c3p egcs-19980721-old/gcc/cp/class.c egcs-19980721/gcc/cp/class.c
*** egcs-19980721-old/gcc/cp/class.c Sat Jul 18 08:05:41 1998
--- egcs-19980721/gcc/cp/class.c Sun Aug 02 13:49:19 1998
*************** set_rtti_entry (virtuals, offset, type)
*** 647,652 ****
--- 647,655 ----
  {
    tree vfn;

+   if (flag_ms_abi)
+     return;
+
    if (flag_rtti)
      vfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, get_tinfo_fn (type));
    else
*************** add_virtual_function (pv, phv, has_virtu
*** 1014,1020 ****

        /* If we are using thunks, use two slots at the front, one
    for the offset pointer, one for the tdesc pointer.  */
!       if (*has_virtual == 0 && flag_vtable_thunks)
   {
     *has_virtual = 1;
   }
--- 1017,1023 ----

        /* If we are using thunks, use two slots at the front, one
    for the offset pointer, one for the tdesc pointer.  */
!       if (*has_virtual == 0 && flag_vtable_thunks && !flag_ms_abi)
   {
     *has_virtual = 1;
   }
*************** add_virtual_function (pv, phv, has_virtu
*** 1023,1030 ****
        {
   static tree index_table[256];
   tree idx;
   /* We skip a slot for the offset/tdesc entry.  */
!  int i = ++(*has_virtual);

   if (i >= 256 || index_table[i] == 0)
     {
--- 1026,1034 ----
        {
   static tree index_table[256];
   tree idx;
+
   /* We skip a slot for the offset/tdesc entry.  */
!  int i = flag_ms_abi ? (*has_virtual)++ : ++(*has_virtual);

   if (i >= 256 || index_table[i] == 0)
     {
*************** skip_rtti_stuff (virtuals)
*** 2352,2369 ****
    int n;

    n = 0;
!   if (*virtuals)
!     {
!       /* We always reserve a slot for the offset/tdesc entry.  */
!       ++n;
!       *virtuals = TREE_CHAIN (*virtuals);
!     }
!   if (flag_vtable_thunks && *virtuals)
      {
!       /* The second slot is reserved for the tdesc pointer when thunks
!          are used.  */
!       ++n;
!       *virtuals = TREE_CHAIN (*virtuals);
      }
    return n;
  }
--- 2356,2376 ----
    int n;

    n = 0;
!   if (!flag_ms_abi)
      {
!       if (*virtuals)
!         {
!           /* We always reserve a slot for the offset/tdesc entry.  */
!           ++n;
!           *virtuals = TREE_CHAIN (*virtuals);
!         }
!       if (flag_vtable_thunks && *virtuals)
!         {
!           /* The second slot is reserved for the tdesc pointer when thunks
!              are used.  */
!           ++n;
!           *virtuals = TREE_CHAIN (*virtuals);
!         }
      }
    return n;
  }
*************** finish_struct_1 (t, warn_anon)
*** 3983,3993 ****
        if (first_vfn_base_index < 0)
   {
     /* The second slot is for the tdesc pointer when thunks are used.  */
!    if (flag_vtable_thunks)
       pending_virtuals = tree_cons (NULL_TREE, NULL_TREE,
pending_virtuals);

     /* The first slot is for the rtti offset.  */
!    pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals);

     set_rtti_entry (pending_virtuals, integer_zero_node, t);
     build_vtable (NULL_TREE, t);
--- 3990,4001 ----
        if (first_vfn_base_index < 0)
   {
     /* The second slot is for the tdesc pointer when thunks are used.  */
!    if (flag_vtable_thunks && !flag_ms_abi)
       pending_virtuals = tree_cons (NULL_TREE, NULL_TREE,
pending_virtuals);

     /* The first slot is for the rtti offset.  */
!    if (!flag_ms_abi)
!      pending_virtuals = tree_cons (NULL_TREE, NULL_TREE,
pending_virtuals);

     set_rtti_entry (pending_virtuals, integer_zero_node, t);
     build_vtable (NULL_TREE, t);
diff -c3p egcs-19980721-old/gcc/cp/cp-tree.h egcs-19980721/gcc/cp/cp-tree.h
*** egcs-19980721-old/gcc/cp/cp-tree.h Sat Jul 18 08:05:41 1998
--- egcs-19980721/gcc/cp/cp-tree.h Sun Aug 02 13:29:43 1998
*************** extern int flag_weak;
*** 2133,2138 ****
--- 2133,2142 ----

  extern int flag_new_abi;

+ /* Nonzero for experimental binary compatibility with MS-Windows (Win32).
*/
+
+ extern int flag_ms_abi;
+
  /* Nonzero to not ignore namespace std. */

  extern int flag_honor_std;
diff -c3p egcs-19980721-old/gcc/cp/decl2.c egcs-19980721/gcc/cp/decl2.c
*** egcs-19980721-old/gcc/cp/decl2.c Sat Jul 18 08:05:45 1998
--- egcs-19980721/gcc/cp/decl2.c Sun Aug 02 13:29:29 1998
*************** int flag_weak = 1;
*** 432,437 ****
--- 432,441 ----

  int flag_new_abi;

+ /* Nonzero for experimental binary compatibility with MS-Windows (Win32).
*/
+
+ int flag_ms_abi = 0;
+
  /* Nonzero to not ignore namespace std. */

  int flag_honor_std;
*************** lang_decode_option (argc, argv)
*** 625,630 ****
--- 629,640 ----
     flag_new_abi = 0;
     flag_do_squangling = 0;
     flag_honor_std = 0;
+  }
+       else if (!strcmp (p, "ms-abi"))
+  {
+           flag_ms_abi = 1;
+           flag_rtti = 0;
+    flag_vtable_thunks = 1;
   }
        else if (!strncmp (p, "template-depth-", 15))
   {
Common subdirectories: egcs-19980721-old/gcc/cp/inc and
egcs-19980721/gcc/cp/inc
diff -c3p egcs-19980721-old/gcc/cp/lang-options.h
egcs-19980721/gcc/cp/lang-options.h
*** egcs-19980721-old/gcc/cp/lang-options.h Mon Jul 13 14:22:27 1998
--- egcs-19980721/gcc/cp/lang-options.h Sun Aug 02 13:39:49 1998
*************** DEFINE_LANG_NAME ("C++")
*** 73,78 ****
--- 73,79 ----
    { "-fname-mangling-version-", "Set the version of name mangling to
use" },
    { "-fnew-abi", "Enable experimental ABI changes" },
    { "-fno-new-abi", "" },
+   { "-fms-abi", "Enable experimental binary compatibility with MS-Windows
(Win32)." },
    { "-fnonnull-objects", "" },
    { "-fno-nonnull-objects", "Do not assume that a reference is always
valid" },
    { "-foperator-names", "Recognise and/bitand/bitor/compl/not/or/xor" },




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