This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Creating a va_list dynamically?
- To: gcc at gcc dot gnu dot org, ghazi at caip dot rutgers dot edu
- Subject: Re: Creating a va_list dynamically?
- From: Mike Stump <mrs at windriver dot com>
- Date: Mon, 9 Oct 2000 11:49:46 -0700 (PDT)
> Date: Mon, 9 Oct 2000 13:22:14 -0400 (EDT)
> From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
> To: gcc@gcc.gnu.org
> I'm trying to see if I can easily teach gcc to optimize e.g.
> > fprintf("%d %s", 5, "hello") -> fputs("5 hello")
> (If I can't use something like vasprintf, I'd have to rewrite a
> complete *printf parser. Bleah.)
I almost think we are better off with a complete parser. The reason
is that target system and host system are inherently !=, and a system
can have local extentions that don't match anything. You want a
conservative approach to % semantics, with non-portable % being
deferred til runtime. Also, if you handle %s %d %c and the various
forms of them and the other numeric formats, you will have 99% of of
all format strings.
Also, be sure to disable optimizations that bloat code when -Os is
given.