On 03/21/2011 06:36 PM, Kai Tietz wrote:
+      attr = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (a)),
+                              CONST_CAST_TREE (a2));

I might use as->name for the name, and change lookup_attribute to take a const_tree rather than use CONST_CAST_TREE.

+  if (!a)
+    {
+      for (a = a2; a != NULL_TREE; a = TREE_CHAIN (a))
+       {
+         const struct attribute_spec *as;
+         const_tree attr;
+         as = lookup_attribute_spec (TREE_PURPOSE (a));
+         if (!as || as->affects_type_identity == false)
+           continue;
+         attr = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (a)),
+                                  CONST_CAST_TREE (a1));
+         if (!attr)
+           break;
+
+         if (TREE_VALUE (a) != NULL_TREE
+             && TREE_CODE (TREE_VALUE (a)) == TREE_LIST
+             && TREE_VALUE (attr) != NULL
+             && TREE_CODE (TREE_VALUE (attr)) == TREE_LIST)
+           {
+             if (simple_cst_list_equal (TREE_VALUE (a),
+                                        TREE_VALUE (attr)) == 1)
+               break;
+           }
+         else if (simple_cst_equal (TREE_VALUE (a), TREE_VALUE (attr)) == 1)
+           break;
+       }

Once we've walked the first list, we don't need to compare the values of common attributes again; for each attribute in the second list either it does appear in the first list and we've already established that they match, or it doesn't appear in the first list and we're done.

Jason

Reply via email to