autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gettext 0.14.1 - mbrtowc.m4


From: Paul Eggert
Subject: Re: [PATCH] gettext 0.14.1 - mbrtowc.m4
Date: Mon, 24 May 2004 16:19:52 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

"Manu" <address@hidden> writes:

> .\main.c:5: warning: the address of `mbrtowc', will always evaluate as `true'

Thanks for this bug report.  I installed the following somewhat-different
patch into Autoconf, which has the same problem.

2004-05-24  Paul Eggert  <address@hidden>

        * lib/autoconf/functions.m4 (AC_FUNC_MBRTOWC): Don't assume that a
        function F exists if the compiler and linker let you compile an
        expression like (F != 0).  Recent versions of GCC optimize away
        the reference to F in that case, since every function address must
        be nonzero, so the link succeeds even if F does not exist.
        Problem reported by Manu in
        <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00060.html>.

--- functions.m4.~1.83.~        2004-05-03 13:15:44 -0700
+++ functions.m4        2004-05-23 10:34:55 -0700
@@ -889,7 +889,11 @@ AC_DEFUN([AC_FUNC_MBRTOWC],
     [AC_LINK_IFELSE(
        [AC_LANG_PROGRAM(
            address@hidden:@include <wchar.h>]],
-           [[mbstate_t state; return ! (sizeof state && mbrtowc);]])],
+           [[wchar_t wc;
+             char const s[] = "";
+             size_t n = 1;
+             mbstate_t state;
+             return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])],
        ac_cv_func_mbrtowc=yes,
        ac_cv_func_mbrtowc=no)])
   if test $ac_cv_func_mbrtowc = yes; then




reply via email to

[Prev in Thread] Current Thread [Next in Thread]