bug-grep
[Top][All Lists]
Advanced

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

[PATCH 2/5] build: fix compilation failure when MBS_SUPPORT is 0


From: Jim Meyering
Subject: [PATCH 2/5] build: fix compilation failure when MBS_SUPPORT is 0
Date: Fri, 16 Sep 2011 13:01:30 +0200

From: Jim Meyering <address@hidden>

* src/dfa.c (add_utf8_anychar): Always compile this function,
but when MBS_SUPPORT is 0, give it an empty body.
(prepare_wc_buf): Likewise.
[! MBS_SUPPORT] (setbit_wc): Define to always abort.
---
 src/dfa.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/dfa.c b/src/dfa.c
index e99202b..8303022 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -579,7 +579,8 @@ setbit_c (int b, charclass c)
   setbit (b, c);
 }
 #else
-#define setbit_c setbit
+# define setbit_c setbit
+static inline bool setbit_wc (wint_t wc, charclass c) { abort (); }
 #endif

 /* Like setbit_c, but if case is folded, set both cases of a letter.  For
@@ -1524,10 +1525,10 @@ addtok_wc (wint_t wc)
 static void addtok_wc (wint_t wc) {}
 #endif

-#if MBS_SUPPORT
 static void
 add_utf8_anychar (void)
 {
+#if MBS_SUPPORT
   static const charclass utf8_classes[5] = {
       {  0,  0,  0,  0, ~0, ~0, 0, 0 },            /* 80-bf: non-lead bytes */
       { ~0, ~0, ~0, ~0, 0, 0, 0, 0 },              /* 00-7f: 1-byte sequence */
@@ -1572,8 +1573,8 @@ add_utf8_anychar (void)
       addtok (CAT);
       addtok (OR);
     }
-}
 #endif
+}

 /* The grammar understood by the parser is as follows.

@@ -3141,13 +3142,13 @@ transit_state (struct dfa *d, int s, unsigned char 
const **pp)
   return s1;
 }

-#if MBS_SUPPORT

 /* Initialize mblen_buf and inputwcs with data from the next line.  */

 static void
 prepare_wc_buf (const char *begin, const char *end)
 {
+#if MBS_SUPPORT
   unsigned char eol = eolbyte;
   size_t remain_bytes, i;

@@ -3188,9 +3189,8 @@ prepare_wc_buf (const char *begin, const char *end)
   buf_end = (unsigned char *) (begin + i);
   mblen_buf[i] = 0;
   inputwcs[i] = 0; /* sentinel */
-}
-
 #endif /* MBS_SUPPORT */
+}

 /* Search through a buffer looking for a match to the given struct dfa.
    Find the first occurrence of a string matching the regexp in the
-- 
1.7.7.rc0.362.g5a14




reply via email to

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