The recover_from_error function calls a68_phrase_to_text in order to get a descriptive text to emit in diagnostics. This text, however, may contain format tags such as %< and %>, so it has to be passed to a68_error as a format string, therwise the format tags are not interpreted and get printed verbatim.
Signed-off-by: Jose E. Marchesi <[email protected]> gcc/algol68/ChangeLog * a68-parser-bottom-up.cc (recover_from_error): Use the output of a68_phrase_to_text as format string so format tags are honored. (cherry picked from commit 290221e86a32369f66a8ac089bd8430e45efe9f4) --- gcc/algol68/a68-parser-bottom-up.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/algol68/a68-parser-bottom-up.cc b/gcc/algol68/a68-parser-bottom-up.cc index 5cc0037ecc0..f3e5793283e 100644 --- a/gcc/algol68/a68-parser-bottom-up.cc +++ b/gcc/algol68/a68-parser-bottom-up.cc @@ -100,6 +100,8 @@ #include "coretypes.h" #include "options.h" +#include <string> + #include "a68.h" #include "a68-pretty-print.h" @@ -2836,8 +2838,10 @@ recover_from_error (NODE_T * p, enum a68_attribute expect, bool suppress) } else { + std::string fmt = seq; + fmt += " is an invalid %e"; a68_attr_format_token a (expect); - a68_error (w, "%s is an invalid %e", seq, &a); + a68_error (w, fmt.c_str (), &a); } if (ERROR_COUNT (&A68_JOB) >= MAX_ERRORS) -- 2.39.5
