This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] localedef: Add --no-warnings/--warnings option
On Okt 17 2017, Carlos O'Donell <carlos@redhat.com> wrote:
> + * locale/programs/record-status.h: Define globals, and function
> + prototypes. Move function bodies...
> + * locale/programs/record-status.c: ... to here. New file.
> + * iconv/Makefile (iconv_prog-modules): Add record-status.
> + * locale/Makefile (lib-modules): Likewise.
> + * iconv/iconv_prog.c: Remove verbose.
> + * iconv/iconv_prog.h: Include record-status.h (defines verbose).
> + * locale/programs/charmap.c (charmap_read): If warn_ascii is true then
> + record a warning about ASCII compatibility.
> + * locale/programs/ld-monetary.c (monetary_finish): If
> + warn_int_curr_symbol is true then record a warning about the symbol
> + not being in our ISO 4217 list.
> + * locale/programs/locale.c: Include record-status.h. Remove verbose.
> + * locale/programs/localedef.c: Include ctype.h. Remove delcaration of
> + verbose, recorded_warning_count, recorded_error_count, and be_quiet.
> + (OPT_NO_WARN): Define.
> + (OPT_WARN): Define.
> + (options): Add entry for --no-warnings, and --warnings.
> + (set_warnings): New function to enable/disable warnings.
> + (parse_opt): Call set_warnings for OPT_NO_WARN and OPT_WARN.
> + * locale/programs/localedef.h: Remove warn_int_curr_symbol.
> + * localedata/gen-locale.sh: Default flags to `--quiet -c'.
> + Add `--no-warnings=ascii' to locales using SHIFT_JIS or SHIFT_JIXX0213.
> + Pass flags to generate_locale.
> + (generate_locale): Accept new flag argument and pass it to localedef
> + invocation.
> + * localedata/Makefile (INSTALL-SUPPORTED-LOCALES): Use
> + --no-warnings=ascii for SHIFT_JIS and SHIFT_JISX0213 charmaps.
Ok.
> @@ -309,6 +307,43 @@ no output file produced because errors were issued"));
> exit (recorded_warning_count != 0);
> }
>
> +/* Search warnings for matching warnings and if found enable those
> + warnings if ENABLED is true, otherwise disable the warnings. */
> +static void
> +set_warnings (char *warnings, bool enabled)
> +{
> + char *tok = warnings;
> + char *copy = (char *) malloc (strlen (warnings) + 1);
> + char *save = copy;
> +
> + /* As we make a copy of the warnings list we remove all spaces from
> + the warnings list to make the processing a more robust. We don't
> + support spaces in a warning name. */
> + do
> + {
> + while (isspace (*tok) != 0)
> + tok++;
> + }
> + while ((*save++ = *tok++));
Implicit boolean coercion.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."