mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
posix: Sync regex code with gnulib
It sync with gnulib commit 43ee1a6bf. The main change is 9682f18e9. (which does not have a meaniful description). Checked on x86_64-linux-gnu.
This commit is contained in:
@ -558,7 +558,7 @@ weak_alias (__regerror, regerror)
|
|||||||
static const bitset_t utf8_sb_map =
|
static const bitset_t utf8_sb_map =
|
||||||
{
|
{
|
||||||
/* Set the first 128 bits. */
|
/* Set the first 128 bits. */
|
||||||
# if defined __GNUC__ && !defined __STRICT_ANSI__
|
# if (defined __GNUC__ || __clang_major__ >= 4) && !defined __STRICT_ANSI__
|
||||||
[0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX
|
[0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX
|
||||||
# else
|
# else
|
||||||
# if 4 * BITSET_WORD_BITS < ASCII_CHARS
|
# if 4 * BITSET_WORD_BITS < ASCII_CHARS
|
||||||
|
@ -612,7 +612,9 @@ extern int re_exec (const char *);
|
|||||||
'configure' might #define 'restrict' to those words, so pick a
|
'configure' might #define 'restrict' to those words, so pick a
|
||||||
different name. */
|
different name. */
|
||||||
#ifndef _Restrict_
|
#ifndef _Restrict_
|
||||||
# if defined __restrict || 2 < __GNUC__ + (95 <= __GNUC_MINOR__)
|
# if defined __restrict \
|
||||||
|
|| 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
|
||||||
|
|| __clang_major__ >= 3
|
||||||
# define _Restrict_ __restrict
|
# define _Restrict_ __restrict
|
||||||
# elif 199901L <= __STDC_VERSION__ || defined restrict
|
# elif 199901L <= __STDC_VERSION__ || defined restrict
|
||||||
# define _Restrict_ restrict
|
# define _Restrict_ restrict
|
||||||
@ -620,13 +622,18 @@ extern int re_exec (const char *);
|
|||||||
# define _Restrict_
|
# define _Restrict_
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
/* For [restrict], use glibc's __restrict_arr if available.
|
/* For the ISO C99 syntax
|
||||||
Otherwise, GCC 3.1 (not in C++ mode) and C99 support [restrict]. */
|
array_name[restrict]
|
||||||
|
use glibc's __restrict_arr if available.
|
||||||
|
Otherwise, GCC 3.1 and clang support this syntax (but not in C++ mode).
|
||||||
|
Other ISO C99 compilers support it as well. */
|
||||||
#ifndef _Restrict_arr_
|
#ifndef _Restrict_arr_
|
||||||
# ifdef __restrict_arr
|
# ifdef __restrict_arr
|
||||||
# define _Restrict_arr_ __restrict_arr
|
# define _Restrict_arr_ __restrict_arr
|
||||||
# elif ((199901L <= __STDC_VERSION__ || 3 < __GNUC__ + (1 <= __GNUC_MINOR__)) \
|
# elif ((199901L <= __STDC_VERSION__ \
|
||||||
&& !defined __GNUG__)
|
|| 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \
|
||||||
|
|| __clang_major__ >= 3) \
|
||||||
|
&& !defined __cplusplus)
|
||||||
# define _Restrict_arr_ _Restrict_
|
# define _Restrict_arr_ _Restrict_
|
||||||
# else
|
# else
|
||||||
# define _Restrict_arr_
|
# define _Restrict_arr_
|
||||||
|
@ -300,18 +300,20 @@ build_wcs_upper_buffer (re_string_t *pstr)
|
|||||||
while (byte_idx < end_idx)
|
while (byte_idx < end_idx)
|
||||||
{
|
{
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
unsigned char ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
|
||||||
|
|
||||||
if (isascii (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx])
|
if (isascii (ch) && mbsinit (&pstr->cur_state))
|
||||||
&& mbsinit (&pstr->cur_state))
|
|
||||||
{
|
{
|
||||||
/* In case of a singlebyte character. */
|
|
||||||
pstr->mbs[byte_idx]
|
|
||||||
= toupper (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]);
|
|
||||||
/* The next step uses the assumption that wchar_t is encoded
|
/* The next step uses the assumption that wchar_t is encoded
|
||||||
ASCII-safe: all ASCII values can be converted like this. */
|
ASCII-safe: all ASCII values can be converted like this. */
|
||||||
pstr->wcs[byte_idx] = (wchar_t) pstr->mbs[byte_idx];
|
wchar_t wcu = __towupper (ch);
|
||||||
++byte_idx;
|
if (isascii (wcu))
|
||||||
continue;
|
{
|
||||||
|
pstr->mbs[byte_idx] = wcu;
|
||||||
|
pstr->wcs[byte_idx] = wcu;
|
||||||
|
byte_idx++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
remain_len = end_idx - byte_idx;
|
remain_len = end_idx - byte_idx;
|
||||||
@ -348,7 +350,6 @@ build_wcs_upper_buffer (re_string_t *pstr)
|
|||||||
{
|
{
|
||||||
/* It is an invalid character, an incomplete character
|
/* It is an invalid character, an incomplete character
|
||||||
at the end of the string, or '\0'. Just use the byte. */
|
at the end of the string, or '\0'. Just use the byte. */
|
||||||
int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
|
|
||||||
pstr->mbs[byte_idx] = ch;
|
pstr->mbs[byte_idx] = ch;
|
||||||
/* And also cast it to wide char. */
|
/* And also cast it to wide char. */
|
||||||
pstr->wcs[byte_idx++] = (wchar_t) ch;
|
pstr->wcs[byte_idx++] = (wchar_t) ch;
|
||||||
|
@ -77,6 +77,14 @@
|
|||||||
# define isblank(ch) ((ch) == ' ' || (ch) == '\t')
|
# define isblank(ch) ((ch) == ' ' || (ch) == '\t')
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* regex code assumes isascii has its usual numeric meaning,
|
||||||
|
even if the portable character set uses EBCDIC encoding,
|
||||||
|
and even if wint_t is wider than int. */
|
||||||
|
#ifndef _LIBC
|
||||||
|
# undef isascii
|
||||||
|
# define isascii(c) (((c) & ~0x7f) == 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
# ifndef _RE_DEFINE_LOCALE_FUNCTIONS
|
# ifndef _RE_DEFINE_LOCALE_FUNCTIONS
|
||||||
# define _RE_DEFINE_LOCALE_FUNCTIONS 1
|
# define _RE_DEFINE_LOCALE_FUNCTIONS 1
|
||||||
@ -335,7 +343,7 @@ typedef struct
|
|||||||
Idx idx; /* for BACK_REF */
|
Idx idx; /* for BACK_REF */
|
||||||
re_context_type ctx_type; /* for ANCHOR */
|
re_context_type ctx_type; /* for ANCHOR */
|
||||||
} opr;
|
} opr;
|
||||||
#if __GNUC__ >= 2 && !defined __STRICT_ANSI__
|
#if (__GNUC__ >= 2 || defined __clang__) && !defined __STRICT_ANSI__
|
||||||
re_token_type_t type : 8;
|
re_token_type_t type : 8;
|
||||||
#else
|
#else
|
||||||
re_token_type_t type;
|
re_token_type_t type;
|
||||||
@ -841,10 +849,10 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx)
|
|||||||
#endif /* RE_ENABLE_I18N */
|
#endif /* RE_ENABLE_I18N */
|
||||||
|
|
||||||
#ifndef FALLTHROUGH
|
#ifndef FALLTHROUGH
|
||||||
# if __GNUC__ < 7
|
# if (__GNUC__ >= 7) || (__clang_major__ >= 10)
|
||||||
# define FALLTHROUGH ((void) 0)
|
|
||||||
# else
|
|
||||||
# define FALLTHROUGH __attribute__ ((__fallthrough__))
|
# define FALLTHROUGH __attribute__ ((__fallthrough__))
|
||||||
|
# else
|
||||||
|
# define FALLTHROUGH ((void) 0)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user