mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-23 19:23:02 +00:00
* src/bison.simple: Define type yystype instead of YYSTYPE, and
define CPP macro, which substitute YYSTYPE by yystype. * src/reader.c (parse_union_decl): Output yystype/YYSTYPE as we do with yyltype/YYLTYPE. This allows inclusion of the generated header within the parser if the compiler, such as GGC, accepts multiple equivalent #defines. From Akim.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
|||||||
|
2001-11-12 Pascal Bart <pascal.bart@epita.fr>
|
||||||
|
|
||||||
|
* src/bison.simple: Define type yystype instead of YYSTYPE, and
|
||||||
|
define CPP macro, which substitute YYSTYPE by yystype.
|
||||||
|
* src/reader.c (parse_union_decl): Output yystype/YYSTYPE as we do
|
||||||
|
with yyltype/YYLTYPE. This allows inclusion of the generated
|
||||||
|
header within the parser if the compiler, such as GGC, accepts
|
||||||
|
multiple equivalent #defines.
|
||||||
|
From Akim.
|
||||||
|
|
||||||
2001-11-05 Akim Demaille <akim@epita.fr>
|
2001-11-05 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/reader.c (symbols_output): New, extracted from...
|
* src/reader.c (symbols_output): New, extracted from...
|
||||||
|
|||||||
@@ -117,7 +117,8 @@
|
|||||||
|
|
||||||
#line %%input_line "%%filename"
|
#line %%input_line "%%filename"
|
||||||
#ifndef YYSTYPE
|
#ifndef YYSTYPE
|
||||||
typedef %%stype YYSTYPE;
|
typedef %%stype yystype;
|
||||||
|
# define YYSTYPE yystype
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef YYLTYPE
|
#ifndef YYLTYPE
|
||||||
|
|||||||
13
src/reader.c
13
src/reader.c
@@ -741,6 +741,13 @@ parse_union_decl (void)
|
|||||||
int c;
|
int c;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
struct obstack union_obstack;
|
struct obstack union_obstack;
|
||||||
|
const char *prologue = "\
|
||||||
|
#ifndef YYSTYPE\n\
|
||||||
|
typedef union";
|
||||||
|
const char *epilogue = "\
|
||||||
|
yystype;\n\
|
||||||
|
# define YYSTYPE yystype\n\
|
||||||
|
#endif\n";
|
||||||
|
|
||||||
if (typed)
|
if (typed)
|
||||||
complain (_("multiple %s declarations"), "%union");
|
complain (_("multiple %s declarations"), "%union");
|
||||||
@@ -749,13 +756,15 @@ parse_union_decl (void)
|
|||||||
|
|
||||||
/* FIXME: I'm worried: are you sure attrs_obstack is properly
|
/* FIXME: I'm worried: are you sure attrs_obstack is properly
|
||||||
filled? */
|
filled? */
|
||||||
|
/* I don't see any reasons to keep this line, because we should
|
||||||
|
create a special skeleton for this option. */
|
||||||
if (no_lines_flag)
|
if (no_lines_flag)
|
||||||
obstack_1grow (&attrs_obstack, '\n');
|
obstack_1grow (&attrs_obstack, '\n');
|
||||||
|
|
||||||
obstack_init (&union_obstack);
|
obstack_init (&union_obstack);
|
||||||
obstack_sgrow (&union_obstack, "union");
|
obstack_sgrow (&union_obstack, "union");
|
||||||
if (defines_flag)
|
if (defines_flag)
|
||||||
obstack_sgrow (&defines_obstack, "typedef union");
|
obstack_sgrow (&defines_obstack, prologue);
|
||||||
|
|
||||||
c = getc (finput);
|
c = getc (finput);
|
||||||
|
|
||||||
@@ -790,7 +799,7 @@ parse_union_decl (void)
|
|||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
{
|
{
|
||||||
if (defines_flag)
|
if (defines_flag)
|
||||||
obstack_sgrow (&defines_obstack, " YYSTYPE;\n");
|
obstack_sgrow (&defines_obstack, epilogue);
|
||||||
/* JF don't choke on trailing semi */
|
/* JF don't choke on trailing semi */
|
||||||
c = skip_white_space ();
|
c = skip_white_space ();
|
||||||
if (c != ';')
|
if (c != ';')
|
||||||
|
|||||||
Reference in New Issue
Block a user