Subject: bug#24323: "regcomp.c", line 467: error: syntax error before or at: preg

From: Dennis Clarke <[email-masked]>
Date: Sun, 28 Aug 2016 17:10:41 -0400

On 08/28/2016 03:58 PM, Paul Eggert wrote:
> I see the problem ...

> Ah, that explains it. 12.4 c99 supports __restrict__ but not __restrict,

Sort of what I said .. I think.  For that matter are you sure about the
  use of "__restrict__" ?

> This Gnulib commit replaces __restrict with _Restrict_

I saw that in a few places and wondered if there was a mistake. I don't
  think that __Restrict__ exists in any standard anywhere either.

> I fixed the bug by installing the attached patch into the grep master
> branch on Savannah. This patch updates the Gnulib version to the current
> latest version, which pulls in the abovementioned bug fix.

I will have to wait for a release to use that.  For now I just toss out
the __restrict and use proper "restrict" and everything is fine.

> You might want to look here for new compiler options in 12.5:
>
> https://docs.oracle.com/cd/E60778_01/html/E60742/gncki.html

Yep.  A lot of build scripts will have to be looked at. Eventually.

>> Hold on a sec here ... are we re-writing the POSIX standard C library
>>  functions for some reason ?
>
> Yes, as grep needs a regular expression matcher that works on data that
> can contain NUL bytes ('\0') and encoding errors.

Well this explains why I generally install GNU grep and use it as
opposed to /usr/xpg4/bin/grep on Solaris machines. However the pedantic
scripts still use the XPG4 version. Mostly because we know it will
always exist.

> The POSIX API does not
> provide this, so grep supplies a substitute regex matcher on systems
> like Solaris that lack the extensions to POSIX that grep needs.

yep .. Solaris systems can be very spec tight and this is why I often
compile things with c99 just to shake loose these little bugs which
would otherwise fly under radar.

Thank you for the quick bug fix.

Dennis