Eric Blake wrote: > > I tried to do the update to m4-1.4.13 (using PkgSrc) on AIX and got > > following error: > > > >> CC regex.o > >> "regex_internal.c", line 320.48: 1506-280 (W) Function argument assignment > >> between types "char** restrict" and "int*" is not allowed. > >> "regex_internal.c", line 388.55: 1506-280 (W) Function argument assignment > >> between types "char** restrict" and "int*" is not allowed. > >> "regcomp.c", line 339.63: 1506-280 (W) Function argument assignment > >> between types "char** restrict" and "int*" is not allowed. > >> "regcomp.c", line 411.57: 1506-280 (W) Function argument assignment > >> between types "char** restrict" and "int*" is not allowed. > >> "regcomp.c", line 415.72: 1506-280 (W) Function argument assignment > >> between types "char** restrict" and "int*" is not allowed. > > All of these warnings come from wcrtomb calls.
Yes. The problem is that mbstate_t is #defined to rpl_mbstate_t (due to a bug in the mbrtowc function), but wcrtomb is left alone by gnulib. This fixes it. 2009-05-01 Bruno Haible <br...@clisp.org> * lib/wchar.in.h (wcsnrtombs): Define if REPLACE_WCSNRTOMBS is 1. * m4/wcsnrtombs.m4 (gl_FUNC_WCSRTOMBS): Invoke gl_MBSTATE_T_BROKEN, and set REPLACE_WCSNRTOMBS if mbstate_t must be replaced. * m4/wchar.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WCSNRTOMBS. * modules/wchar (Makefile.am): Substitute REPLACE_WCSNRTOMBS. * modules/wcsnrtombs (Files): Add m4/mbrtowc.m4, m4/locale-ja.m4, m4/locale-zh.m4, m4/codeset.m4. * m4/wcsrtombs.m4 (gl_FUNC_WCSNRTOMBS): Invoke gl_MBSTATE_T_BROKEN, and set REPLACE_WCSRTOMBS if mbstate_t must be replaced. * modules/wcsrtombs (Files): Add m4/mbrtowc.m4, m4/locale-ja.m4, m4/locale-zh.m4. * m4/wcrtomb.m4 (gl_FUNC_WCRTOMB): Invoke gl_MBSTATE_T_BROKEN, and set REPLACE_WCRTOMB if mbstate_t must be replaced. * modules/wcrtomb (Files): Add m4/mbrtowc.m4. Reported by Jens Rehsack <rehs...@googlemail.com> via Eric Blake. *** lib/wchar.in.h.orig 2009-05-01 17:53:37.000000000 +0200 --- lib/wchar.in.h 2009-05-01 17:04:10.000000000 +0200 *************** *** 264,270 **** /* Convert a wide string to a string. */ #if @GNULIB_WCSNRTOMBS@ ! # if !...@have_wcsnrtombs@ extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps); # endif #elif defined GNULIB_POSIXCHECK --- 264,274 ---- /* Convert a wide string to a string. */ #if @GNULIB_WCSNRTOMBS@ ! # if @REPLACE_WCSNRTOMBS@ ! # undef wcsnrtombs ! # define wcsnrtombs rpl_wcsnrtombs ! # endif ! # if !...@have_wcsnrtombs@ || @REPLACE_WCSNRTOMBS@ extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps); # endif #elif defined GNULIB_POSIXCHECK *** m4/wchar.m4.orig 2009-05-01 17:53:37.000000000 +0200 --- m4/wchar.m4 2009-05-01 17:05:23.000000000 +0200 *************** *** 1,13 **** dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. ! dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. ! # wchar.m4 serial 22 AC_DEFUN([gl_WCHAR_H], [ --- 1,13 ---- dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. ! dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. ! # wchar.m4 serial 23 AC_DEFUN([gl_WCHAR_H], [ *************** *** 73,99 **** GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) dnl Assume proper GNU behavior unless another module says otherwise. ! HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) ! HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) ! HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC]) ! HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN]) ! HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS]) ! HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS]) ! HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) ! HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) ! HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) ! HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) ! HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) ! REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) ! REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) ! REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB]) ! REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT]) ! REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC]) ! REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN]) ! REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS]) ! REPLACE_MBSNRTOWCS=0;AC_SUBST([REPLACE_MBSNRTOWCS]) ! REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB]) ! REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) ! REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) ! WCHAR_H=''; AC_SUBST([WCHAR_H]) ]) --- 73,100 ---- GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) dnl Assume proper GNU behavior unless another module says otherwise. ! HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) ! HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) ! HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC]) ! HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN]) ! HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS]) ! HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS]) ! HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) ! HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) ! HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) ! HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) ! HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) ! REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) ! REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) ! REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB]) ! REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT]) ! REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC]) ! REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN]) ! REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS]) ! REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS]) ! REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB]) ! REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) ! REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) ! REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) ! WCHAR_H=''; AC_SUBST([WCHAR_H]) ]) *** m4/wcrtomb.m4.orig 2009-05-01 17:53:37.000000000 +0200 --- m4/wcrtomb.m4 2009-05-01 17:34:57.000000000 +0200 *************** *** 1,4 **** ! # wcrtomb.m4 serial 3 dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ---- ! # wcrtomb.m4 serial 4 dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 9,19 **** AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_CHECK_FUNCS_ONCE([wcrtomb]) if test $ac_cv_func_wcrtomb = no; then HAVE_WCRTOMB=0 ! else ! dnl On AIX 4.3, OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes dnl returns 0 instead of 1. AC_REQUIRE([AC_PROG_CC]) --- 9,23 ---- AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) + gl_MBSTATE_T_BROKEN + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_WCRTOMB=1 + fi AC_CHECK_FUNCS_ONCE([wcrtomb]) if test $ac_cv_func_wcrtomb = no; then HAVE_WCRTOMB=0 ! fi ! if test $HAVE_WCRTOMB != 0 && test $REPLACE_WCRTOMB != 1; then dnl On AIX 4.3, OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes dnl returns 0 instead of 1. AC_REQUIRE([AC_PROG_CC]) *** m4/wcsnrtombs.m4.orig 2009-05-01 17:53:37.000000000 +0200 --- m4/wcsnrtombs.m4 2009-05-01 17:31:35.000000000 +0200 *************** *** 1,5 **** ! # wcsnrtombs.m4 serial 1 ! dnl Copyright (C) 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. --- 1,5 ---- ! # wcsnrtombs.m4 serial 2 ! dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. *************** *** 9,17 **** --- 9,23 ---- AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) + gl_MBSTATE_T_BROKEN + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_WCSNRTOMBS=1 + fi AC_CHECK_FUNCS_ONCE([wcsnrtombs]) if test $ac_cv_func_wcsnrtombs = no; then HAVE_WCSNRTOMBS=0 + fi + if test $HAVE_WCSNRTOMBS = 0 || test $REPLACE_WCSNRTOMBS = 1; then gl_REPLACE_WCHAR_H AC_LIBOBJ([wcsnrtombs]) AC_LIBOBJ([wcsrtombs-state]) *** m4/wcsrtombs.m4.orig 2009-05-01 17:53:37.000000000 +0200 --- m4/wcsrtombs.m4 2009-05-01 17:33:23.000000000 +0200 *************** *** 1,4 **** ! # wcsrtombs.m4 serial 3 dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ---- ! # wcsrtombs.m4 serial 4 dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 9,18 **** AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_CHECK_FUNCS_ONCE([wcsrtombs]) if test $ac_cv_func_wcsrtombs = no; then HAVE_WCSRTOMBS=0 ! else gl_WCSRTOMBS_TERMINATION gl_WCSRTOMBS_NULL case "$gl_cv_func_wcsrtombs_termination" in --- 9,23 ---- AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) + gl_MBSTATE_T_BROKEN + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_WCSRTOMBS=1 + fi AC_CHECK_FUNCS_ONCE([wcsrtombs]) if test $ac_cv_func_wcsrtombs = no; then HAVE_WCSRTOMBS=0 ! fi ! if test $HAVE_WCSRTOMBS != 0 && test $REPLACE_WCSRTOMBS != 1; then gl_WCSRTOMBS_TERMINATION gl_WCSRTOMBS_NULL case "$gl_cv_func_wcsrtombs_termination" in *** modules/wchar.orig 2009-05-01 17:53:37.000000000 +0200 --- modules/wchar 2009-05-01 17:05:41.000000000 +0200 *************** *** 58,63 **** --- 58,64 ---- -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \ -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \ -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ + -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/wchar.in.h; \ *** modules/wcrtomb.orig 2009-05-01 17:53:37.000000000 +0200 --- modules/wcrtomb 2009-05-01 17:36:14.000000000 +0200 *************** *** 4,9 **** --- 4,10 ---- Files: lib/wcrtomb.c m4/wcrtomb.m4 + m4/mbrtowc.m4 m4/mbstate_t.m4 m4/locale-fr.m4 m4/locale-ja.m4 *** modules/wcsnrtombs.orig 2009-05-01 17:53:37.000000000 +0200 --- modules/wcsnrtombs 2009-05-01 17:38:40.000000000 +0200 *************** *** 5,11 **** --- 5,15 ---- lib/wcsnrtombs.c lib/wcsrtombs-state.c m4/wcsnrtombs.m4 + m4/mbrtowc.m4 m4/mbstate_t.m4 + m4/locale-ja.m4 + m4/locale-zh.m4 + m4/codeset.m4 Depends-on: wchar *** modules/wcsrtombs.orig 2009-05-01 17:53:37.000000000 +0200 --- modules/wcsrtombs 2009-05-01 17:38:02.000000000 +0200 *************** *** 5,12 **** --- 5,15 ---- lib/wcsrtombs.c lib/wcsrtombs-state.c m4/wcsrtombs.m4 + m4/mbrtowc.m4 m4/mbstate_t.m4 m4/locale-fr.m4 + m4/locale-ja.m4 + m4/locale-zh.m4 m4/codeset.m4 Depends-on: