diff options
| author | Paul Eggert | 2020-08-12 11:37:52 -0700 |
|---|---|---|
| committer | Paul Eggert | 2020-08-12 11:45:55 -0700 |
| commit | e697ca152570d59f9b591fc2003292c30d4be050 (patch) | |
| tree | 8cbdaf6e917d0bf5f04d97c56ae650ab05bc0a6c /lib | |
| parent | 9102ecc63b094ffebae2215adc4a840a8b66f6d8 (diff) | |
| download | emacs-e697ca152570d59f9b591fc2003292c30d4be050.tar.gz emacs-e697ca152570d59f9b591fc2003292c30d4be050.zip | |
Update from Gnulib
This incorporates:
2020-08-12 stdint: port intptr_t to more-recent MinGW
2020-08-11 Use __restrict also on clang
2020-08-11 Use flexible array syntax also on clang
2020-08-11 fcntl: On native Windows, use _setmode, not setmode
* lib/binary-io.h, lib/cdefs.h, lib/fcntl.c, lib/regex.h:
* lib/stdint.in.h: Copy from Gnulib.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/binary-io.h | 2 | ||||
| -rw-r--r-- | lib/cdefs.h | 15 | ||||
| -rw-r--r-- | lib/fcntl.c | 4 | ||||
| -rw-r--r-- | lib/regex.h | 17 | ||||
| -rw-r--r-- | lib/stdint.in.h | 5 |
5 files changed, 26 insertions, 17 deletions
diff --git a/lib/binary-io.h b/lib/binary-io.h index 477b4bf4dd3..d17af7c3807 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h | |||
| @@ -56,7 +56,7 @@ __gl_setmode (int fd _GL_UNUSED, int mode _GL_UNUSED) | |||
| 56 | /* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY. | 56 | /* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY. |
| 57 | Return the old mode if successful, -1 (setting errno) on failure. | 57 | Return the old mode if successful, -1 (setting errno) on failure. |
| 58 | Ordinarily this function would be called 'setmode', since that is | 58 | Ordinarily this function would be called 'setmode', since that is |
| 59 | its name on MS-Windows, but it is called 'set_binary_mode' here | 59 | its old name on MS-Windows, but it is called 'set_binary_mode' here |
| 60 | to avoid colliding with a BSD function of another name. */ | 60 | to avoid colliding with a BSD function of another name. */ |
| 61 | 61 | ||
| 62 | #if defined __DJGPP__ || defined __EMX__ | 62 | #if defined __DJGPP__ || defined __EMX__ |
diff --git a/lib/cdefs.h b/lib/cdefs.h index beedd891fb8..4f89f4e4bf0 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h | |||
| @@ -167,8 +167,8 @@ | |||
| 167 | #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc | 167 | #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc |
| 168 | # define __flexarr [] | 168 | # define __flexarr [] |
| 169 | # define __glibc_c99_flexarr_available 1 | 169 | # define __glibc_c99_flexarr_available 1 |
| 170 | #elif __GNUC_PREREQ (2,97) | 170 | #elif __GNUC_PREREQ (2,97) || defined __clang__ |
| 171 | /* GCC 2.97 supports C99 flexible array members as an extension, | 171 | /* GCC 2.97 and clang support C99 flexible array members as an extension, |
| 172 | even when in C89 mode or compiling C++ (any version). */ | 172 | even when in C89 mode or compiling C++ (any version). */ |
| 173 | # define __flexarr [] | 173 | # define __flexarr [] |
| 174 | # define __glibc_c99_flexarr_available 1 | 174 | # define __glibc_c99_flexarr_available 1 |
| @@ -399,8 +399,10 @@ | |||
| 399 | # define __extension__ /* Ignore */ | 399 | # define __extension__ /* Ignore */ |
| 400 | #endif | 400 | #endif |
| 401 | 401 | ||
| 402 | /* __restrict is known in EGCS 1.2 and above. */ | 402 | /* __restrict is known in EGCS 1.2 and above, and in clang. |
| 403 | #if !__GNUC_PREREQ (2,92) | 403 | It works also in C++ mode (outside of arrays), but only when spelled |
| 404 | as '__restrict', not 'restrict'. */ | ||
| 405 | #if !(__GNUC_PREREQ (2,92) || __clang_major__ >= 3) | ||
| 404 | # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L | 406 | # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L |
| 405 | # define __restrict restrict | 407 | # define __restrict restrict |
| 406 | # else | 408 | # else |
| @@ -410,8 +412,9 @@ | |||
| 410 | 412 | ||
| 411 | /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is | 413 | /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is |
| 412 | array_name[restrict] | 414 | array_name[restrict] |
| 413 | GCC 3.1 supports this. */ | 415 | GCC 3.1 and clang support this. |
| 414 | #if __GNUC_PREREQ (3,1) && !defined __GNUG__ | 416 | This syntax is not usable in C++ mode. */ |
| 417 | #if (__GNUC_PREREQ (3,1) || __clang_major__ >= 3) && !defined __cplusplus | ||
| 415 | # define __restrict_arr __restrict | 418 | # define __restrict_arr __restrict |
| 416 | #else | 419 | #else |
| 417 | # ifdef __GNUC__ | 420 | # ifdef __GNUC__ |
diff --git a/lib/fcntl.c b/lib/fcntl.c index 6b9927ec4e5..8cd1531527d 100644 --- a/lib/fcntl.c +++ b/lib/fcntl.c | |||
| @@ -70,14 +70,14 @@ dupfd (int oldfd, int newfd, int flags) | |||
| 70 | return -1; | 70 | return -1; |
| 71 | } | 71 | } |
| 72 | if (old_handle == INVALID_HANDLE_VALUE | 72 | if (old_handle == INVALID_HANDLE_VALUE |
| 73 | || (mode = setmode (oldfd, O_BINARY)) == -1) | 73 | || (mode = _setmode (oldfd, O_BINARY)) == -1) |
| 74 | { | 74 | { |
| 75 | /* oldfd is not open, or is an unassigned standard file | 75 | /* oldfd is not open, or is an unassigned standard file |
| 76 | descriptor. */ | 76 | descriptor. */ |
| 77 | errno = EBADF; | 77 | errno = EBADF; |
| 78 | return -1; | 78 | return -1; |
| 79 | } | 79 | } |
| 80 | setmode (oldfd, mode); | 80 | _setmode (oldfd, mode); |
| 81 | flags |= mode; | 81 | flags |= mode; |
| 82 | 82 | ||
| 83 | for (;;) | 83 | for (;;) |
diff --git a/lib/regex.h b/lib/regex.h index 610f139eb39..306521a3e8a 100644 --- a/lib/regex.h +++ b/lib/regex.h | |||
| @@ -612,7 +612,9 @@ extern int re_exec (const char *); | |||
| 612 | 'configure' might #define 'restrict' to those words, so pick a | 612 | 'configure' might #define 'restrict' to those words, so pick a |
| 613 | different name. */ | 613 | different name. */ |
| 614 | #ifndef _Restrict_ | 614 | #ifndef _Restrict_ |
| 615 | # if defined __restrict || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) | 615 | # if defined __restrict \ |
| 616 | || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ | ||
| 617 | || __clang_major__ >= 3 | ||
| 616 | # define _Restrict_ __restrict | 618 | # define _Restrict_ __restrict |
| 617 | # elif 199901L <= __STDC_VERSION__ || defined restrict | 619 | # elif 199901L <= __STDC_VERSION__ || defined restrict |
| 618 | # define _Restrict_ restrict | 620 | # define _Restrict_ restrict |
| @@ -620,13 +622,18 @@ extern int re_exec (const char *); | |||
| 620 | # define _Restrict_ | 622 | # define _Restrict_ |
| 621 | # endif | 623 | # endif |
| 622 | #endif | 624 | #endif |
| 623 | /* For [restrict], use glibc's __restrict_arr if available. | 625 | /* For the ISO C99 syntax |
| 624 | Otherwise, GCC 3.1 (not in C++ mode) and C99 support [restrict]. */ | 626 | array_name[restrict] |
| 627 | use glibc's __restrict_arr if available. | ||
| 628 | Otherwise, GCC 3.1 and clang support this syntax (but not in C++ mode). | ||
| 629 | Other ISO C99 compilers support it as well. */ | ||
| 625 | #ifndef _Restrict_arr_ | 630 | #ifndef _Restrict_arr_ |
| 626 | # ifdef __restrict_arr | 631 | # ifdef __restrict_arr |
| 627 | # define _Restrict_arr_ __restrict_arr | 632 | # define _Restrict_arr_ __restrict_arr |
| 628 | # elif ((199901L <= __STDC_VERSION__ || 3 < __GNUC__ + (1 <= __GNUC_MINOR__)) \ | 633 | # elif ((199901L <= __STDC_VERSION__ \ |
| 629 | && !defined __GNUG__) | 634 | || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \ |
| 635 | || __clang_major__ >= 3) \ | ||
| 636 | && !defined __cplusplus) | ||
| 630 | # define _Restrict_arr_ _Restrict_ | 637 | # define _Restrict_arr_ _Restrict_ |
| 631 | # else | 638 | # else |
| 632 | # define _Restrict_arr_ | 639 | # define _Restrict_arr_ |
diff --git a/lib/stdint.in.h b/lib/stdint.in.h index 994c0c777c0..63fa1aa628f 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h | |||
| @@ -302,12 +302,11 @@ typedef gl_uint_fast32_t gl_uint_fast16_t; | |||
| 302 | /* kLIBC's <stdint.h> defines _INTPTR_T_DECLARED and needs its own | 302 | /* kLIBC's <stdint.h> defines _INTPTR_T_DECLARED and needs its own |
| 303 | definitions of intptr_t and uintptr_t (which use int and unsigned) | 303 | definitions of intptr_t and uintptr_t (which use int and unsigned) |
| 304 | to avoid clashes with declarations of system functions like sbrk. | 304 | to avoid clashes with declarations of system functions like sbrk. |
| 305 | Similarly, mingw 5.22 <crtdefs.h> defines _INTPTR_T_DEFINED and | 305 | Similarly, MinGW WSL-5.4.1 <stdint.h> needs its own intptr_t and |
| 306 | _UINTPTR_T_DEFINED and needs its own definitions of intptr_t and | ||
| 307 | uintptr_t to avoid conflicting declarations of system functions like | 306 | uintptr_t to avoid conflicting declarations of system functions like |
| 308 | _findclose in <io.h>. */ | 307 | _findclose in <io.h>. */ |
| 309 | # if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \ | 308 | # if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \ |
| 310 | || (defined __MINGW32__ && defined _INTPTR_T_DEFINED && defined _UINTPTR_T_DEFINED)) | 309 | || defined __MINGW32__) |
| 311 | # undef intptr_t | 310 | # undef intptr_t |
| 312 | # undef uintptr_t | 311 | # undef uintptr_t |
| 313 | # ifdef _WIN64 | 312 | # ifdef _WIN64 |