localedef: Update LC_MONETARY handling (Bug 28845)
commit2ab8b74567dc0a9a3c98696e6444881997dd6c49
authorCarlos O'Donell <carlos@redhat.com>
Thu, 3 Feb 2022 21:51:59 +0000 (3 16:51 -0500)
committerCarlos O'Donell <carlos@redhat.com>
Fri, 25 Feb 2022 12:31:27 +0000 (25 07:31 -0500)
tree83be711311d35583db3df31cb7260fabb6602d9d
parentea89d5bbd9e5e514b606045d909e6ab87d851c88
localedef: Update LC_MONETARY handling (Bug 28845)

ISO C17, POSIX Issue 7, and ISO 30112 all allow the char*
types to be empty strings i.e. "", integer or char values to
be -1 or CHAR_MAX respectively, with the exception of
decimal_point which must be non-empty in ISO C. Note that
the defaults for mon_grouping vary, but are functionaly
equivalent e.g. "\177" (no further grouping reuqired) vs.
"" (no grouping defined for all groups).

We include a broad comment talking about harmonizing ISO C,
POSIX, ISO 30112, and the default C/POSIX locale for glibc.

We reorder all setting based on locale/categories.def order.

We soften all missing definitions from errors to warnings when
defaults exist.

Given that ISO C, POSIX and ISO 30112 allow the empty string
we change LC_MONETARY handling of mon_decimal_point to allow
the empty string.  If mon_decimal_point is not defined at all
then we pick the existing legacy glibc default value of
<U002E> i.e. ".".

We also set the default for mon_thousands_sep_wc at the
same time as mon_thousands_sep, but this is not a change in
behaviour, it is always either a matching value or L'\0',
but if in the future we change the default to a non-empty
string we would need to update both at the same time.

Tested on x86_64 and i686 without regressions.
Tested with install-locale-archive target.
Tested with install-locale-files target.

Reviewed-by: DJ Delorie <dj@redhat.com>
locale/programs/ld-monetary.c