[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] gcc/tcc nested macros difference
From: |
Vincent Lefevre |
Subject: |
Re: [Tinycc-devel] gcc/tcc nested macros difference |
Date: |
Wed, 27 Apr 2016 11:13:00 +0200 |
User-agent: |
Mutt/1.6.0-6619-vl-r87826 (2016-04-11) |
On 2016-04-25 13:29:46 +0300, Sergey Korshunoff wrote:
> > Then I'll make the following addition to the bug list, if nobody
> > objects, as I don't suppose the bug will get fixed soon.
> > +- output with -E should include spaces: #define n 0xe {newline} n+1
>
> How gcc decide when to insert space after macro expansion w/o syntax analize?
It seems that gcc adds a space only when the result would otherwise
a different pp-tokenization.
Another example, based on one from Section 6.4 of the ISO C standard:
#define P ++
int main(void)
{
int a = 0, b = -1;
return a P+P b;
}
"gcc -E" gives:
int main(void)
{
int a = 0, b = -1;
return a +++ ++ b;
}
while "tcc -E" incorrectly gives:
int main(void)
{
int a = 0, b = -1;
return a +++++ b;
}
because +++++ would be parsed as ++ ++ +.
--
Vincent Lefèvre <address@hidden> - 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] gcc/tcc nested macros difference, (continued)
- Re: [Tinycc-devel] gcc/tcc nested macros difference, Sergey Korshunoff, 2016/04/25
- Re: [Tinycc-devel] gcc/tcc nested macros difference, Sergey Korshunoff, 2016/04/25
- Re: [Tinycc-devel] gcc/tcc nested macros difference, Sergey Korshunoff, 2016/04/25
- Re: [Tinycc-devel] gcc/tcc nested macros difference, Edmund Grimley Evans, 2016/04/25
- Re: [Tinycc-devel] gcc/tcc nested macros difference, Sergey Korshunoff, 2016/04/25
- Re: [Tinycc-devel] gcc/tcc nested macros difference, Edmund Grimley Evans, 2016/04/25
- Re: [Tinycc-devel] gcc/tcc nested macros difference, Sergey Korshunoff, 2016/04/25
- Re: [Tinycc-devel] gcc/tcc nested macros difference, Edmund Grimley Evans, 2016/04/25
- Re: [Tinycc-devel] gcc/tcc nested macros difference, Sergey Korshunoff, 2016/04/25
- Re: [Tinycc-devel] gcc/tcc nested macros difference, Vincent Lefevre, 2016/04/27
- Re: [Tinycc-devel] gcc/tcc nested macros difference,
Vincent Lefevre <=