From 32e2770e59582f3bea022e20d0cf6722700e7578 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 18 May 2021 22:11:41 -0400 Subject: gnulib: import ffs The Blackfin sim uses this function, but Windows/mingw doesn't provide it. --- gnulib/ChangeLog | 9 ++ gnulib/Makefile.in | 9 ++ gnulib/aclocal.m4 | 2 + gnulib/configure | 174 +++++++++++++++++++++++++++++++++++++++ gnulib/import/Makefile.am | 41 +++++++++ gnulib/import/Makefile.in | 78 +++++++++++++----- gnulib/import/ffs.c | 68 +++++++++++++++ gnulib/import/m4/ffs.m4 | 32 +++++++ gnulib/import/m4/gnulib-cache.m4 | 2 + gnulib/import/m4/gnulib-comp.m4 | 12 +++ gnulib/import/m4/strings_h.m4 | 52 ++++++++++++ gnulib/import/strings.in.h | 122 +++++++++++++++++++++++++++ gnulib/update-gnulib.sh | 1 + 13 files changed, 580 insertions(+), 22 deletions(-) create mode 100644 gnulib/import/ffs.c create mode 100644 gnulib/import/m4/ffs.m4 create mode 100644 gnulib/import/m4/strings_h.m4 create mode 100644 gnulib/import/strings.in.h (limited to 'gnulib') diff --git a/gnulib/ChangeLog b/gnulib/ChangeLog index 13cd518940e..1563e04119b 100644 --- a/gnulib/ChangeLog +++ b/gnulib/ChangeLog @@ -1,3 +1,12 @@ +2021-05-24 Mike Frysinger + + * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add ffs. + * aclocal.m4, configure, Makefile.in, import/Makefile.am, + import/Makefile.in, import/m4/gnulib-cache.m4, + import/m4/gnulib-comp.m4: Regenerate. + * import/ffs.c, import/m4/ffs.m4, import/m4/strings_h.m4, + import/strings.in.h: New files. + 2021-05-04 Mike Frysinger * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add gendocs. diff --git a/gnulib/Makefile.in b/gnulib/Makefile.in index b6439515a40..4c46e0a99e7 100644 --- a/gnulib/Makefile.in +++ b/gnulib/Makefile.in @@ -145,6 +145,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/fcntl.m4 \ $(top_srcdir)/import/m4/fcntl_h.m4 \ $(top_srcdir)/import/m4/fdopendir.m4 \ + $(top_srcdir)/import/m4/ffs.m4 \ $(top_srcdir)/import/m4/filenamecat.m4 \ $(top_srcdir)/import/m4/flexmember.m4 \ $(top_srcdir)/import/m4/float_h.m4 \ @@ -248,6 +249,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/strerror.m4 \ $(top_srcdir)/import/m4/strerror_r.m4 \ $(top_srcdir)/import/m4/string_h.m4 \ + $(top_srcdir)/import/m4/strings_h.m4 \ $(top_srcdir)/import/m4/strnlen.m4 \ $(top_srcdir)/import/m4/strstr.m4 \ $(top_srcdir)/import/m4/strtok_r.m4 \ @@ -454,6 +456,7 @@ GNULIB_FDATASYNC = @GNULIB_FDATASYNC@ GNULIB_FDOPEN = @GNULIB_FDOPEN@ GNULIB_FDOPENDIR = @GNULIB_FDOPENDIR@ GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FFS = @GNULIB_FFS@ GNULIB_FFSL = @GNULIB_FFSL@ GNULIB_FFSLL = @GNULIB_FFSLL@ GNULIB_FGETC = @GNULIB_FGETC@ @@ -938,6 +941,7 @@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ +HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ @@ -976,6 +980,7 @@ HAVE_FCNTL = @HAVE_FCNTL@ HAVE_FDATASYNC = @HAVE_FDATASYNC@ HAVE_FDOPENDIR = @HAVE_FDOPENDIR@ HAVE_FEATURES_H = @HAVE_FEATURES_H@ +HAVE_FFS = @HAVE_FFS@ HAVE_FFSL = @HAVE_FFSL@ HAVE_FFSLL = @HAVE_FFSLL@ HAVE_FMA = @HAVE_FMA@ @@ -1122,9 +1127,11 @@ HAVE_SQRTL = @HAVE_SQRTL@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASECMP = @HAVE_STRCASECMP@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ +HAVE_STRINGS_H = @HAVE_STRINGS_H@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ @@ -1271,6 +1278,7 @@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ +NEXT_AS_FIRST_DIRECTIVE_STRINGS_H = @NEXT_AS_FIRST_DIRECTIVE_STRINGS_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_RANDOM_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_RANDOM_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@ @@ -1299,6 +1307,7 @@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRINGS_H = @NEXT_STRINGS_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_RANDOM_H = @NEXT_SYS_RANDOM_H@ NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@ diff --git a/gnulib/aclocal.m4 b/gnulib/aclocal.m4 index 50c77599a7a..00a0c9c0d95 100644 --- a/gnulib/aclocal.m4 +++ b/gnulib/aclocal.m4 @@ -1218,6 +1218,7 @@ m4_include([import/m4/fcntl-o.m4]) m4_include([import/m4/fcntl.m4]) m4_include([import/m4/fcntl_h.m4]) m4_include([import/m4/fdopendir.m4]) +m4_include([import/m4/ffs.m4]) m4_include([import/m4/filenamecat.m4]) m4_include([import/m4/flexmember.m4]) m4_include([import/m4/float_h.m4]) @@ -1321,6 +1322,7 @@ m4_include([import/m4/strdup.m4]) m4_include([import/m4/strerror.m4]) m4_include([import/m4/strerror_r.m4]) m4_include([import/m4/string_h.m4]) +m4_include([import/m4/strings_h.m4]) m4_include([import/m4/strnlen.m4]) m4_include([import/m4/strstr.m4]) m4_include([import/m4/strtok_r.m4]) diff --git a/gnulib/configure b/gnulib/configure index ad2315d94d3..2ddb1d7cbb0 100644 --- a/gnulib/configure +++ b/gnulib/configure @@ -742,6 +742,9 @@ NEXT_SYS_TYPES_H HAVE_SYS_RANDOM_H NEXT_AS_FIRST_DIRECTIVE_SYS_RANDOM_H NEXT_SYS_RANDOM_H +HAVE_STRINGS_H +NEXT_AS_FIRST_DIRECTIVE_STRINGS_H +NEXT_STRINGS_H NEXT_AS_FIRST_DIRECTIVE_STRING_H NEXT_STRING_H NEXT_AS_FIRST_DIRECTIVE_STDLIB_H @@ -1455,6 +1458,10 @@ GL_GENERATE_FLOAT_H_TRUE FLOAT_H NEXT_AS_FIRST_DIRECTIVE_FLOAT_H NEXT_FLOAT_H +HAVE_DECL_STRNCASECMP +HAVE_STRCASECMP +HAVE_FFS +GNULIB_FFS NEXT_AS_FIRST_DIRECTIVE_FCNTL_H NEXT_FCNTL_H REPLACE_OPENAT @@ -3768,6 +3775,7 @@ as_fn_append ac_func_list " strerror_r" as_fn_append ac_func_list " __xpg_strerror_r" as_fn_append ac_func_list " catgets" as_fn_append ac_func_list " snprintf" +as_fn_append ac_header_list " strings.h" as_fn_append ac_header_list " sys/random.h" as_fn_append ac_header_list " sys/uio.h" as_fn_append ac_func_list " localtime_r" @@ -6704,6 +6712,7 @@ fi # Code from module fd-hook: # Code from module fd-safer-flag: # Code from module fdopendir: + # Code from module ffs: # Code from module filename: # Code from module filenamecat-lgpl: # Code from module flexmember: @@ -6814,6 +6823,7 @@ fi # Code from module strerror-override: # Code from module strerror_r-posix: # Code from module string: + # Code from module strings: # Code from module strnlen: # Code from module strnlen1: # Code from module strstr: @@ -9128,6 +9138,12 @@ fi + GNULIB_FFS=0; + HAVE_FFS=1; + HAVE_STRCASECMP=1; + HAVE_DECL_STRNCASECMP=1; + + GNULIB_FNMATCH=0; @@ -16700,6 +16716,100 @@ $as_echo "$gl_cv_next_string_h" >&6; } + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_strings_h='<'strings.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if ${gl_cv_next_strings_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_strings_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'strings.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_strings_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_strings_h + gl_cv_next_strings_h='"'$gl_header'"' + else + gl_cv_next_strings_h='<'strings.h'>' + fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_strings_h" >&5 +$as_echo "$gl_cv_next_strings_h" >&6; } + fi + NEXT_STRINGS_H=$gl_cv_next_strings_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'strings.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_strings_h + fi + NEXT_AS_FIRST_DIRECTIVE_STRINGS_H=$gl_next_as_first_directive + + + + + if test $ac_cv_header_strings_h = yes; then + HAVE_STRINGS_H=1 + else + HAVE_STRINGS_H=0 + fi + + + + + + ac_fn_c_check_decl "$LINENO" "strnlen" "ac_cv_have_decl_strnlen" "$ac_includes_default" if test "x$ac_cv_have_decl_strnlen" = xyes; then : ac_have_decl=1 @@ -19360,6 +19470,67 @@ _ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffs" >&5 +$as_echo_n "checking for ffs... " >&6; } +if ${gl_cv_func_ffs+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int x; + +int +main () +{ +int (*func) (int) = ffs; + return func (x); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_func_ffs=yes +else + gl_cv_func_ffs=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_ffs" >&5 +$as_echo "$gl_cv_func_ffs" >&6; } + if test $gl_cv_func_ffs = no; then + HAVE_FFS=0 + fi + + if test $HAVE_FFS = 0; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS ffs.$ac_objext" + + fi + + + + + + GNULIB_FFS=1 + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flexible array member" >&5 $as_echo_n "checking for flexible array member... " >&6; } @@ -28740,6 +28911,9 @@ _ACEOF + + + if test $ac_cv_have_decl_strnlen = no; then HAVE_DECL_STRNLEN=0 else diff --git a/gnulib/import/Makefile.am b/gnulib/import/Makefile.am index bfa30c16806..e99adab7a22 100644 --- a/gnulib/import/Makefile.am +++ b/gnulib/import/Makefile.am @@ -39,6 +39,7 @@ # dirent \ # dirfd \ # errno \ +# ffs \ # fnmatch-gnu \ # frexpl \ # gendocs \ @@ -518,6 +519,15 @@ EXTRA_libgnu_a_SOURCES += fdopendir.c ## end gnulib module fdopendir +## begin gnulib module ffs + + +EXTRA_DIST += ffs.c + +EXTRA_libgnu_a_SOURCES += ffs.c + +## end gnulib module ffs + ## begin gnulib module filename @@ -2331,6 +2341,37 @@ EXTRA_DIST += string.in.h ## end gnulib module string +## begin gnulib module strings + +BUILT_SOURCES += strings.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \ + -e 's/@''GNULIB_FFS''@/$(GNULIB_FFS)/g' \ + -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \ + -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \ + -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/strings.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += strings.h strings.h-t + +EXTRA_DIST += strings.in.h + +## end gnulib module strings + ## begin gnulib module strnlen diff --git a/gnulib/import/Makefile.in b/gnulib/import/Makefile.in index 4610d388edd..e02adc633ea 100644 --- a/gnulib/import/Makefile.in +++ b/gnulib/import/Makefile.in @@ -53,6 +53,7 @@ # dirent \ # dirfd \ # errno \ +# ffs \ # fnmatch-gnu \ # frexpl \ # gendocs \ @@ -205,6 +206,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/fcntl.m4 \ $(top_srcdir)/import/m4/fcntl_h.m4 \ $(top_srcdir)/import/m4/fdopendir.m4 \ + $(top_srcdir)/import/m4/ffs.m4 \ $(top_srcdir)/import/m4/filenamecat.m4 \ $(top_srcdir)/import/m4/flexmember.m4 \ $(top_srcdir)/import/m4/float_h.m4 \ @@ -308,6 +310,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/strerror.m4 \ $(top_srcdir)/import/m4/strerror_r.m4 \ $(top_srcdir)/import/m4/string_h.m4 \ + $(top_srcdir)/import/m4/strings_h.m4 \ $(top_srcdir)/import/m4/strnlen.m4 \ $(top_srcdir)/import/m4/strstr.m4 \ $(top_srcdir)/import/m4/strtok_r.m4 \ @@ -552,6 +555,7 @@ GNULIB_FDATASYNC = @GNULIB_FDATASYNC@ GNULIB_FDOPEN = @GNULIB_FDOPEN@ GNULIB_FDOPENDIR = @GNULIB_FDOPENDIR@ GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FFS = @GNULIB_FFS@ GNULIB_FFSL = @GNULIB_FFSL@ GNULIB_FFSLL = @GNULIB_FFSLL@ GNULIB_FGETC = @GNULIB_FGETC@ @@ -1036,6 +1040,7 @@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ +HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ @@ -1074,6 +1079,7 @@ HAVE_FCNTL = @HAVE_FCNTL@ HAVE_FDATASYNC = @HAVE_FDATASYNC@ HAVE_FDOPENDIR = @HAVE_FDOPENDIR@ HAVE_FEATURES_H = @HAVE_FEATURES_H@ +HAVE_FFS = @HAVE_FFS@ HAVE_FFSL = @HAVE_FFSL@ HAVE_FFSLL = @HAVE_FFSLL@ HAVE_FMA = @HAVE_FMA@ @@ -1220,9 +1226,11 @@ HAVE_SQRTL = @HAVE_SQRTL@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASECMP = @HAVE_STRCASECMP@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ +HAVE_STRINGS_H = @HAVE_STRINGS_H@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ @@ -1369,6 +1377,7 @@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ +NEXT_AS_FIRST_DIRECTIVE_STRINGS_H = @NEXT_AS_FIRST_DIRECTIVE_STRINGS_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_RANDOM_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_RANDOM_H@ NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@ @@ -1397,6 +1406,7 @@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_STRINGS_H = @NEXT_STRINGS_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_SYS_RANDOM_H = @NEXT_SYS_RANDOM_H@ NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@ @@ -1781,15 +1791,15 @@ EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \ close.c closedir.c dirent-private.h count-one-bits.h \ ctype.in.h dirent.in.h dirfd.c dirname.h dup.c dup2.c \ eloop-threshold.h errno.in.h error.c error.h exitfail.h \ - fchdir.c fcntl.c fcntl.in.h fd-hook.h fdopendir.c filename.h \ - filenamecat.h flexmember.h float.c float.in.h itold.c \ - fnmatch.c fnmatch_loop.c fnmatch.c fnmatch.in.h fpucw.h free.c \ - frexp.c frexp.c frexpl.c fstat.c stat-w32.c stat-w32.h \ - at-func.c fstatat.c $(top_srcdir)/import/extra/gendocs.sh \ - getcwd.c getcwd-lgpl.c getdelim.c getdtablesize.c getline.c \ - getlogin_r.c getrandom.c gettimeofday.c \ - $(top_srcdir)/import/extra/gitlog-to-changelog glob.c \ - glob_internal.h glob_pattern_p.c globfree.c glob-libc.h \ + fchdir.c fcntl.c fcntl.in.h fd-hook.h fdopendir.c ffs.c \ + filename.h filenamecat.h flexmember.h float.c float.in.h \ + itold.c fnmatch.c fnmatch_loop.c fnmatch.c fnmatch.in.h \ + fpucw.h free.c frexp.c frexp.c frexpl.c fstat.c stat-w32.c \ + stat-w32.h at-func.c fstatat.c \ + $(top_srcdir)/import/extra/gendocs.sh getcwd.c getcwd-lgpl.c \ + getdelim.c getdtablesize.c getline.c getlogin_r.c getrandom.c \ + gettimeofday.c $(top_srcdir)/import/extra/gitlog-to-changelog \ + glob.c glob_internal.h glob_pattern_p.c globfree.c glob-libc.h \ glob.in.h hard-locale.h inet_ntop.c intprops.h inttypes.in.h \ isblank.c float+.h isnan.c isnand-nolibm.h isnand.c float+.h \ isnan.c isnanl-nolibm.h isnanl.c cdefs.h libc-config.h \ @@ -1812,11 +1822,11 @@ EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \ stat-time.h stdalign.in.h stdbool.in.h stddef.in.h stdint.in.h \ stdio.in.h stdlib.in.h strchrnul.c strchrnul.valgrind strdup.c \ streq.h strerror.c strerror-override.c strerror-override.h \ - strerror_r.c string.in.h strnlen.c strstr.c str-two-way.h \ - strstr.c strtok_r.c sys_random.in.h sys_socket.in.h \ - sys_stat.in.h sys_time.in.h sys_types.in.h sys_uio.in.h \ - tempname.h time.in.h time_r.c unistd.in.h unistd--.h \ - unistd-safer.h unsetenv.c \ + strerror_r.c string.in.h strings.in.h strnlen.c strstr.c \ + str-two-way.h strstr.c strtok_r.c sys_random.in.h \ + sys_socket.in.h sys_stat.in.h sys_time.in.h sys_types.in.h \ + sys_uio.in.h tempname.h time.in.h time_r.c unistd.in.h \ + unistd--.h unistd-safer.h unsetenv.c \ $(top_srcdir)/import/extra/update-copyright verify.h \ wchar.in.h wctype.in.h windows-initguard.h windows-mutex.c \ windows-mutex.h windows-once.c windows-once.h \ @@ -1827,9 +1837,9 @@ BUILT_SOURCES = $(ALLOCA_H) arpa/inet.h ctype.h dirent.h $(ERRNO_H) \ fcntl.h $(FLOAT_H) $(FNMATCH_H) $(GLOB_H) inttypes.h \ $(LIMITS_H) locale.h math.h $(NETINET_IN_H) signal.h \ $(STDALIGN_H) $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h \ - stdlib.h string.h sys/random.h sys/socket.h sys/stat.h \ - sys/time.h sys/types.h sys/uio.h time.h unistd.h wchar.h \ - wctype.h + stdlib.h string.h strings.h sys/random.h sys/socket.h \ + sys/stat.h sys/time.h sys/types.h sys/uio.h time.h unistd.h \ + wchar.h wctype.h SUFFIXES = MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t arpa/inet.h \ arpa/inet.h-t ctype.h ctype.h-t dirent.h dirent.h-t errno.h \ @@ -1839,10 +1849,11 @@ MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t arpa/inet.h \ netinet/in.h-t signal.h signal.h-t stdalign.h stdalign.h-t \ stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t \ stdio.h stdio.h-t stdlib.h stdlib.h-t string.h string.h-t \ - sys/random.h sys/random.h-t sys/socket.h sys/socket.h-t \ - sys/stat.h sys/stat.h-t sys/time.h sys/time.h-t sys/types.h \ - sys/types.h-t sys/uio.h sys/uio.h-t time.h time.h-t unistd.h \ - unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t + strings.h strings.h-t sys/random.h sys/random.h-t sys/socket.h \ + sys/socket.h-t sys/stat.h sys/stat.h-t sys/time.h sys/time.h-t \ + sys/types.h sys/types.h-t sys/uio.h sys/uio.h-t time.h \ + time.h-t unistd.h unistd.h-t wchar.h wchar.h-t wctype.h \ + wctype.h-t MOSTLYCLEANDIRS = arpa netinet sys sys sys sys CLEANFILES = DISTCLEANFILES = @@ -1866,7 +1877,7 @@ libgnu_a_LIBADD = $(gl_LIBOBJS) @ALLOCA@ libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@ EXTRA_libgnu_a_SOURCES = alloca.c btowc.c canonicalize-lgpl.c \ chdir-long.c close.c closedir.c dirfd.c dup.c dup2.c error.c \ - fchdir.c fcntl.c fdopendir.c float.c itold.c fnmatch.c \ + fchdir.c fcntl.c fdopendir.c ffs.c float.c itold.c fnmatch.c \ fnmatch_loop.c fnmatch.c free.c frexp.c frexp.c frexpl.c \ fstat.c stat-w32.c at-func.c fstatat.c getcwd.c getcwd-lgpl.c \ getdelim.c getdtablesize.c getline.c getlogin_r.c getrandom.c \ @@ -2017,6 +2028,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer-flag.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdopendir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filenamecat-lgpl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fnmatch.Po@am__quote@ @@ -3439,6 +3451,28 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H } > $@-t && \ mv $@-t $@ +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \ + -e 's/@''GNULIB_FFS''@/$(GNULIB_FFS)/g' \ + -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \ + -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \ + -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/strings.in.h; \ + } > $@-t && \ + mv $@-t $@ + # We need the following in order to create when the system # doesn't have one. sys/random.h: sys_random.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) diff --git a/gnulib/import/ffs.c b/gnulib/import/ffs.c new file mode 100644 index 00000000000..68d5d48daf2 --- /dev/null +++ b/gnulib/import/ffs.c @@ -0,0 +1,68 @@ +/* ffs.c -- find the first set bit in a word. + Copyright (C) 2011-2021 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Eric Blake. */ + +#include + +/* Specification. */ +#include + +#include + +#if defined _MSC_VER && !(__clang_major__ >= 4) +# include +#endif + +int +ffs (int i) +{ +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__clang_major__ >= 4) + return __builtin_ffs (i); +#elif defined _MSC_VER + /* _BitScanForward + */ + unsigned long bit; + if (_BitScanForward (&bit, i)) + return bit + 1; + else + return 0; +#else + /* + gives this deBruijn constant for a branch-less computation, although + that table counted trailing zeros rather than bit position. This + requires 32-bit int, we fall back to a naive algorithm on the rare + platforms where that assumption is not true. */ + if (CHAR_BIT * sizeof i == 32) + { + static unsigned int table[] = { + 1, 2, 29, 3, 30, 15, 25, 4, 31, 23, 21, 16, 26, 18, 5, 9, + 32, 28, 14, 24, 22, 20, 17, 8, 27, 13, 19, 7, 12, 6, 11, 10 + }; + unsigned int u = i; + unsigned int bit = u & -u; + return table[(bit * 0x077cb531U) >> 27] - !i; + } + else + { + unsigned int j; + for (j = 0; j < CHAR_BIT * sizeof i; j++) + if (i & (1U << j)) + return j + 1; + return 0; + } +#endif +} diff --git a/gnulib/import/m4/ffs.m4 b/gnulib/import/m4/ffs.m4 new file mode 100644 index 00000000000..b6e6b3141f3 --- /dev/null +++ b/gnulib/import/m4/ffs.m4 @@ -0,0 +1,32 @@ +# ffs.m4 serial 4 +dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FFS], +[ + AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) + + dnl We can't use AC_CHECK_FUNC here, because ffs() is defined as a + dnl static inline function when compiling for Android 4.2 or older. + dnl But require that ffs() is declared; otherwise we may be using + dnl the GCC built-in function, which leads to warnings + dnl "warning: implicit declaration of function 'ffs'". + AC_CACHE_CHECK([for ffs], [gl_cv_func_ffs], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x; + ]], + [[int (*func) (int) = ffs; + return func (x); + ]]) + ], + [gl_cv_func_ffs=yes], + [gl_cv_func_ffs=no]) + ]) + if test $gl_cv_func_ffs = no; then + HAVE_FFS=0 + fi +]) diff --git a/gnulib/import/m4/gnulib-cache.m4 b/gnulib/import/m4/gnulib-cache.m4 index 79a2f6107df..ad7db9a694e 100644 --- a/gnulib/import/m4/gnulib-cache.m4 +++ b/gnulib/import/m4/gnulib-cache.m4 @@ -44,6 +44,7 @@ # dirent \ # dirfd \ # errno \ +# ffs \ # fnmatch-gnu \ # frexpl \ # gendocs \ @@ -88,6 +89,7 @@ gl_MODULES([ dirent dirfd errno + ffs fnmatch-gnu frexpl gendocs diff --git a/gnulib/import/m4/gnulib-comp.m4 b/gnulib/import/m4/gnulib-comp.m4 index db323163ee9..75fe076f74e 100644 --- a/gnulib/import/m4/gnulib-comp.m4 +++ b/gnulib/import/m4/gnulib-comp.m4 @@ -84,6 +84,7 @@ AC_DEFUN([gl_EARLY], # Code from module fd-hook: # Code from module fd-safer-flag: # Code from module fdopendir: + # Code from module ffs: # Code from module filename: # Code from module filenamecat-lgpl: # Code from module flexmember: @@ -194,6 +195,7 @@ AC_DEFUN([gl_EARLY], # Code from module strerror-override: # Code from module strerror_r-posix: # Code from module string: + # Code from module strings: # Code from module strnlen: # Code from module strnlen1: # Code from module strstr: @@ -329,6 +331,11 @@ AC_DEFUN([gl_INIT], fi gl_DIRENT_MODULE_INDICATOR([fdopendir]) gl_MODULE_INDICATOR([fdopendir]) + gl_FUNC_FFS + if test $HAVE_FFS = 0; then + AC_LIBOBJ([ffs]) + fi + gl_STRINGS_MODULE_INDICATOR([ffs]) gl_FILE_NAME_CONCAT_LGPL AC_C_FLEXIBLE_ARRAY_MEMBER gl_FLOAT_H @@ -712,6 +719,7 @@ AC_DEFUN([gl_INIT], dnl For the modules argp, error. gl_MODULE_INDICATOR([strerror_r-posix]) gl_HEADER_STRING_H + gl_HEADER_STRINGS_H gl_FUNC_STRNLEN if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then AC_LIBOBJ([strnlen]) @@ -990,6 +998,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/fd-safer-flag.c lib/fd-safer.c lib/fdopendir.c + lib/ffs.c lib/filename.h lib/filenamecat-lgpl.c lib/filenamecat.h @@ -1130,6 +1139,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/strerror.c lib/strerror_r.c lib/string.in.h + lib/strings.in.h lib/stripslash.c lib/strnlen.c lib/strnlen1.c @@ -1204,6 +1214,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/fcntl.m4 m4/fcntl_h.m4 m4/fdopendir.m4 + m4/ffs.m4 m4/filenamecat.m4 m4/flexmember.m4 m4/float_h.m4 @@ -1306,6 +1317,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/strerror.m4 m4/strerror_r.m4 m4/string_h.m4 + m4/strings_h.m4 m4/strnlen.m4 m4/strstr.m4 m4/strtok_r.m4 diff --git a/gnulib/import/m4/strings_h.m4 b/gnulib/import/m4/strings_h.m4 new file mode 100644 index 00000000000..1dc2212ac67 --- /dev/null +++ b/gnulib/import/m4/strings_h.m4 @@ -0,0 +1,52 @@ +# Configure a replacement for . +# serial 6 + +# Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_HEADER_STRINGS_H], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_HEADER_STRINGS_H_BODY]) +]) + +AC_DEFUN([gl_HEADER_STRINGS_H_BODY], +[ + AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) + + gl_CHECK_NEXT_HEADERS([strings.h]) + if test $ac_cv_header_strings_h = yes; then + HAVE_STRINGS_H=1 + else + HAVE_STRINGS_H=0 + fi + AC_SUBST([HAVE_STRINGS_H]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ + /* Minix 3.1.8 has a bug: must be included before + . */ + #include + #include + ]], [ffs strcasecmp strncasecmp]) +]) + +AC_DEFUN([gl_STRINGS_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) +]) + +AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS], +[ + GNULIB_FFS=0; AC_SUBST([GNULIB_FFS]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_FFS=1; AC_SUBST([HAVE_FFS]) + HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) + HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP]) +]) diff --git a/gnulib/import/strings.in.h b/gnulib/import/strings.in.h new file mode 100644 index 00000000000..dbbf94b4d4c --- /dev/null +++ b/gnulib/import/strings.in.h @@ -0,0 +1,122 @@ +/* A substitute . + + Copyright (C) 2007-2021 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +#ifndef _@GUARD_PREFIX@_STRINGS_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* Minix 3.1.8 has a bug: must be included before . + But avoid namespace pollution on glibc systems. */ +#if defined __minix && !defined __GLIBC__ +# include +#endif + +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_STRINGS_H@ +# @INCLUDE_NEXT@ @NEXT_STRINGS_H@ +#endif + +#ifndef _@GUARD_PREFIX@_STRINGS_H +#define _@GUARD_PREFIX@_STRINGS_H + +#if ! @HAVE_DECL_STRNCASECMP@ +/* Get size_t. */ +# include +#endif + + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +#ifdef __cplusplus +extern "C" { +#endif + + + /* Find the index of the least-significant set bit. */ +#if @GNULIB_FFS@ +# if !@HAVE_FFS@ +_GL_FUNCDECL_SYS (ffs, int, (int i)); +# endif +_GL_CXXALIAS_SYS (ffs, int, (int i)); +_GL_CXXALIASWARN (ffs); +#elif defined GNULIB_POSIXCHECK +# undef ffs +# if HAVE_RAW_DECL_FFS +_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module"); +# endif +#endif + +/* Compare strings S1 and S2, ignoring case, returning less than, equal to or + greater than zero if S1 is lexicographically less than, equal to or greater + than S2. + Note: This function does not work in multibyte locales. */ +#if ! @HAVE_STRCASECMP@ +extern int strcasecmp (char const *s1, char const *s2) + _GL_ARG_NONNULL ((1, 2)); +#endif +#if defined GNULIB_POSIXCHECK +/* strcasecmp() does not work with multibyte strings: + POSIX says that it operates on "strings", and "string" in POSIX is defined + as a sequence of bytes, not of characters. */ +# undef strcasecmp +# if HAVE_RAW_DECL_STRCASECMP +_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character " + "strings in multibyte locales - " + "use mbscasecmp if you care about " + "internationalization, or use c_strcasecmp , " + "gnulib module c-strcase) if you want a locale " + "independent function"); +# endif +#endif + +/* Compare no more than N bytes of strings S1 and S2, ignoring case, + returning less than, equal to or greater than zero if S1 is + lexicographically less than, equal to or greater than S2. + Note: This function cannot work correctly in multibyte locales. */ +#if ! @HAVE_DECL_STRNCASECMP@ +extern int strncasecmp (char const *s1, char const *s2, size_t n) + _GL_ARG_NONNULL ((1, 2)); +#endif +#if defined GNULIB_POSIXCHECK +/* strncasecmp() does not work with multibyte strings: + POSIX says that it operates on "strings", and "string" in POSIX is defined + as a sequence of bytes, not of characters. */ +# undef strncasecmp +# if HAVE_RAW_DECL_STRNCASECMP +_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character " + "strings in multibyte locales - " + "use mbsncasecmp or mbspcasecmp if you care about " + "internationalization, or use c_strncasecmp , " + "gnulib module c-strcase) if you want a locale " + "independent function"); +# endif +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _@GUARD_PREFIX@_STRING_H */ +#endif /* _@GUARD_PREFIX@_STRING_H */ diff --git a/gnulib/update-gnulib.sh b/gnulib/update-gnulib.sh index cbe4ee6adfc..e8bb5965269 100755 --- a/gnulib/update-gnulib.sh +++ b/gnulib/update-gnulib.sh @@ -36,6 +36,7 @@ IMPORTED_GNULIB_MODULES="\ dirent \ dirfd \ errno \ + ffs \ fnmatch-gnu \ frexpl \ gendocs \ -- cgit v1.2.1