[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: |
Mon, 11 Jul 2022 18:50:43 +0200 |
User-agent: |
Mutt/2.2.6+26 (7d9df177) vl-149028 (2022-07-06) |
On 2022-07-11 17:47:31 +0200, Domingo Alvarez Duarte wrote:
> 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.
I agree that tcc should reject the code. It is too ambiguous to be
regarded as an extension. GCC's interpretation is rather ugly.
Consider a file "err.c":
#define FOO bar
"
FOO
"
"FOO"
zira:~> gcc -E err.c 2> /dev/null
# 0 "err.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "err.c"
"
bar
"
"FOO"
while with tcc:
zira:~> tcc -E err.c
# 1 "err.c"
# 1 "<command line>" 1
# 2 "err.c" 2
"
FOO
"
"FOO"
which makes more sense as an extension, IMHO. But tcc doesn't give
any diagnostic there, and I think that this is incorrect.
--
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)
- [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, Domingo Alvarez Duarte, 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, Ziyao, 2022/07/11
- 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, Ziyao, 2022/07/11
- 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