* config/srclist.txt: Remove regex.c, regex_internal.h temporarily. * lib/regex.c (__STDC_WANT_IEC_60559_BFP_EXT__): Define. * lib/regex_internal.h (BITSET_WORD_BITS): * modules/regex (Depends-on): Add limits-h. Simplify now that we can use ULONG_WIDTH. --- ChangeLog | 9 +++++++++ config/srclist.txt | 4 ++-- lib/regex.c | 2 ++ lib/regex_internal.h | 32 ++------------------------------ modules/regex | 1 + 5 files changed, 16 insertions(+), 32 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 08f05f74c..df8d996c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2020-01-21 Paul Eggert <egg...@cs.ucla.edu> + + regex: simplify definition of BITSET_WORD_BITS + * config/srclist.txt: Remove regex.c, regex_internal.h temporarily. + * lib/regex.c (__STDC_WANT_IEC_60559_BFP_EXT__): Define. + * lib/regex_internal.h (BITSET_WORD_BITS): + * modules/regex (Depends-on): Add limits-h. + Simplify now that we can use ULONG_WIDTH. + 2020-01-20 Bruno Haible <br...@clisp.org> mbrtoc32: Add note about FreeBSD 12. diff --git a/config/srclist.txt b/config/srclist.txt index 9a7b9597d..16a799cc6 100644 --- a/config/srclist.txt +++ b/config/srclist.txt @@ -53,10 +53,10 @@ $LIBCSRC malloc/scratch_buffer_set_array_size.c lib/malloc # Temporarily newer in Gnulib than in glibc. #$LIBCSRC include/intprops.h lib $LIBCSRC posix/regcomp.c lib -$LIBCSRC posix/regex.c lib +#$LIBCSRC posix/regex.c lib $LIBCSRC posix/regex.h lib $LIBCSRC posix/regex_internal.c lib -$LIBCSRC posix/regex_internal.h lib +#$LIBCSRC posix/regex_internal.h lib $LIBCSRC posix/regexec.c lib $LIBCSRC time/timegm.c lib #$LIBCSRC time/mktime.c lib diff --git a/lib/regex.c b/lib/regex.c index 815e2ec76..991eedc82 100644 --- a/lib/regex.c +++ b/lib/regex.c @@ -17,6 +17,8 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#define __STDC_WANT_IEC_60559_BFP_EXT__ + #ifndef _LIBC # include <libc-config.h> diff --git a/lib/regex_internal.h b/lib/regex_internal.h index 6f761c6ed..30e921fef 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -164,36 +164,8 @@ typedef __re_size_t re_hashval_t; typedef unsigned long int bitset_word_t; /* All bits set in a bitset_word_t. */ #define BITSET_WORD_MAX ULONG_MAX - -/* Number of bits in a bitset_word_t. For portability to hosts with - padding bits, do not use '(sizeof (bitset_word_t) * CHAR_BIT)'; - instead, deduce it directly from BITSET_WORD_MAX. Avoid - greater-than-32-bit integers and unconditional shifts by more than - 31 bits, as they're not portable. */ -#if BITSET_WORD_MAX == 0xffffffffUL -# define BITSET_WORD_BITS 32 -#elif BITSET_WORD_MAX >> 31 >> 4 == 1 -# define BITSET_WORD_BITS 36 -#elif BITSET_WORD_MAX >> 31 >> 16 == 1 -# define BITSET_WORD_BITS 48 -#elif BITSET_WORD_MAX >> 31 >> 28 == 1 -# define BITSET_WORD_BITS 60 -#elif BITSET_WORD_MAX >> 31 >> 31 >> 1 == 1 -# define BITSET_WORD_BITS 64 -#elif BITSET_WORD_MAX >> 31 >> 31 >> 9 == 1 -# define BITSET_WORD_BITS 72 -#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 3 == 1 -# define BITSET_WORD_BITS 128 -#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 == 1 -# define BITSET_WORD_BITS 256 -#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 > 1 -# define BITSET_WORD_BITS 257 /* any value > SBC_MAX will do here */ -# if BITSET_WORD_BITS <= SBC_MAX -# error "Invalid SBC_MAX" -# endif -#else -# error "Add case for new bitset_word_t size" -#endif +/* Number of bits in a bitset_word_t. */ +#define BITSET_WORD_BITS ULONG_WIDTH /* Number of bitset_word_t values in a bitset_t. */ #define BITSET_WORDS ((SBC_MAX + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS) diff --git a/modules/regex b/modules/regex index 9d77df7ae..bd38cd2d4 100644 --- a/modules/regex +++ b/modules/regex @@ -22,6 +22,7 @@ builtin-expect [test $ac_use_included_regex = yes] intprops [test $ac_use_included_regex = yes] langinfo [test $ac_use_included_regex = yes] libc-config [test $ac_use_included_regex = yes] +limits-h [test $ac_use_included_regex = yes] lock [test "$ac_cv_gnu_library_2_1:$ac_use_included_regex" = no:yes] memcmp [test $ac_use_included_regex = yes] memmove [test $ac_use_included_regex = yes] -- 2.24.1