mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
Define YYDEBUG to 0 if it is not defined and if we are not debugging.
POSIX requires this.
This commit is contained in:
3
NEWS
3
NEWS
@@ -3,6 +3,9 @@ Bison News
|
|||||||
|
|
||||||
Changes in version 1.30h:
|
Changes in version 1.30h:
|
||||||
|
|
||||||
|
* When the generated parser lacks debugging code, YYDEBUG is now 0
|
||||||
|
(as POSIX requires) instead of being undefined.
|
||||||
|
|
||||||
* User Actions
|
* User Actions
|
||||||
Bison has always permitted actions such as { $$ = $1 }: it adds the
|
Bison has always permitted actions such as { $$ = $1 }: it adds the
|
||||||
ending semicolon. Now if in Yacc compatibility mode, the semicolon
|
ending semicolon. Now if in Yacc compatibility mode, the semicolon
|
||||||
|
|||||||
@@ -262,9 +262,9 @@ and so on.
|
|||||||
.ns
|
.ns
|
||||||
.TP
|
.TP
|
||||||
.B \-\-debug
|
.B \-\-debug
|
||||||
Output a definition of the macro
|
In the parser file, define the macro
|
||||||
.B YYDEBUG
|
.B YYDEBUG
|
||||||
into the parser file,
|
to 1 if it is not already defined,
|
||||||
so that the debugging facilities are compiled.
|
so that the debugging facilities are compiled.
|
||||||
.TP
|
.TP
|
||||||
.B \-v
|
.B \-v
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ foo_tab.c.
|
|||||||
.indent -1
|
.indent -1
|
||||||
2 /DEBUG
|
2 /DEBUG
|
||||||
.skip
|
.skip
|
||||||
Output a definition of the macro YYDEBUG into the parser file,
|
In the parser file,
|
||||||
|
define the macro YYDEBUG to 1 if it is not already defined,
|
||||||
so that the debugging facilities are compiled.
|
so that the debugging facilities are compiled.
|
||||||
.skip
|
.skip
|
||||||
.indent -1
|
.indent -1
|
||||||
|
|||||||
@@ -708,8 +708,8 @@ headers. On some non-@sc{gnu} hosts, @code{<alloca.h>},
|
|||||||
@code{<stddef.h>}, and @code{<stdlib.h>} are included as needed to
|
@code{<stddef.h>}, and @code{<stdlib.h>} are included as needed to
|
||||||
declare memory allocators and related types. In the same situation,
|
declare memory allocators and related types. In the same situation,
|
||||||
C++ parsers may include @code{<cstddef>} and @code{<cstdlib>} instead.
|
C++ parsers may include @code{<cstddef>} and @code{<cstdlib>} instead.
|
||||||
Other system headers may be included if you define @code{YYDEBUG}
|
Other system headers may be included if you define @code{YYDEBUG} to a
|
||||||
(@pxref{Debugging, ,Debugging Your Parser}).
|
nonzero value (@pxref{Debugging, ,Debugging Your Parser}).
|
||||||
|
|
||||||
@node Stages
|
@node Stages
|
||||||
@section Stages in Using Bison
|
@section Stages in Using Bison
|
||||||
@@ -3235,9 +3235,9 @@ directives:
|
|||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item %debug
|
@item %debug
|
||||||
Output a definition of the macro @code{YYDEBUG} into the parser file, so
|
In the parser file, define the macro @code{YYDEBUG} to 1 if it is not
|
||||||
that the debugging facilities are compiled. @xref{Debugging, ,Debugging
|
already defined, so that the debugging facilities are compiled.
|
||||||
Your Parser}.
|
@xref{Debugging, ,Debugging Your Parser}.
|
||||||
|
|
||||||
@item %defines
|
@item %defines
|
||||||
Write an extra output file containing macro definitions for the token
|
Write an extra output file containing macro definitions for the token
|
||||||
@@ -4925,21 +4925,23 @@ If a Bison grammar compiles properly but doesn't do what you want when it
|
|||||||
runs, the @code{yydebug} parser-trace feature can help you figure out why.
|
runs, the @code{yydebug} parser-trace feature can help you figure out why.
|
||||||
|
|
||||||
To enable compilation of trace facilities, you must define the macro
|
To enable compilation of trace facilities, you must define the macro
|
||||||
@code{YYDEBUG} when you compile the parser. You could use
|
@code{YYDEBUG} to a nonzero value when you compile the parser. You
|
||||||
@samp{-DYYDEBUG=1} as a compiler option or you could put @samp{#define
|
could use @samp{-DYYDEBUG=1} as a compiler option or you could put
|
||||||
YYDEBUG 1} in the C declarations section of the grammar file
|
@samp{#define YYDEBUG 1} in the C declarations section of the grammar
|
||||||
(@pxref{C Declarations, ,The C Declarations Section}). Alternatively, use the @samp{-t} option when
|
file (@pxref{C Declarations, ,The C Declarations Section}).
|
||||||
you run Bison (@pxref{Invocation, ,Invoking Bison}). We always define @code{YYDEBUG} so that
|
Alternatively, use the @samp{-t} option when you run Bison
|
||||||
debugging is always possible.
|
(@pxref{Invocation, ,Invoking Bison}) or the @code{%debug} declaration
|
||||||
|
(@pxref{Decl Summary, ,Bison Declaration Summary}). We suggest that
|
||||||
|
you always define @code{YYDEBUG} so that debugging is always possible.
|
||||||
|
|
||||||
The trace facility outputs messages with macro calls of the form
|
The trace facility outputs messages with macro calls of the form
|
||||||
@code{YYFPRINTF (YYSTDERR, @var{format}, @var{args})} where
|
@code{YYFPRINTF (YYSTDERR, @var{format}, @var{args})} where
|
||||||
@var{format} and @var{args} are the usual @code{printf} format and
|
@var{format} and @var{args} are the usual @code{printf} format and
|
||||||
arguments. If you define @code{YYDEBUG} but do not define
|
arguments. If you define @code{YYDEBUG} to a nonzero value but do not
|
||||||
@code{YYFPRINTF}, @code{<stdio.h>} is automatically included and the
|
define @code{YYFPRINTF}, @code{<stdio.h>} is automatically included
|
||||||
macros are defined to @code{fprintf} and @code{stderr}. In the same
|
and the macros are defined to @code{fprintf} and @code{stderr}. In
|
||||||
situation, C++ parsers include @code{<cstdio.h>} instead, and use
|
the same situation, C++ parsers include @code{<cstdio.h>} instead, and
|
||||||
@code{std::fprintf} and @code{std::stderr}.
|
use @code{std::fprintf} and @code{std::stderr}.
|
||||||
|
|
||||||
Once you have compiled the program with trace facilities, the way to
|
Once you have compiled the program with trace facilities, the way to
|
||||||
request a trace is to store a nonzero value in the variable @code{yydebug}.
|
request a trace is to store a nonzero value in the variable @code{yydebug}.
|
||||||
@@ -5100,9 +5102,9 @@ you are developing Bison.
|
|||||||
|
|
||||||
@item -t
|
@item -t
|
||||||
@itemx --debug
|
@itemx --debug
|
||||||
Output a definition of the macro @code{YYDEBUG} into the parser file, so
|
In the parser file, define the macro @code{YYDEBUG} to 1 if it is not
|
||||||
that the debugging facilities are compiled. @xref{Debugging, ,Debugging
|
already defined, so that the debugging facilities are compiled.
|
||||||
Your Parser}.
|
@xref{Debugging, ,Debugging Your Parser}.
|
||||||
|
|
||||||
@item --locations
|
@item --locations
|
||||||
Pretend that @code{%locations} was specified. @xref{Decl Summary}.
|
Pretend that @code{%locations} was specified. @xref{Decl Summary}.
|
||||||
|
|||||||
Reference in New Issue
Block a user