tinycc-devel
[Top][All Lists]
Advanced

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

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


From: Rob Landley
Subject: [Tinycc-devel] New fun bug! #include <regex.h>
Date: Thu, 6 Sep 2007 06:08:49 -0500
User-agent: KMail/1.9.6

cat > blah.c << EOF
#include <stdio.h>

#include <regex.h>

int main(int argc, char *argv[])
{
  return 0;
}
EOF
tcc blah.c
In file included from blah.c:3:
/usr/include/regex.h:543: identifier expected

Which is:

> # if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) \
>      && !defined __GNUG__
> #  define __restrict_arr __restrict
> # else
> #  define __restrict_arr
> # endif
> #endif
>
> /* POSIX compatibility.  */
> extern int regcomp (regex_t *__restrict __preg,
>                     const char *__restrict __pattern,
>                     int __cflags);
>
> extern int regexec (const regex_t *__restrict __preg,
>                     const char *__restrict __string, size_t __nmatch,
>                     regmatch_t __pmatch[__restrict_arr],
^ this line
>                     int __eflags);

Which -E says becomes:

> extern int regexec ( const regex_t * __preg ,
> const char * __string , size_t __nmatch ,
> regmatch_t __pmatch [ restrict ] ,
> int __eflags ) ;

And where did that "restrict" come from?  Earlier in the same file, of course:

> /* GCC 2.95 and later have "__restrict"; C99 compilers have
>    "restrict", and "configure" may have defined "restrict".  */
> #ifndef __restrict
> # if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
> #  if defined restrict || 199901L <= __STDC_VERSION__
> #   define __restrict restrict
> #  else
> #   define __restrict
> #  endif
> # endif
> #endif

I notice that the test here is 199901L <= __STDC_VERSION__ and the earlier 
test was >=, and when they're == it gets _confused_...

I'm going to bed now.  Fixit in the morning...

Rob
-- 
"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]