Traditional cpp

Dimitry Andric dim at FreeBSD.org
Sat Nov 10 11:49:40 UTC 2012


On 2012-11-10 07:46, Greg 'groggy' Lehey wrote:
> On Friday,  9 November 2012 at 13:52:24 +0100, Dimitry Andric wrote:
...
>> Looks like yet another cpp -traditional abuse.
> Use or abuse?

Abuse, definitely. :-)  A "C Preprocessor" is clearly meant to
preprocess C, not arbitrary text files.

You can see the problem of this approach, when you try to use another
traditional preprocessor, like ports/devel/ucpp, for tools like Imake.
Niclas Zeising can probably tell some interesting stories about this.

Any subtly different spacing, token parsing behaviour, etc. tend to
break those tools.  They are basically relying on the specifics of the
GNU cpp implementation.


> In any case, it's not the only one.  In the Good Old
> Days people did things like that.  So, it seems, does imake, and I'm
> sure others will come out of the woodwork.
>
>> Clang will most likely never support traditional preprocessing.
>
> OK.
>
>> It is probably better to just use sed or awk for this kind of
>> trickery.
>
> I'm not sure that's the way to go.  It's more work than it's worth.
>
> What we really need is a traditional cpp.  That's not difficult:
> there's one in 4.3BSD (all 32 kB of source).  OpenBSD also had one,
> though it's gone now, so presumably that one has a clean license.
> Both appear to be from pcc.  Should we import it into the tree as,
> say, tradcpp?

Please check with Niclas and the other ports guys who have been
wrestling with exactly this issue for some time.  They may have lots of
good suggestions.


More information about the freebsd-current mailing list