From 1807336828d8b0d2092fc41003484ae2ba1d9e11 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 22 Aug 2024 21:21:51 +0200 Subject: [PATCH] locales: Fix definition of lc_messages_T::codeset nl_langinfo_l accesses lc_messages_T::codeset as soon as __HAVE_LOCALE_INFO__ is defined, but codeset only exists if __HAVE_LOCALE_INFO_EXTENDED__ is defined. Fix this by defining lc_messages_T::codeset depending on __HAVE_LOCALE_INFO__. Fixes: ac7f1d5e931c ("Get rid of LCID, reformat type definitions in setlocale.h") Reported-by: Inglis Signed-off-by: Corinna Vinschen --- newlib/libc/locale/setlocale.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h index 7abf92f7e..e91034ac8 100644 --- a/newlib/libc/locale/setlocale.h +++ b/newlib/libc/locale/setlocale.h @@ -162,13 +162,15 @@ struct lc_messages_T const char *noexpr; const char *yesstr; const char *nostr; -#ifdef __HAVE_LOCALE_INFO_EXTENDED__ +#ifdef __HAVE_LOCALE_INFO__ const char *codeset; /* codeset for mbtowc conversion */ +#ifdef __HAVE_LOCALE_INFO_EXTENDED__ const wchar_t *wyesexpr; const wchar_t *wnoexpr; const wchar_t *wyesstr; const wchar_t *wnostr; #endif +#endif }; extern const struct lc_messages_T _C_messages_locale;