tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [PATCH] Preprocessor: ignore everything after #error


From: Marc Andre Tanner
Subject: Re: [Tinycc-devel] [PATCH] Preprocessor: ignore everything after #error or #warning
Date: Tue, 25 Sep 2007 09:58:03 +0200
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

Dave Dodge wrote:
On Mon, Sep 24, 2007 at 05:39:07PM +0200, Marc Andre Tanner wrote:
There seems to be a problem in the skiping of preprocessor directives,
tcc attempts to parse the string even after #error or #warning and
complains when it shouldn't.

An #error (or the non-standard #warning, if you assume it works
similarly to #error) is supposed to contain preprocessing tokens.

Yes but does it matter in this case? We just want to skip to the
matching #endif.

The real problem here seems to be that a bare apostrophe can be a valid
preprocessing token according to C99, but tcc doesn't seem to have any
way to recognize it as such in preprocess_skip(). I don't have a
better solution, though.

Ok i took a look at the C99 draft link which you posted and found the
following in 6.4 #3:

 A token is the minimal lexical element of the language in translation
 phases 7 and 8. The categories of tokens are: keywords,
 identifiers, constants, string literals, and punctuators.
 A preprocessing token is the minimal lexical element of the language in
 translation phases 3 through 6. The categories of preprocessing tokens
 are: header names, identifiers, preprocessing numbers, character
 constants, string literals, punctuators, and single non-white-space
 characters that do not lexically match the other preprocessing
 token categories.58) If a ' or a " character matches the last
 category, the behavior is undefined.

I am not quite sure whether i have understood the above but doesn't it say that the behavior of a ' in this context is undefined?

Anyway the patch fixed a problem for me, hope it is useful for someone else.

Marc


--
 Marc Andre Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]