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

From: Dennis Clarke <[email-masked]>
Date: Sat, 27 Aug 2016 23:40:45 -0400

lib/regcomp.c will not compile with C99 strict compiler because of
the usage of the non-standard "__restrict".

I question the use here of the "restrict" for the purpose of
optimization so I compiled and tested 2.25 both with and without
the "restrict" and there was no measurable difference. The testsuite
passes fully regardless.

We may simply change "__restrict" to the C99 spec clean "restrict" or
remove it entirely with no worries.

--- ./lib/regcomp.c_backup      Sun Apr 10 16:50:01 2016
+++ ./lib/regcomp.c     Sun Aug 28 02:35:43 2016
@@ -464,7 +464,7 @@
     the return codes and their meanings.)  */

  int
-regcomp (regex_t *__restrict preg, const char *__restrict pattern, int 
cflags)
+regcomp (regex_t *restrict preg, const char *restrict pattern, int cflags)
  {
    reg_errcode_t ret;
    reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? 
RE_SYNTAX_POSIX_EXTENDED
@@ -523,7 +523,7 @@
     from either regcomp or regexec.   We don't use PREG here.  */

  size_t
-regerror (int errcode, const regex_t *__restrict preg, char *__restrict 
errbuf,
+regerror (int errcode, const regex_t *restrict preg, char *restrict errbuf,
           size_t errbuf_size)
  {
    const char *msg;

The compiler here was c99 in Oracle Studio 12.5 on Solaris 10 sparc
with strict C99 compliance mode enforced.

Dennis Clarke