emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#24323: closed ("regcomp.c", line 467: error: synta


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#24323: closed ("regcomp.c", line 467: error: syntax error before or at: preg)
Date: Sun, 28 Aug 2016 19:59:01 +0000

Your message dated Sun, 28 Aug 2016 12:58:39 -0700
with message-id <address@hidden>
and subject line Re: bug#24323: "regcomp.c", line 467: error: syntax error 
before or at: preg
has caused the debbugs.gnu.org bug report #24323,
regarding "regcomp.c", line 467: error: syntax error before or at: preg
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
24323: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24323
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: "regcomp.c", line 467: error: syntax error before or at: preg Date: Sat, 27 Aug 2016 23:40:45 -0400 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

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






--- End Message ---
--- Begin Message --- Subject: Re: bug#24323: "regcomp.c", line 467: error: syntax error before or at: preg Date: Sun, 28 Aug 2016 12:58:39 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 I see the problem: the grep 2.25 tarball contains a regression from Gnulib that breaks compilation on some non-GCC compilers. Details below.

Dennis Clarke wrote:

it has Oracle Studio 12.4 on it.

Ah, that explains it. 12.4 c99 supports __restrict__ but not __restrict, and this runs afoul of a porting bug in grep 2.25, based on Gnulib commit b7bc3c1a4e78add4cbad39ae1a0c4fb0747b483f (2016-04-09), which contains a regression that causes regcomp.c to not build on (non-GCC) compilers that lack __restrict. After grep 2.25 came out, this regression was fixed in Gnulib commit 334d97f35cef30af0cf61c5eeaa0a67890a45578 (2016-06-08), which you can see here:

http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=334d97f35cef30af0cf61c5eeaa0a67890a45578

This Gnulib commit replaces __restrict with _Restrict_ in lib/regcomp.c, which fixes the regression. Applying this change to grep 2.25 should fix things for you.

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.

If not trivial then change the CFLAGS and give up on ye
old -Xc strict compliance mode and switch to cc with -Xa and a pile of
other flags for my pedantic debugging mode needs :

mimas$ echo $CFLAGS
-m64 -xtarget=ultra2e -xarch=sparcvis -xchip=ultra2e -xcache=generic 
-errfmt=error -erroff=%none -errshort=full -xstrconst -xildoff -m64 
-xmemalign=8s -xnolibmil -Xc -xcode=pic32 -xregs=no%appl -xlibmieee -mc -g -xs 
-ftrap=%none -Qy -xbuiltin=%none -xdebugformat=dwarf -xunroll=1 -D_TS_ERRNO 
-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE

You might want to look here for new compiler options in 12.5:

https://docs.oracle.com/cd/E60778_01/html/E60742/gncki.html

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. 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.

Attachment: 0001-build-update-gnulib-submodule-to-latest.patch
Description: Text Data


--- End Message ---

reply via email to

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