Re: [Tinycc-devel] X(X(1)) (nested macro substitution)

2016-04-28 Thread grischka

Sergey Korshunoff wrote: ---

The recommendation is:
 Implementations should avoid imposing fixed translation limits
 whenever possible.


Implemented adddition is a macro recursion detection:
 * on define macro stage (is the name of macro can be found in macro string)


Bad idea :
#define A B
#define B A
return A + B;


 * on macro call stage (is the name of macro can be found in args)

If macro or call is not recursive then we don't block expansion.
Behaviour is the same as gcc have. All tcc preprop test pass. A
compilation speed is not changed.




___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] X(X(1)) (nested macro substitution)

2016-04-28 Thread Sergey Korshunoff
> The recommendation is:
>  Implementations should avoid imposing fixed translation limits
>  whenever possible.

Implemented adddition is a macro recursion detection:
 * on define macro stage (is the name of macro can be found in macro string)
 * on macro call stage (is the name of macro can be found in args)

If macro or call is not recursive then we don't block expansion.
Behaviour is the same as gcc have. All tcc preprop test pass. A
compilation speed is not changed.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] X(X(1)) (nested macro substitution)

2016-04-28 Thread Vincent Lefevre
On 2016-04-29 00:50:59 +, Michael B. Smith wrote:
> Don't you think it might it be a good idea to limit the possible
> level of recursion?

It seems that the standard doesn't provide a minimum limit for macro
recursion. But it general, this is 63 nesting levels of [...].

> I don't have time to look at the C99 standard right now, but I'd be
> surprised if there weren't a recommendation on this.

The recommendation is:

  Implementations should avoid imposing fixed translation limits
  whenever possible.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] X(X(1)) (nested macro substitution)

2016-04-28 Thread Michael B. Smith
Don't you think it might it be a good idea to limit the possible level of 
recursion?

I don't have time to look at the C99 standard right now, but I'd be surprised 
if there weren't a recommendation on this.

-Original Message-
From: Tinycc-devel 
[mailto:tinycc-devel-bounces+michael=theessentialexchange@nongnu.org] On 
Behalf Of Sergey Korshunoff
Sent: Thursday, April 28, 2016 2:58 PM
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] X(X(1)) (nested macro substitution)

Hi!
A problem solved. A patch
https://github.com/seyko2/tinycc/commit/152d0fb3275169c8f4eca97f4f90ec85f437ae4c
https://github.com/seyko2/tinycc/commit/bc60d942e52f7e8cb9392dd0e6e6a79b42fcd054

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] X(X(1)) (nested macro substitution)

2016-04-28 Thread Sergey Korshunoff
Hi!
A problem solved. A patch
https://github.com/seyko2/tinycc/commit/152d0fb3275169c8f4eca97f4f90ec85f437ae4c
https://github.com/seyko2/tinycc/commit/bc60d942e52f7e8cb9392dd0e6e6a79b42fcd054

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel