From: Bruno Haible Date: Tue, 9 Sep 2025 10:43:00 +0000 (+0200) Subject: mbrtowc: Remove support for OSF/1. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=374f2f93095ac178f8ff3e86dd7071fcb985fae0;p=thirdparty%2Fgnulib.git mbrtowc: Remove support for OSF/1. * m4/mbrtowc.m4 (gl_MBRTOWC_NULL_ARG2): Remove macro. (gl_FUNC_MBRTOWC): Don't invoke it. Don't define MBRTOWC_NULL_ARG2_BUG. (gl_MBRTOWC_INCOMPLETE_STATE): Remove cross-compilation guess for OSF/1. * lib/mbrtowc.c (rpl_mbrtowc): Ignore MBRTOWC_NULL_ARG2_BUG. --- diff --git a/ChangeLog b/ChangeLog index 8b887a9329..0d5202e3f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2025-09-09 Bruno Haible + mbrtowc: Remove support for OSF/1. + * m4/mbrtowc.m4 (gl_MBRTOWC_NULL_ARG2): Remove macro. + (gl_FUNC_MBRTOWC): Don't invoke it. Don't define MBRTOWC_NULL_ARG2_BUG. + (gl_MBRTOWC_INCOMPLETE_STATE): Remove cross-compilation guess for OSF/1. + * lib/mbrtowc.c (rpl_mbrtowc): Ignore MBRTOWC_NULL_ARG2_BUG. + mbrlen: Remove support for OSF/1. * m4/mbrlen.m4 (gl_MBRLEN_INCOMPLETE_STATE): Remove cross-compilation guess for OSF/1. diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c index 6f0aa129b9..3043204929 100644 --- a/lib/mbrtowc.c +++ b/lib/mbrtowc.c @@ -84,7 +84,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) size_t ret; wchar_t wc; -# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG || MBRTOWC_EMPTY_INPUT_BUG +# if MBRTOWC_RETVAL_BUG || MBRTOWC_EMPTY_INPUT_BUG if (s == NULL) { pwc = NULL; diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4 index 364295fe97..4ed9510fd2 100644 --- a/m4/mbrtowc.m4 +++ b/m4/mbrtowc.m4 @@ -1,5 +1,5 @@ # mbrtowc.m4 -# serial 46 +# serial 47 dnl Copyright (C) 2001-2002, 2004-2005, 2008-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -33,7 +33,6 @@ AC_DEFUN([gl_FUNC_MBRTOWC], REPLACE_MBRTOWC=1 else gl_MBRTOWC_NULL_ARG1 - gl_MBRTOWC_NULL_ARG2 gl_MBRTOWC_RETVAL gl_MBRTOWC_NUL_RETVAL gl_MBRTOWC_STORES_INCOMPLETE @@ -46,13 +45,6 @@ AC_DEFUN([gl_FUNC_MBRTOWC], REPLACE_MBRTOWC=1 ;; esac - case "$gl_cv_func_mbrtowc_null_arg2" in - *yes) ;; - *) AC_DEFINE([MBRTOWC_NULL_ARG2_BUG], [1], - [Define if the mbrtowc function has the NULL string argument bug.]) - REPLACE_MBRTOWC=1 - ;; - esac case "$gl_cv_func_mbrtowc_retval" in *yes) ;; *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1], @@ -170,10 +162,10 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on AIX and OSF/1. - aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; + # Guess no on AIX. + aix*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_JA != none; then @@ -346,57 +338,6 @@ int main () ]) ]) -dnl Test whether mbrtowc supports a NULL string argument correctly. -dnl Result is gl_cv_func_mbrtowc_null_arg2. - -AC_DEFUN([gl_MBRTOWC_NULL_ARG2], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gt_LOCALE_EN_UTF8]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], - [gl_cv_func_mbrtowc_null_arg2], - [ - dnl Initial guess, used when cross-compiling or when no suitable locale - dnl is present. -changequote(,)dnl - case "$host_os" in - # Guess no on OSF/1. - osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; - esac -changequote([,])dnl - if test "$LOCALE_EN_UTF8" != none; then - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include -#include -#include -int main () -{ - if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) - { - mbstate_t state; - wchar_t wc; - int ret; - - memset (&state, '\0', sizeof (mbstate_t)); - wc = (wchar_t) 0xBADFACE; - mbrtowc (&wc, NULL, 5, &state); - /* Check that wc was not modified. */ - if (wc != (wchar_t) 0xBADFACE) - return 2; - } - return 0; -}]])], - [gl_cv_func_mbrtowc_null_arg2=yes], - [gl_cv_func_mbrtowc_null_arg2=no], - [:]) - fi - ]) -]) - dnl Test whether mbrtowc, when parsing the end of a multibyte character, dnl correctly returns the number of bytes that were needed to complete the dnl character (not the total number of bytes of the multibyte character).