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]

Re: [PATCH] Canonical types (1/3)


On 12/6/06, Doug Gregor <doug.gregor@gmail.com> wrote:
This patch has been "lightly" tested, by which I mean that it
bootstraps with C, C++, Objective-C, Objective-C++, and Java; "make
check"s for C, C++, Objective-C, Objective-C++, and libstdc++. No
canonical-type warnings or new failures anywhere on i686-pc-linux-gnu.

Before committing, I also need to run the same tests with
"--disable-checking" (to turn off canonical-type verification
throughout), and repeat the whole suite of tests on
powerpc-apple-darwin8.8.0.

With this update to the Objective-C front end, the whole suite of tests mentioned above passes on both i686-pc-linux-gnu and powerpc-apple-darwin8.8.0, producing identical results to the current mainline for the C, C++, Objective-C, Objective-C++ testsuites (all the front ends that are affected), and libstdc++; those front-ends plus Java bootstrap on both platforms. This is both with --enable-checking (verifies canonical types) and --disable-checking (uses canonical types without verifying them).

Anything else I should test?

 Cheers,
 Doug

2006-12-06 Douglas Gregor <doug.gregor@gmail.com>

      * objc-act.c (objc_build_volatilized_type): Keep track of
      canonical types.
      (objc_get_protocol_qualified_type): Ditto.
Index: objc-act.c
===================================================================
--- objc-act.c	(revision 119581)
+++ objc-act.c	(working copy)
@@ -908,6 +908,14 @@ objc_build_volatilized_type (tree type)
   t = build_variant_type_copy (type);
   TYPE_VOLATILE (t) = 1;
 
+  /* Set up the canonical type information. */
+  if (TYPE_STRUCTURAL_EQUALITY_P (type))
+    SET_TYPE_STRUCTURAL_EQUALITY (t);
+  else if (TYPE_CANONICAL (type) != type)
+    TYPE_CANONICAL (t) = objc_build_volatilized_type (TYPE_CANONICAL (type));
+  else
+    TYPE_CANONICAL (t) = t;
+
   return t;
 }
 
@@ -1370,7 +1378,13 @@ objc_get_protocol_qualified_type (tree i
 	 to the pointee.  */
       if (is_ptr)
 	{
-	  TREE_TYPE (type) = build_variant_type_copy (TREE_TYPE (type));
+	  tree orig_pointee_type = TREE_TYPE (type);
+	  TREE_TYPE (type) = build_variant_type_copy (orig_pointee_type);
+
+	  /* Set up the canonical type information. */
+	  TYPE_CANONICAL (type) 
+	    = TYPE_CANONICAL (TYPE_POINTER_TO (orig_pointee_type));
+
 	  TYPE_POINTER_TO (TREE_TYPE (type)) = type;
 	  type = TREE_TYPE (type);
 	}

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