glr: fix improperly placed synclines

Predicates with GLR are issued with synclines in the middle of C code:

          case 2:
      if (! (#line 6 "sempred.y" /* glr.c:816  */
      new_syntax)) YYERROR;
    #line 793 "sempred.tab.c" /* glr.c:816  */
      break;

Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2018-05/msg00033.html

* data/c.m4 (b4_predicate_case): Be sure to start on column 0.
It would be nicer if b4_syncline could ensure this by itself
(that would avoid ugly code when synclines are disabled), but that's
way more work.
* tests/glr-regression.at (Predicates): Be a real end-to-end test.
This would have caught this error years ago...
This commit is contained in:
Akim Demaille
2018-05-29 09:02:21 +02:00
parent d0447d949b
commit 5952fe5abf
2 changed files with 44 additions and 10 deletions

View File

@@ -459,7 +459,8 @@ b4_syncline([@oline@], [@ofile@])
# ------------------------------------
m4_define([b4_predicate_case],
[ case $1:
if (! ($2)) YYERROR;
if (! (
$2)) YYERROR;
b4_syncline([@oline@], [@ofile@])
break;])