GNU bug report logs -
#24323
"regcomp.c", line 467: error: syntax error before or at: preg
Previous Next
Full log
Message #14 received at 24323 <at> debbugs.gnu.org (full text, mbox):
> 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....)
Maybe the first coffee has not hit yet but why is there a redefined
"int regcomp" function inside lib/regcomp.c at all?? This is provided
via the standard C lib and regex.h and so this really is not needed.
I see in lib/regcomp.c : ( complete with the new page control char )
^L
/* Entry point for POSIX code. */
/* regcomp takes a regular expression as a string and compiles it.
PREG is a regex_t *. We do not expect any fields to be initialized,
since POSIX says we shouldn't. Thus, we set
'buffer' to the compiled pattern;
'used' to the length of the compiled pattern;
'syntax' to RE_SYNTAX_POSIX_EXTENDED if the
REG_EXTENDED bit in CFLAGS is set; otherwise, to
RE_SYNTAX_POSIX_BASIC;
'newline_anchor' to REG_NEWLINE being set in CFLAGS;
'fastmap' to an allocated space for the fastmap;
'fastmap_accurate' to zero;
're_nsub' to the number of subexpressions in PATTERN.
PATTERN is the address of the pattern string.
CFLAGS is a series of bits which affect compilation.
If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
use POSIX basic syntax.
If REG_NEWLINE is set, then . and [^...] don't match newline.
Also, regexec will try a match beginning after every newline.
If REG_ICASE is set, then we considers upper- and lowercase
versions of letters to be equivalent when matching.
If REG_NOSUB is set, then when PREG is passed to regexec, that
routine will report only success or failure, and nothing about the
registers.
It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
the return codes and their meanings.) */
int
regcomp (regex_t *restrict preg, const char *restrict pattern, int cflags)
{
.
.
.
Not needed at all.
I see in lib/regex.c this :
#ifdef _LIBC
/* We have to keep the namespace clean. */
.
.
.
# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
.
.
.
#include "regcomp.c"
The only places that use "regcomp" are :
./lib/exclude.c ./lib/regex.c
So really these can all use the standarc C library function provided and
not use the thing in regexec.c at all.
Hold on a sec here ... are we re-writing the POSIX standard C library
functions for some reason ?
Dennis
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.