doc: document -ffixit and --update

* doc/bison.texi (Bison Options): here.
This commit is contained in:
Akim Demaille
2019-01-17 19:53:14 +01:00
parent cd1a9f076c
commit 4a690d3d19

View File

@@ -10269,6 +10269,43 @@ Print the name of the directory containing locale-dependent data.
@item --print-datadir
Print the name of the directory containing skeletons and XSLT.
@item -u
@item --update
Update the grammar file (remove duplicates, update deprecated directives,
etc.). Leaves a backup of the original file with a @code{~} appended. For
instance:
@example
@group
$ @kbd{cat foo.y}
%error-verbose
%define parse.error verbose
%%
exp:;
@end group
@group
$ @kbd{bison -u foo.y}
foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
%error-verbose
^~~~~~~~~~~~~~
foo.y:2.1-27: error: %define variable 'parse.error' redefined
%define parse.error verbose
^~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.y:1.1-14: previous definition
%error-verbose
^~~~~~~~~~~~~~
bison: file 'foo.y' was updated (backup: 'foo.y~')
@end group
@group
$ @kbd{cat foo.y}
%define parse.error verbose
%%
exp:;
@end group
@end example
See the documentation of @option{--feature=fixit} below for more details.
@item -y
@itemx --yacc
Act more like the traditional Yacc command. This can cause different
@@ -10509,6 +10546,61 @@ in.y:3.32-33: error: $2 of exp has no declared type
This option is activated by default.
@item fixit
@itemx diagnostics-parseable-fixits
Show machine-readable fixes, in a manner similar to GCC's and Clang's
@option{-fdiagnostics-parseable-fixits}.
Fix-its are generated for duplicate directives:
@example
@group
$ @kbd{cat foo.y}
%define api.prefix @{foo@}
%define api.prefix @{bar@}
%%
exp:;
@end group
@group
$ @kbd{bison -ffixit foo.y}
foo.y:2.1-24: error: %define variable 'api.prefix' redefined
%define api.prefix @{bar@}
^~~~~~~~~~~~~~~~~~~~~~~~
foo.y:1.1-24: previous definition
%define api.prefix @{foo@}
^~~~~~~~~~~~~~~~~~~~~~~~
fix-it:"foo.y":@{2:1-2:25@}:""
foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
@end group
@end example
They are also generated to update deprecated directives, unless
@option{-Wno-deprecated} was given:
@example
@group
$ @kbd{cat /tmp/foo.yy}
%error-verbose
%name-prefix "foo"
%%
exp:;
@end group
@group
$ @kbd{bison foo.y}
foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
%error-verbose
^~~~~~~~~~~~~~
foo.y:2.1-18: warning: deprecated directive, use '%define api.prefix @{foo@}' [-Wdeprecated]
%name-prefix "foo"
^~~~~~~~~~~~~~~~~~
foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
@end group
@end example
The fix-its are applied by @command{bison} itself when given the option
@option{-u}/@option{--update}. See its documentation above.
@end table
@end table