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]

C++ ABI PATCH to mangle.c


The ABI spec failed to specify the mangling of pointers to cv-qualified
member functions, so we got three different interpretations in the three
existing ia64 compilers.  Intel's compiler is clearly wrong--it doesn't
mangle the cv-quals at all.  Since we're already fixing some ABI bugs in
3.1, we'll change our mangling to match HP's.  I like HP's interpretation
better, anyway.

Tested i686-pc-linux-gnu.  Testcase in g++.dg/abi/mangle5.C.

I'll update the demangler soon.

2002-02-19  Jason Merrill  <jason@redhat.com>

	ABI change: Mangle `void (A::*)() const' as 
	M1AKFvvE, not MK1AFvvE.
	* mangle.c (write_function_type): Write cv-quals for member
	function type here.
	(write_pointer_to_member_type): Not here.

*** mangle.c.~1~	Wed Jan 30 10:59:14 2002
--- mangle.c	Tue Feb 19 17:48:02 2002
*************** write_function_type (type)
*** 1595,1600 ****
--- 1595,1611 ----
  {
    MANGLE_TRACE_TREE ("function-type", type);
  
+   /* For a pointer to member function, the function type may have
+      cv-qualifiers, indicating the quals for the artificial 'this'
+      parameter.  */
+   if (TREE_CODE (type) == METHOD_TYPE)
+     {
+       /* The first parameter must be a POINTER_TYPE pointing to the
+ 	 `this' parameter.  */
+       tree this_type = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (type)));
+       write_CV_qualifiers_for_type (this_type);
+     }
+ 
    write_char ('F');
    /* We don't track whether or not a type is `extern "C"'.  Note that
       you can have an `extern "C"' function that does not have
*************** write_pointer_to_member_type (type)
*** 2021,2044 ****
       tree type;
  {
    write_char ('M');
!   /* For a pointer-to-function member, the class type may be
!      cv-qualified, but that won't be reflected in
!      TYPE_PTRMEM_CLASS_TYPE.  So, we go fishing around in
!      TYPE_PTRMEM_POINTED_TO_TYPE instead.  */
!   if (TYPE_PTRMEMFUNC_P (type))
!     {
!       tree fn_type;
!       tree this_type;
! 
!       fn_type = TYPE_PTRMEM_POINTED_TO_TYPE (type);
!       /* The first parameter must be a POINTER_TYPE pointing to the
! 	 `this' parameter.  */
!       this_type = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fn_type)));
!       write_type (this_type);
!     }
!   /* For a pointer-to-data member, things are simpler.  */
!   else
!     write_type (TYPE_PTRMEM_CLASS_TYPE (type));
    write_type (TYPE_PTRMEM_POINTED_TO_TYPE (type));
  }
  
--- 2032,2038 ----
       tree type;
  {
    write_char ('M');
!   write_type (TYPE_PTRMEM_CLASS_TYPE (type));
    write_type (TYPE_PTRMEM_POINTED_TO_TYPE (type));
  }
  

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