2003-06-12  H.J. Lu  <hongjiu.lu@intel.com>

	* posix/transbug.c (run_test): Return 1 for failure.
	(do_test): Compare only if run_test is successful.

2003-06-12  Simon Josefsson  <jas@extundo.com>

	* argp/argp.h [!__THROW]: Define if undefined.

	* posix/transbug.c: New file.
	* inet/Makefile (aux): Add check_pf.
	* include/ifaddrs.h: Add prototype for __check_pf.
	* sysdeps/generic/check_pf.c: New file.
	* sysdeps/unix/sysv/linux/check_pf.c: New file.
This commit is contained in:
Ulrich Drepper 2003-06-12 18:29:52 +00:00
parent 3bbbaea974
commit 66b110e855
5 changed files with 63 additions and 35 deletions

View File

@ -1,3 +1,12 @@
2003-06-12 H.J. Lu <hongjiu.lu@intel.com>
* posix/transbug.c (run_test): Return 1 for failure.
(do_test): Compare only if run_test is successful.
2003-06-12 Simon Josefsson <jas@extundo.com>
* argp/argp.h [!__THROW]: Define if undefined.
2003-06-12 Ulrich Drepper <drepper@redhat.com> 2003-06-12 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/cris/sysdep.h: Fix handling of syscalls with * sysdeps/unix/sysv/linux/cris/sysdep.h: Fix handling of syscalls with
@ -22,7 +31,7 @@
build_word_op, and build_charclass. build_word_op, and build_charclass.
(build_charclass): Apply translation for character classes too. (build_charclass): Apply translation for character classes too.
(build_word_op): Deliver translation to build_charclass. (build_word_op): Deliver translation to build_charclass.
* posux/transbug.c: New file. * posix/transbug.c: New file.
* posix/Makefile (tests): Add transbug. * posix/Makefile (tests): Add transbug.
2003-06-04 Paolo Bonzini <bonzini@gnu.org> 2003-06-04 Paolo Bonzini <bonzini@gnu.org>
@ -193,10 +202,10 @@
2003-06-10 Ulrich Drepper <drepper@redhat.com> 2003-06-10 Ulrich Drepper <drepper@redhat.com>
* inet/Makefile (aux): Add check_fd. * inet/Makefile (aux): Add check_pf.
* include/ifaddrs.h: Add prototype for __check_fd. * include/ifaddrs.h: Add prototype for __check_pf.
* sysdeps/generic/check_fd.c: New file. * sysdeps/generic/check_pf.c: New file.
* sysdeps/unix/sysv/linux/check_fd.c: New file. * sysdeps/unix/sysv/linux/check_pf.c: New file.
* sysdeps/unix/sysv/linux/ifaddrs.h (__no_netlink_support): Renamed * sysdeps/unix/sysv/linux/ifaddrs.h (__no_netlink_support): Renamed
from no_netlink_support. Export. from no_netlink_support. Export.
* sysdeps/posix/getaddrinfo.c (getaddrinfo): Don't call getifaddrs, * sysdeps/posix/getaddrinfo.c (getaddrinfo): Don't call getifaddrs,

View File

@ -32,6 +32,10 @@
# define __const const # define __const const
#endif #endif
#ifndef __THROW
# define __THROW
#endif
#ifndef __error_t_defined #ifndef __error_t_defined
typedef int error_t; typedef int error_t;
# define __error_t_defined # define __error_t_defined

View File

