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: Richard Sandiford <rsandifo at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 23 Jun 2003 20:37:15 +0100
- Subject: Re: [PATCH] Optimize sprintf(buffer,"foo")
- References: <Pine.LNX.4.44.0306221601070.20426-100000@www.eyesopen.com>
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.
Richard