Commit a3c55309 authored by Paul Eggert's avatar Paul Eggert

Update from Gnulib.

This incorporates:
2019-03-23 Support cross-compilation to musl libc
2019-03-23 noreturn: In C++ mode with clang, use _Noreturn as fallback
2019-03-22 _Noreturn: beware of C's _Noreturn in C++ pre C++11
2019-03-19 Help making signal handlers more reliable
2019-03-18 _Noreturn: clang and MSVC do support [[noreturn]] in C++11
2019-03-17 _Noreturn: GCC 4.7 does not support [[noreturn]] in C++11
2019-03-14 all: Update URLs to msdn.microsoft.com
* doc/misc/texinfo.tex, lib/_Noreturn.h, lib/gettimeofday.c:
* lib/mktime.c, lib/regcomp.c, lib/regexec.c, lib/stat-time.h:
* lib/utimens.c, m4/fdopendir.m4, m4/getgroups.m4:
* m4/gettimeofday.m4, m4/gnulib-common.m4, m4/putenv.m4, m4/utimes.m4:
Update from gnulib.
parent d43af7b6
Pipeline #1078 failed with stage
in 60 minutes and 1 second
This diff is collapsed.
#ifndef _Noreturn
# if 201103 <= (defined __cplusplus ? __cplusplus : 0)
# if (defined __cplusplus \
&& ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
|| (defined _MSC_VER && 1900 <= _MSC_VER)))
# define _Noreturn [[noreturn]]
# elif (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__))
# elif ((!defined __cplusplus || defined __clang__) \
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
/* _Noreturn works as-is. */
# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
# define _Noreturn __attribute__ ((__noreturn__))
......
......@@ -72,10 +72,10 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz)
/* On native Windows, there are two ways to get the current time:
GetSystemTimeAsFileTime
<https://msdn.microsoft.com/en-us/library/ms724397.aspx>
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime>
or
GetSystemTimePreciseAsFileTime
<https://msdn.microsoft.com/en-us/library/hh706895.aspx>.
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>.
GetSystemTimeAsFileTime produces values that jump by increments of
15.627 milliseconds (!) on average.
Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2
......@@ -92,7 +92,7 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz)
GetSystemTimeAsFileTime (&current_time);
/* Convert from FILETIME to 'struct timeval'. */
/* FILETIME: <https://msdn.microsoft.com/en-us/library/ms724284.aspx> */
/* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */
ULONGLONG since_1601 =
((ULONGLONG) current_time.dwHighDateTime << 32)
| (ULONGLONG) current_time.dwLowDateTime;
......
......@@ -72,7 +72,7 @@ my_tzset (void)
/* Rectify the value of the environment variable TZ.
There are four possible kinds of such values:
- Traditional US time zone names, e.g. "PST8PDT". Syntax: see
<https://msdn.microsoft.com/en-us/library/90s5c885.aspx>
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tzset>
- Time zone names based on geography, that contain one or more
slashes, e.g. "Europe/Moscow".
- Time zone names based on geography, without slashes, e.g.
......
......@@ -1800,8 +1800,8 @@ peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
token->word_char = 0;
#ifdef RE_ENABLE_I18N
token->mb_partial = 0;
if (input->mb_cur_max > 1 &&
!re_string_first_byte (input, re_string_cur_idx (input)))
if (input->mb_cur_max > 1
&& !re_string_first_byte (input, re_string_cur_idx (input)))
{
token->type = CHARACTER;
token->mb_partial = 1;
......@@ -1988,8 +1988,8 @@ peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
token->type = OP_PERIOD;
break;
case '^':
if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) &&
re_string_cur_idx (input) != 0)
if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE))
&& re_string_cur_idx (input) != 0)
{
char prev = re_string_peek_byte (input, -1);
if (!(syntax & RE_NEWLINE_ALT) || prev != '\n')
......@@ -1999,8 +1999,8 @@ peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
token->opr.ctx_type = LINE_FIRST;
break;
case '$':
if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) &&
re_string_cur_idx (input) + 1 != re_string_length (input))
if (!(syntax & RE_CONTEXT_INDEP_ANCHORS)
&& re_string_cur_idx (input) + 1 != re_string_length (input))
{
re_token_t next;
re_string_skip_bytes (input, 1);
......@@ -2034,8 +2034,8 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
token->opr.c = c;
#ifdef RE_ENABLE_I18N
if (input->mb_cur_max > 1 &&
!re_string_first_byte (input, re_string_cur_idx (input)))
if (input->mb_cur_max > 1
&& !re_string_first_byte (input, re_string_cur_idx (input)))
{
token->type = CHARACTER;
return 1;
......@@ -2333,8 +2333,8 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
}
FALLTHROUGH;
case OP_CLOSE_SUBEXP:
if ((token->type == OP_CLOSE_SUBEXP) &&
!(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD))
if ((token->type == OP_CLOSE_SUBEXP)
&& !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD))
{
*err = REG_ERPAREN;
return NULL;
......
......@@ -2204,9 +2204,9 @@ sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx,
int naccepted;
/* Check the node can accept "multi byte". */
naccepted = check_node_accept_bytes (dfa, node_idx, &mctx->input, str_idx);
if (naccepted > 0 && str_idx + naccepted <= max_str_idx &&
!STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + naccepted],
dfa->nexts[node_idx]))
if (naccepted > 0 && str_idx + naccepted <= max_str_idx
&& !STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + naccepted],
dfa->nexts[node_idx]))
/* The node can't accept the "multi byte", or the
destination was already thrown away, then the node
couldn't accept the current input "multi byte". */
......@@ -3782,10 +3782,10 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
/* FIXME: I don't think this if is needed, as both '\n'
and '\0' are char_len == 1. */
/* '.' accepts any one character except the following two cases. */
if ((!(dfa->syntax & RE_DOT_NEWLINE) &&
re_string_byte_at (input, str_idx) == '\n') ||
((dfa->syntax & RE_DOT_NOT_NULL) &&
re_string_byte_at (input, str_idx) == '\0'))
if ((!(dfa->syntax & RE_DOT_NEWLINE)
&& re_string_byte_at (input, str_idx) == '\n')
|| ((dfa->syntax & RE_DOT_NOT_NULL)
&& re_string_byte_at (input, str_idx) == '\0'))
return 0;
return char_len;
}
......
......@@ -171,7 +171,7 @@ get_stat_birthtime (struct stat const *st _GL_UNUSED)
#elif defined _WIN32 && ! defined __CYGWIN__
/* Native Windows platforms (but not Cygwin) put the "file creation
time" in st_ctime (!). See
<https://msdn.microsoft.com/en-us/library/14h5k7ff(VS.80).aspx>. */
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions>. */
# if _GL_WINDOWS_STAT_TIMESPEC
t = st->st_ctim;
# else
......
......@@ -288,8 +288,8 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2])
#ifdef USE_SETFILETIME
/* On native Windows, use SetFileTime(). See
<https://msdn.microsoft.com/en-us/library/ms724933.aspx>
<https://msdn.microsoft.com/en-us/library/ms724284.aspx> */
<https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-setfiletime>
<https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */
if (0 <= fd)
{
HANDLE handle;
......@@ -307,10 +307,10 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2])
if (ts == NULL || ts[0].tv_nsec == UTIME_NOW || ts[1].tv_nsec == UTIME_NOW)
{
/* GetSystemTimeAsFileTime
<https://msdn.microsoft.com/en-us/library/ms724397.aspx>.
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime>.
It would be overkill to use
GetSystemTimePreciseAsFileTime
<https://msdn.microsoft.com/en-us/library/hh706895.aspx>. */
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>. */
GetSystemTimeAsFileTime (&current_time);
}
......
# serial 10
# serial 11
# See if we need to provide fdopendir.
dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
......@@ -45,10 +45,12 @@ DIR *fdopendir (int);
[gl_cv_func_fdopendir_works=yes],
[gl_cv_func_fdopendir_works=no],
[case "$host_os" in
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_fdopendir_works="guessing no" ;;
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;;
# Guess yes on musl systems.
*-musl*) gl_cv_func_fdopendir_works="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_fdopendir_works="guessing no" ;;
esac
])])
case "$gl_cv_func_fdopendir_works" in
......
# serial 21
# serial 22
dnl From Jim Meyering.
dnl A wrapper around AC_FUNC_GETGROUPS.
......@@ -42,6 +42,8 @@ AC_DEFUN([AC_FUNC_GETGROUPS],
[case "$host_os" in # ((
# Guess yes on glibc systems.
*-gnu* | gnu*) ac_cv_func_getgroups_works="guessing yes" ;;
# Guess yes on musl systems.
*-musl*) ac_cv_func_getgroups_works="guessing yes" ;;
# If we don't know, assume the worst.
*) ac_cv_func_getgroups_works="guessing no" ;;
esac
......@@ -95,6 +97,8 @@ AC_DEFUN([gl_FUNC_GETGROUPS],
[case "$host_os" in
# Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_getgroups_works="guessing yes" ;;
# Guess yes on musl systems.
*-musl*) gl_cv_func_getgroups_works="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_getgroups_works="guessing no" ;;
esac
......
# serial 25
# serial 26
# Copyright (C) 2001-2003, 2005, 2007, 2009-2019 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
......@@ -105,6 +105,8 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
case "$host_os" in
# Guess all is fine on glibc systems.
*-gnu* | gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
# Guess all is fine on musl systems.
*-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
# Guess no on native Windows.
mingw*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
# If we don't know, assume the worst.
......
# gnulib-common.m4 serial 41
# gnulib-common.m4 serial 44
dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -17,10 +17,13 @@ AC_DEFUN([gl_COMMON_BODY], [
AH_VERBATIM([_Noreturn],
[/* The _Noreturn keyword of C11. */
#ifndef _Noreturn
# if 201103 <= (defined __cplusplus ? __cplusplus : 0)
# if (defined __cplusplus \
&& ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
|| (defined _MSC_VER && 1900 <= _MSC_VER)))
# define _Noreturn [[noreturn]]
# elif (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__))
# elif ((!defined __cplusplus || defined __clang__) \
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
/* _Noreturn works as-is. */
# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
# define _Noreturn __attribute__ ((__noreturn__))
......@@ -84,6 +87,33 @@ AC_DEFUN([gl_COMMON_BODY], [
#else
# define _GL_ATTRIBUTE_MALLOC /* empty */
#endif
])
AH_VERBATIM([async_safe],
[/* The _GL_ASYNC_SAFE marker should be attached to functions that are
signal handlers (for signals other than SIGABRT, SIGPIPE) or can be
invoked from such signal handlers. Such functions have some restrictions:
* All functions that it calls should be marked _GL_ASYNC_SAFE as well,
or should be listed as async-signal-safe in POSIX
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04>
section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in
particular, are NOT async-signal-safe.
* All memory locations (variables and struct fields) that these functions
access must be marked 'volatile'. This holds for both read and write
accesses. Otherwise the compiler might optimize away stores to and
reads from such locations that occur in the program, depending on its
data flow analysis. For example, when the program contains a loop
that is intended to inspect a variable set from within a signal handler
while (!signal_occurred)
;
the compiler is allowed to transform this into an endless loop if the
variable 'signal_occurred' is not declared 'volatile'.
Additionally, recall that:
* A signal handler should not modify errno (except if it is a handler
for a fatal signal and ends by raising the same signal again, thus
provoking the termination of the process). If it invokes a function
that may clobber errno, it needs to save and restore the value of
errno. */
#define _GL_ASYNC_SAFE
])
dnl Preparation for running test programs:
dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not
......
# putenv.m4 serial 22
# putenv.m4 serial 23
dnl Copyright (C) 2002-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -36,6 +36,8 @@ AC_DEFUN([gl_FUNC_PUTENV],
[case "$host_os" in
# Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_svid_putenv="guessing yes" ;;
# Guess yes on musl systems.
*-musl*) gl_cv_func_svid_putenv="guessing yes" ;;
# Guess no on native Windows.
mingw*) gl_cv_func_svid_putenv="guessing no" ;;
# If we don't know, assume the worst.
......
# Detect some bugs in glibc's implementation of utimes.
# serial 5
# serial 6
dnl Copyright (C) 2003-2005, 2009-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
......@@ -143,9 +143,11 @@ main ()
[gl_cv_func_working_utimes=yes],
[gl_cv_func_working_utimes=no],
[case "$host_os" in
# Guess no on native Windows.
mingw*) gl_cv_func_working_utimes="guessing no" ;;
*) gl_cv_func_working_utimes="guessing no" ;;
# Guess yes on musl systems.
*-musl*) gl_cv_func_working_utimes="guessing yes" ;;
# Guess no on native Windows.
mingw*) gl_cv_func_working_utimes="guessing no" ;;
*) gl_cv_func_working_utimes="guessing no" ;;
esac
])
])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment