[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL)

From: Cayle Graumann
Subject: Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL)
Date: Tue, 19 Sep 2006 09:43:53 -0500


If the construct without the extra () should work, then I guess this needs to go on the great big list of things in TCC that should be fixed to conform to spec.  

Do we have a new maintainer for TCC yet?  If so, might I suggest setting up some sort of bug tracking software or even a wiki that we might use to keep track of these things.  That also means that competent and willing people will have to check it occasionally and volunteer to fix things.


On 9/18/06, Dave Dodge <address@hidden> wrote:
On Sun, Sep 17, 2006 at 10:45:06PM -0500, Cayle Graumann wrote:
> On 9/17/06, Daniel Glöckner <address@hidden> wrote:

>    Adding the extra set of parentheses in the define was the solution I
> came up with to get it to compile also.  The real question is why does GCC
> allow it?

Because the grammar makes it unambiguous.  The parentheses are not
supposed to be needed:

  sizeof (x)/sizeof (x)[0]

The [0] can only be applied to a postfix-_expression_.  None of these is
a postfix-_expression_:

  sizeof (x)/sizeof (x)        multiplicative-_expression_
         (x)/sizeof (x)        multiplicative-_expression_
             sizeof (x)        unary-_expression_

The only way it parses is:

                    (x)        primary-_expression_
                    ^^^[0]     postfix-_expression_
             sizeof ^^^^^^     unary-_expression_
         (x)                   primary-_expression_
  sizeof ^^^                   unary-_expression_
  ^^^^^^^^^^/^^^^^^^^^^^^^     multiplicative-_expression_

Which is what the code intends.

> >But then we can go further and ask if "sizeof (char)7" is a legal C
> >_expression_...

No, that's always an error.  For example:

          char      type-name
         (^^^^)7    cast-_expression_
  sizeof ^^^^^^^    error: sizeof can't be applied to a cast-_expression_

          char      type-name
  sizeof (^^^^)     unary-_expression_
  ^^^^^^^^^^^^^7    error: unary-_expression_ followed by constant

                                                  -Dave Dodge

Tinycc-devel mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]