This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]