https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68815
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #0)
> In several cases - as in this one - the code enters as fmt string of a
> diagnostic function (visible as %%L is used). In those cases, '%s' can be
> replaced by %%<%s%%>.
That only seems to be the case for resolve.c.
For expr.c's gfc_check_conformance - used by intrinsic.c and check.c, it enters
as
"%s", buffer
And the same seems to be true for all '%s' in interface.c.
Except of those files, scanner.c also should be handled at some point; however,
it currently uses fprintf directly instead using the common diagnostics
machinery.
Patch for resolve.c:
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -3563 +3563 @@ resolve_operator (gfc_expr *e)
- sprintf (msg, _("Operand of unary numeric operator '%s' at %%L is %s"),
+ sprintf (msg, _("Operand of unary numeric operator %%<%s%%> at %%L is
%s"),
@@ -3579 +3579 @@ resolve_operator (gfc_expr *e)
- _("Operands of binary numeric operator '%s' at %%L are %s/%s"),
+ _("Operands of binary numeric operator %%<%s%%> at %%L are
%s/%s"),
@@ -3613 +3613 @@ resolve_operator (gfc_expr *e)
- sprintf (msg, _("Operands of logical operator '%s' at %%L are %s/%s"),
+ sprintf (msg, _("Operands of logical operator %%<%s%%> at %%L are
%s/%s"),
@@ -3698 +3698 @@ resolve_operator (gfc_expr *e)
- _("Operands of comparison operator '%s' at %%L are %s/%s"),
+ _("Operands of comparison operator %%<%s%%> at %%L are
%s/%s"),
@@ -3706 +3706,2 @@ resolve_operator (gfc_expr *e)
- sprintf (msg, _("Unknown operator '%s' at %%L"),
e->value.op.uop->name);
+ sprintf (msg, _("Unknown operator %%<%s%%> at %%L"),
+ e->value.op.uop->name);
@@ -3708 +3709 @@ resolve_operator (gfc_expr *e)
- sprintf (msg, _("Operand of user operator '%s' at %%L is %s"),
+ sprintf (msg, _("Operand of user operator %%<%s%%> at %%L is %s"),
@@ -3712 +3713 @@ resolve_operator (gfc_expr *e)
- sprintf (msg, _("Operands of user operator '%s' at %%L are %s/%s"),
+ sprintf (msg, _("Operands of user operator %%<%s%%> at %%L are
%s/%s"),