diff --git a/lib/errno.in.h b/lib/errno.in.h index 0bf5792..eafda21 100644 --- a/lib/errno.in.h +++ b/lib/errno.in.h @@ -172,6 +172,11 @@ # define GNULIB_defined_ECANCELED 1 # endif +# ifndef EILSEQ +# define EILSEQ 2013 +# define GNULIB_defined_EILSEQ 1 +# endif + #endif /* address@hidden@_ERRNO_H */ #endif /* address@hidden@_ERRNO_H */ diff --git a/lib/gettext.h b/lib/gettext.h index 65777e6..1ddd68a 100644 --- a/lib/gettext.h +++ b/lib/gettext.h @@ -185,7 +185,7 @@ npgettext_aux (const char *domain, #include #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ - (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ + (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ /* || __STDC_VERSION__ >= 199901L */ ) #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS diff --git a/lib/math.in.h b/lib/math.in.h index d3b4839..c92703f 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -1188,7 +1188,7 @@ _GL_WARN_REAL_FLOATING_DECL (isnan); _GL_EXTERN_C int gl_signbitf (float arg); _GL_EXTERN_C int gl_signbitd (double arg); _GL_EXTERN_C int gl_signbitl (long double arg); -# if __GNUC__ >= 2 && !__STRICT_ANSI__ +# if __GNUC__ >= 2 && !defined __STRICT_ANSI__ # define _GL_NUM_UINT_WORDS(type) \ ((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf diff --git a/lib/regex.h b/lib/regex.h index 27b2226..ea781e1 100644 --- a/lib/regex.h +++ b/lib/regex.h @@ -644,7 +644,7 @@ extern int re_exec (const char *); #ifndef _Restrict_arr_ # if ((199901L <= __STDC_VERSION__ \ || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \ - && !__STRICT_ANSI__)) \ + && !defined __STRICT_ANSI__)) \ && !defined __GNUG__) # define _Restrict_arr_ _Restrict_ # else diff --git a/lib/regex_internal.h b/lib/regex_internal.h index d7413b0..20cc833 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -334,7 +334,7 @@ typedef struct Idx idx; /* for BACK_REF */ re_context_type ctx_type; /* for ANCHOR */ } opr; -#if __GNUC__ >= 2 && !__STRICT_ANSI__ +#if __GNUC__ >= 2 && !defined __STRICT_ANSI__ re_token_type_t type : 8; #else re_token_type_t type; diff --git a/lib/regexec.c b/lib/regexec.c index 5ad438f..7776f9b 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -3985,7 +3985,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, # endif /* _LIBC */ { /* match with range expression? */ -#if __GNUC__ >= 2 && ! (__STDC_VERSION__ < 199901L && __STRICT_ANSI__) +#if __GNUC__ >= 2 && ! (__STDC_VERSION__ < 199901L && defined __STRICT_ANSI__) wchar_t cmp_buf[] = {L'\0', L'\0', wc, L'\0', L'\0', L'\0'}; #else wchar_t cmp_buf[] = {L'\0', L'\0', L'\0', L'\0', L'\0', L'\0'}; diff --git a/lib/spawn.in.h b/lib/spawn.in.h index 3c31fd0..e326022 100644 --- a/lib/spawn.in.h +++ b/lib/spawn.in.h @@ -63,7 +63,7 @@ #ifndef _Restrict_arr_ # if ((199901L <= __STDC_VERSION__ \ || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \ - && !__STRICT_ANSI__)) \ + && !defined __STRICT_ANSI__)) \ && !defined __GNUG__) # define _Restrict_arr_ _Restrict_ # else diff --git a/lib/stdio.in.h b/lib/stdio.in.h index ebbf801..35c45e1 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -833,7 +833,7 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) -# if defined __GNUC__ +# if defined __GNUC__ && !defined __NeXT__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) /* Don't break __attribute__((format(printf,M,N))). */ # define printf __printf__ diff --git a/m4/absolute-header.m4 b/m4/absolute-header.m4 index b7276a3..e5ffbd0 100644 --- a/m4/absolute-header.m4 +++ b/m4/absolute-header.m4 @@ -81,7 +81,10 @@ changequote(,) gl_dirsep_regex='/' ;; esac - gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'$1|{ + dnl Older seds don't support '\|blah|{...}' + gl_absolute_header_sed='s,\([/.]\),\\\1,g' + gl_absolute_header_match=`printf '%s\n' "${gl_dirsep_regex}"'$1' | sed "$gl_absolute_header_sed"` + gl_absolute_header_sed="/${gl_absolute_header_match}/"'{ s|.*"\(.*'"${gl_dirsep_regex}"'$1\)".*|\1| s|^/[^/]|//&| p diff --git a/m4/frexp.m4 b/m4/frexp.m4 index f2048f3..fe76022 100644 --- a/m4/frexp.m4 +++ b/m4/frexp.m4 @@ -93,6 +93,7 @@ AC_DEFUN([gl_FUNC_FREXP_WORKS], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CHECK_FUNCS_ONCE([setrlimit]) AC_CACHE_CHECK([whether frexp works], [gl_cv_func_frexp_works], [ AC_RUN_IFELSE( @@ -100,6 +101,11 @@ AC_DEFUN([gl_FUNC_FREXP_WORKS], #include #include #include +#ifdef HAVE_SETRLIMIT +# include +# include +# include +#endif /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. ICC 10.0 has a bug when optimizing the expression -zero. The expression -DBL_MIN * DBL_MIN does not work when cross-compiling @@ -120,6 +126,13 @@ int main() int i; volatile double x; double zero = 0.0; +#if defined HAVE_SETRLIMIT && defined RLIMIT_CPU + /* On some systems, calling frexp() with an infinite value causes the + function to spin forever. Five seconds of CPU should be enough. */ + struct rlimit rl; + rl.rlim_cur = rl.rlim_max = 5; + setrlimit(RLIMIT_CPU, &rl); +#endif /* Test on denormalized numbers. */ for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) ; diff --git a/m4/include_next.m4 b/m4/include_next.m4 index d5230ce..638f936 100644 --- a/m4/include_next.m4 +++ b/m4/include_next.m4 @@ -223,7 +223,11 @@ changequote(,) ;; esac changequote([,]) - gl_absolute_header_sed='\|'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[|{ + dnl Older seds don't support '\|blah|{...}' + gl_absolute_header_sed='s,\([/.]\),\\\1,g' + gl_absolute_header_match=`printf '%s\n' "${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[' | + sed "$gl_absolute_header_sed"` + gl_absolute_header_sed="/${gl_absolute_header_match}/"'{ s|.*"\(.*'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[\)".*|\1| changequote(,)dnl s|^/[^/]|//&| diff --git a/m4/perror.m4 b/m4/perror.m4 index 8c28d44..68eee6e 100644 --- a/m4/perror.m4 +++ b/m4/perror.m4 @@ -38,7 +38,8 @@ AC_DEFUN([gl_FUNC_PERROR], perror (""); ]])], [CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 2>conftest.txt2 - if cmp conftest.txt1 conftest.txt2 >/dev/null; then + result=$? + if test $result = 0 && cmp conftest.txt1 conftest.txt2 >/dev/null; then gl_cv_func_perror_works=yes else gl_cv_func_perror_works=no diff --git a/m4/sleep.m4 b/m4/sleep.m4 index 74362e4..fdc1af8 100644 --- a/m4/sleep.m4 +++ b/m4/sleep.m4 @@ -17,7 +17,6 @@ AC_DEFUN([gl_FUNC_SLEEP], if test $ac_cv_have_decl_sleep != yes; then HAVE_SLEEP=0 else - dnl Cygwin 1.5.x has a bug where sleep can't exceed 49.7 days. AC_CACHE_CHECK([for working sleep], [gl_cv_func_sleep_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include @@ -32,14 +31,20 @@ handle_alarm (int sig) ]], [[ /* Failure to compile this test due to missing alarm is okay, since all such platforms (mingw) also lack sleep. */ - unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days. */ +#ifdef __CYGWIN__ + /* Cygwin 1.5.x has a bug where sleep can't exceed 49.7 days. */ + unsigned int period = 50 * 24 * 60 * 60; +#else + /* In case alarm() doesn't work, don't wait too long. */ + unsigned int period = 15; +#endif unsigned int remaining; signal (SIGALRM, handle_alarm); alarm (1); - remaining = sleep (pentecost); - if (remaining > pentecost) + remaining = sleep (period); + if (remaining > period) return 3; - if (remaining <= pentecost - 10) + if (remaining <= period - 10) return 4; return 0; ]])], diff --git a/tests/test-printf-posix.c b/tests/test-printf-posix.c index 9337854..0bc3def 100644 --- a/tests/test-printf-posix.c +++ b/tests/test-printf-posix.c @@ -39,7 +39,7 @@ main (int argc, char *argv[]) } /* Test whether __attribute__ (__format__ (...)) still works. */ -#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !__STRICT_ANSI__ +#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !defined __STRICT_ANSI__ extern int func1 (char *, size_t, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern int func2 (char *, size_t, const char *, ...)