Patch to allow strlen expander to fail

Toon Moene toon@moene.indiv.nluug.nl
Tue Mar 7 14:25:00 GMT 2000


Phil Edwards wrote:

> I wrote:

[ freestanding vs hosted execution environment in C ]

> > I think this can only be solved by having a compile time switch that
> > makes clear which of the two environments one compiles for.  It's
> > amazing to me that a compiler that's used so much in the embedded
> > community, doesn't even _have_ -hosted and -freestanding options.
> 
> We're still talking about GCC, right?  Your wish has already been granted.
> :-)  From the pages for 2.95.2:
> 
> #  `-fhosted'

> #  `-ffreestanding'

Yes, in Dutch we would call this "papier is geduldig"

> I couldn't tell you how those switches get used in the source, or what
> they currently affect.

Use grep - it helps !

% grep freestanding *.c
c-decl.c:  else if (!strcmp (p, "-fhosted") || !strcmp (p,
"-fno-freestanding"))
c-decl.c:  else if (!strcmp (p, "-ffreestanding") || !strcmp (p,
"-fno-hosted"))
c-decl.c:      /* We set this to 2 here, but 1 in -Wmain, so
-ffreestanding can turn
toplev.c:  { "-ffreestanding",
toplev.c:  { "-fno-freestanding", "" },

[ Ah, so it *has* them ]

% grep freestanding *.h
c-tree.h:/* Nonzero means environment is hosted (i.e., not freestanding)
*/
% view c-tree.h
[ ... ]
/* Nonzero means environment is hosted (i.e., not freestanding) */

extern int flag_hosted;
[ ... ]
% grep flag_hosted *.c
c-decl.c:int flag_hosted = 1;
c-decl.c:      flag_hosted = 1;
c-decl.c:      flag_hosted = 0;

That's all, folks !

-- 
Toon Moene (toon@moene.indiv.nluug.nl)
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Phone: +31 346 214290; Fax: +31 346 214286
GNU Fortran: http://gcc.gnu.org/onlinedocs/g77_news.html

... Slowly recovering from the Olympic Gardens ....


More information about the Gcc mailing list