aboutsummaryrefslogtreecommitdiffstats
path: root/lib/string.in.h
diff options
context:
space:
mode:
authorPaul Eggert2025-04-19 12:18:28 -0700
committerPaul Eggert2025-04-19 19:31:25 -0700
commit71ee484cac3e0e5b68f006b4cca81c13ca6ce11e (patch)
tree21476621d11357283ad30c8b2bcec2871e604ba1 /lib/string.in.h
parent30335bb73483fce9d4204f1e18618fe777d0f45e (diff)
downloademacs-71ee484cac3e0e5b68f006b4cca81c13ca6ce11e.tar.gz
emacs-71ee484cac3e0e5b68f006b4cca81c13ca6ce11e.zip
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'lib/string.in.h')
-rw-r--r--lib/string.in.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/lib/string.in.h b/lib/string.in.h
index ce488299006..44b9497d802 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -54,6 +54,11 @@
54/* NetBSD 5.0 mis-defines NULL. */ 54/* NetBSD 5.0 mis-defines NULL. */
55#include <stddef.h> 55#include <stddef.h>
56 56
57#if @GNULIB_STRERROR_L@
58/* Get locale_t. */
59# include <locale.h>
60#endif
61
57/* MirBSD defines mbslen as a macro. */ 62/* MirBSD defines mbslen as a macro. */
58#if @GNULIB_MBSLEN@ && defined __MirBSD__ 63#if @GNULIB_MBSLEN@ && defined __MirBSD__
59# include <wchar.h> 64# include <wchar.h>
@@ -429,7 +434,9 @@ _GL_FUNCDECL_SYS (memset_explicit, void *,
429# endif 434# endif
430_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); 435_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
431# endif 436# endif
437# if __GLIBC__ >= 2
432_GL_CXXALIASWARN (memset_explicit); 438_GL_CXXALIASWARN (memset_explicit);
439# endif
433#elif defined GNULIB_POSIXCHECK 440#elif defined GNULIB_POSIXCHECK
434# undef memset_explicit 441# undef memset_explicit
435# if HAVE_RAW_DECL_MEMSET_EXPLICIT 442# if HAVE_RAW_DECL_MEMSET_EXPLICIT
@@ -1178,6 +1185,33 @@ _GL_CXXALIASWARN (mbsrchr);
1178_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) 1185_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
1179 _GL_ATTRIBUTE_PURE 1186 _GL_ATTRIBUTE_PURE
1180 _GL_ARG_NONNULL ((1, 2)); 1187 _GL_ARG_NONNULL ((1, 2));
1188# ifndef _GL_NO_CONST_GENERICS
1189/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1190 compiler warnings for 'const' related mistakes. */
1191# ifdef __cplusplus
1192extern "C++" { /* needed for AIX */
1193template <typename T>
1194 T * mbsstr_template (T* haystack, const char *needle);
1195template <>
1196 inline char * mbsstr_template (char *haystack, const char *needle)
1197 { return mbsstr (haystack, needle); }
1198template <>
1199 inline const char * mbsstr_template (const char *haystack, const char *needle)
1200 { return mbsstr (haystack, needle); }
1201}
1202# undef mbsstr
1203# define mbsstr mbsstr_template
1204# elif !defined mbsstr
1205# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1206 || defined __ICC || defined __TINYC__ \
1207 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1208# define mbsstr(h,n) \
1209 _Generic ((h), \
1210 char const *: (char const *) mbsstr ((h), (n)), \
1211 default : mbsstr ((h), (n)))
1212# endif
1213# endif
1214# endif
1181#endif 1215#endif
1182 1216
1183#if @GNULIB_MBSCASECMP@ 1217#if @GNULIB_MBSCASECMP@
@@ -1219,6 +1253,33 @@ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
1219_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) 1253_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1220 _GL_ATTRIBUTE_PURE 1254 _GL_ATTRIBUTE_PURE
1221 _GL_ARG_NONNULL ((1, 2)); 1255 _GL_ARG_NONNULL ((1, 2));
1256# ifndef _GL_NO_CONST_GENERICS
1257/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1258 compiler warnings for 'const' related mistakes. */
1259# ifdef __cplusplus
1260extern "C++" { /* needed for AIX */
1261template <typename T>
1262 T * mbspcasecmp_template (T* string, const char *prefix);
1263template <>
1264 inline char * mbspcasecmp_template (char *string, const char *prefix)
1265 { return mbspcasecmp (string, prefix); }
1266template <>
1267 inline const char * mbspcasecmp_template (const char *string, const char *prefix)
1268 { return mbspcasecmp (string, prefix); }
1269}
1270# undef mbspcasecmp
1271# define mbspcasecmp mbspcasecmp_template
1272# elif !defined mbspcasecmp
1273# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1274 || defined __ICC || defined __TINYC__ \
1275 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1276# define mbspcasecmp(s,p) \
1277 _Generic ((s), \
1278 char const *: (char const *) mbspcasecmp ((s), (p)), \
1279 default : mbspcasecmp ((s), (p)))
1280# endif
1281# endif
1282# endif
1222#endif 1283#endif
1223 1284
1224#if @GNULIB_MBSCASESTR@ 1285#if @GNULIB_MBSCASESTR@
@@ -1230,6 +1291,33 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1230_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) 1291_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
1231 _GL_ATTRIBUTE_PURE 1292 _GL_ATTRIBUTE_PURE
1232 _GL_ARG_NONNULL ((1, 2)); 1293 _GL_ARG_NONNULL ((1, 2));
1294# ifndef _GL_NO_CONST_GENERICS
1295/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1296 compiler warnings for 'const' related mistakes. */
1297# ifdef __cplusplus
1298extern "C++" { /* needed for AIX */
1299template <typename T>
1300 T * mbscasestr_template (T* haystack, const char *needle);
1301template <>
1302 inline char * mbscasestr_template (char *haystack, const char *needle)
1303 { return mbscasestr (haystack, needle); }
1304template <>
1305 inline const char * mbscasestr_template (const char *haystack, const char *needle)
1306 { return mbscasestr (haystack, needle); }
1307}
1308# undef mbscasestr
1309# define mbscasestr mbscasestr_template
1310# elif !defined mbscasestr
1311# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1312 || defined __ICC || defined __TINYC__ \
1313 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1314# define mbscasestr(h,n) \
1315 _Generic ((h), \
1316 char const *: (char const *) mbscasestr ((h), (n)), \
1317 default : mbscasestr ((h), (n)))
1318# endif
1319# endif
1320# endif
1233#endif 1321#endif
1234 1322
1235#if @GNULIB_MBSCSPN@ 1323#if @GNULIB_MBSCSPN@
@@ -1388,6 +1476,44 @@ _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
1388# endif 1476# endif
1389#endif 1477#endif
1390 1478
1479/* Map any int, typically from errno, into an error message.
1480 With locale_t argument. */
1481#if @GNULIB_STRERROR_L@
1482# if @REPLACE_STRERROR_L@
1483# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1484# undef strerror_l
1485# define strerror_l rpl_strerror_l
1486# endif
1487_GL_FUNCDECL_RPL (strerror_l, char *, (int errnum, locale_t locale),
1488 _GL_ARG_NONNULL ((2)));
1489_GL_CXXALIAS_RPL (strerror_l, char *, (int errnum, locale_t locale));
1490# else
1491# if !@HAVE_STRERROR_L@
1492_GL_FUNCDECL_SYS (strerror_l, char *, (int errnum, locale_t locale),
1493 _GL_ARG_NONNULL ((2)));
1494# endif
1495_GL_CXXALIAS_SYS (strerror_l, char *, (int errnum, locale_t locale));
1496# endif
1497# if __GLIBC__ >= 2
1498_GL_CXXALIASWARN (strerror_l);
1499# endif
1500#elif defined GNULIB_POSIXCHECK
1501# undef strerror_l
1502# if HAVE_RAW_DECL_STRERROR_L
1503_GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
1504 "use gnulib module strerror_l for portability");
1505# endif
1506#endif
1507
1508/* Map any int, typically from errno, into an error message. Multithread-safe,
1509 with locale_t argument.
1510 Not portable! Only provided by gnulib. */
1511#if @GNULIB_STRERROR_L@
1512_GL_FUNCDECL_SYS (strerror_l_r, int,
1513 (int errnum, char *buf, size_t buflen, locale_t locale),
1514 _GL_ARG_NONNULL ((2, 4)));
1515#endif
1516
1391/* Return the name of the system error code ERRNUM. */ 1517/* Return the name of the system error code ERRNUM. */
1392#if @GNULIB_STRERRORNAME_NP@ 1518#if @GNULIB_STRERRORNAME_NP@
1393# if @REPLACE_STRERRORNAME_NP@ 1519# if @REPLACE_STRERRORNAME_NP@
@@ -1403,7 +1529,9 @@ _GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum), );
1403# endif 1529# endif
1404_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); 1530_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum));
1405# endif 1531# endif
1532# if __GLIBC__ >= 2
1406_GL_CXXALIASWARN (strerrorname_np); 1533_GL_CXXALIASWARN (strerrorname_np);
1534# endif
1407#elif defined GNULIB_POSIXCHECK 1535#elif defined GNULIB_POSIXCHECK
1408# undef strerrorname_np 1536# undef strerrorname_np
1409# if HAVE_RAW_DECL_STRERRORNAME_NP 1537# if HAVE_RAW_DECL_STRERRORNAME_NP