diagnostics: complain about Bison directives when -Wyacc

* src/complain.h, src/complain.c (bison_directive): New.
* src/scan-gram.l (BISON_DIRECTIVE): New.
Use it for Bison extensions.
This commit is contained in:
Akim Demaille
2013-02-27 15:43:26 +01:00
committed by Akim Demaille
parent ebe9b20841
commit d92ed9d9f7
6 changed files with 62 additions and 34 deletions

View File

@@ -433,7 +433,13 @@ input.y:26.40-42: warning: unset value: $][$ [-Wother]
AT_BISON_CHECK([-Wnone,yacc -fcaret input.y],
[0], [],
[[input.y:24.23-34: warning: POSIX Yacc does not support typed midrule actions [-Wyacc]
[m4_ifval([$1], [], [[input.y:3.1-11: warning: POSIX Yacc does not support %destructor [-Wyacc]
%destructor { destroy ($$); } <integer>;
^^^^^^^^^^^
]])[input.y:13.10-15: warning: POSIX Yacc does not support %empty [-Wyacc]
b: INT | %empty;
^^^^^^
input.y:24.23-34: warning: POSIX Yacc does not support typed midrule actions [-Wyacc]
m: INT | INT <integer>{ $][$ = $][1; } INT <integer>{ $][$ = $][2 + $][3; } INT { $][$ = $][4 + $][5; };
^^^^^^^^^^^^
input.y:24.49-65: warning: POSIX Yacc does not support typed midrule actions [-Wyacc]
@@ -451,7 +457,10 @@ input.y:26.23-25: warning: POSIX Yacc does not support typed midrule actions [-W
input.y:26.40-42: warning: POSIX Yacc does not support typed midrule actions [-Wyacc]
o: INT | INT <integer>{ } INT <integer>{ } INT { $][$ = $][1 + $][2 + $][3 + $][4 + $][5; };
^^^
]])
]m4_ifval([$1], [[input.y:30.1-11: warning: POSIX Yacc does not support %destructor [-Wyacc]
%destructor { destroy ($$); } <integer>;
^^^^^^^^^^^
]])])
])
## --------------- ##
@@ -1169,7 +1178,9 @@ AT_BISON_OPTION_POPDEFS
# POSIX Yacc accept periods, but not dashes.
AT_BISON_CHECK([--yacc input.y], [1], [],
[[input.y:9.8-16: error: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Werror=yacc]
[[input.y:1.1-5: error: POSIX Yacc does not support %code [-Werror=yacc]
input.y:9.8-16: error: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Werror=yacc]
input.y:13.1-5: error: POSIX Yacc does not support %code [-Werror=yacc]
input.y:20.8-16: error: POSIX Yacc forbids dashes in symbol names: with-dash [-Werror=yacc]
]])

View File

@@ -44,7 +44,7 @@ done
]AT_DATA([$1],
[$2[
%%
foo: %empty {};
foo: '0' {};
]])
# There is not AT_DATA_UNQUOTED.

View File

@@ -88,7 +88,9 @@ AT_SETUP([Early token definitions with --yacc])
# prologue, so that they can use the token definitions in it.
AT_BISON_OPTION_PUSHDEFS
AT_DATA_GRAMMAR([input.y],
# Not AT_DATA_GRAMMAR, which uses %code, which is not supported by Yacc.
AT_DATA([input.y],
[[%{
]AT_YYERROR_DECLARE_EXTERN[
]AT_YYLEX_DECLARE_EXTERN[