@ -104,7 +104,8 @@ static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset,
re_charset_t *mbcset, re_charset_t *mbcset,
int *equiv_class_alloc, int *equiv_class_alloc,
const unsigned char *name); const unsigned char *name);
static reg_errcode_t build_charclass (re_bitset_ptr_t sbcset, static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
re_bitset_ptr_t sbcset,
re_charset_t *mbcset, re_charset_t *mbcset,
int *char_class_alloc, int *char_class_alloc,
const unsigned char *class_name, const unsigned char *class_name,
@ -112,11 +113,13 @@ static reg_errcode_t build_charclass (re_bitset_ptr_t sbcset,
#else /* not RE_ENABLE_I18N */ #else /* not RE_ENABLE_I18N */
static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset, static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset,
const unsigned char *name); const unsigned char *name);
static reg_errcode_t build_charclass (re_bitset_ptr_t sbcset, static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
re_bitset_ptr_t sbcset,
const unsigned char *class_name, const unsigned char *class_name,
reg_syntax_t syntax); reg_syntax_t syntax);
#endif /* not RE_ENABLE_I18N */ #endif /* not RE_ENABLE_I18N */
static bin_tree_t *build_word_op (re_dfa_t *dfa, int not, reg_errcode_t *err); static bin_tree_t *build_word_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
int not, reg_errcode_t *err);
static void free_bin_tree (bin_tree_t *tree); static void free_bin_tree (bin_tree_t *tree);
static bin_tree_t *create_tree (bin_tree_t *left, bin_tree_t *right, static bin_tree_t *create_tree (bin_tree_t *left, bin_tree_t *right,
re_token_type_t type, int index); re_token_type_t type, int index);
@ -2073,12 +2076,12 @@ parse_expression (regexp, preg, token, syntax, nest, err)
dfa->has_mb_node = 1; dfa->has_mb_node = 1;
break; break;
case OP_WORD: case OP_WORD:
tree = build_word_op (dfa, 0, err); tree = build_word_op (dfa, regexp->trans, 0, err);
if (BE (*err != REG_NOERROR && tree == NULL, 0)) if (BE (*err != REG_NOERROR && tree == NULL, 0))
return NULL; return NULL;
break; break;
case OP_NOTWORD: case OP_NOTWORD:
tree = build_word_op (dfa, 1, err); tree = build_word_op (dfa, regexp->trans, 1, err);
if (BE (*err != REG_NOERROR && tree == NULL, 0)) if (BE (*err != REG_NOERROR && tree == NULL, 0))
return NULL; return NULL;
break; break;
@ -2949,7 +2952,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err)
goto parse_bracket_exp_free_return; goto parse_bracket_exp_free_return;
break; break;
case CHAR_CLASS: case CHAR_CLASS:
*err = build_charclass (sbcset, *err = build_charclass (regexp->trans, sbcset,
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
mbcset, &char_class_alloc, mbcset, &char_class_alloc,
#endif /* RE_ENABLE_I18N */ #endif /* RE_ENABLE_I18N */
@ -3200,12 +3203,13 @@ build_equiv_class (sbcset, name)
static reg_errcode_t static reg_errcode_t
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
build_charclass (sbcset, mbcset, char_class_alloc, class_name, syntax) build_charclass (trans, sbcset, mbcset, char_class_alloc, class_name, syntax)
re_charset_t *mbcset; re_charset_t *mbcset;
int *char_class_alloc; int *char_class_alloc;
#else /* not RE_ENABLE_I18N */ #else /* not RE_ENABLE_I18N */
build_charclass (sbcset, class_name, syntax) build_charclass (trans, sbcset, class_name, syntax)
#endif /* not RE_ENABLE_I18N */ #endif /* not RE_ENABLE_I18N */
RE_TRANSLATE_TYPE trans;
re_bitset_ptr_t sbcset; re_bitset_ptr_t sbcset;
const unsigned char *class_name; const unsigned char *class_name;
reg_syntax_t syntax; reg_syntax_t syntax;
@ -3235,11 +3239,14 @@ build_charclass (sbcset, class_name, syntax)
mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name); mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name);
#endif /* RE_ENABLE_I18N */ #endif /* RE_ENABLE_I18N */
#define BUILD_CHARCLASS_LOOP(ctype_func)\ #define BUILD_CHARCLASS_LOOP(ctype_func) \
for (i = 0; i < SBC_MAX; ++i) \ for (i = 0; i < SBC_MAX; ++i) \
{ \ { \
if (ctype_func (i)) \ if (ctype_func (i)) \
bitset_set (sbcset, i); \ { \
int ch = trans ? trans[i] : i; \
bitset_set (sbcset, ch); \
} \
} }
if (strcmp (name, "alnum") == 0) if (strcmp (name, "alnum") == 0)
@ -3273,8 +3280,9 @@ build_charclass (sbcset, class_name, syntax)
} }
static bin_tree_t * static bin_tree_t *
build_word_op (dfa, not, err) build_word_op (dfa, trans, not, err)
re_dfa_t *dfa; re_dfa_t *dfa;
RE_TRANSLATE_TYPE trans;
int not; int not;
reg_errcode_t *err; reg_errcode_t *err;
{ {
@ -3324,7 +3332,7 @@ build_word_op (dfa, not, err)
} }
/* We don't care the syntax in this case. */ /* We don't care the syntax in this case. */
ret = build_charclass (sbcset, ret = build_charclass (trans, sbcset,
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
mbcset, &alloc, mbcset, &alloc,
#endif /* RE_ENABLE_I18N */ #endif /* RE_ENABLE_I18N */

View File

@ -3334,12 +3334,6 @@ group_nodes_into_DFAstates (preg, state, dests_node, dests_ch)
match it the context. */ match it the context. */
if (constraint) if (constraint)
{ {
if (constraint & NEXT_WORD_CONSTRAINT)
for (j = 0; j < BITSET_UINTS; ++j)
accepts[j] &= dfa->word_char[j];
if (constraint & NEXT_NOTWORD_CONSTRAINT)
for (j = 0; j < BITSET_UINTS; ++j)
accepts[j] &= ~dfa->word_char[j];
if (constraint & NEXT_NEWLINE_CONSTRAINT) if (constraint & NEXT_NEWLINE_CONSTRAINT)
{ {
int accepts_newline = bitset_contain (accepts, NEWLINE_CHAR); int accepts_newline = bitset_contain (accepts, NEWLINE_CHAR);
@ -3349,6 +3343,17 @@ group_nodes_into_DFAstates (preg, state, dests_node, dests_ch)
else else
continue; continue;
} }
if (constraint & NEXT_ENDBUF_CONSTRAINT)
{
bitset_empty (accepts);
continue;
}
if (constraint & NEXT_WORD_CONSTRAINT)
for (j = 0; j < BITSET_UINTS; ++j)
accepts[j] &= dfa->word_char[j];
if (constraint & NEXT_NOTWORD_CONSTRAINT)
for (j = 0; j < BITSET_UINTS; ++j)
accepts[j] &= ~dfa->word_char[j];
} }
/* Then divide `accepts' into DFA states, or create a new /* Then divide `accepts' into DFA states, or create a new

View File

@ -105,7 +105,7 @@ run_test (const char *pattern, struct re_registers *regs)
printf ("search 2: res = %d, start = %d, end = %d\n", printf ("search 2: res = %d, start = %d, end = %d\n",
res, regs[1].start[0], regs[1].end[0]); res, regs[1].start[0], regs[1].end[0]);
return 0; return res < 0 ? 1 : 0;
} }
@ -120,17 +120,19 @@ do_test (void)
(void) re_set_syntax (RE_SYNTAX_GNU_AWK); (void) re_set_syntax (RE_SYNTAX_GNU_AWK);
run_test (lower, regs); int result;
run_test (upper, &regs[2]);
int result = 0;
#define CHECK(exp) \ #define CHECK(exp) \
if (exp) { puts (#exp); result = 1; } if (exp) { puts (#exp); result = 1; }
CHECK (regs[0].start[0] != regs[2].start[0]); result = run_test (lower, regs);
CHECK (regs[0].end[0] != regs[2].end[0]); result |= run_test (upper, &regs[2]);
CHECK (regs[1].start[0] != regs[3].start[0]); if (! result)
CHECK (regs[1].end[0] != regs[3].end[0]); {
CHECK (regs[0].start[0] != regs[2].start[0]);
CHECK (regs[0].end[0] != regs[2].end[0]);
CHECK (regs[1].start[0] != regs[3].start[0]);
CHECK (regs[1].end[0] != regs[3].end[0]);
}
return result; return result;
} }