summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-05-02 15:06:52 +0200
committerJim Meyering <meyering@redhat.com>2011-09-16 14:25:22 +0200
commit93927af364aa09dc23a50ca8e4c9a62af0132c59 (patch)
treefb4d7e8bfb90e9a264e5a56d1521608dbcab7716 /src
parentaeef1229af5f6ad00d466daa32a6af53c3bf0729 (diff)
downloadgrep-93927af364aa09dc23a50ca8e4c9a62af0132c59.tar.gz
build: fix compilation failure when MBS_SUPPORT is 0
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/dfa.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dfa.c b/src/dfa.c
index e99202b7..8303022e 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