mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 17:23:02 +00:00
doc: avoid #define YYDEBUG in C++
* doc/bison.texi (Enabling Traces): here.
This commit is contained in:
3
TODO
3
TODO
@@ -35,9 +35,6 @@ Clarify that rule numbers in the skeletons are 1-based.
|
|||||||
There are many macros that should obey api.prefix: YY_CPLUSPLUS, YY_MOVE,
|
There are many macros that should obey api.prefix: YY_CPLUSPLUS, YY_MOVE,
|
||||||
etc.
|
etc.
|
||||||
|
|
||||||
** YYDEBUG etc. in C++
|
|
||||||
Discourage the use of YYDEBUG in C++ (see thread with Jot).
|
|
||||||
|
|
||||||
** yyerrok in Java
|
** yyerrok in Java
|
||||||
And add tests in calc.at, to prepare work for D.
|
And add tests in calc.at, to prepare work for D.
|
||||||
|
|
||||||
|
|||||||
@@ -7000,8 +7000,8 @@ syntax error handling. @xref{LAC}.
|
|||||||
|
|
||||||
In C/C++, define the macro @code{YYDEBUG} (or @code{@var{prefix}DEBUG} with
|
In C/C++, define the macro @code{YYDEBUG} (or @code{@var{prefix}DEBUG} with
|
||||||
@samp{%define api.prefix @{@var{prefix}@}}), see @ref{Multiple Parsers}) to
|
@samp{%define api.prefix @{@var{prefix}@}}), see @ref{Multiple Parsers}) to
|
||||||
1 in the parser implementation file if it is not already defined, so that
|
1 (if it is not already defined) so that the debugging facilities are
|
||||||
the debugging facilities are compiled.
|
compiled.
|
||||||
|
|
||||||
@item Accepted Values: Boolean
|
@item Accepted Values: Boolean
|
||||||
|
|
||||||
@@ -11010,8 +11010,8 @@ defines @code{YYDEBUG} to 1.
|
|||||||
@item the directive @samp{%debug} (deprecated)
|
@item the directive @samp{%debug} (deprecated)
|
||||||
@findex %debug
|
@findex %debug
|
||||||
Add the @code{%debug} directive (@pxref{Decl Summary}). This Bison
|
Add the @code{%debug} directive (@pxref{Decl Summary}). This Bison
|
||||||
extension is maintained for backward compatibility with previous versions of
|
extension is maintained for backward compatibility; use @code{%define
|
||||||
Bison; use @code{%define parse.trace} instead.
|
parse.trace} instead.
|
||||||
|
|
||||||
@item the macro @code{YYDEBUG} (C/C++ only)
|
@item the macro @code{YYDEBUG} (C/C++ only)
|
||||||
@findex YYDEBUG
|
@findex YYDEBUG
|
||||||
@@ -11025,6 +11025,12 @@ Parsers}), for instance @samp{%define
|
|||||||
api.prefix @{c@}}, then if @code{CDEBUG} is defined, its value controls the
|
api.prefix @{c@}}, then if @code{CDEBUG} is defined, its value controls the
|
||||||
tracing feature (enabled if and only if nonzero); otherwise tracing is
|
tracing feature (enabled if and only if nonzero); otherwise tracing is
|
||||||
enabled if and only if @code{YYDEBUG} is nonzero.
|
enabled if and only if @code{YYDEBUG} is nonzero.
|
||||||
|
|
||||||
|
In C++, where POSIX compliance makes no sense, avoid this option, and prefer
|
||||||
|
@samp{%define parse.trace}. If you @code{#define} the @code{YYDEBUG} macro
|
||||||
|
at the wrong place (e.g., in @samp{%code top} instead of @samp{%code
|
||||||
|
require}), the parser class will have two different definitions, thus
|
||||||
|
leading to ODR violations and happy debugging times.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
We suggest that you always enable the trace option so that debugging is
|
We suggest that you always enable the trace option so that debugging is
|
||||||
|
|||||||
Reference in New Issue
Block a user