summaryrefslogtreecommitdiff
path: root/locale/loadlocale.c
diff options
context:
space:
mode:
Diffstat (limited to 'locale/loadlocale.c')
-rw-r--r--locale/loadlocale.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index 2bdb39b4b8..2dba86d773 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -44,8 +44,12 @@ static const size_t _nl_category_num_items[] =
#define NO_PAREN(arg, rest...) arg, ##rest
+/* The size of the array must be specified explicitly because some of
+ the 'items' may be subarrays, which will cause the compiler to deduce
+ an incorrect size from the initializer. */
#define DEFINE_CATEGORY(category, category_name, items, a) \
-static const enum value_type _nl_value_type_##category[] = { NO_PAREN items };
+static const enum value_type _nl_value_type_##category \
+ [_NL_ITEM_INDEX (_NL_NUM_##category)] = { NO_PAREN items };
#define DEFINE_ELEMENT(element, element_name, optstd, type, rest...) \
[_NL_ITEM_INDEX (element)] = type,
#include "categories.def"