This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Optimize sprintf(buffer,"foo")
- From: Roger Sayle <roger at eyesopen dot com>
- To: Richard Sandiford <rsandifo at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 23 Jun 2003 13:39:34 -0600 (MDT)
- Subject: Re: [PATCH] Optimize sprintf(buffer,"foo")
On 23 Jun 2003, Richard Sandiford wrote:
> Roger Sayle <roger@eyesopen.com> writes:
> > extern int sprintf(char*, const char*, ...);
> > [...]
> >
> > #ifdef __OPTIMIZE__
> > /* When optimizing, all the above cases should be transformed into
> > something else. So any remaining calls to the original function
> > should abort. */
> > __attribute__ ((noinline))
> > static int
> > sprintf (char *buf, const char *fmt, ...)
> > {
> > abort ();
> > }
> > #endif
>
> Please use builtins.exp for this! static-after-extern isn't valid C
> and isn't supported on all targets.
Does anyone know why some of the gcc.c-torture/execute/string-opts-*.c
were moved to gcc.c-torture/execute/builtins and the others weren't?
Clearly static-after-extern wasn't the only consideration as almost
all of the remaining string-opts-*.c tests use this idiom.
Roger
--