This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to provide a default for ASM_OUTPUT_INTERNAL_LABEL
- From: Richard Henderson <rth at redhat dot com>
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 29 Aug 2002 18:58:37 -0700
- Subject: Re: Patch to provide a default for ASM_OUTPUT_INTERNAL_LABEL
- References: <200208221736.NAA00268@caip.rutgers.edu>
On Thu, Aug 22, 2002 at 01:36:09PM -0400, Kaveh R. Ghazi wrote:
> Also in a few cases, the OUTPUT and GENERATE macros were slightly
> different ...
It wouldn't bother me at all if OUTPUT was in fact *not*
implemented as a target hook, but instead as a mere
function that calls the GENERATE and ASM_OUTPUT_LABEL
hooks. Any time we can eliminate the possibility for
mismatch like this seems like a Good Thing.
> +#ifndef ASM_OUTPUT_INTERNAL_LABEL
> +#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,LABELNO) \
> + do { \
> + const char *const prefix_ = (PREFIX); \
> + char *const buf_ = alloca (40 + strlen (prefix_)); \
> + ASM_GENERATE_INTERNAL_LABEL (buf_, prefix_, (LABELNO)); \
I don't see that using alloca here is effective at all.
I'd be in favour of the final GENERATE target hook taking a
length parameter for the buffer, and doing something like
if (snprintf (buf, size, format, args) == -1)
abort ();
Or perhaps _define_ the input buffer to have some specific
length (e.g. MAX_INTERNAL_LABEL_LEN=64) and fix up all uses.
r~