This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for gcc 3.3.x Bug#13617
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: ssamoylov at dev dot rtsoft dot ru
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 30 Sep 2004 09:51:52 +0100
- Subject: Re: Patch for gcc 3.3.x Bug#13617
- References: <200409221611.49877.ssamoylov@dev.rtsoft.ru>
"Sergey M. Samoylov" <ssamoylov@dev.rtsoft.ru> writes:
> I've modified this patch for gcc 3.3.x.
Thanks for the patch. There are a couple of problems though:
- 3.3 and 3.4 support the MIPSpro assemblers, and unfortunately, the o32
MIPSpro assembler doesn't support a three-argument .comm. This means
that the patch would break mips-sgi-irix6.5o32. See how 3.4 works
around this.
- I believe 3.3 patches need to be K&R compatible.
So:
> +mips_output_aligned_decl_common (FILE *stream, tree decl, const char *name,
> + unsigned HOST_WIDE_INT size,
> + unsigned int align)
You need a K&R-style function definition here.
> + mips_declare_object (stream, name, "",
> + ":\n\t.space\t" HOST_WIDE_INT_PRINT_UNSIGNED "\n",
> + size);
No string concatenation. You could use ACONCAT instead:
format = ACONCAT ((":\n\t.space\t", HOST_WIDE_INT_PRINT_UNSIGNED,
"\n", NULL));
Also (very minor nit) the function isn't formatted properly. There's too
much indentation in some places and too little in others.
> +void
> +mips_declare_object (FILE *stream, const char *name, const char *init_string,
> + const char *final_string, ...)
> {
> - fputs (init_string, stream); /* "", "\t.comm\t", or "\t.lcomm\t" */
> + va_list ap;
> +
> + fputs (init_string, stream);
> assemble_name (stream, name);
> - fprintf (stream, final_string, size); /* ":\n", ",%u\n", ",%u\n" */
> + va_start (ap, final_string);
> + vfprintf (stream, final_string, ap);
> + va_end (ap);
> +
For K&R, you'd need something like:
void
mips_declare_object VPARAMS ((FILE *stream, const char *name,
const char *init_string,
const char *final_string, ...))
{
VA_OPEN (ap, final_string);
VA_FIXEDARG (ap, FILE *, stream);
VA_FIXEDARG (ap, const char *, name);
VA_FIXEDARG (ap, const char *, init_string);
VA_FIXEDARG (ap, const char *, final_string);
...
VA_CLOSE (ap);
}
(untested).
> -extern void mips_declare_object PARAMS ((FILE *, const char *,
> +extern void mips_output_aligned_decl_common (FILE *, tree, const char *,
> + unsigned HOST_WIDE_INT,
> + unsigned int);
> +/*extern void mips_declare_object PARAMS ((FILE *, const char *,
> const char *,
> - const char *, int));
> + const char *, int));*/
> +extern void mips_declare_object (FILE *, const char *, const char *,
> + const char *, ...);
The new prototypes need to use PARAMS, just like the existing ones do.
You should also just get rid of the old mips_declare_object prototype
(rather than comment it out).
Richard