From 3d20d4d843d62e0bc37b4edc232c44be04400377 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Sat, 23 Apr 2005 14:58:52 +0000 Subject: [PATCH] darwin.c (machopic_indirection_name): Don't use quotes needlessly. * config/darwin.c (machopic_indirection_name): Don't use quotes needlessly. (darwin_emit_unwind_label): Use user_label_prefix instead of "_". From-SVN: r98615 --- gcc/ChangeLog | 7 +++++ gcc/config/darwin.c | 67 ++++++++++++++++++++++----------------------- 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0158f5b36665..3df5cec4b409 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-04-23 Mike Stump + + * config/darwin.c (machopic_indirection_name): Don't use + quotes needlessly. + (darwin_emit_unwind_label): Use user_label_prefix instead of + "_". + 2005-04-23 Kazu Hirata * final.c, ipa-inline.c, varasm.c: Fix comment typos. diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index c20bc0e137ca..8c26bf5d496b 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -302,44 +302,41 @@ machopic_indirection_name (rtx sym_ref, bool stub_p) size_t namelen = strlen (name); machopic_indirection *p; void ** slot; + bool saw_star = false; + bool needs_quotes; + const char *suffix; + const char *prefix = user_label_prefix; + const char *quote = ""; - /* Construct the name of the non-lazy pointer or stub. */ - if (stub_p) + if (name[0] == '*') { - int needs_quotes = name_needs_quotes (name); - buffer = alloca (strlen ("&L") - + namelen - + strlen (STUB_SUFFIX) - + 2 /* possible quotes */ - + 1 /* '\0' */); - - if (needs_quotes) - { - if (name[0] == '*') - sprintf (buffer, "&\"L%s" STUB_SUFFIX "\"", name + 1); - else - sprintf (buffer, "&\"L%s%s" STUB_SUFFIX "\"", user_label_prefix, - name); - } - else if (name[0] == '*') - sprintf (buffer, "&L%s" STUB_SUFFIX, name + 1); - else - sprintf (buffer, "&L%s%s" STUB_SUFFIX, user_label_prefix, name); + saw_star = true; + prefix = ""; + ++name; + --namelen; } - else + + needs_quotes = name_needs_quotes (name); + if (needs_quotes) { - buffer = alloca (strlen ("&L") - + strlen (user_label_prefix) - + namelen - + strlen (NON_LAZY_POINTER_SUFFIX) - + 1 /* '\0' */); - if (name[0] == '*') - sprintf (buffer, "&L%s" NON_LAZY_POINTER_SUFFIX, name + 1); - else - sprintf (buffer, "&L%s%s" NON_LAZY_POINTER_SUFFIX, - user_label_prefix, name); + quote = "\""; } + if (stub_p) + suffix = STUB_SUFFIX; + else + suffix = NON_LAZY_POINTER_SUFFIX; + + buffer = alloca (strlen ("&L") + + strlen (prefix) + + namelen + + strlen (suffix) + + 2 * strlen (quote) + + 1 /* '\0' */); + + /* Construct the name of the non-lazy pointer or stub. */ + sprintf (buffer, "&%sL%s%s%s%s", quote, prefix, name, suffix, quote); + if (!machopic_indirections) machopic_indirections = htab_create_ggc (37, machopic_indirection_hash, @@ -1261,8 +1258,7 @@ darwin_emit_unwind_label (FILE *file, tree decl, int for_eh, int empty) ? DECL_ASSEMBLER_NAME (decl) : DECL_NAME (decl); - const char *prefix = "_"; - const int prefix_len = 1; + const char *prefix = user_label_prefix; const char *base = IDENTIFIER_POINTER (id); unsigned int base_len = IDENTIFIER_LENGTH (id); @@ -1276,7 +1272,8 @@ darwin_emit_unwind_label (FILE *file, tree decl, int for_eh, int empty) if (! for_eh) suffix = ".eh1"; - lab = xmalloc (prefix_len + base_len + strlen (suffix) + quotes_len + 1); + lab = xmalloc (strlen (prefix) + + base_len + strlen (suffix) + quotes_len + 1); lab[0] = '\0'; if (need_quotes) -- 2.43.5