From a6edce193de4c163bcd6e83b5183da0fadad939a Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 14 Jun 2020 13:53:05 +0200 Subject: [PATCH] Make PPerror message more verbose: give hint to buggy line segment --- src/frontend/parse-bison.y | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frontend/parse-bison.y b/src/frontend/parse-bison.y index bc3b55af9..bd3bd78d4 100644 --- a/src/frontend/parse-bison.y +++ b/src/frontend/parse-bison.y @@ -27,6 +27,8 @@ while (0) static void PPerror (YYLTYPE *locp, char **line, struct pnode **retval, char const *); + + static char keepline[256]; %} %name-prefix "PP" @@ -96,6 +98,7 @@ { $$.num = 0.0; yylloc.start = yylloc.stop = NULL; + strncpy(keepline, *line, 255); }; %% @@ -171,5 +174,5 @@ PPerror (YYLTYPE *locp, char **line, struct pnode **retval, char const *s) NG_IGNORE(line); NG_IGNORE(retval); - fprintf (stderr, "%s: %s\n", __func__, s); + fprintf (stderr, "%s: %s\n in line segment %s\n", __func__, s, keepline); }