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 <[email protected]> - 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 mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to