diff options
| author | Paul Eggert | 2024-12-17 14:02:41 -0800 |
|---|---|---|
| committer | Paul Eggert | 2024-12-17 14:13:54 -0800 |
| commit | b1e5f6d6ef8432a9cce0664238de72d387730bd1 (patch) | |
| tree | 7eb50047793367bf8f2483e28fb716cfc4334c13 /lib/stdlib.in.h | |
| parent | 22806c65f4f8d68547d33997d017039763b4bf6a (diff) | |
| download | emacs-b1e5f6d6ef8432a9cce0664238de72d387730bd1.tar.gz emacs-b1e5f6d6ef8432a9cce0664238de72d387730bd1.zip | |
Update from Gnulib by running admin/merge-gnulib
* admin/merge-gnulib (AVOIDED_MODULES): Avoid gnulib-i18n.
* lib/stdlib.c, m4/selinux-selinux-h.m4:
New files, taken from Gnulib.
Diffstat (limited to 'lib/stdlib.in.h')
| -rw-r--r-- | lib/stdlib.in.h | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 6667f426ad9..adbef69131b 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h | |||
| @@ -54,7 +54,7 @@ | |||
| 54 | 54 | ||
| 55 | /* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, | 55 | /* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, |
| 56 | _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, | 56 | _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, |
| 57 | GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | 57 | _GL_INLINE_HEADER_BEGIN, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ |
| 58 | #if !_GL_CONFIG_H_INCLUDED | 58 | #if !_GL_CONFIG_H_INCLUDED |
| 59 | #error "Please include config.h first." | 59 | #error "Please include config.h first." |
| 60 | #endif | 60 | #endif |
| @@ -130,6 +130,14 @@ struct random_data | |||
| 130 | # include <string> | 130 | # include <string> |
| 131 | #endif | 131 | #endif |
| 132 | 132 | ||
| 133 | _GL_INLINE_HEADER_BEGIN | ||
| 134 | #ifndef _GL_STDLIB_INLINE | ||
| 135 | # define _GL_STDLIB_INLINE _GL_INLINE | ||
| 136 | #endif | ||
| 137 | #ifndef _GL_REALLOC_INLINE | ||
| 138 | # define _GL_REALLOC_INLINE _GL_INLINE | ||
| 139 | #endif | ||
| 140 | |||
| 133 | /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers | 141 | /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers |
| 134 | that can be freed by passing them as the Ith argument to the | 142 | that can be freed by passing them as the Ith argument to the |
| 135 | function F. */ | 143 | function F. */ |
| @@ -283,8 +291,8 @@ _GL_CXXALIASWARN (free); | |||
| 283 | #elif defined GNULIB_POSIXCHECK | 291 | #elif defined GNULIB_POSIXCHECK |
| 284 | # undef free | 292 | # undef free |
| 285 | /* Assume free is always declared. */ | 293 | /* Assume free is always declared. */ |
| 286 | _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " | 294 | _GL_WARN_ON_USE (free, "free is not POSIX:2024 compliant everywhere - " |
| 287 | "use gnulib module free for portability"); | 295 | "use gnulib module free-posix for portability"); |
| 288 | #endif | 296 | #endif |
| 289 | 297 | ||
| 290 | 298 | ||
| @@ -367,9 +375,10 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - " | |||
| 367 | #endif | 375 | #endif |
| 368 | 376 | ||
| 369 | #if @GNULIB_CALLOC_POSIX@ | 377 | #if @GNULIB_CALLOC_POSIX@ |
| 370 | # if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \ | 378 | # if @REPLACE_CALLOC_FOR_CALLOC_POSIX@ \ |
| 371 | || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@) | 379 | || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@) |
| 372 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 380 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ |
| 381 | || _GL_USE_STDLIB_ALLOC) | ||
| 373 | # undef calloc | 382 | # undef calloc |
| 374 | # define calloc rpl_calloc | 383 | # define calloc rpl_calloc |
| 375 | # endif | 384 | # endif |
| @@ -681,7 +690,7 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " | |||
| 681 | by never specifying a zero size), so it does not need malloc or | 690 | by never specifying a zero size), so it does not need malloc or |
| 682 | realloc to be redefined. */ | 691 | realloc to be redefined. */ |
| 683 | #if @GNULIB_MALLOC_POSIX@ | 692 | #if @GNULIB_MALLOC_POSIX@ |
| 684 | # if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \ | 693 | # if @REPLACE_MALLOC_FOR_MALLOC_POSIX@ \ |
| 685 | || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@) | 694 | || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@) |
| 686 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ | 695 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ |
| 687 | || _GL_USE_STDLIB_ALLOC) | 696 | || _GL_USE_STDLIB_ALLOC) |
| @@ -740,11 +749,12 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " | |||
| 740 | /* Return maximum number of bytes of a multibyte character. */ | 749 | /* Return maximum number of bytes of a multibyte character. */ |
| 741 | #if @REPLACE_MB_CUR_MAX@ | 750 | #if @REPLACE_MB_CUR_MAX@ |
| 742 | # if !GNULIB_defined_MB_CUR_MAX | 751 | # if !GNULIB_defined_MB_CUR_MAX |
| 743 | static inline | 752 | _GL_STDLIB_INLINE int |
| 744 | int gl_MB_CUR_MAX (void) | 753 | gl_MB_CUR_MAX (void) |
| 745 | { | 754 | { |
| 746 | /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */ | 755 | /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */ |
| 747 | return MB_CUR_MAX + (MB_CUR_MAX == 3); | 756 | int gl_mb_cur_max = MB_CUR_MAX; |
| 757 | return gl_mb_cur_max == 3 ? 4 : gl_mb_cur_max; | ||
| 748 | } | 758 | } |
| 749 | # undef MB_CUR_MAX | 759 | # undef MB_CUR_MAX |
| 750 | # define MB_CUR_MAX gl_MB_CUR_MAX () | 760 | # define MB_CUR_MAX gl_MB_CUR_MAX () |
| @@ -1454,16 +1464,25 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " | |||
| 1454 | 1464 | ||
| 1455 | 1465 | ||
| 1456 | #if @GNULIB_REALLOC_POSIX@ | 1466 | #if @GNULIB_REALLOC_POSIX@ |
| 1457 | # if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \ | 1467 | # if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ |
| 1458 | || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@) | 1468 | # if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2 |
| 1469 | # define _GL_INLINE_RPL_REALLOC 1 | ||
| 1470 | _GL_REALLOC_INLINE void * | ||
| 1471 | rpl_realloc (void *ptr, size_t size) | ||
| 1472 | { | ||
| 1473 | return realloc (ptr, size ? size : 1); | ||
| 1474 | } | ||
| 1475 | # endif | ||
| 1459 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ | 1476 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ |
| 1460 | || _GL_USE_STDLIB_ALLOC) | 1477 | || _GL_USE_STDLIB_ALLOC) |
| 1461 | # undef realloc | 1478 | # undef realloc |
| 1462 | # define realloc rpl_realloc | 1479 | # define realloc rpl_realloc |
| 1463 | # endif | 1480 | # endif |
| 1481 | # if !defined _GL_INLINE_RPL_REALLOC | ||
| 1464 | _GL_FUNCDECL_RPL (realloc, void *, | 1482 | _GL_FUNCDECL_RPL (realloc, void *, |
| 1465 | (void *ptr, size_t size), | 1483 | (void *ptr, size_t size), |
| 1466 | _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD); | 1484 | _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD); |
| 1485 | # endif | ||
| 1467 | _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); | 1486 | _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); |
| 1468 | # else | 1487 | # else |
| 1469 | # if __GNUC__ >= 11 && !defined __clang__ | 1488 | # if __GNUC__ >= 11 && !defined __clang__ |
| @@ -1968,6 +1987,8 @@ _GL_CXXALIASWARN (wctomb); | |||
| 1968 | #endif | 1987 | #endif |
| 1969 | 1988 | ||
| 1970 | 1989 | ||
| 1990 | _GL_INLINE_HEADER_END | ||
| 1991 | |||
| 1971 | #endif /* _@GUARD_PREFIX@_STDLIB_H */ | 1992 | #endif /* _@GUARD_PREFIX@_STDLIB_H */ |
| 1972 | #endif /* _@GUARD_PREFIX@_STDLIB_H */ | 1993 | #endif /* _@GUARD_PREFIX@_STDLIB_H */ |
| 1973 | #endif | 1994 | #endif |