mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
2003-09-26 Paolo Bonzini <bonzini@gnu.org> * posix/regcomp.c (parse_sub_exp): Pass RE_CARET_ANCHORS_HERE for the first token in a subexpression as well. 2003-10-02 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c (peek_token): Add 2003-09-20 changes for anchor handling again. (parse_reg_exp): Likewise. * posix/regex.h (RE_CARET_ANCHORS_HERE): Define. * posix/bug-regex11.c (tests): Add new tests. * posix/bug-regex12.c (tests): Add new test.
This commit is contained in:
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2003-09-26 Paolo Bonzini <bonzini@gnu.org>
|
||||||
|
|
||||||
|
* posix/regcomp.c (parse_sub_exp): Pass RE_CARET_ANCHORS_HERE
|
||||||
|
for the first token in a subexpression as well.
|
||||||
|
|
||||||
|
2003-10-02 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* posix/regcomp.c (peek_token): Add 2003-09-20 changes for anchor
|
||||||
|
handling again.
|
||||||
|
(parse_reg_exp): Likewise.
|
||||||
|
* posix/regex.h (RE_CARET_ANCHORS_HERE): Define.
|
||||||
|
|
||||||
|
* posix/bug-regex11.c (tests): Add new tests.
|
||||||
|
* posix/bug-regex12.c (tests): Add new test.
|
||||||
|
|
||||||
2003-10-01 Thorsten Kukuk <kukuk@suse.de>
|
2003-10-01 Thorsten Kukuk <kukuk@suse.de>
|
||||||
|
|
||||||
* elf/dl-reloc.c (_dl_allocate_static_tls): Move definition of
|
* elf/dl-reloc.c (_dl_allocate_static_tls): Move definition of
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2003-10-02 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (DOCARGS_1): Use
|
||||||
|
correct offset.
|
||||||
|
|
||||||
2003-10-02 Jakub Jelinek <jakub@redhat.com>
|
2003-10-02 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* Makefile (tests): Add tst-cancel8.
|
* Makefile (tests): Add tst-cancel8.
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
# define _POPCARGS_0 /* No arguments to pop. */
|
# define _POPCARGS_0 /* No arguments to pop. */
|
||||||
|
|
||||||
# define PUSHCARGS_1 movl %ebx, %edx; PUSHCARGS_0
|
# define PUSHCARGS_1 movl %ebx, %edx; PUSHCARGS_0
|
||||||
# define DOCARGS_1 _DOARGS_1 (4)
|
# define DOCARGS_1 _DOARGS_1 (8)
|
||||||
# define POPCARGS_1 POPCARGS_0; movl %edx, %ebx
|
# define POPCARGS_1 POPCARGS_0; movl %edx, %ebx
|
||||||
# define _PUSHCARGS_1 pushl %ebx; L(PUSHBX2): _PUSHCARGS_0
|
# define _PUSHCARGS_1 pushl %ebx; L(PUSHBX2): _PUSHCARGS_0
|
||||||
# define _POPCARGS_1 _POPCARGS_0; popl %ebx; L(POPBX2):
|
# define _POPCARGS_1 _POPCARGS_0; popl %ebx; L(POPBX2):
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2003-10-02 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (DOCARGS_1): Use
|
||||||
|
correct offset.
|
||||||
|
|
||||||
2003-10-02 Jakub Jelinek <jakub@redhat.com>
|
2003-10-02 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* Makefile (tests): Add tst-cancel19.
|
* Makefile (tests): Add tst-cancel19.
|
||||||
|
@ -314,7 +314,7 @@
|
|||||||
# define _POPCARGS_0 /* No arguments to pop. */
|
# define _POPCARGS_0 /* No arguments to pop. */
|
||||||
|
|
||||||
# define PUSHCARGS_1 movl %ebx, %edx; L(SAVEBX2): PUSHCARGS_0
|
# define PUSHCARGS_1 movl %ebx, %edx; L(SAVEBX2): PUSHCARGS_0
|
||||||
# define DOCARGS_1 _DOARGS_1 (4)
|
# define DOCARGS_1 _DOARGS_1 (8)
|
||||||
# define POPCARGS_1 POPCARGS_0; movl %edx, %ebx; L(RESTBX2):
|
# define POPCARGS_1 POPCARGS_0; movl %edx, %ebx; L(RESTBX2):
|
||||||
# define _PUSHCARGS_1 pushl %ebx; L(PUSHBX2): _PUSHCARGS_0
|
# define _PUSHCARGS_1 pushl %ebx; L(PUSHBX2): _PUSHCARGS_0
|
||||||
# define _POPCARGS_1 _POPCARGS_0; popl %ebx; L(POPBX2):
|
# define _POPCARGS_1 _POPCARGS_0; popl %ebx; L(POPBX2):
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Regular expression tests.
|
/* Regular expression tests.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
|
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
|
||||||
|
|
||||||
@ -41,7 +41,17 @@ struct
|
|||||||
{ { 0, 21 }, { 8, 9 }, { 9, 10 } } },
|
{ { 0, 21 }, { 8, 9 }, { 9, 10 } } },
|
||||||
{ "^\\(a*\\)\\1\\{9\\}\\(a\\{0,9\\}\\)\\([0-9]*;.*[^a]\\2\\([0-9]\\)\\)",
|
{ "^\\(a*\\)\\1\\{9\\}\\(a\\{0,9\\}\\)\\([0-9]*;.*[^a]\\2\\([0-9]\\)\\)",
|
||||||
"a1;;0a1aa2aaa3aaaa4aaaaa5aaaaaa6aaaaaaa7aaaaaaaa8aaaaaaaaa9aa2aa1a0", 0,
|
"a1;;0a1aa2aaa3aaaa4aaaaa5aaaaaa6aaaaaaa7aaaaaaaa8aaaaaaaaa9aa2aa1a0", 0,
|
||||||
5, { { 0, 67 }, { 0, 0 }, { 0, 1 }, { 1, 67 }, { 66, 67 } } }
|
5, { { 0, 67 }, { 0, 0 }, { 0, 1 }, { 1, 67 }, { 66, 67 } } },
|
||||||
|
/* Test for BRE expression anchoring. POSIX says just that this may match;
|
||||||
|
in glibc regex it always matched, so avoid changing it. */
|
||||||
|
{ "\\(^\\|foo\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } },
|
||||||
|
{ "\\(foo\\|^\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } },
|
||||||
|
/* In ERE this must be treated as an anchor. */
|
||||||
|
{ "(^|foo)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } },
|
||||||
|
{ "(foo|^)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } },
|
||||||
|
/* Here ^ cannot be treated as an anchor according to POSIX. */
|
||||||
|
{ "(^|foo)bar", "(^|foo)bar", 0, 2, { { 0, 10 }, { -1, -1 } } },
|
||||||
|
{ "(foo|^)bar", "(foo|^)bar", 0, 2, { { 0, 10 }, { -1, -1 } } },
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Regular expression tests.
|
/* Regular expression tests.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
|
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
|
||||||
|
|
||||||
@ -32,7 +32,9 @@ struct
|
|||||||
int flags, nmatch;
|
int flags, nmatch;
|
||||||
} tests[] = {
|
} tests[] = {
|
||||||
{ "^<\\([^~]*\\)\\([^~]\\)[^~]*~\\1\\(.\\).*|=.*\\3.*\\2",
|
{ "^<\\([^~]*\\)\\([^~]\\)[^~]*~\\1\\(.\\).*|=.*\\3.*\\2",
|
||||||
"<,.8~2,~so-|=-~.0,123456789<><", REG_NOSUB, 0, }
|
"<,.8~2,~so-|=-~.0,123456789<><", REG_NOSUB, 0 },
|
||||||
|
/* In ERE, all carets must be treated as anchors. */
|
||||||
|
{ "a^b", "a^b", REG_EXTENDED, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -119,7 +119,7 @@ static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
|
|||||||
reg_syntax_t syntax);
|
reg_syntax_t syntax);
|
||||||
#endif /* not RE_ENABLE_I18N */
|
#endif /* not RE_ENABLE_I18N */
|
||||||
static bin_tree_t *build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
|
static bin_tree_t *build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
|
||||||
const unsigned char *class_name,
|
const unsigned char *class_name,
|
||||||
const unsigned char *extra, int not,
|
const unsigned char *extra, int not,
|
||||||
reg_errcode_t *err);
|
reg_errcode_t *err);
|
||||||
static void free_bin_tree (bin_tree_t *tree);
|
static void free_bin_tree (bin_tree_t *tree);
|
||||||
@ -1660,12 +1660,11 @@ peek_token (token, input, syntax)
|
|||||||
token->type = OP_PERIOD;
|
token->type = OP_PERIOD;
|
||||||
break;
|
break;
|
||||||
case '^':
|
case '^':
|
||||||
if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) &&
|
if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) &&
|
||||||
re_string_cur_idx (input) != 0)
|
re_string_cur_idx (input) != 0)
|
||||||
{
|
{
|
||||||
char prev = re_string_peek_byte (input, -1);
|
char prev = re_string_peek_byte (input, -1);
|
||||||
if (prev != '|' && prev != '(' &&
|
if (!(syntax & RE_NEWLINE_ALT) || prev != '\n')
|
||||||
(!(syntax & RE_NEWLINE_ALT) || prev != '\n'))
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
token->type = ANCHOR;
|
token->type = ANCHOR;
|
||||||
@ -1800,7 +1799,7 @@ parse (regexp, preg, syntax, err)
|
|||||||
bin_tree_t *tree, *eor, *root;
|
bin_tree_t *tree, *eor, *root;
|
||||||
re_token_t current_token;
|
re_token_t current_token;
|
||||||
int new_idx;
|
int new_idx;
|
||||||
current_token = fetch_token (regexp, syntax);
|
current_token = fetch_token (regexp, syntax | RE_CARET_ANCHORS_HERE);
|
||||||
tree = parse_reg_exp (regexp, preg, ¤t_token, syntax, 0, err);
|
tree = parse_reg_exp (regexp, preg, ¤t_token, syntax, 0, err);
|
||||||
if (BE (*err != REG_NOERROR && tree == NULL, 0))
|
if (BE (*err != REG_NOERROR && tree == NULL, 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1847,7 +1846,7 @@ parse_reg_exp (regexp, preg, token, syntax, nest, err)
|
|||||||
{
|
{
|
||||||
re_token_t alt_token = *token;
|
re_token_t alt_token = *token;
|
||||||
new_idx = re_dfa_add_node (dfa, alt_token, 0);
|
new_idx = re_dfa_add_node (dfa, alt_token, 0);
|
||||||
*token = fetch_token (regexp, syntax);
|
*token = fetch_token (regexp, syntax | RE_CARET_ANCHORS_HERE);
|
||||||
if (token->type != OP_ALT && token->type != END_OF_RE
|
if (token->type != OP_ALT && token->type != END_OF_RE
|
||||||
&& (nest == 0 || token->type != OP_CLOSE_SUBEXP))
|
&& (nest == 0 || token->type != OP_CLOSE_SUBEXP))
|
||||||
{
|
{
|
||||||
@ -2178,7 +2177,7 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
dfa->nodes[new_idx].opr.idx = cur_nsub;
|
dfa->nodes[new_idx].opr.idx = cur_nsub;
|
||||||
*token = fetch_token (regexp, syntax);
|
*token = fetch_token (regexp, syntax | RE_CARET_ANCHORS_HERE);
|
||||||
|
|
||||||
/* The subexpression may be a null string. */
|
/* The subexpression may be a null string. */
|
||||||
if (token->type == OP_CLOSE_SUBEXP)
|
if (token->type == OP_CLOSE_SUBEXP)
|
||||||
|
@ -170,6 +170,11 @@ typedef unsigned long int reg_syntax_t;
|
|||||||
If not set, then case is significant. */
|
If not set, then case is significant. */
|
||||||
#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
|
#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
|
||||||
|
|
||||||
|
/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
|
||||||
|
for ^, because it is difficult to scan the regex backwards to find
|
||||||
|
whether ^ should be special. */
|
||||||
|
#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
|
||||||
|
|
||||||
/* This global variable defines the particular regexp syntax to use (for
|
/* This global variable defines the particular regexp syntax to use (for
|
||||||
some interfaces). When a regexp is compiled, the syntax used is
|
some interfaces). When a regexp is compiled, the syntax used is
|
||||||
stored in the pattern buffer, so changing this does not affect
|
stored in the pattern buffer, so changing this does not affect
|
||||||
|
Reference in New Issue
Block a user