This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: i18n: cp/call.c: get width of translated string right


On Mon, 21 Apr 2003, Zack Weinberg wrote:

> Could you please test that?  I do not have access to older NetBSD
> systems.

Your patch did not work...  But I have modified it some, and have boot-
strapped and tested it on i386-unknown-netbsdelf1.6 (which has a broken
mbstowcs) and i386-unknown-netbsdelf1.6Q (which has a working mbstowcs).

OK to commit?

   /Krister


2003-04-24  Krister Walfridsson  <cato at df dot lth dot se>

	* configure.in: Check whether mbstowcs works.
	* configure, config.in: Regenerate.
	* intl.c: Use HAVE_WORKING_MBSTOWCS.


Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.660
diff -c -3 -p -r1.660 configure.in
*** configure.in	16 Apr 2003 06:51:19 -0000	1.660
--- configure.in	24 Apr 2003 17:39:28 -0000
*************** AC_CHECK_FUNCS(times clock dup2 kill get
*** 789,794 ****
--- 789,812 ----
  	fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \
          scandir alphasort gettimeofday mbstowcs wcswidth)

+ if test x$ac_cv_func_mbstowcs = xyes; then
+   AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
+ [    AC_TRY_RUN([#include <stdlib.h>
+ int main()
+ {
+   mbstowcs(0, "", 0);
+   return 0;
+ }],
+     gcc_cv_func_mbstowcs_works=yes,
+     gcc_cv_func_mbstowcs_works=no,
+     gcc_cv_func_mbstowcs_works=yes)])
+   if test x$gcc_cv_func_mbstowcs_works = xyes; then
+     AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1,
+   [Define this macro if mbstowcs does not crash when its
+    first argument is NULL.])
+   fi
+ fi
+
  AC_CHECK_TYPE(ssize_t, int)

  # Try to determine the array type of the second argument of getgroups
Index: intl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/intl.c,v
retrieving revision 1.7
diff -c -3 -p -r1.7 intl.c
*** intl.c	12 Apr 2003 18:07:04 -0000	1.7
--- intl.c	24 Apr 2003 17:39:28 -0000
*************** gcc_init_libintl ()
*** 45,51 ****
    (void) textdomain ("gcc");
  }

! #if defined HAVE_WCHAR_H && defined HAVE_MBSTOWCS && defined HAVE_WCSWIDTH
  #include <wchar.h>

  /* Returns the width in columns of MSGSTR, which came from gettext.
--- 45,51 ----
    (void) textdomain ("gcc");
  }

! #if defined HAVE_WCHAR_H && defined HAVE_WORKING_MBSTOWCS && defined HAVE_WCSWIDTH
  #include <wchar.h>

  /* Returns the width in columns of MSGSTR, which came from gettext.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]