This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Questions about defaults.h ASM_FORMAT_PRIVATE_NAME
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 1 Sep 2002 12:44:18 -0400 (EDT)
- Subject: Questions about defaults.h ASM_FORMAT_PRIVATE_NAME
The defaults.h copy of ASM_FORMAT_PRIVATE_NAME looks like this:
do { \
int len = strlen (NAME); \
char *temp = (char *) alloca (len + 3); \
temp[0] = 'L'; \
strcpy (&temp[1], (NAME)); \
temp[len + 1] = '.'; \
temp[len + 2] = 0; \
(OUTPUT) = (char *) alloca (strlen (NAME) + 11); \
ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO); \
} while (0)
1. Aside from some obvious inefficiencies, I was wondering about the
call to ASM_GENERATE_INTERNAL_LABEL. Namely why is it used? Most
(all?) ports define their own version which simply does this:
sprintf (BUF, "%s.%d", NAME, NUM). I.e. without any '*' prefix.
2. Given that it must return space allocated by alloca, there's no
way to make this into a (target hook) function, right? So the
best hope would be to simply eliminate duplicate port specific
copies (as long as I understand the use of GENERATE vs naked
sprintf?)
The tm.texi documentation wasn't 100% clear (to me at least) in this
regard. At least, I would have suspected that using GENERATE here
would be wrong and we're getting lucky because all ports define their
own copy of this macro. (?)
Thanks,
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu