diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2017-12-20 09:47:44 -0200 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2018-07-04 09:54:45 -0300 |
commit | eb04c21373e2a2885f3d52ff192b0499afe3c672 (patch) | |
tree | 040d92dd6f342295f296df31de00ed9ace1b7d67 /posix/regex.c | |
parent | b11643c21c5c9d67a69c8ae952e5231ce002e7f1 (diff) | |
download | glibc-eb04c21373e2a2885f3d52ff192b0499afe3c672.tar glibc-eb04c21373e2a2885f3d52ff192b0499afe3c672.tar.gz glibc-eb04c21373e2a2885f3d52ff192b0499afe3c672.tar.bz2 glibc-eb04c21373e2a2885f3d52ff192b0499afe3c672.zip |
posix: Sync gnulib regex implementation
This patch syncs the regex implementation with gnulib (commit 0ee5212).
Only two changes in GLIBC regex testing are required:
1. posix/bug-regex28.c: as previously discussed [1] the change of
expected results on the pattern should be safe.
2. posix/PCRE.tests: the ERE (a)|\1 is malformed (in the sense that
the \1 doesn't mean anything) and although current GLIBC accepts
it has undefined behavior. This patch removes the specific test.
This sync contains some patches from thread 'Regex: Make libc regex
more usable outside GLIBC.' [2] which have been pushed upstream in
gnulib. This patches also fixes some regex issues (BZ #23233,
BZ #21163, BZ #18986, BZ #13762) and I did not add testcases for
both #23233 and #13762 because I couldn't think a simple way to
trigger the expected failure path to trigger them.
Checked on x86_64-linux-gnu and i686-linux-gnu.
[BZ #23233]
[BZ #21163]
[BZ #18986]
[BZ #13762]
* posix/Makefile (tests): Add bug-regex37 and bug-regex38.
* posix/PCRE.tests: Remove invalid test.
* posix/bug-regex28.c: Fix expected values for used syntax.
* posix/bug-regex37.c: New file.
* posix/bug-regex38.c: Likewise.
* posix/regcomp.c: Sync with gnulib.
* posix/regex.c: Likewise.
* posix/regex.h: Likewise.
* posix/regex_internal.c: Likewise.
* posix/regex_internal.h: Likewise.
* posix/regexec.c: Likewise.
[1] https://sourceware.org/ml/libc-alpha/2017-12/msg00807.html
[2] https://sourceware.org/ml/libc-alpha/2017-12/msg00237.html
Diffstat (limited to 'posix/regex.c')
-rw-r--r-- | posix/regex.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/posix/regex.c b/posix/regex.c index 68b5ef17ba..d6591e8670 100644 --- a/posix/regex.c +++ b/posix/regex.c @@ -15,14 +15,22 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ -#ifdef HAVE_CONFIG_H -#include "config.h" +#ifndef _LIBC +# include <config.h> + +# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ +# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +# endif +# if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ +# pragma GCC diagnostic ignored "-Wold-style-definition" +# pragma GCC diagnostic ignored "-Wtype-limits" +# endif #endif -/* Make sure noone compiles this code with a C++ compiler. */ -#ifdef __cplusplus +/* Make sure no one compiles this code with a C++ compiler. */ +#if defined __cplusplus && defined _LIBC # error "This is C code, use a C compiler" #endif @@ -56,9 +64,6 @@ #undefs RE_DUP_MAX and sets it to the right value. */ #include <limits.h> -/* This header defines the MIN and MAX macros. */ -#include <sys/param.h> - #include <regex.h> #include "regex_internal.h" |