PATCH: Reserve the __attributes__ for member function pointer type

Bo Yang techrazy.yang@gmail.com
Thu Jul 31 09:45:00 GMT 2008


Ok, the revised patch:


Index: gcc/cp/ChangeLog
===================================================================
--- gcc/cp/ChangeLog	(revision 138353)
+++ gcc/cp/ChangeLog	(working copy)
@@ -1,12 +1,17 @@
+2008-07-31  Bo yang  <techrazy.yang@gmail.com>
+
+	* decl2.c (build_memfn_type): Reserve the attrbiutes of a member
+	function.
+
 2008-07-30  Dodji Seketeli  <dseketel@redhat.com>

 	PR c++/36767
 	* decl2.c (fix_temporary_vars_context_r): New function.
 	 (one_static_initialization_or_destruction): Make sure temporary
 	 variables part of the initialiser have their DECL_CONTEXT()
 	 properly set.

 2008-07-30  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

 	PR 34389
 	* typeck.c (build_binary_op): Encapsulate code into
Index: gcc/cp/decl2.c
===================================================================
--- gcc/cp/decl2.c	(revision 138353)
+++ gcc/cp/decl2.c	(working copy)
@@ -98,36 +98,38 @@

 int at_eof;

 


 /* Return a member function type (a METHOD_TYPE), given FNTYPE (a
    FUNCTION_TYPE), CTYPE (class type), and QUALS (the cv-qualifiers
    that apply to the function).  */

 tree
 build_memfn_type (tree fntype, tree ctype, cp_cv_quals quals)
 {
-  tree raises;
+  tree raises, attr;
   int type_quals;

   if (fntype == error_mark_node || ctype == error_mark_node)
     return error_mark_node;

   type_quals = quals & ~TYPE_QUAL_RESTRICT;
   ctype = cp_build_qualified_type (ctype, type_quals);
+  attr = TYPE_ATTRIBUTES (fntype);
   fntype = build_method_type_directly (ctype, TREE_TYPE (fntype),
 				       (TREE_CODE (fntype) == METHOD_TYPE
 					? TREE_CHAIN (TYPE_ARG_TYPES (fntype))
 					: TYPE_ARG_TYPES (fntype)));
+  TYPE_ATTRIBUTES (fntype) = attr;
   raises = TYPE_RAISES_EXCEPTIONS (fntype);
   if (raises)
     fntype = build_exception_variant (fntype, raises);

   return fntype;
 }

 /* Build a PARM_DECL with NAME and TYPE, and set DECL_ARG_TYPE
    appropriately.  */

 tree
 cp_build_parm_decl (tree name, tree type)



More information about the Gcc-patches mailing list