diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-09-17 20:58:01 +0200 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-09-17 18:58:01 +0000 |
commit | 31043f6cfc3612e0278f2dea1a8e3ce050b72798 (patch) | |
tree | 359a816dbf10dd679ca548628aef0b485522372a /gcc/fortran/resolve.c | |
parent | 652b0932d7753aec43306dee62e5005492a6cf3c (diff) | |
download | gcc-31043f6cfc3612e0278f2dea1a8e3ce050b72798.zip gcc-31043f6cfc3612e0278f2dea1a8e3ce050b72798.tar.gz gcc-31043f6cfc3612e0278f2dea1a8e3ce050b72798.tar.bz2 |
re PR fortran/15586 (gfortran should support i18n in its compiler messages)
PR fortran/15586
* arith.c (gfc_arith_error): Add translation support
for error messages.
* array.c (gfc_match_array_ref): Likewise.
(gfc_match_array_spec): Likewise.
* check.c (must_be): Add msgid convention to third argument.
(same_type_check): Add translation support for error message.
(rank_check): Likewise.
(kind_value_check): Likewise.
(gfc_check_associated): Correct typo.
(gfc_check_reshape): Add translation support for error message.
(gfc_check_spread): Likewise.
* error.c (error_printf): Add nocmsgid convention to argument.
(gfc_warning, gfc_notify_std, gfc_warning_now, gfc_warning_check)
(gfc_error, gfc_error_now): Likewise.
(gfc_status): Add cmsgid convention to argument.
* expr.c (gfc_extract_int): Add translation support
for error messages.
(gfc_check_conformance): Add msgid convention to argument.
(gfc_check_pointer_assign): Correct tabbing.
* gfortran.h: Include intl.h header. Remove prototype
for gfc_article.
* gfortranspec.c: Include intl.h header.
(lang_specific_driver): Add translation support for --version.
* io.c (check_format): Add translation support for
error message.
(format_item_1): Likewise.
(data_desc): Likewise.
* matchexp.c: Likewise.
* misc.c (gfc_article): Remove function.
* module.c (bad_module): Use msgid convention. Add
translation support for error messages.
(require_atom): Add translation support for error messages.
* parse.c (gfc_ascii_statement): Likewise.
(gfc_state_name): Likewise.
* primary.c (match_boz_constant): Reorganise error
messages for translations.
* resolve.c (resolve_entries): Likewise.
(resolve_operator): Add translation support for error messages.
(gfc_resolve_expr): Use msgid convention. Reorganise error
messages for translations.
(resolve_symbol): Add translation support for error messages.
* symbol.c (gfc_add_procedure): Remove use of gfc_article function.
* trans-const.c (gfc_build_string_const): Use msgid convention.
* exgettext: Add a new nocmsgid convention for arguments
that should be marked as no-c-format.
* gcc.pot: Regenerate.
From-SVN: r104372
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 99 |
1 files changed, 64 insertions, 35 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 968d137..f941333 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -411,13 +411,27 @@ resolve_entries (gfc_namespace * ns) { sym = el->sym->result; if (sym->attr.dimension) - gfc_error ("%s result %s can't be an array in FUNCTION %s at %L", - el == ns->entries ? "FUNCTION" : "ENTRY", sym->name, - ns->entries->sym->name, &sym->declared_at); + { + if (el == ns->entries) + gfc_error + ("FUNCTION result %s can't be an array in FUNCTION %s at %L", + sym->name, ns->entries->sym->name, &sym->declared_at); + else + gfc_error + ("ENTRY result %s can't be an array in FUNCTION %s at %L", + sym->name, ns->entries->sym->name, &sym->declared_at); + } else if (sym->attr.pointer) - gfc_error ("%s result %s can't be a POINTER in FUNCTION %s at %L", - el == ns->entries ? "FUNCTION" : "ENTRY", sym->name, - ns->entries->sym->name, &sym->declared_at); + { + if (el == ns->entries) + gfc_error + ("FUNCTION result %s can't be a POINTER in FUNCTION %s at %L", + sym->name, ns->entries->sym->name, &sym->declared_at); + else + gfc_error + ("ENTRY result %s can't be a POINTER in FUNCTION %s at %L", + sym->name, ns->entries->sym->name, &sym->declared_at); + } else { ts = &sym->ts; @@ -450,10 +464,18 @@ resolve_entries (gfc_namespace * ns) break; } if (sym) - gfc_error ("%s result %s can't be of type %s in FUNCTION %s at %L", - el == ns->entries ? "FUNCTION" : "ENTRY", sym->name, - gfc_typename (ts), ns->entries->sym->name, - &sym->declared_at); + { + if (el == ns->entries) + gfc_error + ("FUNCTION result %s can't be of type %s in FUNCTION %s at %L", + sym->name, gfc_typename (ts), ns->entries->sym->name, + &sym->declared_at); + else + gfc_error + ("ENTRY result %s can't be of type %s in FUNCTION %s at %L", + sym->name, gfc_typename (ts), ns->entries->sym->name, + &sym->declared_at); + } } } } @@ -1417,7 +1439,7 @@ resolve_operator (gfc_expr * e) break; } - sprintf (msg, "Operand of unary numeric operator '%s' at %%L is %s", + sprintf (msg, _("Operand of unary numeric operator '%s' at %%L is %s"), gfc_op2string (e->value.op.operator), gfc_typename (&e->ts)); goto bad_op; @@ -1433,7 +1455,7 @@ resolve_operator (gfc_expr * e) } sprintf (msg, - "Operands of binary numeric operator '%s' at %%L are %s/%s", + _("Operands of binary numeric operator '%s' at %%L are %s/%s"), gfc_op2string (e->value.op.operator), gfc_typename (&op1->ts), gfc_typename (&op2->ts)); goto bad_op; @@ -1447,7 +1469,7 @@ resolve_operator (gfc_expr * e) } sprintf (msg, - "Operands of string concatenation operator at %%L are %s/%s", + _("Operands of string concatenation operator at %%L are %s/%s"), gfc_typename (&op1->ts), gfc_typename (&op2->ts)); goto bad_op; @@ -1466,7 +1488,7 @@ resolve_operator (gfc_expr * e) break; } - sprintf (msg, "Operands of logical operator '%s' at %%L are %s/%s", + sprintf (msg, _("Operands of logical operator '%s' at %%L are %s/%s"), gfc_op2string (e->value.op.operator), gfc_typename (&op1->ts), gfc_typename (&op2->ts)); @@ -1480,7 +1502,7 @@ resolve_operator (gfc_expr * e) break; } - sprintf (msg, "Operand of .NOT. operator at %%L is %s", + sprintf (msg, _("Operand of .NOT. operator at %%L is %s"), gfc_typename (&op1->ts)); goto bad_op; @@ -1490,7 +1512,7 @@ resolve_operator (gfc_expr * e) case INTRINSIC_LE: if (op1->ts.type == BT_COMPLEX || op2->ts.type == BT_COMPLEX) { - strcpy (msg, "COMPLEX quantities cannot be compared at %L"); + strcpy (msg, _("COMPLEX quantities cannot be compared at %L")); goto bad_op; } @@ -1515,11 +1537,13 @@ resolve_operator (gfc_expr * e) } if (op1->ts.type == BT_LOGICAL && op2->ts.type == BT_LOGICAL) - sprintf (msg, "Logicals at %%L must be compared with %s instead of %s", + sprintf (msg, + _("Logicals at %%L must be compared with %s instead of %s"), e->value.op.operator == INTRINSIC_EQ ? ".EQV." : ".NEQV.", gfc_op2string (e->value.op.operator)); else - sprintf (msg, "Operands of comparison operator '%s' at %%L are %s/%s", + sprintf (msg, + _("Operands of comparison operator '%s' at %%L are %s/%s"), gfc_op2string (e->value.op.operator), gfc_typename (&op1->ts), gfc_typename (&op2->ts)); @@ -1527,10 +1551,10 @@ resolve_operator (gfc_expr * e) case INTRINSIC_USER: if (op2 == NULL) - sprintf (msg, "Operand of user operator '%s' at %%L is %s", + sprintf (msg, _("Operand of user operator '%s' at %%L is %s"), e->value.op.uop->name, gfc_typename (&op1->ts)); else - sprintf (msg, "Operands of user operator '%s' at %%L are %s/%s", + sprintf (msg, _("Operands of user operator '%s' at %%L are %s/%s"), e->value.op.uop->name, gfc_typename (&op1->ts), gfc_typename (&op2->ts)); @@ -2342,24 +2366,26 @@ gfc_resolve_expr (gfc_expr * e) INTEGER or (optionally) REAL type. */ static try -gfc_resolve_iterator_expr (gfc_expr * expr, bool real_ok, const char * name) +gfc_resolve_iterator_expr (gfc_expr * expr, bool real_ok, + const char * name_msgid) { if (gfc_resolve_expr (expr) == FAILURE) return FAILURE; if (expr->rank != 0) { - gfc_error ("%s at %L must be a scalar", name, &expr->where); + gfc_error ("%s at %L must be a scalar", _(name_msgid), &expr->where); return FAILURE; } if (!(expr->ts.type == BT_INTEGER || (expr->ts.type == BT_REAL && real_ok))) { - gfc_error ("%s at %L must be INTEGER%s", - name, - &expr->where, - real_ok ? " or REAL" : ""); + if (real_ok) + gfc_error ("%s at %L must be INTEGER or REAL", _(name_msgid), + &expr->where); + else + gfc_error ("%s at %L must be INTEGER", _(name_msgid), &expr->where); return FAILURE; } return SUCCESS; @@ -4147,9 +4173,12 @@ resolve_symbol (gfc_symbol * sym) || sym->as->type == AS_ASSUMED_SHAPE) && sym->attr.dummy == 0) { - gfc_error ("Assumed %s array at %L must be a dummy argument", - sym->as->type == AS_ASSUMED_SIZE ? "size" : "shape", - &sym->declared_at); + if (sym->as->type == AS_ASSUMED_SIZE) + gfc_error ("Assumed size array at %L must be a dummy argument", + &sym->declared_at); + else + gfc_error ("Assumed shape array at %L must be a dummy argument", + &sym->declared_at); return; } @@ -4265,15 +4294,15 @@ resolve_symbol (gfc_symbol * sym) /* Can the sybol have an initializer? */ whynot = NULL; if (sym->attr.allocatable) - whynot = "Allocatable"; + whynot = _("Allocatable"); else if (sym->attr.external) - whynot = "External"; + whynot = _("External"); else if (sym->attr.dummy) - whynot = "Dummy"; + whynot = _("Dummy"); else if (sym->attr.intrinsic) - whynot = "Intrinsic"; + whynot = _("Intrinsic"); else if (sym->attr.result) - whynot = "Function Result"; + whynot = _("Function Result"); else if (sym->attr.dimension && !sym->attr.pointer) { /* Don't allow initialization of automatic arrays. */ @@ -4284,7 +4313,7 @@ resolve_symbol (gfc_symbol * sym) || sym->as->upper[i] == NULL || sym->as->upper[i]->expr_type != EXPR_CONSTANT) { - whynot = "Automatic array"; + whynot = _("Automatic array"); break; } } |