summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* wcsncmp: Work around two ISO C compliance bugs on several platforms.Bruno Haible2023-04-192-4/+17
| | | | | | | | | | | | | * lib/wchar.in.h (wcsncmp): Consider REPLACE_WCSNCMP. * lib/wcsncmp-impl.h (wcsncmp): Don't assume that the two wide characters are in the range 0..INT_MAX. * m4/wcsncmp.m4 (gl_FUNC_WCSNCMP): Test whether wcsncmp works for all wide characters. Set REPLACE_WCSNCMP. * m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WCSNCMP. * modules/wchar (Makefile.am): Substitute REPLACE_WCSNCMP. * modules/wcsncmp (Status, Notice): Un-obsolete this module. (configure.ac): Consider REPLACE_WCSNCMP. * doc/posix-functions/wcsncmp.texi: Mention the two bugs.
* wcscmp: Work around two ISO C compliance bugs on several platforms.Bruno Haible2023-04-192-4/+15
| | | | | | | | | | | | | * lib/wchar.in.h (wcscmp): Consider REPLACE_WCSCMP. * lib/wcscmp-impl.h (wcscmp): Don't assume that the two wide characters are in the range 0..INT_MAX. * m4/wcscmp.m4 (gl_FUNC_WCSCMP): Test whether wcscmp works for all wide characters. Set REPLACE_WCSCMP. * m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WCSCMP. * modules/wchar (Makefile.am): Substitute REPLACE_WCSCMP. * modules/wcscmp (Status, Notice): Un-obsolete this module. (configure.ac): Consider REPLACE_WCSCMP. * doc/posix-functions/wcscmp.texi: Mention the two bugs.
* wmemcmp: Work around ISO C compliance bug on several platforms.Bruno Haible2023-04-192-4/+17
| | | | | | | | | | | | * lib/wchar.in.h (wmemcmp): Consider REPLACE_WMEMCMP. * lib/wmemcmp-impl.h (wmemcmp): Don't assume that the two wide characters are in the range 0..INT_MAX. * m4/wmemcmp.m4 (gl_FUNC_WMEMCMP): Test whether wmemcmp works for all wide characters. Set REPLACE_WMEMCMP. * m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WMEMCMP. * modules/wchar (Makefile.am): Substitute REPLACE_WMEMCMP. * modules/wmemcmp (configure.ac): Consider REPLACE_WMEMCMP. * doc/posix-functions/wmemcmp.texi: Mention the bug.
* isnan: Fix compilation error in C++ mode on FreeBSD 13.2.Bruno Haible2023-04-151-0/+5
| | | | | * lib/math.in.h (isnan): On FreeBSD 13.2 or newer, don't declare isnan through _GL_MATH_CXX_REAL_FLOATING_DECL_2.
* filemode: Fix double-inclusion guard.Bruno Haible2023-04-141-0/+1
| | | | * lib/filemode.h: Make the double-inclusion guard actually work.
* year2038: Add reminder to include <config.h> before time_t gets defined.Bruno Haible2023-04-147-0/+49
| | | | | | | | | | | | * lib/sched.in.h: Check that config.h was already included before the * lib/sys_select.in.h: Likewise. * lib/sys_stat.in.h: Likewise. * lib/sys_time.in.h: Likewise. * lib/sys_types.in.h: Likewise. * lib/time.in.h: Likewise. * lib/utime.in.h: Likewise. * modules/year2038 (Depends-on): Add sched, sys_msg, sys_select, sys_sem, sys_shm, sys_stat, sys_time, sys_types, time-h, utime-h.
* sys_shm: New module.Bruno Haible2023-04-141-0/+30
| | | | | | | * lib/sys_shm.in.h: New file. * m4/sys_shm_h.m4: New file. * modules/sys_shm: New file. * doc/posix-headers/sys_shm.texi: Mention the new module.
* sys_sem: New module.Bruno Haible2023-04-141-0/+30
| | | | | | | * lib/sys_sem.in.h: New file. * m4/sys_sem_h.m4: New file. * modules/sys_sem: New file. * doc/posix-headers/sys_sem.texi: Mention the new module.
* sys_msg: New module.Bruno Haible2023-04-141-0/+30
| | | | | | | * lib/sys_msg.in.h: New file. * m4/sys_msg_h.m4: New file. * modules/sys_msg: New file. * doc/posix-headers/sys_msg.texi: Mention the new module.
* Add more reminders to include <config.h>.Bruno Haible2023-04-1329-0/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/aligned-malloc.h: Check that config.h was already included. * lib/careadlinkat.h: Likewise. * lib/filemode.h: Likewise. * lib/freadptr.h: Likewise. * lib/fseterr.h: Likewise. * lib/glthread/lock.h: Likewise. * lib/glthread/tls.h: Likewise. * lib/immutable.h: Likewise. * lib/isapipe.h: Likewise. * lib/isnand-nolibm.h: Likewise. * lib/isnanf-nolibm.h: Likewise. * lib/isnanl-nolibm.h: Likewise. * lib/mbswidth.h: Likewise. * lib/md5.h: Likewise. * lib/minmax.h: Likewise. * lib/msvc-inval.h: Likewise. * lib/msvc-nothrow.h: Likewise. * lib/pathmax.h: Likewise. * lib/sha1.h: Likewise. * lib/sha256.h: Likewise. * lib/sha512.h: Likewise. * lib/size_max.h: Likewise. * lib/sm3.h: Likewise. * lib/stat-size.h: Likewise. * lib/termcap.h: Likewise. * lib/terminfo.h: Likewise. * lib/thread-optim.h: Likewise. * lib/unlocked-io.h: Likewise. * lib/vma-iter.h: Likewise.
* Adjust comments in <config.h> reminders.Bruno Haible2023-04-1325-25/+30
| | | | * lib/*.h: In the comments, mention also HAVE_*.
* Adjust comments in <config.h> reminders.Bruno Haible2023-04-1345-45/+50
| | | | | * lib/*.in.h: In the comments, mention also HAVE_RAW_DECL_*. * Makefile (sc_check_config_h_reminder): Search also for HAVE_RAW_DECL_.
* utmp: Avoid using HAVE_* macros in *.in.h files.Bruno Haible2023-04-131-3/+3
| | | | | | | | | | | | | * m4/pty_h.m4 (gl_PTY_CHECK_UTIL_H): New macro, extracted from gl_PTY_H. (gl_PTY_H): Invoke it. * m4/utmp_h.m4 (gl_UTMP_H): Invoke gl_PTY_CHECK_UTIL_H and set HAVE_TERMIOS_H. (gl_UTMP_H_DEFAULTS): Require gl_PTY_H_DEFAULTS, gl_TERMIOS_H_DEFAULTS. * modules/utmp (Files): Add m4/pty_h.m4, m4/termios_h.m4. (Makefile.am): Substitute also HAVE_UTIL_H, HAVE_LIBUTIL_H, HAVE_TERMIOS_H. * lib/utmp.in.h: Test HAVE_UTIL_H, HAVE_LIBUTIL_H, HAVE_TERMIOS_H as Autoconf variables.
* getprogname: Avoid using HAVE_* macros in *.in.h files.Bruno Haible2023-04-131-2/+2
| | | | | | | | | | | * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_DECL_PROGRAM_INVOCATION_NAME. * m4/getprogname.m4 (gl_FUNC_GETPROGNAME): Require gl_STDLIB_H_DEFAULTS and gl_USE_SYSTEM_EXTENSIONS. Set HAVE_DECL_PROGRAM_INVOCATION_NAME. * modules/stdlib (Makefile.am): Substitute HAVE_DECL_PROGRAM_INVOCATION_NAME. * lib/stdlib.in.h (getprogname): Test HAVE_DECL_PROGRAM_INVOCATION_NAME as an Autoconf variable.
* selinux-h: Avoid using HAVE_* macros in *.in.h files.Bruno Haible2023-04-131-1/+1
| | | | | | | | * m4/selinux-selinux-h.m4 (gl_HEADERS_SELINUX_SELINUX_H): Initialize HAVE_SELINUX_SELINUX_H. * modules/selinux-h (Makefile.am): Substitute HAVE_SELINUX_SELINUX_H. * lib/se-selinux.in.h: Test HAVE_SELINUX_SELINUX_H as an Autoconf variable.
* ialloc, gethrxtime: Restore GCC diagnostics options.Bruno Haible2023-04-132-0/+4
| | | | | | * lib/ialloc.h: Invoke _GL_INLINE_HEADER_END. * lib/xtime.h: Likewise. * Makefile (sc_check_GL_INLINE_HEADER_use): New rule.
* Add more reminders to include <config.h>.Bruno Haible2023-04-12204-164/+1067
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * m4/gnulib-common.m4 (gl_COMMON): In config.h, define _GL_CONFIG_H_INCLUDED. * lib/acl-internal.h: Test _GL_CONFIG_H_INCLUDED instead of _GL_INLINE_HEADER_BEGIN. * lib/alignalloc.h: Likewise. * lib/argp-fmtstream.h: Likewise. * lib/argp.h: Likewise. * lib/binary-io.h: Likewise. * lib/bitrotate.h: Likewise. * lib/c-ctype.h: Likewise. * lib/count-leading-zeros.h: Likewise. * lib/count-one-bits.h: Likewise. * lib/count-trailing-zeros.h: Likewise. * lib/eealloc.h: Likewise. * lib/execinfo.in.h: Likewise. * lib/gethrxtime.h: Likewise. * lib/gl_list.h: Likewise. * lib/gl_map.h: Likewise. * lib/gl_omap.h: Likewise. * lib/gl_openssl.h: Likewise. * lib/gl_oset.h: Likewise. * lib/gl_set.h: Likewise. * lib/gl_xlist.h: Likewise. * lib/gl_xmap.h: Likewise. * lib/gl_xomap.h: Likewise. * lib/gl_xoset.h: Likewise. * lib/gl_xset.h: Likewise. * lib/gl_xsublist.h: Likewise. * lib/glthread/cond.h: Likewise. * lib/hamt.h: Likewise. * lib/ialloc.h: Likewise. * lib/math.in.h: Likewise. * lib/mbchar.h: Likewise. * lib/mbfile.h: Likewise. * lib/mbiter.h: Likewise. * lib/mbuiter.h: Likewise. * lib/openat.h: Likewise. * lib/pipe-filter-aux.h: Likewise. * lib/priv-set.h: Likewise. * lib/safe-alloc.h: Likewise. * lib/savewd.h: Likewise. * lib/se-context.in.h: Likewise. * lib/se-label.in.h: Likewise. * lib/se-selinux.in.h: Likewise. * lib/sig-handler.h: Likewise. * lib/stat-time.h: Likewise. * lib/string-desc-quotearg.h: Likewise. * lib/string-desc.h: Likewise. * lib/sys_socket.in.h: Likewise. * lib/timespec.h: Likewise. * lib/u64.h: Likewise. * lib/uchar.in.h: Likewise. * lib/unistd.in.h: Likewise. * lib/utimens.h: Likewise. * lib/wctype.in.h: Likewise. * lib/xalloc.h: Likewise. * lib/xbinary-io.h: Likewise. * lib/xsize.h: Likewise. * lib/xstring-desc.h: Likewise. * lib/xtime.h: Likewise. * lib/acl.h: Check that config.h was already included. * lib/alignof.h: Likewise. * lib/argmatch.h: Likewise. * lib/argv-iter.h: Likewise. * lib/arpa_inet.in.h: Likewise. * lib/attribute.h: Likewise. * lib/backupfile.h: Likewise. * lib/base32.h: Likewise. * lib/base64.h: Likewise. * lib/basename-lgpl.h: Likewise. * lib/bitset.h: Likewise. * lib/bitsetv.h: Likewise. * lib/c-snprintf.h: Likewise. * lib/c-stack.h: Likewise. * lib/c-strcase.h: Likewise. * lib/c-vasnprintf.h: Likewise. * lib/c-vasprintf.h: Likewise. * lib/c-vsnprintf.h: Likewise. * lib/c-xvasprintf.h: Likewise. * lib/canon-host.h: Likewise. * lib/canonicalize.h: Likewise. * lib/clean-temp.h: Likewise. * lib/concat-filename.h: Likewise. * lib/ctype.in.h: Likewise. * lib/dfa.h: Likewise. * lib/di-set.h: Likewise. * lib/dirent-safer.h: Likewise. * lib/dirent.in.h: Likewise. * lib/dirname.h: Likewise. * lib/eloop-threshold.h: Likewise. * lib/error.in.h: Likewise. * lib/exclude.h: Likewise. * lib/fatal-signal.h: Likewise. * lib/fcntl.in.h: Likewise. * lib/file-type.h: Likewise. * lib/filenamecat.h: Likewise. * lib/filevercmp.h: Likewise. * lib/flexmember.h: Likewise. * lib/fnmatch.in.h: Likewise. * lib/fpending.h: Likewise. * lib/freadable.h: Likewise. * lib/freadahead.h: Likewise. * lib/freading.h: Likewise. * lib/fts_.h: Likewise. * lib/fwritable.h: Likewise. * lib/fwriting.h: Likewise. * lib/gc.h: Likewise. * lib/get_progname_of.h: Likewise. * lib/glob.in.h: Likewise. * lib/glthread/thread.h: Likewise. * lib/hash-pjw-bare.h: Likewise. * lib/hash-pjw.h: Likewise. * lib/hash-triple.h: Likewise. * lib/hash.h: Likewise. * lib/i-ring.h: Likewise. * lib/iconv.in.h: Likewise. * lib/ino-map.h: Likewise. * lib/inttostr.h: Likewise. * lib/inttypes.in.h: Likewise. * lib/javaversion.h: Likewise. * lib/langinfo.in.h: Likewise. * lib/locale.in.h: Likewise. * lib/localename.h: Likewise. * lib/malloc.in.h: Likewise. * lib/malloca.h: Likewise. * lib/memcasecmp.h: Likewise. * lib/memchr2.h: Likewise. * lib/memcmp2.h: Likewise. * lib/modechange.h: Likewise. * lib/monetary.in.h: Likewise. * lib/mountlist.h: Likewise. * lib/netdb.in.h: Likewise. * lib/obstack.h: Likewise. * lib/opendirat.h: Likewise. * lib/pagealign_alloc.h: Likewise. * lib/pipe-filter.h: Likewise. * lib/poll.in.h: Likewise. * lib/pthread.in.h: Likewise. * lib/pty.in.h: Likewise. * lib/quotearg.h: Likewise. * lib/read-file.h: Likewise. * lib/readline.h: Likewise. * lib/readutmp.h: Likewise. * lib/regex-quote.h: Likewise. * lib/relocatable.h: Likewise. * lib/savedir.h: Likewise. * lib/sched.in.h: Likewise. * lib/search.in.h: Likewise. * lib/sh-quote.h: Likewise. * lib/signal.in.h: Likewise. * lib/sigpipe-die.h: Likewise. * lib/sockets.h: Likewise. * lib/spawn.in.h: Likewise. * lib/ssfmalloc.h: Likewise. * lib/stack.h: Likewise. * lib/stdalign.in.h: Likewise. * lib/stdarg.in.h: Likewise. * lib/stddef.in.h: Likewise. * lib/stdio-safer.h: Likewise. * lib/stdio.in.h: Likewise. * lib/stdlib.in.h: Likewise. * lib/stdnoreturn.in.h: Likewise. * lib/strerror-override.h: Likewise. * lib/striconv.h: Likewise. * lib/striconveh.h: Likewise. * lib/striconveha.h: Likewise. * lib/string-buffer.h: Likewise. * lib/string.in.h: Likewise. * lib/strings.in.h: Likewise. * lib/strnlen1.h: Likewise. * lib/sys_file.in.h: Likewise. * lib/sys_ioctl.in.h: Likewise. * lib/sys_random.in.h: Likewise. * lib/sys_resource.in.h: Likewise. * lib/sys_select.in.h: Likewise. * lib/sys_stat.in.h: Likewise. * lib/sys_time.in.h: Likewise. * lib/sys_times.in.h: Likewise. * lib/sys_utsname.in.h: Likewise. * lib/sys_wait.in.h: Likewise. * lib/system-quote.h: Likewise. * lib/term-style-control.h: Likewise. * lib/termios.in.h: Likewise. * lib/textstyle.in.h: Likewise. * lib/threads.in.h: Likewise. * lib/time.in.h: Likewise. * lib/trim.h: Likewise. * lib/utime.in.h: Likewise. * lib/utmp.in.h: Likewise. * lib/vasnprintf.h: Likewise. * lib/verror.h: Likewise. * lib/version-etc.h: Likewise. * lib/wchar.in.h: Likewise. * lib/windows-spawn.h: Likewise. * lib/windows-thread.h: Likewise. * lib/xgetcwd.h: Likewise. * lib/xgetdomainname.h: Likewise. * lib/xgethostname.h: Likewise. * lib/xmalloca.h: Likewise. * lib/xmemdup0.h: Likewise. * lib/xprintf.h: Likewise. * lib/xreadlink.h: Likewise. * lib/xstriconv.h: Likewise. * lib/xstriconveh.h: Likewise. * lib/xstrndup.h: Likewise. * lib/xstrtol-error.h: Likewise. * lib/xvasprintf.h: Likewise. * Makefile (config_h_MACROS*): New variables. (sc_check_config_h_reminder): New rule.
* c32toupper: New module.Bruno Haible2023-04-102-0/+49
| | | | | | | | | * lib/uchar.in.h (c32toupper): New declaration. * lib/c32toupper.c: New file. * modules/c32toupper: New file. * m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize GNULIB_C32TOUPPER. * modules/uchar (Makefile.am): Substitute GNULIB_C32TOUPPER.
* c32tolower: New module.Bruno Haible2023-04-093-0/+144
| | | | | | | | | | * lib/uchar.in.h (c32tolower): New declaration. * lib/c32tolower.c: New file. * lib/c32to-impl.h: New file, based on lib/c32is-impl.h. * modules/c32tolower: New file. * m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize GNULIB_C32TOLOWER. * modules/uchar (Makefile.am): Substitute GNULIB_C32TOLOWER.
* mbrtoc32: Add comments.Bruno Haible2023-04-091-0/+7
| | | | | | * lib/mbrtoc32.c: Add comment regarding AIX. * m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32): Add comment regarding GNULIB_defined_mbstate_t.
* login_tty: Fix compilation error in C++ mode on Solaris 11.4.Bruno Haible2023-04-081-1/+4
| | | | | | | | * m4/login_tty.m4 (gl_FUNC_LOGIN_TTY): Test whether <termios.h> exists. Consider it when testing whether login_tty is declared. * lib/utmp.in.h: If none of <util.h> and <libutil.h> exists, include <termios.h> instead. * doc/glibc-functions/login_tty.texi: Document the Solaris 11.4 problem.
* time: Fix compilation error in C++ mode on Solaris 11.Bruno Haible2023-04-081-0/+2
| | | | | * lib/time.in.h (time): Disable _GL_CXXALIASWARN invocation on non-glibc systems.
* stdio: Fix the value of _PRINTF_NAN_LEN_MAX on OpenBSD.Bruno Haible2023-04-081-3/+2
| | | | * lib/stdio.in.h (_PRINTF_NAN_LEN_MAX): Define to 4 on OpenBSD.
* vasnwprintf-posix: Work around %La bug in glibc 2.15 and Haiku.Bruno Haible2023-04-071-7/+7
| | | | | | | | | | * m4/printf.m4 (gl_SWPRINTF_DIRECTIVE_LA): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke gl_SWPRINTF_DIRECTIVE_LA and define NEED_WPRINTF_DIRECTIVE_LA accordingly. * lib/vasnprintf.c: When compiling vasnwprintf, if NEED_WPRINTF_DIRECTIVE_LA, handle the %La and %LA directives ourselves. * doc/posix-functions/swprintf.texi: Mention the %La bug.
* stdio: Fix compilation error in C++ mode on macOS.Bruno Haible2023-04-071-0/+8
| | | | | * lib/stdio.in.h (getw, putw): Repeat the declaration even if the function is already supposed to be declared.
* uchar: Force inline functions to C linkage in C++ mode.Bruno Haible2023-04-061-0/+40
| | | | | | | * m4/gnulib-common.m4 (gl_COMMON_BODY): Put definitions of _GL_BEGIN_C_LINKAGE, _GL_END_C_LINKAGE into config.h. * lib/uchar.in.h: Enclose all inline functions in _GL_BEGIN_C_LINKAGE / _GL_END_C_LINKAGE.
* alignalloc: Fix link error on glibc 2.15 systems.Bruno Haible2023-04-061-1/+1
| | | | | * lib/alignalloc.h (ALIGNALLOC_VIA_ALIGNED_ALLOC): Set to 0 on glibc 2.15 systems.
* random_r: Fix compilation error on Haiku.Bruno Haible2023-04-051-3/+1
| | | | | * lib/stdlib.in.h: For random_r, include <stdint.h> always. * modules/random_r (Depends-on): Depend on 'stdint' always.
* strerrorname_np: Fix compilation error on Haiku.Bruno Haible2023-04-051-1/+1
| | | | | | * lib/strerrorname_np.c (strerrorname_np): Avoid conflict between EDOOFUS and EINVAL. * tests/test-strerrorname_np.c (main): Likewise.
* uchar: Fix recent change.Bruno Haible2023-04-051-0/+4
| | | | * lib/uchar.in.h: Include <string.h>, <wctype.h>.
* localename: Add support for Haiku's per-thread locales.Bruno Haible2023-04-051-0/+65
| | | | | * lib/localename.c: Include <dlfcn.h>. (gl_locale_name_thread_unsafe): Add special code for Haiku.
* uchar: Work around Haiku bug.Bruno Haible2023-04-051-0/+4
| | | | | | | | | | | | * m4/uchar_h.m4 (gl_UCHAR_H, gl_TYPE_CHAR8_T, gl_TYPE_CHAR16_T, gl_TYPE_CHAR32_T): Before including <uchar.h>, on Haiku, first include <stdint.h>. * m4/c32rtomb.m4 (gl_FUNC_C32RTOMB): Likewise. * m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32, gl_CHECK_FUNC_MBRTOC32, gl_MBRTOC32_EMPTY_INPUT, gl_MBRTOC32_C_LOCALE, gl_MBRTOC32_SANITYCHECK): Likewise. * lib/uchar.in.h: On Haiku, include <stdint.h> before the include_next. * doc/posix-headers/uchar.texi: Mention the Haiku bug.
* duplocale: Fix compilation error on Haiku (regression 2023-01-22).Bruno Haible2023-04-051-9/+9
| | | | | | | * lib/locale.in.h (duplocale): If HAVE_DUPLOCALE = 0, don't declare it, even if REPLACE_DUPLOCALE = 1. * modules/duplocale (Depends-on, configure.ac): Don't compile a replacement if HAVE_DUPLOCALE = 0 and REPLACE_DUPLOCALE = 1.
* stdlib: Work around MB_CUR_MAX bug on Solaris 10.Bruno Haible2023-04-041-0/+15
| | | | | | | | | | * lib/stdlib.in.h (gl_MB_CUR_MAX): New function. (MB_CUR_MAX, GNULIB_defined_MB_CUR_MAX): New macros. * m4/stdlib_h.m4 (gl_STDLIB_H): Test whether MB_CUR_MAX is correct. (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_MB_CUR_MAX. * modules/stdlib (Files): Add m4/locale-fr.m4. (Makefile.am): Substitute REPLACE_MB_CUR_MAX. * doc/posix-headers/stdlib.texi: Mention the Solaris 10 bug.
* *c32*: Inline most functions on glibc and musl libc.Bruno Haible2023-04-0422-0/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/uchar.in.h: Invoke _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END. (btoc32): Inline if _GL_WCHAR_T_IS_UCS4. (c32isalnum, c32isalpha, c32isblank, c32iscntrl, c32isdigit, c32isgraph, c32islower, c32isprint, c32ispunct, c32isspace, c32isupper, c32isxdigit): Inline if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t. (c32snrtombs, c32srtombs, c32stombs, c32tob, mbsnrtoc32s, mbsrtoc32s, mbstoc32s): Inline if _GL_WCHAR_T_IS_UCS4. * lib/btoc32.c: Define compilation unit marker. (btoc32): Conditionally mark as _GL_EXTERN_INLINE. * lib/c32isalnum.c: Define compilation unit marker. * lib/c32isalpha.c: Likewise. * lib/c32isblank.c: Likewise. * lib/c32iscntrl.c: Likewise. * lib/c32isdigit.c: Likewise. * lib/c32isgraph.c: Likewise. * lib/c32islower.c: Likewise. * lib/c32isprint.c: Likewise. * lib/c32ispunct.c: Likewise. * lib/c32isspace.c: Likewise. * lib/c32isupper.c: Likewise. * lib/c32isxdigit.c: Likewise. * lib/c32is-impl.h (FUNC): Conditionally mark as _GL_EXTERN_INLINE. * lib/c32snrtombs.c: Define compilation unit marker. (c32snrtombs): Conditionally mark as _GL_EXTERN_INLINE. * lib/c32srtombs.c: Define compilation unit marker. (c32srtombs): Conditionally mark as _GL_EXTERN_INLINE. * lib/c32stombs.c: Define compilation unit marker. (c32stombs): Conditionally mark as _GL_EXTERN_INLINE. * lib/c32tob.c: Define compilation unit marker. (c32tob): Conditionally mark as _GL_EXTERN_INLINE. * lib/mbsnrtoc32s.c: Define compilation unit marker. (mbsnrtoc32s): Conditionally mark as _GL_EXTERN_INLINE. * lib/mbsrtoc32s.c: Define compilation unit marker. (mbsrtoc32s): Conditionally mark as _GL_EXTERN_INLINE. * lib/mbstoc32s.c: Define compilation unit marker. (mbstoc32s): Conditionally mark as _GL_EXTERN_INLINE. * modules/uchar (Depends-on): Add extern-inline.
* backupfile: fix bug when renaming from subdirectoryPádraig Brady2023-04-041-3/+4
| | | | | | | * lib/backupfile.c (backup_internal): Ensure we use the appropriate offset if operating on a subdirectory, i.e., on an updated sdir. Fixes https://bugs.gnu.org/62607
* *c32*: Optimize on musl libc like on glibc.Bruno Haible2023-04-048-7/+23
| | | | | | | | | | | * lib/uchar.in.h (_GL_WCHAR_T_IS_UCS4): New macro. * lib/btoc32.c (btoc32): Test _GL_WCHAR_T_IS_UCS4 instead of __GLIBC__. * lib/mbsrtoc32s.c: Likewise. * lib/mbsnrtoc32s.c: Likewise. * lib/c32tob.c (c32tob): Likewise. * lib/c32srtombs.c: Likewise. * lib/c32snrtombs.c: Likewise. * lib/c32is-impl.h (FUNC): Likewise.
* uchar: Rename _GL_LARGE_CHAR32_T to _GL_SMALL_WCHAR_T.Bruno Haible2023-04-049-10/+10
| | | | | | | | | | | | | * lib/uchar.in.h (_GL_SMALL_WCHAR_T): Renamed from _GL_LARGE_CHAR32_T. * lib/mbrtoc32.c: Update. * lib/mbsrtoc32s.c: Update. * lib/mbsnrtoc32s.c: Update. * lib/c32tob.c: Update. * lib/c32rtomb.c: Update. * lib/c32srtombs.c: Update. * lib/c32snrtombs.c: Update. * lib/c32is-impl.h: Update. * tests/test-uchar.c: Update.
* vasnprintf-posix: Fix harmless mistake (regression 2023-03-24).Bruno Haible2023-04-031-0/+1
| | | | | | Found by Coverity. * lib/vasnprintf.c (MAX_ROOM_NEEDED): Insert 'break;' statement.
* trim: Fix trim_trailing result in multibyte locales.Bruno Haible2023-04-021-7/+0
| | | | * lib/trim.c (IF_LINT): Remove macro.
* trim: Fix trim_trailing result in multibyte locales.Bruno Haible2023-04-021-32/+11
| | | | | * lib/trim.c (trim2): Simplify algorithm for trim_trailing in multibyte locales, to use 2 instead of 3 states.
* unistr/u8-strstr: Simplify code.Bruno Haible2023-04-022-147/+23
| | | | | | * lib/unistr/u8-strstr.c: Inline the contents of lib/unistr/u-strstr.h. * lib/unistr/u-strstr.h: Remove file. * modules/unistr/u8-strstr (Files): Remove it.
* unistr/u{16,32}-strstr: Use two-way algorithm (no memory allocation).Bruno Haible2023-04-025-95/+87
| | | | | | | | | | | | | | | | | | | | | | | * lib/wcs-two-way.h: Use UNIT instead of wchar_t. Don't undefine RETURN_TYPE. * lib/wcsstr-impl.h: Move the non-linear implementation away. Use UNIT instead of wchar_t, RETURN_TYPE instead of 'wchar_t *', FUNC instead of wcsstr. (AVAILABLE): Use MEMCHR0 instead of wmemchr. (FUNC): Use STRCHR instead of wcschr. * lib/wcsstr.c: Moved the non-linear implementation to here. (FUNC, UNIT, RETURN_TYPE, MEMCHR0, STRCHR): New macros. * lib/unistr/u16-strstr.c: Don't include malloca.h, str-kmp.h, u-strstr.h. Instead, include wcsstr-impl.h. * lib/unistr/u32-strstr.c: Likewise. * modules/unistr/u16-strstr (Files): Remove u-strstr.h, str-kmp.h. Add wcsstr-impl.h, wcs-two-way.h. (Depends-on): Remove u16-strmbtouc, u16-strlen, u16-strnlen, malloca. Add u16-chr, u16-cmp. * modules/unistr/u32-strstr (Files): Remove u-strstr.h, str-kmp.h. Add wcsstr-impl.h, wcs-two-way.h. (Depends-on): Remove u32-strlen, u32-strnlen, malloca. Add u32-chr, u32-cmp.
* vasnwprintf-posix: Fix behaviour in the C locale.Bruno Haible2023-04-011-1/+72
| | | | | | | | | | | | | | | | * lib/vasnprintf.c (VASNPRINTF): If NEED_WPRINTF_DIRECTIVE_C is set, implement the 'c' directive here. * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke gl_MBRTOWC_C_LOCALE. If mbrtowc is buggy in the C locale, define NEED_WPRINTF_DIRECTIVE_C. * modules/vasnwprintf (Files): Add m4/mbrtowc.m4. * tests/test-vasnwprintf-posix.c (test_function): Add tests of %s and %c in the C locale. * doc/posix-functions/fwprintf.texi: Mention the C locale behaviour bug. * doc/posix-functions/swprintf.texi: Likewise. * doc/posix-functions/vfwprintf.texi: Likewise. * doc/posix-functions/vswprintf.texi: Likewise. * doc/posix-functions/vwprintf.texi: Likewise. * doc/posix-functions/wprintf.texi: Likewise.
* vasnprintf-posix: Fix crash in narrow %lc directive (regr. 2023-03-21).Bruno Haible2023-04-011-6/+6
| | | | | | | | | | | * lib/vasnprintf.c (VASNPRINTF): Negative results of local_wcrtomb can now occur; handle them. * tests/test-vasnprintf-posix.c (test_function): Test %lc directive with a wint_t argument that is not a valid wide character. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnwprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise.
* stddef: Fix __need_wint_t handling in case of two stddef.h overrides.Bruno Haible2023-04-011-3/+3
| | | | | * lib/stddef.in.h: Replace _GL_STDDEF_WINT_T with a symbol that depends on the @GUARD_PREFIX@.
* vasnwprintf: Fix crash upon conversion failure when processing %s.Bruno Haible2023-03-311-3/+5
| | | | | * lib/vasnprintf.c (VASNPRINTF): When processing %s with !has_precision and !has_width, don't call abort() if there is a conversion failure.
* mbstowcs: New module.Bruno Haible2023-03-312-0/+63
| | | | | | | | | | | | | | | * lib/stdlib.in.h (mbstowcs): New declaration. * lib/mbstowcs.c: New file, based on lib/mbstoc32s.c. * m4/mbstowcs.m4: New file. * m4/stdlib_h.m4 (gl_STDLIB_H): Test whether mbstowcs is declared. (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize GNULIB_MBSTOWCS. (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_MBSTOWCS. * modules/stdlib (Makefile.am): Substitute GNULIB_MBSTOWCS, REPLACE_MBSTOWCS. * modules/mbstowcs: New file. * tests/test-stdlib-c++.cc (mbstowcs): Check signature. * doc/posix-functions/mbstowcs.texi: Mention the C locale behaviour bug and the new module.
* btowc: Fix behaviour in the C locale.Bruno Haible2023-03-301-0/+8
| | | | | | | | | | | | | | | | | | * lib/btowc.c: Include <string.h> (btowc): Use mbrtowc instead of mbtowc when possible. * m4/btowc.m4 (gl_FUNC_BTOWC): Test for the mingw bug in the C locale. Invoke gl_MBRTOWC_C_LOCALE. If mbrtowc is buggy in the C locale, override also btowc. (gl_PREREQ_BTOWC): Test whether mbrtowc exists. * modules/btowc (Files): Add m4/mbrtowc.m4. (Depends-on): Add mbrtowc. * tests/test-btowc.c (main): Add a test of the C locale, based on tests/test-mbrtowc.c. * tests/test-btowc3.sh: New file, based on tests/test-mbrtowc5.sh. * modules/btowc-tests (Files): Add it. (Makefile.am): Test it. * doc/posix-functions/btowc.texi: Mention the two C locale behaviour bugs and that they are worked around.
* string-desc-quotearg: New module.Bruno Haible2023-03-292-0/+240
| | | | | | * lib/string-desc-quotearg.h: New file. * lib/string-desc-quotearg.c: New file. * modules/string-desc-quotearg: New file.