[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180504025832.GF30522@ZenIV.linux.org.uk>
Date: Fri, 4 May 2018 03:58:32 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Alexey Dobriyan <adobriyan@...il.com>, dsterba@...e.cz,
Christoph Hellwig <hch@...radead.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] proc: use #pragma once
On Fri, May 04, 2018 at 01:23:12AM +0200, Rasmus Villemoes wrote:
> > Note that sequence of preprocessor tokens does not depend upon the ifdefs;
> > anything under #if 0 *is* tokenized all the same. So it's not even that
> > "parsing" (tokenizing, actually) has to be repeated.
>
> Are you sure about that? Maybe formally it has to (if the phases are
> done strictly sequentially), but can't it go into some fast-forward mode
> under #if 0 (or #ifndef $some-defined-macro) where it only looks for
> string and char literals, comments and "control-flow" directives?
What else do you expect preprocessor tokenizer to do? It must take care
of line continuations, it must recognize and skip whitespace (including
comments) and if it recognizes string and character literals, what else
is left to do? pp-numbers? Sure - that'd be
[.]?[0-9]([0-9a-zA-Z_.]|[epEP][-+])*
Horribly hard to recognize, that... Identifiers are no harder, obviously
(especially since keywords are _not_ something special at that level)
and punctuators are also easily taken care of.
Preprocessor tokens are nowhere near as much work as C ones. And you
can't do mapping to C ones before the preprocessing is done - if nothing
else, quoting and token concatenation needs to happen first.
Powered by blists - more mailing lists