summaryrefslogtreecommitdiff
path: root/m4
Commit message (Collapse)AuthorAgeFilesLines
...
* snprintf-gnu: New module.Bruno Haible2023-03-242-18/+38
| | | | | | | | | | * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): New macro, extracted from gl_FUNC_SNPRINTF_POSIX. (gl_FUNC_SNPRINTF_POSIX): Require it. Invoke gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS. * m4/snprintf-gnu.m4: New file, based on m4/snprintf-posix.m4. * modules/snprintf-gnu: New file, based on modules/vasnprintf-gnu. * doc/posix-functions/snprintf.texi: Mention the new module.
* vsnprintf-gnu: New module.Bruno Haible2023-03-242-18/+38
| | | | | | | | | | * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): New macro, extracted from gl_FUNC_VSNPRINTF_POSIX. (gl_FUNC_VSNPRINTF_POSIX): Require it. Invoke gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS. * m4/vsnprintf-gnu.m4: New file, based on m4/vsnprintf-posix.m4. * modules/vsnprintf-gnu: New file, based on modules/vasnprintf-gnu. * doc/posix-functions/vsnprintf.texi: Mention the new module.
* vasnprintf-gnu: New module.Bruno Haible2023-03-244-97/+210
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suggested by Eric Blake in <https://lists.gnu.org/archive/html/bug-gnulib/2023-03/msg00060.html>. * lib/printf-parse.c (PRINTF_PARSE): Recognize the 'B' conversion. * lib/printf-parse.h: Update comments. * lib/wprintf-parse.h: Likewise. * lib/vasnprintf.c (MAX_ROOM_NEEDED): Treat the 'B' conversion like 'b'. (VASNPRINTF): Implement 'B' conversion if NEED_PRINTF_DIRECTIVE_UPPERCASE_B is set. Support the 'B' conversion if requested. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_B): When cross-compiling, guess yes on glibc >= 2.35. (gl_PRINTF_DIRECTIVE_UPPERCASE_B): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS): Renamed from gl_PREREQ_VASNPRINTF_WITH_EXTRAS. (gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B, gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS): New macros. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): New macro, extracted from gl_FUNC_VASNPRINTF_POSIX. (gl_FUNC_VASNPRINTF_POSIX): Require it. Invoke gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS. * m4/vasnprintf-gnu.m4: New file. * modules/vasnprintf-gnu: New file. * modules/c-vasnprintf (configure.ac): Update. * modules/unistdio/u8-vasnprintf (configure.ac): Likewise. * modules/unistdio/u8-u8-vasnprintf (configure.ac): Likewise. * modules/unistdio/u16-vasnprintf (configure.ac): Likewise. * modules/unistdio/u16-u16-vasnprintf (configure.ac): Likewise. * modules/unistdio/u32-vasnprintf (configure.ac): Likewise. * modules/unistdio/u32-u32-vasnprintf (configure.ac): Likewise. * modules/unistdio/ulc-vasnprintf (configure.ac): Likewise.
* vasnwprintf: Fix a warning: implicit declaration of function ‘wcsnlen’.Bruno Haible2023-03-221-1/+2
| | | | | | | * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Test also whether wcsnlen is declared. * lib/vasnprintf.c (local_wcsnlen): Together with HAVE_WCSNLEN, test also HAVE_DECL_WCSNLEN.
* vasnwprintf: Fix test failures on FreeBSD, NetBSD, AIX, mingw.Bruno Haible2023-03-222-45/+120
| | | | | | | | | | | | | * m4/printf.m4 (gl_SWPRINTF_WORKS): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke it and define HAVE_WORKING_SWPRINTF accordingly. * lib/vasnprintf.c: Together with HAVE_SWPRINTF, test also HAVE_WORKING_SWPRINTF. (VASNPRINTF): If WIDE_CHAR_VERSION && !DCHAR_IS_TCHAR, don't pass a wchar_t[] to snprintf. Add a workaround against mingw's snwprintf function. * doc/posix-functions/swprintf.texi: Document the null wide character bug.
* *printf-posix: Work around bug with %lc of 0 on many platforms.Bruno Haible2023-03-2113-189/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/vasnprintf.c (local_wctomb): Define also for NEED_PRINTF_DIRECTIVE_LC. (VASNPRINTF): Implement %lc handling ourselves if NEED_PRINTF_DIRECTIVE_LC. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_LC): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_LC): New macro. (gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it. * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Require gl_PRINTF_DIRECTIVE_LC and test its result. Invoke gl_PREREQ_VASNPRINTF_DIRECTIVE_LC. * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_POSIX): Likewise. * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX): Likewise. * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_POSIX): Likewise. * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_POSIX): Likewise. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_POSIX): Likewise. * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_POSIX): Likewise. * m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_POSIX): Likewise. * m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_POSIX): Likewise. * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_POSIX): Likewise. * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_POSIX): Likewise. * tests/test-snprintf-posix.h (test_function): Add more tests for the %c and %lc directives. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise. * doc/glibc-functions/asprintf.texi: Mention the %lc 0 bug. * doc/glibc-functions/obstack_printf.texi: Likewise. * doc/glibc-functions/obstack_vprintf.texi: Likewise. * doc/glibc-functions/vasprintf.texi: Likewise. * doc/posix-functions/dprintf.texi: Likewise. * doc/posix-functions/fprintf.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/snprintf.texi: Likewise. * doc/posix-functions/sprintf.texi: Likewise. * doc/posix-functions/vdprintf.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/vsnprintf.texi: Likewise. * doc/posix-functions/vsprintf.texi: Likewise.
* vasnwprintf: Port to older platforms without swprintf.Bruno Haible2023-03-201-2/+2
| | | | | | | | | | | * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Test for swprintf. * lib/vasnprintf.c (TCHAR_T, DCHAR_IS_TCHAR, SNPRINTF): When WIDE_CHAR_VERSION and swprintf does not exist, use TCHAR_T = char, SNPRINTF = snprintf, and !DCHAR_IS_TCHAR. (VASNPRINTF): In this case, implement %ls and %lc directly. Adjust a couple of #if conditions. For the conversion from TCHAR_T[] to DCHAR_T[], use mbsrtowcs. * modules/vasnwprintf (Depends-on): Add mbsrtowcs.
* vasnwprintf: Fix test failures on musl libc.Bruno Haible2023-03-201-1/+2
| | | | | | | | | | * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke gl_MUSL_LIBC. * lib/vasnprintf.c (VASNPRINTF): On musl libc, when WIDE_CHAR_VERSION, - force pad_ourselves to be 1, - don't use %n. Fix zero-padding when the result starts with a prefix "0x" or "0b". * modules/vasnwprintf (Files): Add musl.m4. * doc/posix-functions/swprintf.texi: Mention two musl libc bugs.
* *printf-posix: ISO C 23: Add %b directive for binary output of integers.Bruno Haible2023-03-1714-229/+358
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/printf-parse.c (PRINTF_PARSE): Recognize the 'b' directive. * lib/printf-parse.h: Update comment. * lib/wprintf-parse.h: Likewise. * lib/vasnprintf.c (MAX_ROOM_NEEDED, VASNPRINTF): Add support for the 'b' directive. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_B): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_B): New macro. (gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it. * m4/vasnwprintf-posix.m4 (gl_FUNC_VASNWPRINTF_POSIX): Invoke gl_PREREQ_VASNPRINTF_DIRECTIVE_B. * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Require gl_PRINTF_DIRECTIVE_B and test its result. Invoke gl_PREREQ_VASNPRINTF_DIRECTIVE_B. * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_POSIX): Likewise. * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX): Likewise. * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_POSIX): Likewise. * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_POSIX): Likewise. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_POSIX): Likewise. * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_POSIX): Likewise. * m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_POSIX): Likewise. * m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_POSIX): Likewise. * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_POSIX): Likewise. * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_POSIX): Likewise. * tests/test-snprintf-posix.h (test_function): Add some tests of the %b directive. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnprintf-posix.c (test_function): Likewise. * tests/test-vasnwprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise. * doc/glibc-functions/asprintf.texi: Mention the 'b' directive. * doc/glibc-functions/obstack_printf.texi: Likewise. * doc/glibc-functions/obstack_vprintf.texi: Likewise. * doc/glibc-functions/vasprintf.texi: Likewise. * doc/posix-functions/dprintf.texi: Likewise. * doc/posix-functions/fprintf.texi: Likewise. * doc/posix-functions/fwprintf.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/snprintf.texi: Likewise. * doc/posix-functions/sprintf.texi: Likewise. * doc/posix-functions/swprintf.texi: Likewise. * doc/posix-functions/vdprintf.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vfwprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/vsnprintf.texi: Likewise. * doc/posix-functions/vsprintf.texi: Likewise. * doc/posix-functions/vswprintf.texi: Likewise. * doc/posix-functions/vwprintf.texi: Likewise. * doc/posix-functions/wprintf.texi: Likewise.
* time: Fix test failure on AIX 7.2.Bruno Haible2023-03-171-1/+3
| | | | | * m4/time.m4 (gl_FUNC_TIME): Guess that it does not work on AIX. * doc/posix-functions/time.texi: Mention the bug on AIX.
* time: Fix test failure on native Windows.Bruno Haible2023-03-171-4/+7
| | | | | | | * m4/time.m4 (gl_FUNC_TIME): Guess that it does not work on native Windows. * modules/time (Depends-on): Add gettimeofday. * doc/posix-functions/time.texi: Mention the bug on Windows.
* vasnwprintf-posix: New module.Bruno Haible2023-03-171-0/+21
| | | | | | * m4/vasnwprintf-posix.m4: New file. * modules/vasnwprintf-posix: New file, based on modules/vasnprintf-posix.
* vasnwprintf: New module.Bruno Haible2023-03-171-9/+35
| | | | | | | | | | | | | | | | | | | * lib/vasnprintf.c: Enable more code for WIDE_CHAR_VERSION, because snwprintf()/_snwprintf() (Windows) and swprintf() (Unix) don't return the needed buffer size, like snprintf does. * lib/wprintf-parse.h: New file, based on lib/printf-parse.h and gettext/gettext-runtime/intl/wprintf-parse.h. * lib/wprintf-parse.c: New file, based on gettext/gettext-runtime/intl/printf.c. * lib/vasnwprintf.h: New file, based on lib/vasnprintf.h and gettext/gettext-runtime/intl/vasnwprintf.h. * lib/vasnwprintf.c: New file. * lib/asnwprintf.c: New file, based on lib/asnprintf.c. * m4/vasnprintf.m4 (gl_FUNC_VASNWPRINTF): New macro. (gl_PREREQ_VASNXPRINTF): New macro, extracted from gl_PREREQ_VASNPRINTF. (gl_PREREQ_VASNPRINTF): Invoke it. Don't test for wcsnlen and mbrtowc. (gl_PREREQ_VASNWPRINTF): New macro. * modules/vasnwprintf: New file, based on modules/vasnprintf.
* strtol, strtoll, strtoul, strtoull: Make ISO C 23 compliant.Bruno Haible2023-03-164-16/+60
| | | | | | | | | | | | | | | | | | | | * lib/strtol.c (INTERNAL (strtol)): Treat 'b' and base 2 like 'x' and base 16. Based on glibc commit 64924422a99690d147a166b4de3103f3bf3eaf6c by Joseph Myers. * m4/strtol.m4 (gl_FUNC_STRTOL): Test also whether parsing binary integers works. Update cross-compilation guesses. * m4/strtoll.m4 (gl_FUNC_STRTOLL): Likewise. * m4/strtoul.m4 (gl_FUNC_STRTOUL): Likewise. * m4/strtoull.m4 (gl_FUNC_STRTOULL): Likewise. * tests/test-strtol.c (main): Add tests of parsing binary integers. * tests/test-strtoll.c (main): Likewise. * tests/test-strtoul.c (main): Likewise. * tests/test-strtoull.c (main): Likewise. * doc/posix-functions/strtol.texi: Mention the problem with parsing binary integers. * doc/posix-functions/strtoll.texi: Likewise. * doc/posix-functions/strtoul.texi: Likewise. * doc/posix-functions/strtoull.texi: Likewise.
* stddef: Define 'unreachable', for ISO C 23 compliance.Bruno Haible2023-03-161-1/+16
| | | | | | | | | | | | * lib/verify.h (_GL_HAS_BUILTIN_UNREACHABLE): Don't define if already defined. * lib/stddef.in.h (_GL_HAS_BUILTIN_UNREACHABLE, unreachable): New macros. (abort): Declare if needed for unreachable. * m4/stddef_h.m4 (gl_STDDEF_H): Test for unreachable. * tests/test-stddef.c (test_unreachable_optimization, test_unreachable_noreturn): New functions, based on tests/test-verify.c. * doc/posix-headers/stddef.texi: Mention unreachable.
* time: New module.Bruno Haible2023-03-082-1/+46
| | | | | | | | | | | | | | * lib/time.in.h (time): New declaration. * lib/time.c: New file. * m4/time_h.m4 (gl_TIME_H_REQUIRE_DEFAULTS): Initialize GNULIB_TIME. (gl_TIME_H_DEFAULTS): Initialize REPLACE_TIME. * m4/time.m4: New file. * modules/time-h (Makefile.am): Substitute GNULIB_TIME, REPLACE_TIME. * modules/time: New file. * tests/test-time-h-c++.cc: Check the signature of GNULIB_NAMESPACE::time. * doc/posix-functions/time.texi: Mention the glibc problem and the 'time' module.
* lseek: avoid SEEK_HOLE bugs in FreeBSD, macOSPaul Eggert2023-02-231-6/+26
| | | | | | | | | | | | | This attempts to fix <https://bugs.gnu.org/61386>, a bug in GNU cp caused by a serious data corruption bug in FreeBSD and macOS. * doc/posix-functions/lseek.texi: Mention the bug. * lib/unistd.in.h (SEEK_DATA, SEEK_HOLE): Undef in macOS < 13 and FreeBSD < 14. FreeBSD fixed the bug sometime during FreeBSD 13 <https://bugs.freebsd.org/256205>, so the "FreeBSD < 14" is conservative. It’s unknown when Apple will fix macOS so use macOS "9999" as a placeholder. * m4/lseek.m4 (gl_FUNC_LSEEK): Replace lseek if on one of the above platforms.
* configmake: Add support for $build_os != $host_os.Bruno Haible2023-02-182-3/+217
| | | | | | | | | | | * m4/build-to-host.m4: New file. * m4/configmake.m4 (gl_CONFIGMAKE_PREP): Provide a configure-time definition for pkgdatadir, pkgincludedir, pkglibdir. (gl_CONFIGMAKE): New macro. * modules/configmake (Files): Add m4/build-to-host.m4. (configure.ac): Invoke gl_CONFIGMAKE instead of gl_CONFIGMAKE_PREP. (Makefile.am): For creating configmake.h, use the various *prefix_c_make and *dir_c_make variables.
* Improve cross-compilation for midipix.Bruno Haible2023-02-1720-19/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Ørjan Malde <red@foxi.me> at <https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00131.html>. This patch handles the cases where midipix acts like Linux. * m4/chmod.m4 (gl_FUNC_CHMOD): Treat midipix like Linux with glibc or musl libc. * m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Likewise. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Likewise. * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Likewise. * m4/link.m4 (gl_FUNC_LINK): Likewise. * m4/linkat.m4 (gl_FUNC_LINKAT): Likewise. * m4/lstat.m4 (gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): Likewise. * m4/mkdir.m4 (gl_FUNC_MKDIR): Likewise. * m4/pselect.m4 (gl_FUNC_PSELECT): Likewise. * m4/ptsname.m4 (gl_FUNC_PTSNAME): Likewise. * m4/readlink.m4 (gl_FUNC_READLINK): Likewise. * m4/rename.m4 (gl_FUNC_RENAME): Likewise. * m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise. * m4/select.m4 (gl_FUNC_SELECT): Likewise. * m4/sleep.m4 (gl_FUNC_SLEEP): Likewise. * m4/stat.m4 (gl_FUNC_STAT): Likewise. * m4/symlink.m4 (gl_FUNC_SYMLINK): Likewise. * m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Likewise. * m4/unlink.m4 (gl_FUNC_UNLINK): Likewise. * m4/usleep.m4 (gl_FUNC_USLEEP): Likewise.
* Improve cross-compilation from midipix.Bruno Haible2023-02-1770-655/+656
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Ørjan Malde <red@foxi.me> at <https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00131.html>. Since midipix consists of musl libc based on an emulation of Linux system calls, for pure libc functionality it can be treated like musl libc. * m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Treat midipix like systems with musl libc. * m4/cbrtl.m4 (gl_FUNC_CBRTL): Likewise. * m4/ceil.m4 (gl_FUNC_CEIL): Likewise. * m4/ceilf.m4 (gl_FUNC_CEILF): Likewise. * m4/ceill.m4 (gl_FUNC_CEILL): Likewise. * m4/exp2l.m4 (gl_FUNC_EXP2L): Likewise. * m4/expl.m4 (gl_FUNC_EXPL): Likewise. * m4/expm1.m4 (gl_FUNC_EXPM1): Likewise. * m4/expm1f.m4 (gl_FUNC_EXPM1F): Likewise. * m4/expm1l.m4 (gl_FUNC_EXPM1L): Likewise. * m4/fclose.m4 (gl_FUNC_FCLOSE_STDIN): Likewise. * m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Likewise. * m4/ffsll.m4 (gl_FUNC_FFSLL): Likewise. * m4/floor.m4 (gl_FUNC_FLOOR): Likewise. * m4/floorf.m4 (gl_FUNC_FLOORF): Likewise. * m4/fmod.m4 (gl_FUNC_FMOD): Likewise. * m4/fmodf.m4 (gl_FUNC_FMODF): Likewise. * m4/fmodl.m4 (gl_FUNC_FMODL): Likewise. * m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Likewise. * m4/fopen.m4 (gl_FUNC_FOPEN_GNU): Likewise. * m4/fpurge.m4 (gl_FUNC_FPURGE): Likewise. * m4/getdelim.m4 (gl_FUNC_GETDELIM): Likewise. * m4/getline.m4 (gl_FUNC_GETLINE): Likewise. * m4/hypot.m4 (gl_FUNC_HYPOT): Likewise. * m4/hypotf.m4 (gl_FUNC_HYPOTF): Likewise. * m4/hypotl.m4 (gl_FUNC_HYPOTL): Likewise. * m4/iconv_open-utf.m4 (gl_FUNC_ICONV_OPEN_UTF_SUPPORT): Likewise. * m4/log.m4 (gl_FUNC_LOG): Likewise. * m4/log10.m4 (gl_FUNC_LOG10): Likewise. * m4/log10f.m4 (gl_FUNC_LOG10F): Likewise. * m4/log10l.m4 (gl_FUNC_LOG10L_WORKS): Likewise. * m4/log1p.m4 (gl_FUNC_LOG1P): Likewise. * m4/log1pf.m4 (gl_FUNC_LOG1PF): Likewise. * m4/log1pl.m4 (gl_FUNC_LOG1PL, gl_FUNC_LOG1PL_WORKS): Likewise. * m4/log2.m4 (gl_FUNC_LOG2): Likewise. * m4/log2f.m4 (gl_FUNC_LOG2F): Likewise. * m4/log2l.m4 (gl_FUNC_LOG2L_WORKS): Likewise. * m4/logf.m4 (gl_FUNC_LOGF): Likewise. * m4/logl.m4 (gl_FUNC_LOGL_WORKS): Likewise. * m4/malloc.m4 (_AC_FUNC_MALLOC_IF): Likewise. * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Likewise. * m4/modf.m4 (gl_FUNC_MODF): Likewise. * m4/modff.m4 (gl_FUNC_MODFF): Likewise. * m4/modfl.m4 (gl_FUNC_MODFL): Likewise. * m4/musl.m4 (gl_MUSL_LIBC): Likewise. * m4/perror.m4 (gl_FUNC_PERROR): Likewise. * m4/posix_spawn.m4 (gl_POSIX_SPAWN_SECURE, gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE, gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2, gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN): Likewise. * m4/printf.m4 (gl_PRINTF_SIZES_C99, gl_PRINTF_INFINITE, gl_PRINTF_INFINITE_LONG_DOUBLE, gl_PRINTF_DIRECTIVE_A, gl_PRINTF_DIRECTIVE_F, gl_PRINTF_FLAG_ZERO, gl_SNPRINTF_TRUNCATION_C99, gl_SNPRINTF_RETVAL_C99, gl_SNPRINTF_DIRECTIVE_N, gl_VSNPRINTF_ZEROSIZE_C99): Likewise. * m4/pthread_rwlock_rdlock.m4 (gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER): Likewise. * m4/putenv.m4 (gl_FUNC_PUTENV): Likewise. * m4/realloc.m4 (_AC_FUNC_REALLOC_IF): Likewise. * m4/remainder.m4 (gl_FUNC_REMAINDER): Likewise. * m4/remainderf.m4 (gl_FUNC_REMAINDERF): Likewise. * m4/remainderl.m4 (gl_FUNC_REMAINDERL, gl_FUNC_REMAINDERL_WORKS): Likewise. * m4/rintl.m4 (gl_FUNC_RINTL): Likewise. * m4/round.m4 (gl_FUNC_ROUND): Likewise. * m4/roundf.m4 (gl_FUNC_ROUNDF): Likewise. * m4/roundl.m4 (gl_FUNC_ROUNDL): Likewise. * m4/setenv.m4 (gl_FUNC_SETENV): Likewise. * m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Likewise. * m4/signbit.m4 (gl_SIGNBIT): Likewise. * m4/stpncpy.m4 (gl_FUNC_STPNCPY): Likewise. * m4/strerror.m4 (gl_FUNC_STRERROR, gl_FUNC_STRERROR_0): Likewise. * m4/strtod.m4 (gl_FUNC_STRTOD): Likewise. * m4/strtold.m4 (gl_FUNC_STRTOLD): Likewise. * m4/trunc.m4 (gl_FUNC_TRUNC): Likewise. * m4/truncf.m4 (gl_FUNC_TRUNCF): Likewise. * m4/truncl.m4 (gl_FUNC_TRUNCL): Likewise. * m4/ungetc.m4 (gl_FUNC_UNGETC_WORKS): Likewise. * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Likewise.
* terminfo, termcap: Avoid wrong configure result with clang ≥ 15.Bruno Haible2023-02-122-6/+6
| | | | | | | | | | | clang 15 reports an error for -Wint-conversion by default. Reported by Sam James <sam@gentoo.org> in <https://savannah.gnu.org/bugs/?63793>. * m4/terminfo.m4 (gl_TERMINFO_BODY): Avoid a -Wint-conversion warning when testing for tparam and tparm. * m4/termcap.m4 (gl_TERMCAP_BODY): Likewise.
* error-h: Make less fragile.Bruno Haible2023-02-111-1/+9
| | | | | | | | | * lib/error.in.h: Use #include_next if the system has an <error.h>. Use a split double-inclusion guard. * m4/error_h.m4 (gl_ERROR_H): Invoke gl_CHECK_NEXT_HEADERS. Set HAVE_ERROR_H. * modules/error-h (Makefile.am): Substitute GUARD_PREFIX, HAVE_ERROR_H, INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, NEXT_ERROR_H.
* Fix code duplication in last commit.Bruno Haible2023-02-101-158/+117
| | | | | | | | | | * m4/gnulib-common.m4 (gl_CHECK_FUNCS_DEFAULT_CASE, gl_CHECK_FUNCS_CASE_FOR_ANDROID, gl_CHECK_FUNCS_CASE_FOR_MACOS, gl_CHECK_FUNCS_SET_RESULTS): New macros, extracted from gl_CHECK_FUNCS_ANDROID, gl_CHECK_FUNCS_MACOS, gl_CHECK_FUNCS_ANDROID_MACOS. (gl_CHECK_FUNCS_ANDROID, gl_CHECK_FUNCS_MACOS, gl_CHECK_FUNCS_ANDROID_MACOS): Use them.
* mkfifoat: Fix crash on macOS 12.Bruno Haible2023-02-102-4/+200
| | | | | | | * m4/gnulib-common.m4 (gl_PREPARE_CHECK_FUNCS_MACOS, gl_CHECK_FUNCS_MACOS, gl_CHECK_FUNCS_ANDROID_MACOS): New macros. * m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Test for mknodat and mkfifoat using gl_CHECK_FUNCS_ANDROID_MACOS instead of gl_CHECK_FUNCS_ANDROID.
* nullptr: work around Apple clang 14 issuePaul Eggert2023-02-091-10/+20
| | | | | | | | | Problem reported by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2023-02/msg00098.html * doc/gnulib.texi (nullptr): Document limitations better. * m4/nullptr.m4 (gl_NULLPTR): Check for incompatibility of macOS clang 14.0.0 (clang-1400.0.29.202), where <stddef.h> defines a non-working nullptr macro.
* Fix compilation errors in C++ mode on macOS 12.5.Bruno Haible2023-02-091-2/+2
| | | | | | * m4/gnulib-common.m4 (gl_COMMON_BODY): Don't define _GL_ATTRIBUTE_MAYBE_UNUSED to [[__maybe_unused__]] if the compiler is an Apple variant of clang.
* limits-h: Work around a clang 15 bug.Bruno Haible2023-02-091-0/+1
| | | | | * m4/limits-h.m4 (gl_LIMITS_H): Test also for BOOL_MAX. * doc/posix-headers/limits.texi: Mention the clang bug.
* assert-h: Fix test failure on IRIX 6.5.Bruno Haible2023-02-081-4/+10
| | | | | * m4/assert_h.m4 (gl_ASSERT_H): Ensure that on IRIX, including <assert.h> after <config.h> actually defines the assert macro.
* nullptr: test for compilers at autoconf-timePaul Eggert2023-02-071-9/+19
| | | | | | | * m4/nullptr.m4 (gl_NULLPTR): Test for C and C++ compiler usage at autoconf-time. This should work better than testing at configure-time. Also, push and pop languages so we check the proper compiler.
* nullptr: test for C++ nullptr at configure-timePaul Eggert2023-02-071-24/+24
| | | | | | * m4/nullptr.m4 (gl_NULLPTR): Test for C++ support for nullptr at configure-time, as we already do for C support. This should be more reliable than maintaining #ifdefs by hand.
* nullptr: rename from c-nullptrPaul Eggert2023-02-071-1/+1
| | | | | | | | | | * NEWS, doc/gnulib.texi: Mention this. * m4/nullptr.m4: Rename from m4/c-nullptr.m4. (gl_NULLPTR): Rename from gl_C_NULLPTR. * modules/nullptr: Rename from modules/nullptr. * modules/nullptr-c++-tests: Rename from modules/c-nullptr-c++-tests. * modules/nullptr-tests: Rename from modules/c-nullptr-tests. All uses changed.
* setlocale-null: Don't use a lock in Cygwin >= 3.4.6.Bruno Haible2023-02-061-3/+17
| | | | | | | | | Road paved by Corinna Vinschen <vinschen@redhat.com>. * m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Assume that setlocale (LC_ALL, NULL) is multithread-safe in Cygwin >= 3.4.6. * lib/setlocale_null.c: Update comments. * tests/test-setlocale_null-mt-all.c: Likewise.
* c-nullptr: Fix conflict with libstdc++ in GCC >= 11.Bruno Haible2023-02-061-6/+18
| | | | | | | | | Reported by Bjarni Ingi Gislason <bjarniig@simnet.is> in <https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00030.html>. * m4/c-nullptr.m4 (gl_C_NULLPTR): Don't define nullptr if it is already defined. In C++ mode, ignore the result of the configure test and don't define it when we know that the C++ compiler already supports it.
* c-nullptr: new modulePaul Eggert2023-02-051-0/+30
| | | | | | * doc/gnulib.texi (nullptr): New section. * doc/posix-headers/stddef.texi: Document lack of nullptr_t. * m4/c-nullptr.m4, modules/c-nullptr: New files.
* Clarify _GL_ATTRIBUTE_NODISCARD code.Bruno Haible2023-01-281-1/+4
| | | | | | | Reported by Paul Eggert. * m4/gnulib-common.m4 (gl_COMMON_BODY): Add comment regarding _GL_ATTRIBUTE_NODISCARD definition.
* Avoid clang warnings regarding [[__nodiscard__]].Bruno Haible2023-01-281-2/+8
| | | | | | * m4/gnulib-common.m4 (gl_COMMON_BODY): For clang, in C++ mode, ignore the __has_c_attribute value and define _GL_ATTRIBUTE_NODISCARD to __attribute__ ((__warn_unused_result__)), not [[__nodiscard__]].
* Avoid clang warnings regarding [[__maybe_unused__]].Bruno Haible2023-01-281-3/+9
| | | | | | | * m4/gnulib-common.m4 (gl_COMMON_BODY): For clang versions ≥ 6, < 10, in C++ mode, ignore the __has_c_attribute value and define _GL_ATTRIBUTE_MAYBE_UNUSED to __attribute__ ((__unused__)), not [[__maybe_unused__]].
* alignasof: Ensure a correct _Alignof (regression 2023-01-15).Bruno Haible2023-01-281-25/+30
| | | | | * m4/stdalign.m4 (gl_ALIGNASOF): Apply the workaround for wrong _Alignof in GCC < 4.9 and clang < 8.0.0 also when the system has <stdalign.h>.
* stdalign: Ensure alignof is defined on FreeBSD (regression 2023-01-15).Bruno Haible2023-01-281-5/+13
| | | | | | | | | * lib/stdalign.in.h: Include the system's <stdalign.h> when it exists. * m4/stdalign.m4 (gl_ALIGNASOF): Invoke gl_CHECK_NEXT_HEADERS. Set HAVE_STDALIGN_H. * modules/stdalign (Makefile.am): Substitute GUARD_PREFIX, HAVE_STDALIGN_H, INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, PRAGMA_COLUMNS, NEXT_STDALIGN_H.
* stddef: Fix test-stddef compilation error on FreeBSD 12/x86.Bruno Haible2023-01-271-2/+9
| | | | | * m4/stddef_h.m4 (gl_STDDEF_H): When testing for good max_align_t, use an ISO C compliant definition of _Alignof.
* Keep config.h idempotent.Bruno Haible2023-01-251-129/+181
| | | | | | | | | | | | | | | * m4/gnulib-common.m4 (gl_COMMON_BODY): Add double-inclusion guards to the definitions of the macros _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_ARTIFICIAL, _GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_CONST, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR, _GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE, _GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF, _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED, _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_NONSTRING, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_RETURNS_NONNULL, _GL_ATTRIBUTE_SENTINEL, _GL_ATTRIBUTE_UNUSED, _GL_UNUSED_LABEL.
* threadlib: Fix support for Solaris 9 and older.Nick Bowler2023-01-251-1/+3
| | | | | * m4/threadlib.m4 (gl_PTHREADLIB_BODY): Allow case patterns to survive m4 processing by using changequote.
* alignasof, stdalign: Fix a compilation error on FreeBSD 12.0.Bruno Haible2023-01-241-2/+6
| | | | | | * m4/stdalign.m4 (gl_ALIGNASOF): In C mode, prefer __builtin_offsetof over offsetof when possible, since __builtin_offsetof works also when <stddef.h> has not been fully included yet.
* Resolve conflicts for functions introduced in Android API level 29.Bruno Haible2023-01-221-1/+4
| | | | | | | * m4/reallocarray.m4 (gl_FUNC_REALLOCARRAY): Conditionally set REPLACE_REALLOCARRAY. * lib/stdlib.in.h (reallocarray): Disable _GL_CXXALIASWARN invocation on non-glibc systems.
* Resolve conflicts for functions introduced in Android API level 29.Bruno Haible2023-01-222-2/+7
| | | | | | | | | | | * lib/stdlib.in.h (getloadavg): Consider REPLACE_GETLOADAVG. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_GETLOADAVG. * modules/stdlib (Makefile.am): Substitute REPLACE_GETLOADAVG. * m4/getloadavg.m4 (gl_GETLOADAVG): Conditionally set REPLACE_GETLOADAVG. * modules/getloadavg (Depends-on, configure.ac): Consider REPLACE_GETLOADAVG.
* Resolve conflicts for functions introduced in Android API level 29.Bruno Haible2023-01-223-13/+30
| | | | | | | | | | | | | * lib/time.in.h (timespec_get): Consider REPLACE_TIMESPEC_GET. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/time_h.m4 (gl_TIME_H_DEFAULTS): Initialize REPLACE_TIMESPEC_GET. * modules/time (Makefile.am): Substitute REPLACE_TIMESPEC_GET. * m4/gettime.m4 (gl_CHECK_FUNC_TIMESPEC_GET): Set also gl_cv_onwards_func_timespec_get. * m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET): Conditionally set REPLACE_TIMESPEC_GET. * modules/timespec_get (Depends-on, configure.ac): Consider REPLACE_TIMESPEC_GET.
* Resolve conflicts for functions introduced in Android API level 28.Bruno Haible2023-01-222-2/+8
| | | | | | | * m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC): Conditionally set REPLACE_ALIGNED_ALLOC. * m4/getrandom.m4 (gl_FUNC_GETRANDOM): Conditionally set REPLACE_GETRANDOM.
* Resolve conflicts for functions introduced in Android API level 28.Bruno Haible2023-01-221-1/+4
| | | | | | | * m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Conditionally set REPLACE_GETLOGIN_R. * lib/unistd.in.h (getlogin_r): Disable _GL_CXXALIASWARN invocation on non-glibc systems.
* Resolve conflicts for functions introduced in Android API level 28.Bruno Haible2023-01-221-1/+4
| | | | | | | | | | | | | | | * m4/spawn_h.m4 (gl_HAVE_POSIX_SPAWN): Conditionally set REPLACE_POSIX_SPAWN. * lib/spawn.in.h: Adapt logic for defining the POSIX_SPAWN_* constants. (posix_spawn, posix_spawnp, posix_spawnattr_init, posix_spawnattr_destroy, posix_spawnattr_getsigdefault, posix_spawnattr_setsigdefault, posix_spawnattr_getsigmask, posix_spawnattr_setsigmask, posix_spawnattr_getflags, posix_spawnattr_setflags, posix_spawnattr_getpgroup, posix_spawnattr_setpgroup, posix_spawn_file_actions_init, posix_spawn_file_actions_destroy, posix_spawn_file_actions_addchdir, posix_spawn_file_actions_addfchdir): Disable _GL_CXXALIASWARN invocation on non-glibc systems.
* Resolve conflicts for functions introduced in Android API level 28.Bruno Haible2023-01-221-1/+4
| | | | | | * m4/glob.m4 (gl_GLOB): Conditionally set REPLACE_GLOB. * lib/glob.in.h (glob): Disable _GL_CXXALIASWARN invocation on non-glibc systems.