When multibyte support is disabled, locale_utf8locale and UTF8_SINGLEBYTE are not available. This causes a compilation error in lib/glob/smatch.c in functions like is_cclass, collseqcmp, and the FOLD macro.
This fixes the following failure seen with br-arm-basic toolchain: strmatch.c:145:7: error: 'locale_utf8locale' undeclared (first use in this function) 145 | if (locale_utf8locale && (UTF8_SINGLEBYTE (c) == 0 || UTF8_SINGLEBYTE (equiv) == 0)) Signed-off-by: Shubham Chakraborty <[email protected]> --- lib/glob/smatch.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/glob/smatch.c b/lib/glob/smatch.c index e42b8fc..b437062 100644 --- a/lib/glob/smatch.c +++ b/lib/glob/smatch.c @@ -141,9 +141,11 @@ rangecmp (int c1, int c2, int forcecoll) static int collseqcmp (int c, int equiv) { +#if HANDLE_MULTIBYTE /* Make sure characters >= 0x80 are compared as bytes in a UTF-8 locale. */ if (locale_utf8locale && (UTF8_SINGLEBYTE (c) == 0 || UTF8_SINGLEBYTE (equiv) == 0)) return (c == equiv); +#endif if (charcmp (c, equiv, 1) == 0) return 1; @@ -285,8 +287,10 @@ is_cclass (int c, const char *name) enum char_class char_class; int result; +#if HANDLE_MULTIBYTE if (locale_utf8locale && UTF8_SINGLEBYTE (c) == 0) return -1; +#endif char_class = is_valid_cclass (name); if (char_class == CC_NO_CLASS) @@ -298,10 +302,17 @@ is_cclass (int c, const char *name) /* Now include `sm_loop.c' for single-byte characters. */ /* The result of FOLD is an `unsigned char' */ +#if HANDLE_MULTIBYTE # define FOLD(c) \ (((flags & FNM_CASEFOLD) && (locale_utf8locale == 0 || UTF8_SINGLEBYTE (c))) \ ? TOLOWER ((unsigned char)c) \ : ((unsigned char)c)) +#else +# define FOLD(c) \ + ((flags & FNM_CASEFOLD) \ + ? TOLOWER ((unsigned char)c) \ + : ((unsigned char)c)) +#endif #if !defined (__CYGWIN__) # define ISDIRSEP(c) ((c) == '/') -- 2.55.0
