diff options
| author | Paul Eggert | 2024-05-11 13:16:48 -0700 |
|---|---|---|
| committer | Paul Eggert | 2024-05-11 18:46:26 -0700 |
| commit | 7ae091d933b03d0a1e1e0b39a949c2811c4c3618 (patch) | |
| tree | 6c4f1fbbbc86621d3e4320a9bcceab901c1b6d68 /lib | |
| parent | 2e13c2adbad4fc609f560926f6e536b25281f925 (diff) | |
| download | emacs-7ae091d933b03d0a1e1e0b39a949c2811c4c3618.tar.gz emacs-7ae091d933b03d0a1e1e0b39a949c2811c4c3618.zip | |
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/acl.h | 10 | ||||
| -rw-r--r-- | lib/allocator.h | 10 | ||||
| -rw-r--r-- | lib/binary-io.h | 10 | ||||
| -rw-r--r-- | lib/boot-time-aux.h | 39 | ||||
| -rw-r--r-- | lib/careadlinkat.h | 10 | ||||
| -rw-r--r-- | lib/cloexec.h | 10 | ||||
| -rw-r--r-- | lib/close-stream.h | 10 | ||||
| -rw-r--r-- | lib/execinfo.in.h | 10 | ||||
| -rw-r--r-- | lib/fcntl.in.h | 3 | ||||
| -rw-r--r-- | lib/filevercmp.h | 10 | ||||
| -rw-r--r-- | lib/fpending.h | 10 | ||||
| -rw-r--r-- | lib/fsusage.h | 14 | ||||
| -rw-r--r-- | lib/ftoastr.h | 10 | ||||
| -rw-r--r-- | lib/gnulib.mk.in | 23 | ||||
| -rw-r--r-- | lib/idx.h | 10 | ||||
| -rw-r--r-- | lib/intprops-internal.h | 8 | ||||
| -rw-r--r-- | lib/memset_explicit.c | 6 | ||||
| -rw-r--r-- | lib/mini-gmp.c | 16 | ||||
| -rw-r--r-- | lib/openat-priv.h | 10 | ||||
| -rw-r--r-- | lib/openat.h | 10 | ||||
| -rw-r--r-- | lib/save-cwd.h | 12 | ||||
| -rw-r--r-- | lib/stddef.in.h | 33 | ||||
| -rw-r--r-- | lib/stdio.in.h | 19 | ||||
| -rw-r--r-- | lib/stdlib.in.h | 32 | ||||
| -rw-r--r-- | lib/strftime.c | 69 | ||||
| -rw-r--r-- | lib/sys_types.in.h | 9 | ||||
| -rw-r--r-- | lib/u64.h | 10 | ||||
| -rw-r--r-- | lib/unistd.in.h | 5 | ||||
| -rw-r--r-- | lib/utimens.h | 19 |
29 files changed, 370 insertions, 77 deletions
| @@ -28,6 +28,11 @@ | |||
| 28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
| 29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
| 30 | 30 | ||
| 31 | #ifdef __cplusplus | ||
| 32 | extern "C" { | ||
| 33 | #endif | ||
| 34 | |||
| 35 | |||
| 31 | bool acl_errno_valid (int) _GL_ATTRIBUTE_CONST; | 36 | bool acl_errno_valid (int) _GL_ATTRIBUTE_CONST; |
| 32 | int file_has_acl (char const *, struct stat const *); | 37 | int file_has_acl (char const *, struct stat const *); |
| 33 | int qset_acl (char const *, int, mode_t); | 38 | int qset_acl (char const *, int, mode_t); |
| @@ -36,4 +41,9 @@ int qcopy_acl (char const *, int, char const *, int, mode_t); | |||
| 36 | int copy_acl (char const *, int, char const *, int, mode_t); | 41 | int copy_acl (char const *, int, char const *, int, mode_t); |
| 37 | int chmod_or_fchmod (char const *, int, mode_t); | 42 | int chmod_or_fchmod (char const *, int, mode_t); |
| 38 | 43 | ||
| 44 | |||
| 45 | #ifdef __cplusplus | ||
| 46 | } | ||
| 47 | #endif | ||
| 48 | |||
| 39 | #endif | 49 | #endif |
diff --git a/lib/allocator.h b/lib/allocator.h index bb30a3440c2..53c8dfcacdf 100644 --- a/lib/allocator.h +++ b/lib/allocator.h | |||
| @@ -22,6 +22,11 @@ | |||
| 22 | 22 | ||
| 23 | #include <stddef.h> | 23 | #include <stddef.h> |
| 24 | 24 | ||
| 25 | #ifdef __cplusplus | ||
| 26 | extern "C" { | ||
| 27 | #endif | ||
| 28 | |||
| 29 | |||
| 25 | /* An object describing a memory allocator family. */ | 30 | /* An object describing a memory allocator family. */ |
| 26 | 31 | ||
| 27 | struct allocator | 32 | struct allocator |
| @@ -55,4 +60,9 @@ struct allocator | |||
| 55 | /* An allocator using the stdlib functions and a null DIE function. */ | 60 | /* An allocator using the stdlib functions and a null DIE function. */ |
| 56 | extern struct allocator const stdlib_allocator; | 61 | extern struct allocator const stdlib_allocator; |
| 57 | 62 | ||
| 63 | |||
| 64 | #ifdef __cplusplus | ||
| 65 | } | ||
| 66 | #endif | ||
| 67 | |||
| 58 | #endif /* _GL_ALLOCATOR_H */ | 68 | #endif /* _GL_ALLOCATOR_H */ |
diff --git a/lib/binary-io.h b/lib/binary-io.h index 0cc5c11748c..1da018fad85 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h | |||
| @@ -55,6 +55,11 @@ __gl_setmode (_GL_UNUSED int fd, _GL_UNUSED int mode) | |||
| 55 | } | 55 | } |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | #ifdef __cplusplus | ||
| 59 | extern "C" { | ||
| 60 | #endif | ||
| 61 | |||
| 62 | |||
| 58 | /* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY. | 63 | /* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY. |
| 59 | Return the old mode if successful, -1 (setting errno) on failure. | 64 | Return the old mode if successful, -1 (setting errno) on failure. |
| 60 | Ordinarily this function would be called 'setmode', since that is | 65 | Ordinarily this function would be called 'setmode', since that is |
| @@ -74,6 +79,11 @@ set_binary_mode (int fd, int mode) | |||
| 74 | /* This macro is obsolescent. */ | 79 | /* This macro is obsolescent. */ |
| 75 | #define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY)) | 80 | #define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY)) |
| 76 | 81 | ||
| 82 | |||
| 83 | #ifdef __cplusplus | ||
| 84 | } | ||
| 85 | #endif | ||
| 86 | |||
| 77 | _GL_INLINE_HEADER_END | 87 | _GL_INLINE_HEADER_END |
| 78 | 88 | ||
| 79 | #endif /* _BINARY_H */ | 89 | #endif /* _BINARY_H */ |
diff --git a/lib/boot-time-aux.h b/lib/boot-time-aux.h index 8b966fe691f..7f8c5405e4c 100644 --- a/lib/boot-time-aux.h +++ b/lib/boot-time-aux.h | |||
| @@ -304,18 +304,35 @@ get_windows_boot_time (struct timespec *p_boot_time) | |||
| 304 | Instead, on Windows, the boot time can be retrieved by looking at the | 304 | Instead, on Windows, the boot time can be retrieved by looking at the |
| 305 | time stamp of a file that (normally) gets touched only during the boot | 305 | time stamp of a file that (normally) gets touched only during the boot |
| 306 | process, namely C:\pagefile.sys. */ | 306 | process, namely C:\pagefile.sys. */ |
| 307 | const char * const boot_touched_file = | 307 | const char * const boot_touched_files[] = |
| 308 | #if defined __CYGWIN__ && !defined _WIN32 | ||
| 309 | "/cygdrive/c/pagefile.sys" | ||
| 310 | #else | ||
| 311 | "C:\\pagefile.sys" | ||
| 312 | #endif | ||
| 313 | ; | ||
| 314 | struct stat statbuf; | ||
| 315 | if (stat (boot_touched_file, &statbuf) >= 0) | ||
| 316 | { | 308 | { |
| 317 | *p_boot_time = get_stat_mtime (&statbuf); | 309 | #if defined __CYGWIN__ && !defined _WIN32 |
| 318 | return 0; | 310 | /* It is more portable to use /proc/cygdrive/c than /cygdrive/c. */ |
| 311 | "/proc/cygdrive/c/pagefile.sys", | ||
| 312 | /* A fallback, working around a Cygwin 3.5.3 bug. It has a modification | ||
| 313 | time about 1.5 minutes after the last boot; but that's better than | ||
| 314 | nothing. */ | ||
| 315 | "/proc/cygdrive/c/ProgramData/Microsoft/Windows/DeviceMetadataCache/dmrc.idx" | ||
| 316 | #else | ||
| 317 | "C:\\pagefile.sys" | ||
| 318 | #endif | ||
| 319 | }; | ||
| 320 | for (idx_t i = 0; i < SIZEOF (boot_touched_files); i++) | ||
| 321 | { | ||
| 322 | const char *filename = boot_touched_files[i]; | ||
| 323 | struct stat statbuf; | ||
| 324 | if (stat (filename, &statbuf) >= 0) | ||
| 325 | { | ||
| 326 | # if defined __CYGWIN__ && !defined _WIN32 | ||
| 327 | /* Work around a Cygwin 3.5.3 bug. | ||
| 328 | <https://cygwin.com/pipermail/cygwin/2024-May/255931.html> */ | ||
| 329 | if (!S_ISDIR (statbuf.st_mode)) | ||
| 330 | # endif | ||
| 331 | { | ||
| 332 | *p_boot_time = get_stat_mtime (&statbuf); | ||
| 333 | return 0; | ||
| 334 | } | ||
| 335 | } | ||
| 319 | } | 336 | } |
| 320 | return -1; | 337 | return -1; |
| 321 | } | 338 | } |
diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index 473e6531e67..2c552b692af 100644 --- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h | |||
| @@ -28,6 +28,11 @@ | |||
| 28 | #include <fcntl.h> | 28 | #include <fcntl.h> |
| 29 | #include <unistd.h> | 29 | #include <unistd.h> |
| 30 | 30 | ||
| 31 | #ifdef __cplusplus | ||
| 32 | extern "C" { | ||
| 33 | #endif | ||
| 34 | |||
| 35 | |||
| 31 | struct allocator; | 36 | struct allocator; |
| 32 | 37 | ||
| 33 | /* Assuming the current directory is FD, get the symbolic link value | 38 | /* Assuming the current directory is FD, get the symbolic link value |
| @@ -69,4 +74,9 @@ char *careadlinkat (int fd, char const *filename, | |||
| 69 | # endif | 74 | # endif |
| 70 | #endif | 75 | #endif |
| 71 | 76 | ||
| 77 | |||
| 78 | #ifdef __cplusplus | ||
| 79 | } | ||
| 80 | #endif | ||
| 81 | |||
| 72 | #endif /* _GL_CAREADLINKAT_H */ | 82 | #endif /* _GL_CAREADLINKAT_H */ |
diff --git a/lib/cloexec.h b/lib/cloexec.h index f52e5f2ec0f..a7944d6dd5d 100644 --- a/lib/cloexec.h +++ b/lib/cloexec.h | |||
| @@ -15,6 +15,11 @@ | |||
| 15 | You should have received a copy of the GNU Lesser General Public License | 15 | You should have received a copy of the GNU Lesser General Public License |
| 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 17 | 17 | ||
| 18 | #ifdef __cplusplus | ||
| 19 | extern "C" { | ||
| 20 | #endif | ||
| 21 | |||
| 22 | |||
| 18 | /* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, | 23 | /* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, |
| 19 | or clear the flag if VALUE is false. | 24 | or clear the flag if VALUE is false. |
| 20 | Return 0 on success, or -1 on error with 'errno' set. | 25 | Return 0 on success, or -1 on error with 'errno' set. |
| @@ -32,3 +37,8 @@ int set_cloexec_flag (int desc, bool value); | |||
| 32 | be duplicated. */ | 37 | be duplicated. */ |
| 33 | 38 | ||
| 34 | int dup_cloexec (int fd); | 39 | int dup_cloexec (int fd); |
| 40 | |||
| 41 | |||
| 42 | #ifdef __cplusplus | ||
| 43 | } | ||
| 44 | #endif | ||
diff --git a/lib/close-stream.h b/lib/close-stream.h index 8a1b3c7ac2c..3c421dce513 100644 --- a/lib/close-stream.h +++ b/lib/close-stream.h | |||
| @@ -17,4 +17,14 @@ | |||
| 17 | 17 | ||
| 18 | #include <stdio.h> | 18 | #include <stdio.h> |
| 19 | 19 | ||
| 20 | #ifdef __cplusplus | ||
| 21 | extern "C" { | ||
| 22 | #endif | ||
| 23 | |||
| 24 | |||
| 20 | int close_stream (FILE *stream); | 25 | int close_stream (FILE *stream); |
| 26 | |||
| 27 | |||
| 28 | #ifdef __cplusplus | ||
| 29 | } | ||
| 30 | #endif | ||
diff --git a/lib/execinfo.in.h b/lib/execinfo.in.h index 0ffb2c386e7..e017947bca4 100644 --- a/lib/execinfo.in.h +++ b/lib/execinfo.in.h | |||
| @@ -30,6 +30,11 @@ _GL_INLINE_HEADER_BEGIN | |||
| 30 | # define _GL_EXECINFO_INLINE _GL_INLINE | 30 | # define _GL_EXECINFO_INLINE _GL_INLINE |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | #ifdef __cplusplus | ||
| 34 | extern "C" { | ||
| 35 | #endif | ||
| 36 | |||
| 37 | |||
| 33 | _GL_EXECINFO_INLINE int | 38 | _GL_EXECINFO_INLINE int |
| 34 | backtrace (void **buffer, int size) | 39 | backtrace (void **buffer, int size) |
| 35 | { | 40 | { |
| @@ -54,6 +59,11 @@ backtrace_symbols_fd (void *const *buffer, int size, int fd) | |||
| 54 | (void) fd; | 59 | (void) fd; |
| 55 | } | 60 | } |
| 56 | 61 | ||
| 62 | |||
| 63 | #ifdef __cplusplus | ||
| 64 | } | ||
| 65 | #endif | ||
| 66 | |||
| 57 | _GL_INLINE_HEADER_END | 67 | _GL_INLINE_HEADER_END |
| 58 | 68 | ||
| 59 | #endif | 69 | #endif |
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index eea3b9542a5..1465ce594d7 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h | |||
| @@ -51,7 +51,8 @@ | |||
| 51 | #ifndef _@GUARD_PREFIX@_FCNTL_H | 51 | #ifndef _@GUARD_PREFIX@_FCNTL_H |
| 52 | 52 | ||
| 53 | /* Needed before <sys/stat.h>. | 53 | /* Needed before <sys/stat.h>. |
| 54 | May also define off_t to a 64-bit type on native Windows. */ | 54 | May also define off_t to a 64-bit type on native Windows. |
| 55 | Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */ | ||
| 55 | #include <sys/types.h> | 56 | #include <sys/types.h> |
| 56 | /* On some systems other than glibc, <sys/stat.h> is a prerequisite of | 57 | /* On some systems other than glibc, <sys/stat.h> is a prerequisite of |
| 57 | <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. | 58 | <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. |
diff --git a/lib/filevercmp.h b/lib/filevercmp.h index 8c549fcda00..81f821d5267 100644 --- a/lib/filevercmp.h +++ b/lib/filevercmp.h | |||
| @@ -27,6 +27,11 @@ | |||
| 27 | 27 | ||
| 28 | #include <stddef.h> | 28 | #include <stddef.h> |
| 29 | 29 | ||
| 30 | #ifdef __cplusplus | ||
| 31 | extern "C" { | ||
| 32 | #endif | ||
| 33 | |||
| 34 | |||
| 30 | /* Compare strings A and B as file names containing version numbers, | 35 | /* Compare strings A and B as file names containing version numbers, |
| 31 | and return an integer that is negative, zero, or positive depending | 36 | and return an integer that is negative, zero, or positive depending |
| 32 | on whether A compares less than, equal to, or greater than B. | 37 | on whether A compares less than, equal to, or greater than B. |
| @@ -80,4 +85,9 @@ int filevercmp (char const *a, char const *b) _GL_ATTRIBUTE_PURE; | |||
| 80 | int filenvercmp (char const *a, ptrdiff_t alen, char const *b, ptrdiff_t blen) | 85 | int filenvercmp (char const *a, ptrdiff_t alen, char const *b, ptrdiff_t blen) |
| 81 | _GL_ATTRIBUTE_PURE; | 86 | _GL_ATTRIBUTE_PURE; |
| 82 | 87 | ||
| 88 | |||
| 89 | #ifdef __cplusplus | ||
| 90 | } | ||
| 91 | #endif | ||
| 92 | |||
| 83 | #endif /* FILEVERCMP_H */ | 93 | #endif /* FILEVERCMP_H */ |
diff --git a/lib/fpending.h b/lib/fpending.h index 28db3b403d9..345c0bc71d9 100644 --- a/lib/fpending.h +++ b/lib/fpending.h | |||
| @@ -30,6 +30,16 @@ | |||
| 30 | # include <stdio_ext.h> | 30 | # include <stdio_ext.h> |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | #ifdef __cplusplus | ||
| 34 | extern "C" { | ||
| 35 | #endif | ||
| 36 | |||
| 37 | |||
| 33 | #if !HAVE_DECL___FPENDING | 38 | #if !HAVE_DECL___FPENDING |
| 34 | size_t __fpending (FILE *) _GL_ATTRIBUTE_PURE; | 39 | size_t __fpending (FILE *) _GL_ATTRIBUTE_PURE; |
| 35 | #endif | 40 | #endif |
| 41 | |||
| 42 | |||
| 43 | #ifdef __cplusplus | ||
| 44 | } | ||
| 45 | #endif | ||
diff --git a/lib/fsusage.h b/lib/fsusage.h index d7ae5f63a36..da87859060c 100644 --- a/lib/fsusage.h +++ b/lib/fsusage.h | |||
| @@ -19,9 +19,14 @@ | |||
| 19 | /* Space usage statistics for a file system. Blocks are 512-byte. */ | 19 | /* Space usage statistics for a file system. Blocks are 512-byte. */ |
| 20 | 20 | ||
| 21 | #if !defined FSUSAGE_H_ | 21 | #if !defined FSUSAGE_H_ |
| 22 | # define FSUSAGE_H_ | 22 | #define FSUSAGE_H_ |
| 23 | |||
| 24 | #include <stdint.h> | ||
| 25 | |||
| 26 | #ifdef __cplusplus | ||
| 27 | extern "C" { | ||
| 28 | #endif | ||
| 23 | 29 | ||
| 24 | # include <stdint.h> | ||
| 25 | 30 | ||
| 26 | struct fs_usage | 31 | struct fs_usage |
| 27 | { | 32 | { |
| @@ -36,4 +41,9 @@ struct fs_usage | |||
| 36 | 41 | ||
| 37 | int get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp); | 42 | int get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp); |
| 38 | 43 | ||
| 44 | |||
| 45 | #ifdef __cplusplus | ||
| 46 | } | ||
| 47 | #endif | ||
| 48 | |||
| 39 | #endif | 49 | #endif |
diff --git a/lib/ftoastr.h b/lib/ftoastr.h index ed43c961a04..94554863a1e 100644 --- a/lib/ftoastr.h +++ b/lib/ftoastr.h | |||
| @@ -24,6 +24,11 @@ | |||
| 24 | #include <float.h> | 24 | #include <float.h> |
| 25 | #include <stddef.h> | 25 | #include <stddef.h> |
| 26 | 26 | ||
| 27 | #ifdef __cplusplus | ||
| 28 | extern "C" { | ||
| 29 | #endif | ||
| 30 | |||
| 31 | |||
| 27 | /* Store into BUF (of size BUFSIZE) an accurate minimal-precision | 32 | /* Store into BUF (of size BUFSIZE) an accurate minimal-precision |
| 28 | string representation of a floating point number. FLAGS affect the | 33 | string representation of a floating point number. FLAGS affect the |
| 29 | formatting of the number. Pad the output string with spaces as | 34 | formatting of the number. Pad the output string with spaces as |
| @@ -149,4 +154,9 @@ enum | |||
| 149 | #define DBL_BUFSIZE_BOUND ( DBL_STRLEN_BOUND + 1) | 154 | #define DBL_BUFSIZE_BOUND ( DBL_STRLEN_BOUND + 1) |
| 150 | #define LDBL_BUFSIZE_BOUND (LDBL_STRLEN_BOUND + 1) | 155 | #define LDBL_BUFSIZE_BOUND (LDBL_STRLEN_BOUND + 1) |
| 151 | 156 | ||
| 157 | |||
| 158 | #ifdef __cplusplus | ||
| 159 | } | ||
| 160 | #endif | ||
| 161 | |||
| 152 | #endif /* _GL_FTOASTR_H */ | 162 | #endif /* _GL_FTOASTR_H */ |
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 711ddcf1260..a5c009cfb85 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in | |||
| @@ -618,6 +618,7 @@ GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@ | |||
| 618 | GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@ | 618 | GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@ |
| 619 | GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@ | 619 | GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@ |
| 620 | GL_GNULIB_STRTOD = @GL_GNULIB_STRTOD@ | 620 | GL_GNULIB_STRTOD = @GL_GNULIB_STRTOD@ |
| 621 | GL_GNULIB_STRTOF = @GL_GNULIB_STRTOF@ | ||
| 621 | GL_GNULIB_STRTOIMAX = @GL_GNULIB_STRTOIMAX@ | 622 | GL_GNULIB_STRTOIMAX = @GL_GNULIB_STRTOIMAX@ |
| 622 | GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@ | 623 | GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@ |
| 623 | GL_GNULIB_STRTOL = @GL_GNULIB_STRTOL@ | 624 | GL_GNULIB_STRTOL = @GL_GNULIB_STRTOL@ |
| @@ -809,6 +810,7 @@ HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ | |||
| 809 | HAVE_MODULES = @HAVE_MODULES@ | 810 | HAVE_MODULES = @HAVE_MODULES@ |
| 810 | HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ | 811 | HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ |
| 811 | HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@ | 812 | HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@ |
| 813 | HAVE_OFF64_T = @HAVE_OFF64_T@ | ||
| 812 | HAVE_OPENAT = @HAVE_OPENAT@ | 814 | HAVE_OPENAT = @HAVE_OPENAT@ |
| 813 | HAVE_OPENDIR = @HAVE_OPENDIR@ | 815 | HAVE_OPENDIR = @HAVE_OPENDIR@ |
| 814 | HAVE_OS_H = @HAVE_OS_H@ | 816 | HAVE_OS_H = @HAVE_OS_H@ |
| @@ -872,6 +874,7 @@ HAVE_STRPBRK = @HAVE_STRPBRK@ | |||
| 872 | HAVE_STRPTIME = @HAVE_STRPTIME@ | 874 | HAVE_STRPTIME = @HAVE_STRPTIME@ |
| 873 | HAVE_STRSEP = @HAVE_STRSEP@ | 875 | HAVE_STRSEP = @HAVE_STRSEP@ |
| 874 | HAVE_STRTOD = @HAVE_STRTOD@ | 876 | HAVE_STRTOD = @HAVE_STRTOD@ |
| 877 | HAVE_STRTOF = @HAVE_STRTOF@ | ||
| 875 | HAVE_STRTOL = @HAVE_STRTOL@ | 878 | HAVE_STRTOL = @HAVE_STRTOL@ |
| 876 | HAVE_STRTOLD = @HAVE_STRTOLD@ | 879 | HAVE_STRTOLD = @HAVE_STRTOLD@ |
| 877 | HAVE_STRTOLL = @HAVE_STRTOLL@ | 880 | HAVE_STRTOLL = @HAVE_STRTOLL@ |
| @@ -922,12 +925,10 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |||
| 922 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | 925 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
| 923 | INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ | 926 | INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ |
| 924 | INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ | 927 | INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ |
| 928 | IS_D8_R8 = @IS_D8_R8@ | ||
| 925 | JARSIGNER = @JARSIGNER@ | 929 | JARSIGNER = @JARSIGNER@ |
| 926 | JAVAC = @JAVAC@ | 930 | JAVAC = @JAVAC@ |
| 927 | JPEG_CFLAGS = @JPEG_CFLAGS@ | 931 | JPEG_CFLAGS = @JPEG_CFLAGS@ |
| 928 | JSON_CFLAGS = @JSON_CFLAGS@ | ||
| 929 | JSON_LIBS = @JSON_LIBS@ | ||
| 930 | JSON_OBJ = @JSON_OBJ@ | ||
| 931 | KQUEUE_CFLAGS = @KQUEUE_CFLAGS@ | 932 | KQUEUE_CFLAGS = @KQUEUE_CFLAGS@ |
| 932 | KQUEUE_LIBS = @KQUEUE_LIBS@ | 933 | KQUEUE_LIBS = @KQUEUE_LIBS@ |
| 933 | KRB4LIB = @KRB4LIB@ | 934 | KRB4LIB = @KRB4LIB@ |
| @@ -1017,9 +1018,12 @@ NDK_BUILD_ARCH = @NDK_BUILD_ARCH@ | |||
| 1017 | NDK_BUILD_CC = @NDK_BUILD_CC@ | 1018 | NDK_BUILD_CC = @NDK_BUILD_CC@ |
| 1018 | NDK_BUILD_CFLAGS = @NDK_BUILD_CFLAGS@ | 1019 | NDK_BUILD_CFLAGS = @NDK_BUILD_CFLAGS@ |
| 1019 | NDK_BUILD_CXX = @NDK_BUILD_CXX@ | 1020 | NDK_BUILD_CXX = @NDK_BUILD_CXX@ |
| 1021 | NDK_BUILD_CXX_LDFLAGS = @NDK_BUILD_CXX_LDFLAGS@ | ||
| 1020 | NDK_BUILD_CXX_SHARED = @NDK_BUILD_CXX_SHARED@ | 1022 | NDK_BUILD_CXX_SHARED = @NDK_BUILD_CXX_SHARED@ |
| 1023 | NDK_BUILD_CXX_STL = @NDK_BUILD_CXX_STL@ | ||
| 1021 | NDK_BUILD_MODULES = @NDK_BUILD_MODULES@ | 1024 | NDK_BUILD_MODULES = @NDK_BUILD_MODULES@ |
| 1022 | NDK_BUILD_NASM = @NDK_BUILD_NASM@ | 1025 | NDK_BUILD_NASM = @NDK_BUILD_NASM@ |
| 1026 | NDK_BUILD_READELF = @NDK_BUILD_READELF@ | ||
| 1023 | NDK_BUILD_SDK = @NDK_BUILD_SDK@ | 1027 | NDK_BUILD_SDK = @NDK_BUILD_SDK@ |
| 1024 | NEXT_ASSERT_H = @NEXT_ASSERT_H@ | 1028 | NEXT_ASSERT_H = @NEXT_ASSERT_H@ |
| 1025 | NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@ | 1029 | NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@ |
| @@ -1068,6 +1072,7 @@ NS_OBJ = @NS_OBJ@ | |||
| 1068 | NS_OBJC_OBJ = @NS_OBJC_OBJ@ | 1072 | NS_OBJC_OBJ = @NS_OBJC_OBJ@ |
| 1069 | NTDIR = @NTDIR@ | 1073 | NTDIR = @NTDIR@ |
| 1070 | NTLIB = @NTLIB@ | 1074 | NTLIB = @NTLIB@ |
| 1075 | NULLPTR_T_NEEDS_STDDEF = @NULLPTR_T_NEEDS_STDDEF@ | ||
| 1071 | OBJC = @OBJC@ | 1076 | OBJC = @OBJC@ |
| 1072 | OBJCFLAGS = @OBJCFLAGS@ | 1077 | OBJCFLAGS = @OBJCFLAGS@ |
| 1073 | OBJEXT = @OBJEXT@ | 1078 | OBJEXT = @OBJEXT@ |
| @@ -1101,6 +1106,7 @@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ | |||
| 1101 | QCOPY_ACL_LIB = @QCOPY_ACL_LIB@ | 1106 | QCOPY_ACL_LIB = @QCOPY_ACL_LIB@ |
| 1102 | RALLOC_OBJ = @RALLOC_OBJ@ | 1107 | RALLOC_OBJ = @RALLOC_OBJ@ |
| 1103 | RANLIB = @RANLIB@ | 1108 | RANLIB = @RANLIB@ |
| 1109 | READELF = @READELF@ | ||
| 1104 | REPLACE_ACCESS = @REPLACE_ACCESS@ | 1110 | REPLACE_ACCESS = @REPLACE_ACCESS@ |
| 1105 | REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@ | 1111 | REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@ |
| 1106 | REPLACE_CALLOC_FOR_CALLOC_GNU = @REPLACE_CALLOC_FOR_CALLOC_GNU@ | 1112 | REPLACE_CALLOC_FOR_CALLOC_GNU = @REPLACE_CALLOC_FOR_CALLOC_GNU@ |
| @@ -1258,6 +1264,7 @@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ | |||
| 1258 | REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ | 1264 | REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ |
| 1259 | REPLACE_STRSTR = @REPLACE_STRSTR@ | 1265 | REPLACE_STRSTR = @REPLACE_STRSTR@ |
| 1260 | REPLACE_STRTOD = @REPLACE_STRTOD@ | 1266 | REPLACE_STRTOD = @REPLACE_STRTOD@ |
| 1267 | REPLACE_STRTOF = @REPLACE_STRTOF@ | ||
| 1261 | REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ | 1268 | REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ |
| 1262 | REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ | 1269 | REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ |
| 1263 | REPLACE_STRTOL = @REPLACE_STRTOL@ | 1270 | REPLACE_STRTOL = @REPLACE_STRTOL@ |
| @@ -1308,6 +1315,7 @@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ | |||
| 1308 | SQLITE3_LIBS = @SQLITE3_LIBS@ | 1315 | SQLITE3_LIBS = @SQLITE3_LIBS@ |
| 1309 | STDCKDINT_H = @STDCKDINT_H@ | 1316 | STDCKDINT_H = @STDCKDINT_H@ |
| 1310 | STDDEF_H = @STDDEF_H@ | 1317 | STDDEF_H = @STDDEF_H@ |
| 1318 | STDDEF_NOT_IDEMPOTENT = @STDDEF_NOT_IDEMPOTENT@ | ||
| 1311 | STDINT_H = @STDINT_H@ | 1319 | STDINT_H = @STDINT_H@ |
| 1312 | SUBDIR_MAKEFILES_IN = @SUBDIR_MAKEFILES_IN@ | 1320 | SUBDIR_MAKEFILES_IN = @SUBDIR_MAKEFILES_IN@ |
| 1313 | SYSTEM_TYPE = @SYSTEM_TYPE@ | 1321 | SYSTEM_TYPE = @SYSTEM_TYPE@ |
| @@ -2195,6 +2203,7 @@ SED_HEADER_STDOUT = sed -e 1h -e '1$(SED_HEADER_NOEDIT)' -e 1G | |||
| 2195 | SED_HEADER_TO_AT_t = $(SED_HEADER_STDOUT) -n -e 'w $@-t' | 2203 | SED_HEADER_TO_AT_t = $(SED_HEADER_STDOUT) -n -e 'w $@-t' |
| 2196 | 2204 | ||
| 2197 | # Use $(gl_V_at) instead of $(AM_V_GEN) or $(AM_V_at) on a line that | 2205 | # Use $(gl_V_at) instead of $(AM_V_GEN) or $(AM_V_at) on a line that |
| 2206 | # is its recipe's first line if and only if @NMD@ lines are absent. | ||
| 2198 | gl_V_at = $(AM_V_GEN) | 2207 | gl_V_at = $(AM_V_GEN) |
| 2199 | 2208 | ||
| 2200 | endif | 2209 | endif |
| @@ -3078,9 +3087,11 @@ stddef.h: stddef.in.h $(top_builddir)/config.status | |||
| 3078 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | 3087 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ |
| 3079 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | 3088 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ |
| 3080 | -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ | 3089 | -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ |
| 3090 | -e 's|@''NULLPTR_T_NEEDS_STDDEF''@|$(NULLPTR_T_NEEDS_STDDEF)|g' \ | ||
| 3091 | -e 's|@''STDDEF_NOT_IDEMPOTENT''@|$(STDDEF_NOT_IDEMPOTENT)|g' \ | ||
| 3092 | -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ | ||
| 3081 | -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ | 3093 | -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ |
| 3082 | -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ | 3094 | -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ |
| 3083 | -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ | ||
| 3084 | $(srcdir)/stddef.in.h > $@-t | 3095 | $(srcdir)/stddef.in.h > $@-t |
| 3085 | $(AM_V_at)mv $@-t $@ | 3096 | $(AM_V_at)mv $@-t $@ |
| 3086 | else | 3097 | else |
| @@ -3347,6 +3358,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
| 3347 | -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ | 3358 | -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ |
| 3348 | -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ | 3359 | -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ |
| 3349 | -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ | 3360 | -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ |
| 3361 | -e 's/@''GNULIB_STRTOF''@/$(GL_GNULIB_STRTOF)/g' \ | ||
| 3350 | -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ | 3362 | -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ |
| 3351 | -e 's/@''GNULIB_STRTOLD''@/$(GL_GNULIB_STRTOLD)/g' \ | 3363 | -e 's/@''GNULIB_STRTOLD''@/$(GL_GNULIB_STRTOLD)/g' \ |
| 3352 | -e 's/@''GNULIB_STRTOLL''@/$(GL_GNULIB_STRTOLL)/g' \ | 3364 | -e 's/@''GNULIB_STRTOLL''@/$(GL_GNULIB_STRTOLL)/g' \ |
| @@ -3399,6 +3411,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
| 3399 | -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ | 3411 | -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ |
| 3400 | -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ | 3412 | -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ |
| 3401 | -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ | 3413 | -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ |
| 3414 | -e 's|@''HAVE_STRTOF''@|$(HAVE_STRTOF)|g' \ | ||
| 3402 | -e 's|@''HAVE_STRTOL''@|$(HAVE_STRTOL)|g' \ | 3415 | -e 's|@''HAVE_STRTOL''@|$(HAVE_STRTOL)|g' \ |
| 3403 | -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ | 3416 | -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ |
| 3404 | -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ | 3417 | -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ |
| @@ -3444,6 +3457,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
| 3444 | -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ | 3457 | -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ |
| 3445 | -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ | 3458 | -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ |
| 3446 | -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ | 3459 | -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ |
| 3460 | -e 's|@''REPLACE_STRTOF''@|$(REPLACE_STRTOF)|g' \ | ||
| 3447 | -e 's|@''REPLACE_STRTOL''@|$(REPLACE_STRTOL)|g' \ | 3461 | -e 's|@''REPLACE_STRTOL''@|$(REPLACE_STRTOL)|g' \ |
| 3448 | -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ | 3462 | -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ |
| 3449 | -e 's|@''REPLACE_STRTOLL''@|$(REPLACE_STRTOLL)|g' \ | 3463 | -e 's|@''REPLACE_STRTOLL''@|$(REPLACE_STRTOLL)|g' \ |
| @@ -3833,6 +3847,7 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status | |||
| 3833 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | 3847 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ |
| 3834 | -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ | 3848 | -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ |
| 3835 | -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ | 3849 | -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ |
| 3850 | -e 's|@''HAVE_OFF64_T''@|$(HAVE_OFF64_T)|g' \ | ||
| 3836 | -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ | 3851 | -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ |
| 3837 | $(srcdir)/sys_types.in.h > $@-t | 3852 | $(srcdir)/sys_types.in.h > $@-t |
| 3838 | $(AM_V_at)mv $@-t $@ | 3853 | $(AM_V_at)mv $@-t $@ |
| @@ -111,6 +111,11 @@ | |||
| 111 | help producing good code and good warnings. The type 'idx_t' could | 111 | help producing good code and good warnings. The type 'idx_t' could |
| 112 | then be typedef'ed to a range type that is signed after promotion. */ | 112 | then be typedef'ed to a range type that is signed after promotion. */ |
| 113 | 113 | ||
| 114 | #ifdef __cplusplus | ||
| 115 | extern "C" { | ||
| 116 | #endif | ||
| 117 | |||
| 118 | |||
| 114 | /* In the future, idx_t could be typedef'ed to a signed range type. | 119 | /* In the future, idx_t could be typedef'ed to a signed range type. |
| 115 | The clang "extended integer types", supported in Clang 11 or newer | 120 | The clang "extended integer types", supported in Clang 11 or newer |
| 116 | <https://clang.llvm.org/docs/LanguageExtensions.html#extended-integer-types>, | 121 | <https://clang.llvm.org/docs/LanguageExtensions.html#extended-integer-types>, |
| @@ -131,4 +136,9 @@ typedef ptrdiff_t idx_t; | |||
| 131 | Perhaps there should be another macro IDX_VALUE_BITS that does not | 136 | Perhaps there should be another macro IDX_VALUE_BITS that does not |
| 132 | count the sign bit and is therefore one less than PTRDIFF_WIDTH. */ | 137 | count the sign bit and is therefore one less than PTRDIFF_WIDTH. */ |
| 133 | 138 | ||
| 139 | |||
| 140 | #ifdef __cplusplus | ||
| 141 | } | ||
| 142 | #endif | ||
| 143 | |||
| 134 | #endif /* _IDX_H */ | 144 | #endif /* _IDX_H */ |
diff --git a/lib/intprops-internal.h b/lib/intprops-internal.h index c8a87d2bb27..443024c6657 100644 --- a/lib/intprops-internal.h +++ b/lib/intprops-internal.h | |||
| @@ -169,7 +169,9 @@ | |||
| 169 | /* Work around GCC bug 91450. */ | 169 | /* Work around GCC bug 91450. */ |
| 170 | # define _GL_INT_MULTIPLY_WRAPV(a, b, r) \ | 170 | # define _GL_INT_MULTIPLY_WRAPV(a, b, r) \ |
| 171 | ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && _GL_EXPR_SIGNED (a) && _GL_EXPR_SIGNED (b) \ | 171 | ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && _GL_EXPR_SIGNED (a) && _GL_EXPR_SIGNED (b) \ |
| 172 | && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \ | 172 | && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, \ |
| 173 | (__typeof__ (*(r))) 0, \ | ||
| 174 | (__typeof__ (*(r))) -1)) \ | ||
| 173 | ? ((void) __builtin_mul_overflow (a, b, r), 1) \ | 175 | ? ((void) __builtin_mul_overflow (a, b, r), 1) \ |
| 174 | : __builtin_mul_overflow (a, b, r)) | 176 | : __builtin_mul_overflow (a, b, r)) |
| 175 | # endif | 177 | # endif |
| @@ -183,10 +185,10 @@ | |||
| 183 | /* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: | 185 | /* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: |
| 184 | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 | 186 | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 |
| 185 | https://llvm.org/bugs/show_bug.cgi?id=25390 | 187 | https://llvm.org/bugs/show_bug.cgi?id=25390 |
| 186 | For now, assume all versions of GCC-like compilers generate bogus | 188 | For now, assume GCC < 14 and all Clang versions generate bogus |
| 187 | warnings for _Generic. This matters only for compilers that | 189 | warnings for _Generic. This matters only for compilers that |
| 188 | lack relevant builtins. */ | 190 | lack relevant builtins. */ |
| 189 | #if __GNUC__ || defined __clang__ | 191 | #if (__GNUC__ && __GNUC__ < 14) || defined __clang__ |
| 190 | # define _GL__GENERIC_BOGUS 1 | 192 | # define _GL__GENERIC_BOGUS 1 |
| 191 | #else | 193 | #else |
| 192 | # define _GL__GENERIC_BOGUS 0 | 194 | # define _GL__GENERIC_BOGUS 0 |
diff --git a/lib/memset_explicit.c b/lib/memset_explicit.c index cf6cc647847..33c09873482 100644 --- a/lib/memset_explicit.c +++ b/lib/memset_explicit.c | |||
| @@ -16,11 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include <config.h> | 17 | #include <config.h> |
| 18 | 18 | ||
| 19 | /* memset_s need this define */ | 19 | /* Specification. */ |
| 20 | #if HAVE_MEMSET_S | ||
| 21 | # define __STDC_WANT_LIB_EXT1__ 1 | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #include <string.h> | 20 | #include <string.h> |
| 25 | 21 | ||
| 26 | /* Set S's bytes to C, where S has LEN bytes. The compiler will not | 22 | /* Set S's bytes to C, where S has LEN bytes. The compiler will not |
diff --git a/lib/mini-gmp.c b/lib/mini-gmp.c index 69a72bfd460..c580a8fc025 100644 --- a/lib/mini-gmp.c +++ b/lib/mini-gmp.c | |||
| @@ -2809,6 +2809,7 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v) | |||
| 2809 | mpz_t tu, tv, s0, s1, t0, t1; | 2809 | mpz_t tu, tv, s0, s1, t0, t1; |
| 2810 | mp_bitcnt_t uz, vz, gz; | 2810 | mp_bitcnt_t uz, vz, gz; |
| 2811 | mp_bitcnt_t power; | 2811 | mp_bitcnt_t power; |
| 2812 | int cmp; | ||
| 2812 | 2813 | ||
| 2813 | if (u->_mp_size == 0) | 2814 | if (u->_mp_size == 0) |
| 2814 | { | 2815 | { |
| @@ -2960,12 +2961,21 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v) | |||
| 2960 | mpz_tdiv_q_2exp (t0, t0, 1); | 2961 | mpz_tdiv_q_2exp (t0, t0, 1); |
| 2961 | } | 2962 | } |
| 2962 | 2963 | ||
| 2963 | /* Arrange so that |s| < |u| / 2g */ | 2964 | /* Choose small cofactors (they should generally satify |
| 2965 | |||
| 2966 | |s| < |u| / 2g and |t| < |v| / 2g, | ||
| 2967 | |||
| 2968 | with some documented exceptions). Always choose the smallest s, | ||
| 2969 | if there are two choices for s with same absolute value, choose | ||
| 2970 | the one with smallest corresponding t (this asymmetric condition | ||
| 2971 | is needed to prefer s = 0, |t| = 1 when g = |a| = |b|). */ | ||
| 2964 | mpz_add (s1, s0, s1); | 2972 | mpz_add (s1, s0, s1); |
| 2965 | if (mpz_cmpabs (s0, s1) > 0) | 2973 | mpz_sub (t1, t0, t1); |
| 2974 | cmp = mpz_cmpabs (s0, s1); | ||
| 2975 | if (cmp > 0 || (cmp == 0 && mpz_cmpabs (t0, t1) > 0)) | ||
| 2966 | { | 2976 | { |
| 2967 | mpz_swap (s0, s1); | 2977 | mpz_swap (s0, s1); |
| 2968 | mpz_sub (t0, t0, t1); | 2978 | mpz_swap (t0, t1); |
| 2969 | } | 2979 | } |
| 2970 | if (u->_mp_size < 0) | 2980 | if (u->_mp_size < 0) |
| 2971 | mpz_neg (s0, s0); | 2981 | mpz_neg (s0, s0); |
diff --git a/lib/openat-priv.h b/lib/openat-priv.h index 7fd4beb5a73..63093f4597e 100644 --- a/lib/openat-priv.h +++ b/lib/openat-priv.h | |||
| @@ -24,6 +24,11 @@ | |||
| 24 | #include <limits.h> | 24 | #include <limits.h> |
| 25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
| 26 | 26 | ||
| 27 | #ifdef __cplusplus | ||
| 28 | extern "C" { | ||
| 29 | #endif | ||
| 30 | |||
| 31 | |||
| 27 | /* Maximum number of bytes that it is safe to allocate as a single | 32 | /* Maximum number of bytes that it is safe to allocate as a single |
| 28 | array on the stack, and that is known as a compile-time constant. | 33 | array on the stack, and that is known as a compile-time constant. |
| 29 | The assumption is that we'll touch the array very quickly, or a | 34 | The assumption is that we'll touch the array very quickly, or a |
| @@ -61,4 +66,9 @@ int at_func2 (int fd1, char const *file1, | |||
| 61 | int fd2, char const *file2, | 66 | int fd2, char const *file2, |
| 62 | int (*func) (char const *file1, char const *file2)); | 67 | int (*func) (char const *file1, char const *file2)); |
| 63 | 68 | ||
| 69 | |||
| 70 | #ifdef __cplusplus | ||
| 71 | } | ||
| 72 | #endif | ||
| 73 | |||
| 64 | #endif /* _GL_HEADER_OPENAT_PRIV */ | 74 | #endif /* _GL_HEADER_OPENAT_PRIV */ |
diff --git a/lib/openat.h b/lib/openat.h index dc34092bb3f..b6b94f68c75 100644 --- a/lib/openat.h +++ b/lib/openat.h | |||
| @@ -33,6 +33,11 @@ | |||
| 33 | 33 | ||
| 34 | _GL_INLINE_HEADER_BEGIN | 34 | _GL_INLINE_HEADER_BEGIN |
| 35 | 35 | ||
| 36 | #ifdef __cplusplus | ||
| 37 | extern "C" { | ||
| 38 | #endif | ||
| 39 | |||
| 40 | |||
| 36 | #if !HAVE_OPENAT | 41 | #if !HAVE_OPENAT |
| 37 | 42 | ||
| 38 | int openat_permissive (int fd, char const *file, int flags, mode_t mode, | 43 | int openat_permissive (int fd, char const *file, int flags, mode_t mode, |
| @@ -122,6 +127,11 @@ lstatat (int fd, char const *name, struct stat *st) | |||
| 122 | wrappers are not provided for accessat or euidaccessat, so as to | 127 | wrappers are not provided for accessat or euidaccessat, so as to |
| 123 | avoid dragging in -lgen on some platforms. */ | 128 | avoid dragging in -lgen on some platforms. */ |
| 124 | 129 | ||
| 130 | |||
| 131 | #ifdef __cplusplus | ||
| 132 | } | ||
| 133 | #endif | ||
| 134 | |||
| 125 | _GL_INLINE_HEADER_END | 135 | _GL_INLINE_HEADER_END |
| 126 | 136 | ||
| 127 | #endif /* _GL_HEADER_OPENAT */ | 137 | #endif /* _GL_HEADER_OPENAT */ |
diff --git a/lib/save-cwd.h b/lib/save-cwd.h index 692e4b97be2..9d314c2cf45 100644 --- a/lib/save-cwd.h +++ b/lib/save-cwd.h | |||
| @@ -19,7 +19,12 @@ | |||
| 19 | /* Written by Jim Meyering. */ | 19 | /* Written by Jim Meyering. */ |
| 20 | 20 | ||
| 21 | #ifndef SAVE_CWD_H | 21 | #ifndef SAVE_CWD_H |
| 22 | # define SAVE_CWD_H 1 | 22 | #define SAVE_CWD_H 1 |
| 23 | |||
| 24 | #ifdef __cplusplus | ||
| 25 | extern "C" { | ||
| 26 | #endif | ||
| 27 | |||
| 23 | 28 | ||
| 24 | struct saved_cwd | 29 | struct saved_cwd |
| 25 | { | 30 | { |
| @@ -31,4 +36,9 @@ int save_cwd (struct saved_cwd *cwd); | |||
| 31 | int restore_cwd (const struct saved_cwd *cwd); | 36 | int restore_cwd (const struct saved_cwd *cwd); |
| 32 | void free_cwd (struct saved_cwd *cwd); | 37 | void free_cwd (struct saved_cwd *cwd); |
| 33 | 38 | ||
| 39 | |||
| 40 | #ifdef __cplusplus | ||
| 41 | } | ||
| 42 | #endif | ||
| 43 | |||
| 34 | #endif /* SAVE_CWD_H */ | 44 | #endif /* SAVE_CWD_H */ |
diff --git a/lib/stddef.in.h b/lib/stddef.in.h index fa8998d9b72..63bb500e262 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h | |||
| @@ -27,13 +27,21 @@ | |||
| 27 | #endif | 27 | #endif |
| 28 | @PRAGMA_COLUMNS@ | 28 | @PRAGMA_COLUMNS@ |
| 29 | 29 | ||
| 30 | #if defined __need_wchar_t || defined __need_size_t \ | 30 | #if (defined __need_wchar_t || defined __need_size_t \ |
| 31 | || defined __need_ptrdiff_t || defined __need_NULL \ | 31 | || defined __need_ptrdiff_t || defined __need_NULL \ |
| 32 | || defined __need_wint_t | 32 | || defined __need_wint_t) \ |
| 33 | /* Avoid warning triggered by "gcc -std=gnu23 -Wsystem-headers" \ | ||
| 34 | in Fedora 40 with gcc 14.0.1. \ | ||
| 35 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870>. */ \ | ||
| 36 | && !@STDDEF_NOT_IDEMPOTENT@ | ||
| 33 | /* Special invocation convention inside gcc header files. In | 37 | /* Special invocation convention inside gcc header files. In |
| 34 | particular, gcc provides a version of <stddef.h> that blindly | 38 | particular, <stddef.h> in some ancient versions of GCC blindly |
| 35 | redefines NULL even when __need_wint_t was defined, even though | 39 | redefined NULL when __need_wint_t was defined, even though wint_t |
| 36 | wint_t is not normally provided by <stddef.h>. Hence, we must | 40 | is not normally provided by <stddef.h>. |
| 41 | (FIXME: It's not clear what GCC versions those were - perhaps so | ||
| 42 | ancient that we can stop worrying about this?) | ||
| 43 | Although glibc 2.26 (2017) and later do not use __need_wint_t, | ||
| 44 | for portability to macOS, Cygwin, Haiku, and older Glibc + GCC, | ||
| 37 | remember if special invocation has ever been used to obtain wint_t, | 45 | remember if special invocation has ever been used to obtain wint_t, |
| 38 | in which case we need to clean up NULL yet again. */ | 46 | in which case we need to clean up NULL yet again. */ |
| 39 | 47 | ||
| @@ -52,6 +60,13 @@ | |||
| 52 | # endif | 60 | # endif |
| 53 | 61 | ||
| 54 | #else | 62 | #else |
| 63 | /* For @STDDEF_NOT_IDEMPOTENT@. */ | ||
| 64 | # undef __need_wchar_t | ||
| 65 | # undef __need_size_t | ||
| 66 | # undef __need_ptrdiff_t | ||
| 67 | # undef __need_NULL | ||
| 68 | # undef __need_wint_t | ||
| 69 | |||
| 55 | /* Normal invocation convention. */ | 70 | /* Normal invocation convention. */ |
| 56 | 71 | ||
| 57 | # ifndef _@GUARD_PREFIX@_STDDEF_H | 72 | # ifndef _@GUARD_PREFIX@_STDDEF_H |
| @@ -74,6 +89,12 @@ typedef long max_align_t; | |||
| 74 | # endif | 89 | # endif |
| 75 | # endif | 90 | # endif |
| 76 | 91 | ||
| 92 | # if !defined _GCC_NULLPTR_T && !@NULLPTR_T_NEEDS_STDDEF@ | ||
| 93 | /* Suppress unwanted nullptr_t typedef. See | ||
| 94 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114869>. */ | ||
| 95 | # define _GCC_NULLPTR_T | ||
| 96 | # endif | ||
| 97 | |||
| 77 | /* The include_next requires a split double-inclusion guard. */ | 98 | /* The include_next requires a split double-inclusion guard. */ |
| 78 | 99 | ||
| 79 | # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ | 100 | # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ |
diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 4947307e578..1c0c9661bfe 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h | |||
| @@ -77,7 +77,8 @@ | |||
| 77 | 77 | ||
| 78 | /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 | 78 | /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 |
| 79 | and eglibc 2.11.2. | 79 | and eglibc 2.11.2. |
| 80 | May also define off_t to a 64-bit type on native Windows. */ | 80 | May also define off_t to a 64-bit type on native Windows. |
| 81 | Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */ | ||
| 81 | #include <sys/types.h> | 82 | #include <sys/types.h> |
| 82 | 83 | ||
| 83 | /* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */ | 84 | /* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */ |
| @@ -907,14 +908,14 @@ _GL_CXXALIAS_SYS (fwrite, size_t, | |||
| 907 | && !defined __cplusplus) | 908 | && !defined __cplusplus) |
| 908 | # undef fwrite | 909 | # undef fwrite |
| 909 | # undef fwrite_unlocked | 910 | # undef fwrite_unlocked |
| 910 | extern size_t __REDIRECT (rpl_fwrite, | 911 | _GL_EXTERN_C size_t __REDIRECT (rpl_fwrite, |
| 911 | (const void *__restrict, size_t, size_t, | 912 | (const void *__restrict, size_t, size_t, |
| 912 | FILE *__restrict), | 913 | FILE *__restrict), |
| 913 | fwrite); | 914 | fwrite); |
| 914 | extern size_t __REDIRECT (rpl_fwrite_unlocked, | 915 | _GL_EXTERN_C size_t __REDIRECT (rpl_fwrite_unlocked, |
| 915 | (const void *__restrict, size_t, size_t, | 916 | (const void *__restrict, size_t, size_t, |
| 916 | FILE *__restrict), | 917 | FILE *__restrict), |
| 917 | fwrite_unlocked); | 918 | fwrite_unlocked); |
| 918 | # define fwrite rpl_fwrite | 919 | # define fwrite rpl_fwrite |
| 919 | # define fwrite_unlocked rpl_fwrite_unlocked | 920 | # define fwrite_unlocked rpl_fwrite_unlocked |
| 920 | # endif | 921 | # endif |
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index b901d175aeb..e74e7c18d19 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h | |||
| @@ -1591,6 +1591,38 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - " | |||
| 1591 | # endif | 1591 | # endif |
| 1592 | #endif | 1592 | #endif |
| 1593 | 1593 | ||
| 1594 | #if @GNULIB_STRTOF@ | ||
| 1595 | /* Parse a float from STRING, updating ENDP if appropriate. */ | ||
| 1596 | # if @REPLACE_STRTOF@ | ||
| 1597 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 1598 | # define strtof rpl_strtof | ||
| 1599 | # endif | ||
| 1600 | # define GNULIB_defined_strtof_function 1 | ||
| 1601 | _GL_FUNCDECL_RPL (strtof, float, | ||
| 1602 | (const char *restrict str, char **restrict endp) | ||
| 1603 | _GL_ARG_NONNULL ((1))); | ||
| 1604 | _GL_CXXALIAS_RPL (strtof, float, | ||
| 1605 | (const char *restrict str, char **restrict endp)); | ||
| 1606 | # else | ||
| 1607 | # if !@HAVE_STRTOF@ | ||
| 1608 | _GL_FUNCDECL_SYS (strtof, float, | ||
| 1609 | (const char *restrict str, char **restrict endp) | ||
| 1610 | _GL_ARG_NONNULL ((1))); | ||
| 1611 | # endif | ||
| 1612 | _GL_CXXALIAS_SYS (strtof, float, | ||
| 1613 | (const char *restrict str, char **restrict endp)); | ||
| 1614 | # endif | ||
| 1615 | # if __GLIBC__ >= 2 | ||
| 1616 | _GL_CXXALIASWARN (strtof); | ||
| 1617 | # endif | ||
| 1618 | #elif defined GNULIB_POSIXCHECK | ||
| 1619 | # undef strtof | ||
| 1620 | # if HAVE_RAW_DECL_STRTOF | ||
| 1621 | _GL_WARN_ON_USE (strtof, "strtof is unportable - " | ||
| 1622 | "use gnulib module strtof for portability"); | ||
| 1623 | # endif | ||
| 1624 | #endif | ||
| 1625 | |||
| 1594 | #if @GNULIB_STRTOLD@ | 1626 | #if @GNULIB_STRTOLD@ |
| 1595 | /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ | 1627 | /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ |
| 1596 | # if @REPLACE_STRTOLD@ | 1628 | # if @REPLACE_STRTOLD@ |
diff --git a/lib/strftime.c b/lib/strftime.c index 128176cad40..9b205e48023 100644 --- a/lib/strftime.c +++ b/lib/strftime.c | |||
| @@ -141,6 +141,15 @@ extern char *tzname[]; | |||
| 141 | ? (a) >> (b) \ | 141 | ? (a) >> (b) \ |
| 142 | : ((a) + ((a) < 0)) / (1 << (b)) - ((a) < 0)) | 142 | : ((a) + ((a) < 0)) / (1 << (b)) - ((a) < 0)) |
| 143 | 143 | ||
| 144 | enum pad_style | ||
| 145 | { | ||
| 146 | ZERO_PAD, /* (default) Pad with 0 unless format says otherwise. */ | ||
| 147 | ALWAYS_ZERO_PAD, /* '0' Always pad with 0. */ | ||
| 148 | SIGN_PAD, /* '+' Always output a sign. */ | ||
| 149 | SPACE_PAD, /* '_' Pad with space. */ | ||
| 150 | NO_PAD /* '-' Do not pad. */ | ||
| 151 | }; | ||
| 152 | |||
| 144 | #define TM_YEAR_BASE 1900 | 153 | #define TM_YEAR_BASE 1900 |
| 145 | 154 | ||
| 146 | #ifndef __isleap | 155 | #ifndef __isleap |
| @@ -193,7 +202,7 @@ extern char *tzname[]; | |||
| 193 | do \ | 202 | do \ |
| 194 | { \ | 203 | { \ |
| 195 | size_t _n = (n); \ | 204 | size_t _n = (n); \ |
| 196 | size_t _w = pad == L_('-') || width < 0 ? 0 : width; \ | 205 | size_t _w = pad == NO_PAD || width < 0 ? 0 : width; \ |
| 197 | size_t _incr = _n < _w ? _w : _n; \ | 206 | size_t _incr = _n < _w ? _w : _n; \ |
| 198 | if (_incr >= maxsize - i) \ | 207 | if (_incr >= maxsize - i) \ |
| 199 | { \ | 208 | { \ |
| @@ -205,7 +214,7 @@ extern char *tzname[]; | |||
| 205 | if (_n < _w) \ | 214 | if (_n < _w) \ |
| 206 | { \ | 215 | { \ |
| 207 | size_t _delta = _w - _n; \ | 216 | size_t _delta = _w - _n; \ |
| 208 | if (pad == L_('0') || pad == L_('+')) \ | 217 | if (pad == ALWAYS_ZERO_PAD || pad == SIGN_PAD) \ |
| 209 | memset_zero (p, _delta); \ | 218 | memset_zero (p, _delta); \ |
| 210 | else \ | 219 | else \ |
| 211 | memset_space (p, _delta); \ | 220 | memset_space (p, _delta); \ |
| @@ -825,7 +834,7 @@ static CHAR_T const c_month_names[][sizeof "September"] = | |||
| 825 | 834 | ||
| 826 | static size_t __strftime_internal (STREAM_OR_CHAR_T *, STRFTIME_ARG (size_t) | 835 | static size_t __strftime_internal (STREAM_OR_CHAR_T *, STRFTIME_ARG (size_t) |
| 827 | const CHAR_T *, const struct tm *, | 836 | const CHAR_T *, const struct tm *, |
| 828 | bool, int, int, bool * | 837 | bool, enum pad_style, int, bool * |
| 829 | extra_args_spec LOCALE_PARAM); | 838 | extra_args_spec LOCALE_PARAM); |
| 830 | 839 | ||
| 831 | /* Write information from TP into S according to the format | 840 | /* Write information from TP into S according to the format |
| @@ -841,7 +850,8 @@ my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 841 | { | 850 | { |
| 842 | bool tzset_called = false; | 851 | bool tzset_called = false; |
| 843 | return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp, false, | 852 | return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp, false, |
| 844 | 0, -1, &tzset_called extra_args LOCALE_ARG); | 853 | ZERO_PAD, -1, |
| 854 | &tzset_called extra_args LOCALE_ARG); | ||
| 845 | } | 855 | } |
| 846 | libc_hidden_def (my_strftime) | 856 | libc_hidden_def (my_strftime) |
| 847 | 857 | ||
| @@ -853,7 +863,7 @@ static size_t | |||
| 853 | __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | 863 | __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) |
| 854 | const CHAR_T *format, | 864 | const CHAR_T *format, |
| 855 | const struct tm *tp, bool upcase, | 865 | const struct tm *tp, bool upcase, |
| 856 | int yr_spec, int width, bool *tzset_called | 866 | enum pad_style yr_spec, int width, bool *tzset_called |
| 857 | extra_args_spec LOCALE_PARAM) | 867 | extra_args_spec LOCALE_PARAM) |
| 858 | { | 868 | { |
| 859 | #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL | 869 | #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL |
| @@ -977,7 +987,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 977 | 987 | ||
| 978 | for (f = format; *f != '\0'; width = -1, f++) | 988 | for (f = format; *f != '\0'; width = -1, f++) |
| 979 | { | 989 | { |
| 980 | int pad = 0; /* Padding for number ('_', '-', '+', '0', or 0). */ | 990 | enum pad_style pad = ZERO_PAD; |
| 981 | int modifier; /* Field modifier ('E', 'O', or 0). */ | 991 | int modifier; /* Field modifier ('E', 'O', or 0). */ |
| 982 | int digits = 0; /* Max digits for numeric format. */ | 992 | int digits = 0; /* Max digits for numeric format. */ |
| 983 | int number_value; /* Numeric value to be printed. */ | 993 | int number_value; /* Numeric value to be printed. */ |
| @@ -1095,12 +1105,10 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1095 | switch (*++f) | 1105 | switch (*++f) |
| 1096 | { | 1106 | { |
| 1097 | /* This influences the number formats. */ | 1107 | /* This influences the number formats. */ |
| 1098 | case L_('_'): | 1108 | case L_('_'): pad = SPACE_PAD; continue; |
| 1099 | case L_('-'): | 1109 | case L_('-'): pad = NO_PAD; continue; |
| 1100 | case L_('+'): | 1110 | case L_('+'): pad = SIGN_PAD; continue; |
| 1101 | case L_('0'): | 1111 | case L_('0'): pad = ALWAYS_ZERO_PAD; continue; |
| 1102 | pad = *f; | ||
| 1103 | continue; | ||
| 1104 | 1112 | ||
| 1105 | /* This changes textual output. */ | 1113 | /* This changes textual output. */ |
| 1106 | case L_('^'): | 1114 | case L_('^'): |
| @@ -1336,7 +1344,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1336 | # endif | 1344 | # endif |
| 1337 | if (len != 0) | 1345 | if (len != 0) |
| 1338 | { | 1346 | { |
| 1339 | # if defined __NetBSD__ || defined __sun /* NetBSD, Solaris */ | 1347 | # if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 31) || defined __NetBSD__ || defined __sun /* glibc < 2.31, NetBSD, Solaris */ |
| 1340 | if (format_char == L_('c')) | 1348 | if (format_char == L_('c')) |
| 1341 | { | 1349 | { |
| 1342 | /* The output of the strftime %c directive consists of the | 1350 | /* The output of the strftime %c directive consists of the |
| @@ -1374,7 +1382,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1374 | } | 1382 | } |
| 1375 | } | 1383 | } |
| 1376 | } | 1384 | } |
| 1377 | # if REQUIRE_GNUISH_STRFTIME_AM_PM | 1385 | # if (defined __NetBSD__ || defined __sun) && REQUIRE_GNUISH_STRFTIME_AM_PM |
| 1378 | /* The output of the strftime %p and %r directives contains | 1386 | /* The output of the strftime %p and %r directives contains |
| 1379 | an AM/PM indicator even for locales where it is not | 1387 | an AM/PM indicator even for locales where it is not |
| 1380 | suitable, such as French. Remove this indicator. */ | 1388 | suitable, such as French. Remove this indicator. */ |
| @@ -1483,17 +1491,17 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1483 | goto do_number_body; | 1491 | goto do_number_body; |
| 1484 | 1492 | ||
| 1485 | do_yearish: | 1493 | do_yearish: |
| 1486 | if (pad == 0) | 1494 | if (pad == ZERO_PAD) |
| 1487 | pad = yr_spec; | 1495 | pad = yr_spec; |
| 1488 | always_output_a_sign | 1496 | always_output_a_sign |
| 1489 | = (pad == L_('+') | 1497 | = (pad == SIGN_PAD |
| 1490 | && ((digits == 2 ? 99 : 9999) < u_number_value | 1498 | && ((digits == 2 ? 99 : 9999) < u_number_value |
| 1491 | || digits < width)); | 1499 | || digits < width)); |
| 1492 | goto do_maybe_signed_number; | 1500 | goto do_maybe_signed_number; |
| 1493 | 1501 | ||
| 1494 | do_number_spacepad: | 1502 | do_number_spacepad: |
| 1495 | if (pad == 0) | 1503 | if (pad == ZERO_PAD) |
| 1496 | pad = L_('_'); | 1504 | pad = SPACE_PAD; |
| 1497 | 1505 | ||
| 1498 | do_number: | 1506 | do_number: |
| 1499 | /* Format NUMBER_VALUE according to the MODIFIER flag. */ | 1507 | /* Format NUMBER_VALUE according to the MODIFIER flag. */ |
| @@ -1551,8 +1559,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1551 | while (u_number_value != 0 || tz_colon_mask != 0); | 1559 | while (u_number_value != 0 || tz_colon_mask != 0); |
| 1552 | 1560 | ||
| 1553 | do_number_sign_and_padding: | 1561 | do_number_sign_and_padding: |
| 1554 | if (pad == 0) | 1562 | if (pad == ZERO_PAD) |
| 1555 | pad = L_('0'); | 1563 | pad = ALWAYS_ZERO_PAD; |
| 1556 | if (width < 0) | 1564 | if (width < 0) |
| 1557 | width = digits; | 1565 | width = digits; |
| 1558 | 1566 | ||
| @@ -1562,11 +1570,11 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1562 | : 0); | 1570 | : 0); |
| 1563 | int numlen = buf + sizeof buf / sizeof buf[0] - bufp; | 1571 | int numlen = buf + sizeof buf / sizeof buf[0] - bufp; |
| 1564 | int shortage = width - !!sign_char - numlen; | 1572 | int shortage = width - !!sign_char - numlen; |
| 1565 | int padding = pad == L_('-') || shortage <= 0 ? 0 : shortage; | 1573 | int padding = pad == NO_PAD || shortage <= 0 ? 0 : shortage; |
| 1566 | 1574 | ||
| 1567 | if (sign_char) | 1575 | if (sign_char) |
| 1568 | { | 1576 | { |
| 1569 | if (pad == L_('_')) | 1577 | if (pad == SPACE_PAD) |
| 1570 | { | 1578 | { |
| 1571 | if (p) | 1579 | if (p) |
| 1572 | memset_space (p, padding); | 1580 | memset_space (p, padding); |
| @@ -1584,9 +1592,9 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1584 | case L_('F'): | 1592 | case L_('F'): |
| 1585 | if (modifier != 0) | 1593 | if (modifier != 0) |
| 1586 | goto bad_format; | 1594 | goto bad_format; |
| 1587 | if (pad == 0 && width < 0) | 1595 | if (pad == ZERO_PAD && width < 0) |
| 1588 | { | 1596 | { |
| 1589 | pad = L_('+'); | 1597 | pad = SIGN_PAD; |
| 1590 | subwidth = 4; | 1598 | subwidth = 4; |
| 1591 | } | 1599 | } |
| 1592 | else | 1600 | else |
| @@ -1653,8 +1661,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1653 | ndigs--, n /= 10; | 1661 | ndigs--, n /= 10; |
| 1654 | for (int j = ndigs; 0 < j; j--) | 1662 | for (int j = ndigs; 0 < j; j--) |
| 1655 | buf[j - 1] = n % 10 + L_('0'), n /= 10; | 1663 | buf[j - 1] = n % 10 + L_('0'), n /= 10; |
| 1656 | if (!pad) | 1664 | if (pad == ZERO_PAD) |
| 1657 | pad = L_('0'); | 1665 | pad = ALWAYS_ZERO_PAD; |
| 1658 | width_cpy (0, ndigs, buf); | 1666 | width_cpy (0, ndigs, buf); |
| 1659 | width_add (width - ndigs, 0, (void) 0); | 1667 | width_add (width - ndigs, 0, (void) 0); |
| 1660 | } | 1668 | } |
| @@ -1864,7 +1872,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1864 | # else | 1872 | # else |
| 1865 | subfmt = era->era_format; | 1873 | subfmt = era->era_format; |
| 1866 | # endif | 1874 | # endif |
| 1867 | if (pad == 0) | 1875 | if (pad == ZERO_PAD) |
| 1868 | pad = yr_spec; | 1876 | pad = yr_spec; |
| 1869 | goto subformat; | 1877 | goto subformat; |
| 1870 | } | 1878 | } |
| @@ -1887,7 +1895,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1887 | if (era) | 1895 | if (era) |
| 1888 | { | 1896 | { |
| 1889 | int delta = tp->tm_year - era->start_date[0]; | 1897 | int delta = tp->tm_year - era->start_date[0]; |
| 1890 | if (pad == 0) | 1898 | if (pad == ZERO_PAD) |
| 1891 | pad = yr_spec; | 1899 | pad = yr_spec; |
| 1892 | DO_NUMBER (2, (era->offset | 1900 | DO_NUMBER (2, (era->offset |
| 1893 | + delta * era->absolute_direction)); | 1901 | + delta * era->absolute_direction)); |
| @@ -1916,7 +1924,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1916 | { | 1924 | { |
| 1917 | /* The zone string is always given in multibyte form. We have | 1925 | /* The zone string is always given in multibyte form. We have |
| 1918 | to convert it to wide character. */ | 1926 | to convert it to wide character. */ |
| 1919 | size_t w = pad == L_('-') || width < 0 ? 0 : width; | 1927 | size_t w = pad == NO_PAD || width < 0 ? 0 : width; |
| 1920 | char const *z = zone; | 1928 | char const *z = zone; |
| 1921 | mbstate_t st = {0}; | 1929 | mbstate_t st = {0}; |
| 1922 | size_t len = __mbsrtowcs_l (p, &z, maxsize - i, &st, loc); | 1930 | size_t len = __mbsrtowcs_l (p, &z, maxsize - i, &st, loc); |
| @@ -1934,7 +1942,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1934 | { | 1942 | { |
| 1935 | size_t delta = w - len; | 1943 | size_t delta = w - len; |
| 1936 | __wmemmove (p + delta, p, len); | 1944 | __wmemmove (p + delta, p, len); |
| 1937 | wchar_t wc = pad == L_('0') || pad == L_('+') ? L'0' : L' '; | 1945 | wchar_t wc = (pad == ALWAYS_ZERO_PAD || pad == SIGN_PAD |
| 1946 | ? L'0' : L' '); | ||
| 1938 | wmemset (p, wc, delta); | 1947 | wmemset (p, wc, delta); |
| 1939 | } | 1948 | } |
| 1940 | p += incr; | 1949 | p += incr; |
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h index 0a0ccc3c379..4eb2e926960 100644 --- a/lib/sys_types.in.h +++ b/lib/sys_types.in.h | |||
| @@ -60,6 +60,15 @@ | |||
| 60 | # define _GL_WINDOWS_64_BIT_OFF_T 1 | 60 | # define _GL_WINDOWS_64_BIT_OFF_T 1 |
| 61 | #endif | 61 | #endif |
| 62 | 62 | ||
| 63 | /* Define the off64_t type. */ | ||
| 64 | #if !@HAVE_OFF64_T@ | ||
| 65 | # if !GNULIB_defined_off64_t | ||
| 66 | /* Define off64_t to int64_t always. */ | ||
| 67 | typedef long long off64_t; | ||
| 68 | # define GNULIB_defined_off64_t 1 | ||
| 69 | # endif | ||
| 70 | #endif | ||
| 71 | |||
| 63 | /* Override dev_t and ino_t if distinguishable inodes support is requested | 72 | /* Override dev_t and ino_t if distinguishable inodes support is requested |
| 64 | on native Windows. */ | 73 | on native Windows. */ |
| 65 | #if @WINDOWS_STAT_INODES@ | 74 | #if @WINDOWS_STAT_INODES@ |
| @@ -29,6 +29,11 @@ _GL_INLINE_HEADER_BEGIN | |||
| 29 | # define _GL_U64_INLINE _GL_INLINE | 29 | # define _GL_U64_INLINE _GL_INLINE |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | #ifdef __cplusplus | ||
| 33 | extern "C" { | ||
| 34 | #endif | ||
| 35 | |||
| 36 | |||
| 32 | /* Return X rotated left by N bits, where 0 < N < 64. */ | 37 | /* Return X rotated left by N bits, where 0 < N < 64. */ |
| 33 | #define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n)) | 38 | #define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n)) |
| 34 | 39 | ||
| @@ -178,4 +183,9 @@ u64shr (u64 x, int n) | |||
| 178 | 183 | ||
| 179 | #endif | 184 | #endif |
| 180 | 185 | ||
| 186 | |||
| 187 | #ifdef __cplusplus | ||
| 188 | } | ||
| 189 | #endif | ||
| 190 | |||
| 181 | _GL_INLINE_HEADER_END | 191 | _GL_INLINE_HEADER_END |
diff --git a/lib/unistd.in.h b/lib/unistd.in.h index b412966367d..fa99d7472f4 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h | |||
| @@ -159,8 +159,9 @@ | |||
| 159 | #endif | 159 | #endif |
| 160 | 160 | ||
| 161 | /* MSVC defines off_t in <sys/types.h>. | 161 | /* MSVC defines off_t in <sys/types.h>. |
| 162 | May also define off_t to a 64-bit type on native Windows. */ | 162 | May also define off_t to a 64-bit type on native Windows. |
| 163 | /* Get off_t, ssize_t, mode_t. */ | 163 | Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */ |
| 164 | /* Get off_t, off64_t, ssize_t, mode_t. */ | ||
| 164 | #include <sys/types.h> | 165 | #include <sys/types.h> |
| 165 | 166 | ||
| 166 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | 167 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
diff --git a/lib/utimens.h b/lib/utimens.h index 7c740afd36d..b20d4f4f7ee 100644 --- a/lib/utimens.h +++ b/lib/utimens.h | |||
| @@ -23,11 +23,22 @@ | |||
| 23 | #endif | 23 | #endif |
| 24 | 24 | ||
| 25 | #include <time.h> | 25 | #include <time.h> |
| 26 | |||
| 27 | #ifdef __cplusplus | ||
| 28 | extern "C" { | ||
| 29 | #endif | ||
| 30 | |||
| 26 | int fdutimens (int, char const *, struct timespec const [2]); | 31 | int fdutimens (int, char const *, struct timespec const [2]); |
| 27 | int utimens (char const *, struct timespec const [2]); | 32 | int utimens (char const *, struct timespec const [2]); |
| 28 | int lutimens (char const *, struct timespec const [2]); | 33 | int lutimens (char const *, struct timespec const [2]); |
| 29 | 34 | ||
| 35 | #ifdef __cplusplus | ||
| 36 | } | ||
| 37 | #endif | ||
| 38 | |||
| 39 | |||
| 30 | #if GNULIB_FDUTIMENSAT | 40 | #if GNULIB_FDUTIMENSAT |
| 41 | |||
| 31 | # include <fcntl.h> | 42 | # include <fcntl.h> |
| 32 | # include <sys/stat.h> | 43 | # include <sys/stat.h> |
| 33 | 44 | ||
| @@ -36,6 +47,10 @@ _GL_INLINE_HEADER_BEGIN | |||
| 36 | # define _GL_UTIMENS_INLINE _GL_INLINE | 47 | # define _GL_UTIMENS_INLINE _GL_INLINE |
| 37 | #endif | 48 | #endif |
| 38 | 49 | ||
| 50 | #ifdef __cplusplus | ||
| 51 | extern "C" { | ||
| 52 | #endif | ||
| 53 | |||
| 39 | int fdutimensat (int fd, int dir, char const *name, struct timespec const [2], | 54 | int fdutimensat (int fd, int dir, char const *name, struct timespec const [2], |
| 40 | int atflag); | 55 | int atflag); |
| 41 | 56 | ||
| @@ -46,6 +61,10 @@ lutimensat (int dir, char const *file, struct timespec const times[2]) | |||
| 46 | return utimensat (dir, file, times, AT_SYMLINK_NOFOLLOW); | 61 | return utimensat (dir, file, times, AT_SYMLINK_NOFOLLOW); |
| 47 | } | 62 | } |
| 48 | 63 | ||
| 64 | #ifdef __cplusplus | ||
| 65 | } | ||
| 66 | #endif | ||
| 67 | |||
| 49 | _GL_INLINE_HEADER_END | 68 | _GL_INLINE_HEADER_END |
| 50 | 69 | ||
| 51 | #endif | 70 | #endif |