GNU bug report logs - #24323
"regcomp.c", line 467: error: syntax error before or at: preg

Previous Next

Package: grep;

Reported by: Dennis Clarke <dclarke <at> blastwave.org>

Date: Sun, 28 Aug 2016 03:43:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Dennis Clarke <dclarke <at> blastwave.org>, 24323 <at> debbugs.gnu.org
Subject: bug#24323: "regcomp.c", line 467: error: syntax error before or at: preg
Date: Sun, 28 Aug 2016 01:45:49 -0700
[Message part 1 (text/plain, inline)]
Dennis Clarke wrote:

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

Thanks for the bug report. What are the diagnostics?

> I compiled and tested 2.25 both with and without
> the "restrict" and there was no measurable difference.

POSIX requires a 'restrict' here; see 
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/regcomp.html>. 
(Whether a compiler takes advantage of 'restrict' is not something under our 
control....)

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

The Gnulib code is supposed to be portable to compilers that do not support 
'restrict'. It does this by #defining 'restrict' to something equivalent, on 
compilers that are picky about 'restrict' for one reason or another. Sun C has 
this problem (actually C++), so the code #defines 'restrict' to '__restrict' to 
pacify it.

Sun C supports __restrict, so I'm puzzled as to why you're observing a problem. 
I did not have a problem building grep 2.25 on my Solaris 10 sparc host with 
Oracle Developer Studio 12.5. Please see the attached compressed build log; you 
might want to compare it with your build's output and debug any significant 
discrepancies (you can look in config.log).

One more thing: why use 'c99'? On Solaris it's typically better to use 'cc', as 
'c99' is mainly for portability pedants. If 'grep' builds with 'cc' but not with 
'c99', I'm inclined to declare victory with Oracle Developer Studio.
[build.txt.gz (application/gzip, attachment)]

This bug report was last modified 8 years and 264 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.