Patch to provide a default for ASM_OUTPUT_INTERNAL_LABEL

Richard Henderson rth@redhat.com
Thu Aug 29 19:09:00 GMT 2002


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~



More information about the Gcc-patches mailing list