[COMMITTED] a68: fix diagnostic in recover_from_error
Checks
Commit Message
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 <jemarch@gnu.org>
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.
---
gcc/algol68/a68-parser-bottom-up.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
@@ -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)