[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks
From: |
Vincent Lefevre |
Subject: |
Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks |
Date: |
Tue, 12 Jul 2022 03:20:50 +0200 |
User-agent: |
Mutt/2.2.6+26 (7d9df177) vl-149028 (2022-07-06) |
On 2022-07-12 06:57:41 +0800, Ziyao wrote:
> On Mon, Jul 11, 2022 at 05:47:31PM +0200, Domingo Alvarez Duarte wrote:
> > Hello Ziyao !
> >
> > Although gcc compiles a file containing your example with warnings, I'm not
> > sure it's worth try to do the same in TiinyCC the preprocessor probably uses
> > TOKENS from the lexer to decide to skip till the end of the initial "#if 0"
> > and '"' is not a valid token the error probably come from the lexer that
> > found a non terminated string.
> >
> For conditional inclusion,C99 document says:
> Only the first group whose control condition evaluates to true
> (nonzero) is processed. If none of the conditions evaluates to true,
> and there is a #else directive, the group controlled by the #else is
> processed; lacking a #else directive, all the groups until the
> #endif are skipped.1
> In my understanding,the skipped part should NOT be processed.
To be able to skip it, the compiler needs to parse it as described
in 6.10. So code like
#if 0
#if 1
#else
foo
#endif
#else
OK
#endif
should give OK. And if anything violates the syntax during parsing,
one should get a diagnostic.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
- Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, (continued)
- Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, Vincent Lefevre, 2022/07/11
- Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, Vincent Lefevre, 2022/07/12
- Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, Ziyao, 2022/07/13
- Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, grischka, 2022/07/13
- Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, Ziyao, 2022/07/13
- Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, grischka, 2022/07/15
- Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, Vincent Lefevre, 2022/07/13
- Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, grischka, 2022/07/13
- Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, Vincent Lefevre, 2022/07/13
Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, Ziyao, 2022/07/11
- Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks,
Vincent Lefevre <=
Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, Vincent Lefevre, 2022/07/12
Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, Christian JULLIEN, 2022/07/16
Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks, Christian JULLIEN, 2022/07/19