diff options
author | Tony Abou-Assaleh <taa@acm.org> | 2009-01-25 02:36:37 +0000 |
---|---|---|
committer | Tony Abou-Assaleh <taa@acm.org> | 2009-01-25 02:36:37 +0000 |
commit | ef37308585454bbf81467f3bb7604ce1d65410b3 (patch) | |
tree | 7038d02875e14e8e1a09d1d9de28aa2edb1c6249 /lib | |
parent | fae439f8ec589f6c4ef3343083d900062daea604 (diff) | |
download | grep-ef37308585454bbf81467f3bb7604ce1d65410b3.tar.gz |
* lib/posix/regex.h (__restrict, __restrict_arr): Remove macros.
(_Restrict_, _Restrict_arr_): New macros. From gnulib/lib/regex.h.
(regcomp, regexec): Update declarations to use them.
* lib/posix/regex.h (__restrict, __restrict_arr): Remove macros.
(_Restrict_, _Restrict_arr_): New macros. From gnulib/lib/regex.h.
(regcomp, regexec): Update declarations to use them.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/posix/regex.h | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/lib/posix/regex.h b/lib/posix/regex.h index f4c41501..54935978 100644 --- a/lib/posix/regex.h +++ b/lib/posix/regex.h @@ -1,6 +1,7 @@ /* Definitions for data structures and routines for the regular expression library, version 0.12. - Copyright (C) 1985,1989-1993,1995-1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1985,1989-1993,1995-1998, 2000, 2006, 2007, 2009 + Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. @@ -520,29 +521,41 @@ extern int re_exec _RE_ARGS ((const char *)); #endif /* GCC 2.95 and later have "__restrict"; C99 compilers have - "restrict", and "configure" may have defined "restrict". */ -#ifndef __restrict -# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) -# if defined restrict || 199901L <= __STDC_VERSION__ -# define __restrict restrict -# else -# define __restrict -# endif + "restrict", and "configure" may have defined "restrict". + Other compilers use __restrict, __restrict__, and _Restrict, and + 'configure' might #define 'restrict' to those words, so pick a + different name. */ +#ifndef _Restrict_ +# if 199901L <= __STDC_VERSION__ +# define _Restrict_ restrict +# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__) +# define _Restrict_ __restrict +# else +# define _Restrict_ +# endif +#endif +/* gcc 3.1 and up support the [restrict] syntax. Don't trust + sys/cdefs.h's definition of __restrict_arr, though, as it + mishandles gcc -ansi -pedantic. */ +#ifndef _Restrict_arr_ +# if ((199901L <= __STDC_VERSION__ \ + || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \ + && !__STRICT_ANSI__)) \ + && !defined __GNUG__) +# define _Restrict_arr_ _Restrict_ +# else +# define _Restrict_arr_ # endif #endif -/* For now unconditionally define __restrict_arr to expand to nothing. - Ideally we would have a test for the compiler which allows defining - it to restrict. */ -#define __restrict_arr /* POSIX compatibility. */ -extern int regcomp _RE_ARGS ((regex_t *__restrict __preg, - const char *__restrict __pattern, +extern int regcomp _RE_ARGS ((regex_t *_Restrict_ __preg, + const char *_Restrict_ __pattern, int __cflags)); -extern int regexec _RE_ARGS ((const regex_t *__restrict __preg, - const char *__restrict __string, size_t __nmatch, - regmatch_t __pmatch[__restrict_arr], +extern int regexec _RE_ARGS ((const regex_t *_Restrict_ __preg, + const char *_Restrict_ __string, size_t __nmatch, + regmatch_t __pmatch[_Restrict_arr_], int __eflags)); extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg, |