[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Tinycc-devel] Preprocessor output
From: |
Svein Berge |
Subject: |
RE: [Tinycc-devel] Preprocessor output |
Date: |
Mon, 16 Oct 2006 10:40:19 +0200 |
> -----Original Message-----
> From: Rob Landley [mailto:address@hidden
> Sent: Monday, October 16, 2006 1:41 AM
> To: address@hidden
> Cc: Svein Berge; 'Bernhard Fischer'
> Subject: Re: [Tinycc-devel] Preprocessor output
>
> On Saturday 14 October 2006 1:36 pm, Svein Berge wrote:
> > > -----Original Message-----
> > > From: Bernhard Fischer [mailto:address@hidden
> > > Sent: Saturday, October 14, 2006 6:43 PM
> > > To: address@hidden
> > > Cc: address@hidden
> > > Subject: Re: [Tinycc-devel] Preprocessor output
> > >
> > > On Sat, Oct 14, 2006 at 12:24:58AM +0200, Svein Berge wrote:
> > > >For my project (www.sourceforge.org/projects/jsext), I need
> > > a C compiler
> > > >(preferrably tiny), but also a C preprocessor. I've added a
> > > few lines of
> > > >code to add the -E option to tcc and a tcc_preprocess
> > > function to tcclib.
> > > >The -E option makes tcc stop after preprocessing and send
> > > output to stdout
> > > >(like gcc does). The tcc_preprocess function in libtcc takes
> > > C code as a
> > > >char * and returns preprocessed C code as a char *.
> > > >
> > > >The preprocessor output contains preprocessed code, a list
> > > of all constant
> > > >#defines (that is, those without parameters) and #
> > > linenumber "filename"
> > > >records.
> > > >
> > > >Enclosed are the diff files for libtcc.h and tcc.c. I hope
> > > this will be
> > >
> > > Sounds useful. Unfortunately your patch doesn't apply to current
> > > cvs. Could you please send a "diff -u" against current cvs?
> > >
> > > TIA,
> > >
> > > >included in a future release. It may be a useful feature for
> > > others, too,
> > > >adds little code and is backwards-compatible.
> >
> > Right... I worked from release 0.9.23. Here are the diffs
> against CVS (with
> > -u).
>
> I think I understand most of it, but what's this bit for?
>
> @@ -1675,6 +1687,8 @@
> case TOK_GT:
> v = '>';
> goto addv;
> + case TOK_DOTS:
> + return strcpy(p, "...");
> case TOK_A_SHL:
> return strcpy(p, "<<=");
> case TOK_A_SAR:
>
> - the_end:
> + the_end:
That's because the DOTS token was missing from the token-to-string function.
Every time the ... token was encountered, the preprocessor would output
(null).
Svein
> Don't indent labels. The whole point of labels is to violate
> bracket nesting
> levels. They belong at the left edge. They're supposed to
> stand out and be
> ugly.
>
>
> At some point I need to apply a whitespace cleanup to my
> repository, turning
> the tabs into 8 spaces and removing trailing whitespace from
> lines, something
> like:
>
> sed -ne 's/\t/ /' -e 's/ *$//' *.[ch]
>
> And then checking it in...
>
> Rob
> --
> "Perfection is reached, not when there is no longer anything
> to add, but
> when there is no longer anything to take away." - Antoine de
> Saint-Exupery
- [Tinycc-devel] Preprocessor output, Svein Berge, 2006/10/13
- Re: [Tinycc-devel] Preprocessor output, Bernhard Fischer, 2006/10/14
- RE: [Tinycc-devel] Preprocessor output, Svein Berge, 2006/10/14
- Re: [Tinycc-devel] Preprocessor output, Rob Landley, 2006/10/15
- Re: [Tinycc-devel] Preprocessor output, Bernhard Fischer, 2006/10/16
- RE: [Tinycc-devel] Preprocessor output, Svein Berge, 2006/10/16
- RE: [Tinycc-devel] Preprocessor output, Svein Berge, 2006/10/16
- Re: [Tinycc-devel] Preprocessor output, Fabrice Bellard, 2006/10/16
- Re: [Tinycc-devel] Preprocessor output, Rob Landley, 2006/10/17
- RE: [Tinycc-devel] Preprocessor output,
Svein Berge <=
- Re: [Tinycc-devel] Preprocessor output, Rob Landley, 2006/10/15
- RE: [Tinycc-devel] Preprocessor output, Svein Berge, 2006/10/16