aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib.in.h
diff options
context:
space:
mode:
authorPaul Eggert2023-05-14 18:51:22 -0700
committerPaul Eggert2023-05-14 19:28:09 -0700
commitb77d357ea356134fbc159797b34498b7a0006dc9 (patch)
tree1a1d03db84c1b2aac7f6e8dafcdc3e952192c854 /lib/stdlib.in.h
parente7dc30c1d58c602ccc4b7b9c98c0ea07f5631675 (diff)
downloademacs-b77d357ea356134fbc159797b34498b7a0006dc9.tar.gz
emacs-b77d357ea356134fbc159797b34498b7a0006dc9.zip
Update from Gnulib by running admin/merge-gnulib
* lib/dirent-private.h, m4/codeset.m4, m4/locale-fr.m4, m4/musl.m4: New files, from Gnulib.
Diffstat (limited to '')
-rw-r--r--lib/stdlib.in.h63
1 files changed, 58 insertions, 5 deletions
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index a91f4e23d67..1479a2b2871 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -37,6 +37,12 @@
37#ifndef _@GUARD_PREFIX@_STDLIB_H 37#ifndef _@GUARD_PREFIX@_STDLIB_H
38#define _@GUARD_PREFIX@_STDLIB_H 38#define _@GUARD_PREFIX@_STDLIB_H
39 39
40/* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
41 _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
42#if !_GL_CONFIG_H_INCLUDED
43 #error "Please include config.h first."
44#endif
45
40/* NetBSD 5.0 mis-defines NULL. */ 46/* NetBSD 5.0 mis-defines NULL. */
41#include <stddef.h> 47#include <stddef.h>
42 48
@@ -67,9 +73,7 @@
67# include <random.h> 73# include <random.h>
68# endif 74# endif
69 75
70# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@ 76# include <stdint.h>
71# include <stdint.h>
72# endif
73 77
74# if !@HAVE_STRUCT_RANDOM_DATA@ 78# if !@HAVE_STRUCT_RANDOM_DATA@
75/* Define 'struct random_data'. 79/* Define 'struct random_data'.
@@ -461,7 +465,7 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
461# undef getprogname 465# undef getprogname
462# define getprogname rpl_getprogname 466# define getprogname rpl_getprogname
463# endif 467# endif
464# ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME 468# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
465_GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); 469_GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
466# else 470# else
467_GL_FUNCDECL_RPL (getprogname, const char *, (void)); 471_GL_FUNCDECL_RPL (getprogname, const char *, (void));
@@ -469,7 +473,7 @@ _GL_FUNCDECL_RPL (getprogname, const char *, (void));
469_GL_CXXALIAS_RPL (getprogname, const char *, (void)); 473_GL_CXXALIAS_RPL (getprogname, const char *, (void));
470# else 474# else
471# if !@HAVE_GETPROGNAME@ 475# if !@HAVE_GETPROGNAME@
472# ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME 476# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
473_GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); 477_GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
474# else 478# else
475_GL_FUNCDECL_SYS (getprogname, const char *, (void)); 479_GL_FUNCDECL_SYS (getprogname, const char *, (void));
@@ -589,6 +593,51 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
589# endif 593# endif
590#endif 594#endif
591 595
596/* Return maximum number of bytes of a multibyte character. */
597#if @REPLACE_MB_CUR_MAX@
598# if !GNULIB_defined_MB_CUR_MAX
599static inline
600int gl_MB_CUR_MAX (void)
601{
602 /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */
603 return MB_CUR_MAX + (MB_CUR_MAX == 3);
604}
605# undef MB_CUR_MAX
606# define MB_CUR_MAX gl_MB_CUR_MAX ()
607# define GNULIB_defined_MB_CUR_MAX 1
608# endif
609#endif
610
611/* Convert a string to a wide string. */
612#if @GNULIB_MBSTOWCS@
613# if @REPLACE_MBSTOWCS@
614# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
615# undef mbstowcs
616# define mbstowcs rpl_mbstowcs
617# endif
618_GL_FUNCDECL_RPL (mbstowcs, size_t,
619 (wchar_t *restrict dest, const char *restrict src,
620 size_t len)
621 _GL_ARG_NONNULL ((2)));
622_GL_CXXALIAS_RPL (mbstowcs, size_t,
623 (wchar_t *restrict dest, const char *restrict src,
624 size_t len));
625# else
626_GL_CXXALIAS_SYS (mbstowcs, size_t,
627 (wchar_t *restrict dest, const char *restrict src,
628 size_t len));
629# endif
630# if __GLIBC__ >= 2
631_GL_CXXALIASWARN (mbstowcs);
632# endif
633#elif defined GNULIB_POSIXCHECK
634# undef mbstowcs
635# if HAVE_RAW_DECL_MBSTOWCS
636_GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - "
637 "use gnulib module mbstowcs for portability");
638# endif
639#endif
640
592/* Convert a multibyte character to a wide character. */ 641/* Convert a multibyte character to a wide character. */
593#if @GNULIB_MBTOWC@ 642#if @GNULIB_MBTOWC@
594# if @REPLACE_MBTOWC@ 643# if @REPLACE_MBTOWC@
@@ -1009,7 +1058,9 @@ _GL_FUNCDECL_SYS (random, long, (void));
1009 int. */ 1058 int. */
1010_GL_CXXALIAS_SYS_CAST (random, long, (void)); 1059_GL_CXXALIAS_SYS_CAST (random, long, (void));
1011# endif 1060# endif
1061# if __GLIBC__ >= 2
1012_GL_CXXALIASWARN (random); 1062_GL_CXXALIASWARN (random);
1063# endif
1013#elif defined GNULIB_POSIXCHECK 1064#elif defined GNULIB_POSIXCHECK
1014# undef random 1065# undef random
1015# if HAVE_RAW_DECL_RANDOM 1066# if HAVE_RAW_DECL_RANDOM
@@ -1034,7 +1085,9 @@ _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
1034 unsigned long seed. */ 1085 unsigned long seed. */
1035_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); 1086_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
1036# endif 1087# endif
1088# if __GLIBC__ >= 2
1037_GL_CXXALIASWARN (srandom); 1089_GL_CXXALIASWARN (srandom);
1090# endif
1038#elif defined GNULIB_POSIXCHECK 1091#elif defined GNULIB_POSIXCHECK
1039# undef srandom 1092# undef srandom
1040# if HAVE_RAW_DECL_SRANDOM 1093# if HAVE_RAW_DECL_SRANDOM