From 60530d050b8d50ab442026e6b6fac30245e459fd Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 23 Apr 2017 18:27:44 +0200 Subject: [PATCH] strerror_r-posix: Revert commits from 2016-10-16,2016-11-04,2016-11-14. * m4/strerror_r.m4: Revert changes since 2016-10-16. * lib/strerror_r.c: Likewise. --- ChangeLog | 6 ++++++ lib/strerror_r.c | 2 +- m4/strerror_r.m4 | 26 ++++++-------------------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75e7d8abc9..4c91f4dd2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-04-23 Bruno Haible + + strerror_r-posix: Revert commits from 2016-10-16,2016-11-04,2016-11-14. + * m4/strerror_r.m4: Revert changes since 2016-10-16. + * lib/strerror_r.c: Likewise. + 2017-04-23 Paul Eggert Target a C99 subset, not a C89 subset diff --git a/lib/strerror_r.c b/lib/strerror_r.c index 09ec8d9e15..d7b0f778f0 100644 --- a/lib/strerror_r.c +++ b/lib/strerror_r.c @@ -40,7 +40,7 @@ extern #endif int __xpg_strerror_r (int errnum, char *buf, size_t buflen); -#elif HAVE_DECL_STRERROR_R_ORIG && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) +#elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) /* The system's strerror_r function is OK, except that its third argument is 'int', not 'size_t', or its return type is wrong. */ diff --git a/m4/strerror_r.m4 b/m4/strerror_r.m4 index 1e3e7a7518..28cd0d42d4 100644 --- a/m4/strerror_r.m4 +++ b/m4/strerror_r.m4 @@ -1,4 +1,4 @@ -# strerror_r.m4 serial 18 +# strerror_r.m4 serial 19 dnl Copyright (C) 2002, 2007-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,10 +14,10 @@ AC_DEFUN([gl_FUNC_STRERROR_R], dnl Some systems don't declare strerror_r() if _THREAD_SAFE and _REENTRANT dnl are not defined. - AC_CHECK_DECL([strerror_r], - [HAVE_DECL_STRERROR_R=1], [HAVE_DECL_STRERROR_R=0]) - AC_DEFINE_UNQUOTED([HAVE_DECL_STRERROR_R_ORIG], [$HAVE_DECL_STRERROR_R], - [Define to 1 if you have the declaration of 'strerror_r' in the system include files, or to 0 otherwise.]) + AC_CHECK_DECLS_ONCE([strerror_r]) + if test $ac_cv_have_decl_strerror_r = no; then + HAVE_DECL_STRERROR_R=0 + fi if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then @@ -36,20 +36,6 @@ AC_DEFUN([gl_FUNC_STRERROR_R], REPLACE_STRERROR_R=1 fi fi - - # Overwrite the findings of AC_FUNC_STRERROR_R (for code that uses that). - AC_REQUIRE([AC_FUNC_STRERROR_R]) -]) - -# If this module is in use, we unconditionally want POSIX semantics; so -# replace autoconf's macro with a version that does not probe -AC_DEFUN([AC_FUNC_STRERROR_R], [ - AC_DEFINE([HAVE_DECL_STRERROR_R], [1], - [Define to 1, since you should have the declaration of strerror_r.]) - AC_DEFINE([HAVE_STRERROR_R], [1], - [Define to 1, since you should have the function strerror_r.]) - AC_DEFINE([STRERROR_R_CHAR_P], [0], - [Define to 0, since strerror_r should not return char *.]) ]) # Prerequisites of lib/strerror_r.c. @@ -68,7 +54,7 @@ AC_DEFUN([gl_FUNC_STRERROR_R_WORKS], AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_FUNC_STRERROR_0]) - AC_CHECK_FUNC([strerror_r]) + AC_CHECK_FUNCS_ONCE([strerror_r]) if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then dnl The POSIX prototype is: int strerror_r (int, char *, size_t); -- 2.39.5