[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 3/4] dfa/grep: fix compilation with MBS_SUPPORT
From: |
Jim Meyering |
Subject: |
Re: [PATCH v2 3/4] dfa/grep: fix compilation with MBS_SUPPORT |
Date: |
Thu, 25 Mar 2010 11:22:43 +0100 |
Paolo Bonzini wrote:
> From: Norihirio Tanaka <address@hidden>
>
> * src/dfa.c (cur_mb_len): Initialize to 1 and always make it available.
> (parse_bracket_exp): Fix compilation with !MBS_SUPPORT.
> * src/kwsearch.c (kwsinit): Do not use mbtolower and MB_CUR_MAX
> if !MBS_SUPPORT.
> * src/searchutils.c (kwsinit): Do not refer to MB_CUR_MAX if !MBS_SUPPORT.
> ---
> src/dfa.c | 12 ++++++++----
> src/kwsearch.c | 2 ++
> src/searchutils.c | 6 +++++-
> 3 files changed, 15 insertions(+), 5 deletions(-)
This is a fine start, but it is incomplete.
When I simulate lack of MBS_SUPPORT with this temporary change,
diff --git a/src/mbsupport.h b/src/mbsupport.h
index 40a85ab..cc95e2c 100644
--- a/src/mbsupport.h
+++ b/src/mbsupport.h
@@ -30,7 +30,7 @@
#include <stdlib.h>
#endif
-#if defined(HAVE_WCSCOLL) && defined(HAVE_ISWCTYPE)
+#if 0 && defined(HAVE_WCSCOLL) && defined(HAVE_ISWCTYPE)
# define MBS_SUPPORT 1
#else
# undef MBS_SUPPORT
and try to build, I saw these errors:
dfa.c:246: error: expected ')' before 'b'
cc1: warnings being treated as errors
dfa.c: In function 'parse_bracket_exp':
dfa.c:571: error: implicit declaration of function 'setbit_case_fold'
[-Wimplicit-function-declaration]
dfa.c:694: error: 'wc' undeclared (first use in this function)
dfa.c:694: error: (Each undeclared identifier is reported only once
dfa.c:694: error: for each function it appears in.)
make[2]: *** [dfa.o] Error 1
Here's a start:
Include wchar.h and wctype.h unconditionally, since
gnulib provides them:
diff --git a/src/dfa.c b/src/dfa.c
index e2e45fd..b74a62e 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -76,10 +76,10 @@
#define _(str) gettext (str)
#include "mbsupport.h" /* defines MBS_SUPPORT if appropriate */
-#ifdef MBS_SUPPORT
/* We can handle multibyte strings. */
-# include <wchar.h>
-# include <wctype.h>
+#include <wchar.h>
+#include <wctype.h>
+#if HAVE_LANGINFO_CODESET
# include <langinfo.h>
#endif