From b989baba65afd6ccee24b586db0773712222eeb1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 3 Aug 2024 12:14:48 +0200 Subject: [PATCH] Add an xerror_handler parameter to check_message and check_message_list. * gettext-tools/src/msgl-check.h: Include xerror-handler.h. (check_plural_eval, check_message, check_message_list): Add xerror_handler_ty parameter. * gettext-tools/src/msgl-check.c (check_plural_eval, check_plural, check_pair, check_header_entry, check_message, check_message_list): Add xerror_handler_ty parameter. Use it for error handling. (struct formatstring_error_logger_locals): Add xeh field. (formatstring_error_logger): Use it for error handling. * gettext-tools/libgettextpo/gettext-po.c: Don't include po-xerror.h. (po_file_check_all, po_message_check_all): Pass a stack-allocated xerror_handler to check_message_list. (po_message_check_format): Pass a stack-allocated xerror_handler to check_message. * gettext-tools/src/msgfmt.c (main, msgfmt_operand_list_add_from_directory): Use the default xerror_handler. * gettext-tools/src/msgmerge.c (match_domain): Likewise. --- gettext-tools/libgettextpo/gettext-po.c | 71 +++++---- gettext-tools/src/msgfmt.c | 6 +- gettext-tools/src/msgl-check.c | 191 +++++++++++++----------- gettext-tools/src/msgl-check.h | 12 +- gettext-tools/src/msgmerge.c | 2 +- 5 files changed, 149 insertions(+), 133 deletions(-) diff --git a/gettext-tools/libgettextpo/gettext-po.c b/gettext-tools/libgettextpo/gettext-po.c index 43cea1136..acbd4f37e 100644 --- a/gettext-tools/libgettextpo/gettext-po.c +++ b/gettext-tools/libgettextpo/gettext-po.c @@ -34,7 +34,6 @@ #include "read-po-lex.h" #include "write-catalog.h" #include "write-po.h" -#include "po-xerror.h" #include "xvasprintf.h" #include "msgl-check.h" #include "gettext.h" @@ -1093,21 +1092,21 @@ po_file_check_all (po_file_t file, po_xerror_handler_t handler) msgdomain_list_ty *mdlp; size_t k; - /* Establish error handler. */ - po_xerror = - (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *)) - handler->xerror; - po_xerror2 = - (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *, const message_ty *, const char *, size_t, size_t, int, const char *)) - handler->xerror2; + /* Establish error handler for check_message_list(). */ + unsigned int error_count = 0; + struct xerror_handler local_xerror_handler = + { + (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *)) + handler->xerror, + (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *, const message_ty *, const char *, size_t, size_t, int, const char *)) + handler->xerror2, + &error_count + }; mdlp = file->mdlp; for (k = 0; k < mdlp->nitems; k++) - check_message_list (mdlp->item[k]->messages, 1, 1, 1, 1, 1, 0, 0, 0); - - /* Restore error handler. */ - po_xerror = textmode_xerror; - po_xerror2 = textmode_xerror2; + check_message_list (mdlp->item[k]->messages, 1, 1, 1, 1, 1, 0, 0, 0, + &local_xerror_handler); } @@ -1121,13 +1120,16 @@ po_message_check_all (po_message_t message, po_message_iterator_t iterator, { message_ty *mp = (message_ty *) message; - /* Establish error handler. */ - po_xerror = - (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *)) - handler->xerror; - po_xerror2 = - (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *, const message_ty *, const char *, size_t, size_t, int, const char *)) - handler->xerror2; + /* Establish error handler for check_message_list(). */ + unsigned int error_count = 0; + struct xerror_handler local_xerror_handler = + { + (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *)) + handler->xerror, + (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *, const message_ty *, const char *, size_t, size_t, int, const char *)) + handler->xerror2, + &error_count + }; /* For plural checking, combine the message and its header into a small, two-element message list. */ @@ -1164,13 +1166,9 @@ po_message_check_all (po_message_t message, po_message_iterator_t iterator, if (mp != header) message_list_append (&ml, mp); - check_message_list (&ml, 1, 1, 1, 1, 1, 0, 0, 0); + check_message_list (&ml, 1, 1, 1, 1, 1, 0, 0, 0, &local_xerror_handler); } } - - /* Restore error handler. */ - po_xerror = textmode_xerror; - po_xerror2 = textmode_xerror2; } @@ -1182,18 +1180,17 @@ po_message_check_format (po_message_t message, po_xerror_handler_t handler) { message_ty *mp = (message_ty *) message; - /* Establish error handler. */ - po_xerror = - (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *)) - handler->xerror; - po_xerror2 = - (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *, const message_ty *, const char *, size_t, size_t, int, const char *)) - handler->xerror2; + /* Establish error handler for check_message(). */ + unsigned int error_count = 0; + struct xerror_handler local_xerror_handler = + { + (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *)) + handler->xerror, + (void (*) (int, const message_ty *, const char *, size_t, size_t, int, const char *, const message_ty *, const char *, size_t, size_t, int, const char *)) + handler->xerror2, + &error_count + }; if (!mp->obsolete) - check_message (mp, &mp->pos, 0, 1, NULL, 0, 0, 0, 0); - - /* Restore error handler. */ - po_xerror = textmode_xerror; - po_xerror2 = textmode_xerror2; + check_message (mp, &mp->pos, 0, 1, NULL, 0, 0, 0, 0, &local_xerror_handler); } diff --git a/gettext-tools/src/msgfmt.c b/gettext-tools/src/msgfmt.c index d1a275ec6..f7aa19bfb 100644 --- a/gettext-tools/src/msgfmt.c +++ b/gettext-tools/src/msgfmt.c @@ -770,7 +770,8 @@ There is NO WARRANTY, to the extent permitted by law.\n\ 0, 0, 1, check_format_strings, check_header, check_compatibility, - check_accelerators, accelerator_char); + check_accelerators, accelerator_char, + textmode_xerror_handler); /* Exit with status 1 on any error. */ if (nerrors > 0) @@ -1609,7 +1610,8 @@ msgfmt_operand_list_add_from_directory (msgfmt_operand_list_ty *operands, 0, 0, 1, check_format_strings, check_header, check_compatibility, - check_accelerators, accelerator_char); + check_accelerators, accelerator_char, + textmode_xerror_handler); retval += nerrors; if (nerrors > 0) diff --git a/gettext-tools/src/msgl-check.c b/gettext-tools/src/msgl-check.c index 1a668c298..3931a1f36 100644 --- a/gettext-tools/src/msgl-check.c +++ b/gettext-tools/src/msgl-check.c @@ -88,7 +88,8 @@ int check_plural_eval (const struct expression *plural_expr, unsigned long nplurals_value, const message_ty *header, - struct plural_distribution *distribution) + struct plural_distribution *distribution, + xerror_handler_ty xeh) { /* Do as if the plural formula assumes a value N infinitely often if it assumes it at least 5 times. */ @@ -110,14 +111,14 @@ check_plural_eval (const struct expression *plural_expr, if (res.status != PE_OK) { if (res.status == PE_INTDIV) - po_xerror (PO_SEVERITY_ERROR, header, NULL, 0, 0, false, - _("plural expression can produce division by zero")); + xeh->xerror (CAT_SEVERITY_ERROR, header, NULL, 0, 0, false, + _("plural expression can produce division by zero")); else if (res.status == PE_INTOVF) - po_xerror (PO_SEVERITY_ERROR, header, NULL, 0, 0, false, - _("plural expression can produce integer overflow")); + xeh->xerror (CAT_SEVERITY_ERROR, header, NULL, 0, 0, false, + _("plural expression can produce integer overflow")); else if (res.status == PE_STACKOVF) - po_xerror (PO_SEVERITY_ERROR, header, NULL, 0, 0, false, - _("plural expression can produce stack overflow")); + xeh->xerror (CAT_SEVERITY_ERROR, header, NULL, 0, 0, false, + _("plural expression can produce stack overflow")); else /* Other res.status values should not occur. */ abort (); @@ -130,8 +131,8 @@ check_plural_eval (const struct expression *plural_expr, if ((long) val < 0) { - po_xerror (PO_SEVERITY_ERROR, header, NULL, 0, 0, false, - _("plural expression can produce negative values")); + xeh->xerror (CAT_SEVERITY_ERROR, header, NULL, 0, 0, false, + _("plural expression can produce negative values")); free (array); return 1; } @@ -140,7 +141,7 @@ check_plural_eval (const struct expression *plural_expr, char *msg = xasprintf (_("nplurals = %lu but plural expression can produce values as large as %lu"), nplurals_value, val); - po_xerror (PO_SEVERITY_ERROR, header, NULL, 0, 0, false, msg); + xeh->xerror (CAT_SEVERITY_ERROR, header, NULL, 0, 0, false, msg); free (msg); free (array); return 1; @@ -245,7 +246,8 @@ static int check_plural (message_list_ty *mlp, int ignore_untranslated_messages, int ignore_fuzzy_messages, - struct plural_distribution *distributionp) + struct plural_distribution *distributionp, + xerror_handler_ty xeh) { int seen_errors = 0; const message_ty *has_plural; @@ -325,16 +327,16 @@ check_plural (message_list_ty *mlp, if (help != NULL) { char *msg2ext = xasprintf ("%s\n%s", msg2, help); - po_xerror2 (PO_SEVERITY_ERROR, - has_plural, NULL, 0, 0, false, msg1, - header, NULL, 0, 0, true, msg2ext); + xeh->xerror2 (CAT_SEVERITY_ERROR, + has_plural, NULL, 0, 0, false, msg1, + header, NULL, 0, 0, true, msg2ext); free (msg2ext); free (help); } else - po_xerror2 (PO_SEVERITY_ERROR, - has_plural, NULL, 0, 0, false, msg1, - header, NULL, 0, 0, false, msg2); + xeh->xerror2 (CAT_SEVERITY_ERROR, + has_plural, NULL, 0, 0, false, msg1, + header, NULL, 0, 0, false, msg2); seen_errors++; } @@ -349,16 +351,16 @@ check_plural (message_list_ty *mlp, if (help != NULL) { char *msg2ext = xasprintf ("%s\n%s", msg2, help); - po_xerror2 (PO_SEVERITY_ERROR, - has_plural, NULL, 0, 0, false, msg1, - header, NULL, 0, 0, true, msg2ext); + xeh->xerror2 (CAT_SEVERITY_ERROR, + has_plural, NULL, 0, 0, false, msg1, + header, NULL, 0, 0, true, msg2ext); free (msg2ext); free (help); } else - po_xerror2 (PO_SEVERITY_ERROR, - has_plural, NULL, 0, 0, false, msg1, - header, NULL, 0, 0, false, msg2); + xeh->xerror2 (CAT_SEVERITY_ERROR, + has_plural, NULL, 0, 0, false, msg1, + header, NULL, 0, 0, false, msg2); seen_errors++; } @@ -385,13 +387,14 @@ check_plural (message_list_ty *mlp, if (help != NULL) { char *msgext = xasprintf ("%s\n%s", msg, help); - po_xerror (PO_SEVERITY_ERROR, header, NULL, 0, 0, true, - msgext); + xeh->xerror (CAT_SEVERITY_ERROR, header, NULL, 0, 0, true, + msgext); free (msgext); free (help); } else - po_xerror (PO_SEVERITY_ERROR, header, NULL, 0, 0, false, msg); + xeh->xerror (CAT_SEVERITY_ERROR, header, NULL, 0, 0, false, + msg); seen_errors++; } @@ -407,13 +410,14 @@ check_plural (message_list_ty *mlp, if (help != NULL) { char *msgext = xasprintf ("%s\n%s", msg, help); - po_xerror (PO_SEVERITY_ERROR, header, NULL, 0, 0, true, - msgext); + xeh->xerror (CAT_SEVERITY_ERROR, header, NULL, 0, 0, true, + msgext); free (msgext); free (help); } else - po_xerror (PO_SEVERITY_ERROR, header, NULL, 0, 0, false, msg); + xeh->xerror (CAT_SEVERITY_ERROR, header, NULL, 0, 0, false, + msg); seen_errors++; } @@ -423,7 +427,7 @@ check_plural (message_list_ty *mlp, if (!seen_errors) seen_errors = check_plural_eval (plural_expr, nplurals_value, header, - &distribution); + &distribution, xeh); /* Check the number of plurals of the translations. */ if (!seen_errors) @@ -437,9 +441,9 @@ check_plural (message_list_ty *mlp, "but some messages have only %lu plural forms", min_nplurals), min_nplurals); - po_xerror2 (PO_SEVERITY_ERROR, - header, NULL, 0, 0, false, msg1, - min_pos, NULL, 0, 0, false, msg2); + xeh->xerror2 (CAT_SEVERITY_ERROR, + header, NULL, 0, 0, false, msg1, + min_pos, NULL, 0, 0, false, msg2); free (msg2); free (msg1); seen_errors++; @@ -453,9 +457,9 @@ check_plural (message_list_ty *mlp, "but some messages have %lu plural forms", max_nplurals), max_nplurals); - po_xerror2 (PO_SEVERITY_ERROR, - header, NULL, 0, 0, false, msg1, - max_pos, NULL, 0, 0, false, msg2); + xeh->xerror2 (CAT_SEVERITY_ERROR, + header, NULL, 0, 0, false, msg1, + max_pos, NULL, 0, 0, false, msg2); free (msg2); free (msg1); seen_errors++; @@ -472,8 +476,8 @@ check_plural (message_list_ty *mlp, { if (has_plural != NULL) { - po_xerror (PO_SEVERITY_ERROR, has_plural, NULL, 0, 0, false, - _("message catalog has plural form translations, but lacks a header entry with \"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\"")); + xeh->xerror (CAT_SEVERITY_ERROR, has_plural, NULL, 0, 0, false, + _("message catalog has plural form translations, but lacks a header entry with \"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\"")); seen_errors++; } no_plural: @@ -504,6 +508,7 @@ check_plural (message_list_ty *mlp, /* Signal an error when checking format strings. */ struct formatstring_error_logger_locals { + xerror_handler_ty xeh; const message_ty *curr_mp; lex_pos_ty curr_msgid_pos; }; @@ -523,12 +528,13 @@ formatstring_error_logger (void *data, const char *format, ...) va_start (args, format); if (vasprintf (&msg, format, args) < 0) - error (EXIT_FAILURE, 0, _("memory exhausted")); + l->xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false, + _("memory exhausted")); va_end (args); - po_xerror (PO_SEVERITY_ERROR, - l->curr_mp, - l->curr_msgid_pos.file_name, l->curr_msgid_pos.line_number, - (size_t)(-1), false, msg); + l->xeh->xerror (CAT_SEVERITY_ERROR, + l->curr_mp, + l->curr_msgid_pos.file_name, l->curr_msgid_pos.line_number, + (size_t)(-1), false, msg); free (msg); } @@ -550,7 +556,8 @@ check_pair (const message_ty *mp, int check_format_strings, const struct plural_distribution *distribution, int check_compatibility, - int check_accelerators, char accelerator_char) + int check_accelerators, char accelerator_char, + xerror_handler_ty xeh) { int seen_errors; int has_newline; @@ -574,10 +581,10 @@ check_pair (const message_ty *mp, if (TEST_NEWLINE(msgid_plural) != has_newline) { - po_xerror (PO_SEVERITY_ERROR, - mp, msgid_pos->file_name, msgid_pos->line_number, - (size_t)(-1), false, - _("'msgid' and 'msgid_plural' entries do not both begin with '\\n'")); + xeh->xerror (CAT_SEVERITY_ERROR, + mp, msgid_pos->file_name, msgid_pos->line_number, + (size_t)(-1), false, + _("'msgid' and 'msgid_plural' entries do not both begin with '\\n'")); seen_errors++; } for (p = msgstr, j = 0; p < msgstr + msgstr_len; p += strlen (p) + 1, j++) @@ -586,9 +593,9 @@ check_pair (const message_ty *mp, char *msg = xasprintf (_("'msgid' and 'msgstr[%u]' entries do not both begin with '\\n'"), j); - po_xerror (PO_SEVERITY_ERROR, - mp, msgid_pos->file_name, msgid_pos->line_number, - (size_t)(-1), false, msg); + xeh->xerror (CAT_SEVERITY_ERROR, + mp, msgid_pos->file_name, msgid_pos->line_number, + (size_t)(-1), false, msg); free (msg); seen_errors++; } @@ -597,10 +604,10 @@ check_pair (const message_ty *mp, { if (TEST_NEWLINE(msgstr) != has_newline) { - po_xerror (PO_SEVERITY_ERROR, - mp, msgid_pos->file_name, msgid_pos->line_number, - (size_t)(-1), false, - _("'msgid' and 'msgstr' entries do not both begin with '\\n'")); + xeh->xerror (CAT_SEVERITY_ERROR, + mp, msgid_pos->file_name, msgid_pos->line_number, + (size_t)(-1), false, + _("'msgid' and 'msgstr' entries do not both begin with '\\n'")); seen_errors++; } } @@ -615,10 +622,10 @@ check_pair (const message_ty *mp, if (TEST_NEWLINE(msgid_plural) != has_newline) { - po_xerror (PO_SEVERITY_ERROR, - mp, msgid_pos->file_name, msgid_pos->line_number, - (size_t)(-1), false, - _("'msgid' and 'msgid_plural' entries do not both end with '\\n'")); + xeh->xerror (CAT_SEVERITY_ERROR, + mp, msgid_pos->file_name, msgid_pos->line_number, + (size_t)(-1), false, + _("'msgid' and 'msgid_plural' entries do not both end with '\\n'")); seen_errors++; } for (p = msgstr, j = 0; p < msgstr + msgstr_len; p += strlen (p) + 1, j++) @@ -627,9 +634,9 @@ check_pair (const message_ty *mp, char *msg = xasprintf (_("'msgid' and 'msgstr[%u]' entries do not both end with '\\n'"), j); - po_xerror (PO_SEVERITY_ERROR, - mp, msgid_pos->file_name, msgid_pos->line_number, - (size_t)(-1), false, msg); + xeh->xerror (CAT_SEVERITY_ERROR, + mp, msgid_pos->file_name, msgid_pos->line_number, + (size_t)(-1), false, msg); free (msg); seen_errors++; } @@ -638,10 +645,10 @@ check_pair (const message_ty *mp, { if (TEST_NEWLINE(msgstr) != has_newline) { - po_xerror (PO_SEVERITY_ERROR, - mp, msgid_pos->file_name, msgid_pos->line_number, - (size_t)(-1), false, - _("'msgid' and 'msgstr' entries do not both end with '\\n'")); + xeh->xerror (CAT_SEVERITY_ERROR, + mp, msgid_pos->file_name, msgid_pos->line_number, + (size_t)(-1), false, + _("'msgid' and 'msgstr' entries do not both end with '\\n'")); seen_errors++; } } @@ -650,10 +657,10 @@ check_pair (const message_ty *mp, if (check_compatibility && msgid_plural != NULL) { - po_xerror (PO_SEVERITY_ERROR, - mp, msgid_pos->file_name, msgid_pos->line_number, - (size_t)(-1), false, - _("plural handling is a GNU gettext extension")); + xeh->xerror (CAT_SEVERITY_ERROR, + mp, msgid_pos->file_name, msgid_pos->line_number, + (size_t)(-1), false, + _("plural handling is a GNU gettext extension")); seen_errors++; } @@ -662,6 +669,7 @@ check_pair (const message_ty *mp, of format specifications. */ { struct formatstring_error_logger_locals locals; + locals.xeh = xeh; locals.curr_mp = mp; locals.curr_msgid_pos = *msgid_pos; seen_errors += @@ -697,9 +705,9 @@ check_pair (const message_ty *mp, char *msg = xasprintf (_("msgstr lacks the keyboard accelerator mark '%c'"), accelerator_char); - po_xerror (PO_SEVERITY_ERROR, - mp, msgid_pos->file_name, msgid_pos->line_number, - (size_t)(-1), false, msg); + xeh->xerror (CAT_SEVERITY_ERROR, + mp, msgid_pos->file_name, msgid_pos->line_number, + (size_t)(-1), false, msg); free (msg); seen_errors++; } @@ -708,9 +716,9 @@ check_pair (const message_ty *mp, char *msg = xasprintf (_("msgstr has too many keyboard accelerator marks '%c'"), accelerator_char); - po_xerror (PO_SEVERITY_ERROR, - mp, msgid_pos->file_name, msgid_pos->line_number, - (size_t)(-1), false, msg); + xeh->xerror (CAT_SEVERITY_ERROR, + mp, msgid_pos->file_name, msgid_pos->line_number, + (size_t)(-1), false, msg); free (msg); seen_errors++; } @@ -723,7 +731,8 @@ check_pair (const message_ty *mp, /* Perform miscellaneous checks on a header entry. */ static int -check_header_entry (const message_ty *mp, const char *msgstr_string) +check_header_entry (const message_ty *mp, const char *msgstr_string, + xerror_handler_ty xeh) { static const char *required_fields[] = { @@ -753,10 +762,10 @@ check_header_entry (const message_ty *mp, const char *msgstr_string) { #if 0 int severity = - (cnt < nrequiredfields ? PO_SEVERITY_ERROR : PO_SEVERITY_WARNING); + (cnt < nrequiredfields ? CAT_SEVERITY_ERROR : CAT_SEVERITY_WARNING); #else int severity = - PO_SEVERITY_WARNING; + CAT_SEVERITY_WARNING; #endif const char *field = required_fields[cnt]; size_t len = strlen (field); @@ -782,9 +791,9 @@ check_header_entry (const message_ty *mp, const char *msgstr_string) char *msg = xasprintf (_("header field '%s' still has the initial default value\n"), field); - po_xerror (severity, mp, NULL, 0, 0, true, msg); + xeh->xerror (severity, mp, NULL, 0, 0, true, msg); free (msg); - if (severity == PO_SEVERITY_ERROR) + if (severity == CAT_SEVERITY_ERROR) seen_errors++; } } @@ -799,9 +808,9 @@ check_header_entry (const message_ty *mp, const char *msgstr_string) char *msg = xasprintf (_("header field '%s' missing in header\n"), field); - po_xerror (severity, mp, NULL, 0, 0, true, msg); + xeh->xerror (severity, mp, NULL, 0, 0, true, msg); free (msg); - if (severity == PO_SEVERITY_ERROR) + if (severity == CAT_SEVERITY_ERROR) seen_errors++; } } @@ -819,12 +828,13 @@ check_message (const message_ty *mp, const struct plural_distribution *distribution, int check_header, int check_compatibility, - int check_accelerators, char accelerator_char) + int check_accelerators, char accelerator_char, + xerror_handler_ty xeh) { int seen_errors = 0; if (check_header && is_header (mp)) - seen_errors += check_header_entry (mp, mp->msgstr); + seen_errors += check_header_entry (mp, mp->msgstr, xeh); seen_errors += check_pair (mp, mp->msgid, msgid_pos, mp->msgid_plural, @@ -834,7 +844,8 @@ check_message (const message_ty *mp, check_format_strings, distribution, check_compatibility, - check_accelerators, accelerator_char); + check_accelerators, accelerator_char, + xeh); return seen_errors; } @@ -849,7 +860,8 @@ check_message_list (message_list_ty *mlp, int check_format_strings, int check_header, int check_compatibility, - int check_accelerators, char accelerator_char) + int check_accelerators, char accelerator_char, + xerror_handler_ty xeh) { int seen_errors = 0; struct plural_distribution distribution; @@ -862,7 +874,7 @@ check_message_list (message_list_ty *mlp, if (check_header) seen_errors += check_plural (mlp, ignore_untranslated_messages, - ignore_fuzzy_messages, &distribution); + ignore_fuzzy_messages, &distribution, xeh); for (j = 0; j < mlp->nitems; j++) { @@ -876,7 +888,8 @@ check_message_list (message_list_ty *mlp, check_format_strings, &distribution, check_header, check_compatibility, - check_accelerators, accelerator_char); + check_accelerators, accelerator_char, + xeh); } return seen_errors; diff --git a/gettext-tools/src/msgl-check.h b/gettext-tools/src/msgl-check.h index e5c2be0a3..7073bbd09 100644 --- a/gettext-tools/src/msgl-check.h +++ b/gettext-tools/src/msgl-check.h @@ -1,5 +1,5 @@ /* Checking of messages in PO files. - Copyright (C) 2005-2023 Free Software Foundation, Inc. + Copyright (C) 2005-2024 Free Software Foundation, Inc. Written by Bruno Haible , 2005. This program is free software: you can redistribute it and/or modify @@ -22,6 +22,7 @@ #include "pos.h" #include "plural-eval.h" #include "plural-distrib.h" +#include "xerror-handler.h" #ifdef __cplusplus @@ -37,7 +38,8 @@ extern "C" { extern int check_plural_eval (const struct expression *plural_expr, unsigned long nplurals_value, const message_ty *header, - struct plural_distribution *distribution); + struct plural_distribution *distribution, + xerror_handler_ty xeh); /* Perform all checks on a non-obsolete message. */ extern int check_message (const message_ty *mp, @@ -47,7 +49,8 @@ extern int check_message (const message_ty *mp, const struct plural_distribution *distribution, int check_header, int check_compatibility, - int check_accelerators, char accelerator_char); + int check_accelerators, char accelerator_char, + xerror_handler_ty xeh); /* Perform all checks on a message list. Return the number of errors that were seen. */ @@ -58,7 +61,8 @@ extern int check_message_list (message_list_ty *mlp, int check_format_strings, int check_header, int check_compatibility, - int check_accelerators, char accelerator_char); + int check_accelerators, char accelerator_char, + xerror_handler_ty xeh); #ifdef __cplusplus diff --git a/gettext-tools/src/msgmerge.c b/gettext-tools/src/msgmerge.c index 481b3ae87..fd7d8b4c5 100644 --- a/gettext-tools/src/msgmerge.c +++ b/gettext-tools/src/msgmerge.c @@ -1487,7 +1487,7 @@ match_domain (const char *fn1, const char *fn2, po_xerror = silent_xerror; if (check_plural_eval (plural_expr, nplurals, header_entry, - &distribution) > 0) + &distribution, textmode_xerror_handler) > 0) { distribution.expr = NULL; distribution.often = NULL; -- 2.47.2