[Top][All Lists]

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

Re: [Tinycc-devel] New fun bug! #include <regex.h>

From: Rob Landley
Subject: Re: [Tinycc-devel] New fun bug! #include <regex.h>
Date: Fri, 21 Sep 2007 18:55:50 -0500
User-agent: KMail/1.9.6

On Friday 21 September 2007 3:02:19 am Marc Andre Tanner wrote:
> Rob Landley wrote:
> > On Thursday 20 September 2007 4:00:33 pm Marc Andre Tanner wrote:
> >> And since recent tcc sets __STDC_VERSION__ to 199901L __restrict_arr is
> >> defined as restrict which causes the problem because tcc doesn't know
> >> how to handle this.
> >
> > gcc doesn't know how to handle this either.  If I save the tcc -E output
> > and then feed it to gcc, gcc dies at the exact same point with an
> > equivalent error.
> Yes, but if you run gcc -E this results in:
>     regmatch_t __pmatch[__restrict]

That's because if you do this:

$ tcc -D__GNUC__=4 -E temp.c | grep pmatch
regmatch_t __pmatch [ ] ,

See the problem?  The headers change behavior when they think it's GCC.

> According to the comment in sys/cdefs.h this is valid C99 don't know
> whether this is true or not.
> /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
>       array_name[restrict]
>     GCC 3.1 supports this.  */

Since gcc 3.4 and 4.1 both barf on that, I suspect the comment is wrong.  
However, unless we want to selectively pretend to be gcc, we have to work 
around bugs in things that have never been tested against anything that 
_didn't_ at least pretend to be gcc.

"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.

reply via email to

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