+ gcc_checking_assert (TREE_CODE (TREE_PURPOSE (list)) == IDENTIFIER_NODE);
+
+ /* Identifiers can be compared directly for equality. */
+ if (attr_identifier == TREE_PURPOSE (list))
+ break;
+
+ /* If they are not equal, they may still be one in the form
+ 'text' while the other one is in the form '__text__'. TODO:
+ If we were storing attributes in normalized 'text' form, then
+ this could all go away and we could take full advantage of
+ the fact that we're comparing identifiers. :-) */
+ {
+ size_t attr_len = IDENTIFIER_LENGTH (attr_identifier);
+ size_t ident_len = IDENTIFIER_LENGTH (TREE_PURPOSE (list));
+
+ if (ident_len == attr_len + 4)
+ {
+ const char *p = IDENTIFIER_POINTER (TREE_PURPOSE (list));
+ const char *q = IDENTIFIER_POINTER (attr_identifier);
+ if (p[0] == '_' && p[1] == '_'
+ && p[ident_len - 2] == '_' && p[ident_len - 1] == '_'
+ && strncmp (q, p + 2, attr_len) == 0)
+ break;
+ }
+ else if (ident_len + 4 == attr_len)
+ {
+ const char *p = IDENTIFIER_POINTER (TREE_PURPOSE (list));
+ const char *q = IDENTIFIER_POINTER (attr_identifier);
+ if (q[0] == '_' && q[1] == '_'
+ && q[attr_len - 2] == '_' && q[attr_len - 1] == '_'
+ && strncmp (q + 2, p, ident_len) == 0)
+ break;
+ }
+ }
+ list = TREE_CHAIN (list);