diff options
author | Jan Hubicka <jh@suse.cz> | 2008-07-13 22:55:47 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2008-07-13 20:55:47 +0000 |
commit | 4d16a7b7c29ca46e15e7d8d305b9522addbcdc62 (patch) | |
tree | 7e76dbeb22b728700c3425bdf242521ccdfe4cd8 /gcc/tree.c | |
parent | f4c91e0d876115fe3e6a04d88fc89235127a5390 (diff) | |
download | gcc-4d16a7b7c29ca46e15e7d8d305b9522addbcdc62.zip gcc-4d16a7b7c29ca46e15e7d8d305b9522addbcdc62.tar.gz gcc-4d16a7b7c29ca46e15e7d8d305b9522addbcdc62.tar.bz2 |
tree.c (decl_assembler_name_equal): Expect assembler name of decl to be mangled too.
* tree.c (decl_assembler_name_equal): Expect assembler name of decl
to be mangled too.
From-SVN: r137756
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. */ |