aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2005-04-23 14:58:52 +0000
committerMike Stump <mrs@gcc.gnu.org>2005-04-23 14:58:52 +0000
commit3d20d4d843d62e0bc37b4edc232c44be04400377 (patch)
tree000b9c0fcb3806b6342fbbde5dffc6a2a830c2fa
parentb6dae270a24c68aeca4bb9e6b4379f6add1d5f91 (diff)
downloadgcc-3d20d4d843d62e0bc37b4edc232c44be04400377.zip
gcc-3d20d4d843d62e0bc37b4edc232c44be04400377.tar.gz
gcc-3d20d4d843d62e0bc37b4edc232c44be04400377.tar.bz2
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
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/darwin.c67
2 files changed, 39 insertions, 35 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0158f5b..3df5cec 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2005-04-23 Mike Stump <mrs@apple.com>
+
+ * 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 <kazu@cs.umass.edu>
* final.c, ipa-inline.c, varasm.c: Fix comment typos.
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index c20bc0e..8c26bf5 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)