diff options
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 35 |
1 files changed, 28 insertions, 7 deletions
@@ -350,32 +350,53 @@ bool decl_assembler_name_equal (tree decl, const_tree asmname) { tree decl_asmname = DECL_ASSEMBLER_NAME (decl); + const char *decl_str; + const char *asmname_str; + bool test = false; if (decl_asmname == asmname) return true; + decl_str = IDENTIFIER_POINTER (decl_asmname); + asmname_str = IDENTIFIER_POINTER (asmname); + + /* If the target assembler name was set by the user, things are trickier. We have a leading '*' to begin with. After that, it's arguable what is the correct thing to do with -fleading-underscore. Arguably, we've historically been doing the wrong thing in assemble_alias by always printing the leading underscore. Since we're not changing that, make sure user_label_prefix follows the '*' before matching. */ - if (IDENTIFIER_POINTER (decl_asmname)[0] == '*') + if (decl_str[0] == '*') { - const char *decl_str = IDENTIFIER_POINTER (decl_asmname) + 1; size_t ulp_len = strlen (user_label_prefix); + decl_str ++; + if (ulp_len == 0) - ; + test = true; else if (strncmp (decl_str, user_label_prefix, ulp_len) == 0) - decl_str += ulp_len; + decl_str += ulp_len, test=true; else - return false; + decl_str --; + } + if (asmname_str[0] == '*') + { + size_t ulp_len = strlen (user_label_prefix); - return strcmp (decl_str, IDENTIFIER_POINTER (asmname)) == 0; + asmname_str ++; + + if (ulp_len == 0) + test = true; + else if (strncmp (asmname_str, user_label_prefix, ulp_len) == 0) + asmname_str += ulp_len, test=true; + else + asmname_str --; } - return false; + if (!test) + return false; + return strcmp (decl_str, asmname_str) == 0; } /* Hash asmnames ignoring the user specified marks. */ |