Skip to content

Commit 345c319

Browse files
committed
upgrade win_bison to version 3.0.4
1 parent 59c6e2a commit 345c319

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1033
-785
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ bld/
2424

2525
# Visual Studio 2015 cache/options directory
2626
.vs/
27+
*.VC.db
28+
*.VC.opendb
2729

2830
# MSTest test Results
2931
[Tt]est[Rr]esult*/

bin/Release/README.txt

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
=======
2+
versions 2.4.6/2.5.6
3+
--------------
4+
upgrade win_bison to version 3.0.4
5+
win_bison v2.7 is unchanged
6+
17
=======
28
versions 2.4.5/2.5.5
39
--------------

bin/Release/win_bison.exe

5 KB
Binary file not shown.

bin/Release/win_flex.exe

3 KB
Binary file not shown.

bison/data/c++.m4

+62-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# C++ skeleton for Bison
44

5-
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
5+
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
66

77
# This program is free software: you can redistribute it and/or modify
88
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,21 @@
1717
# You should have received a copy of the GNU General Public License
1818
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1919

20+
# Sanity checks, before defaults installed by c.m4.
21+
b4_percent_define_ifdef([[api.value.union.name]],
22+
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
23+
[named %union is invalid in C++])])
24+
25+
# Sanity checks, before defaults installed by c.m4.
26+
b4_percent_define_ifdef([[api.value.union.name]],
27+
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
28+
[named %union is invalid in C++])])
29+
30+
# Sanity checks, before defaults installed by c.m4.
31+
b4_percent_define_ifdef([[api.value.union.name]],
32+
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
33+
[named %union is invalid in C++])])
34+
2035
m4_include(b4_pkgdatadir/[c.m4])
2136

2237
# b4_comment(TEXT, [PREFIX])
@@ -169,9 +184,12 @@ m4_define([b4_public_types_declare],
169184
/// (External) token type, as returned by yylex.
170185
typedef token::yytokentype token_type;
171186
172-
/// Internal symbol number.
187+
/// Symbol type: an internal symbol number.
173188
typedef int symbol_number_type;
174189
190+
/// The symbol type number to denote an empty symbol.
191+
enum { empty_symbol = -2 };
192+
175193
/// Internal symbol number for tokens (subsumed by symbol_number_type).
176194
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
177195
@@ -204,8 +222,15 @@ m4_define([b4_public_types_declare],
204222
const semantic_type& v]b4_locations_if([,
205223
const location_type& l])[);
206224
225+
/// Destroy the symbol.
207226
~basic_symbol ();
208227
228+
/// Destroy contents, and record that is empty.
229+
void clear ();
230+
231+
/// Whether empty.
232+
bool empty () const;
233+
209234
/// Destructive move, \a s is emptied into this.
210235
void move (basic_symbol& s);
211236
@@ -235,21 +260,23 @@ m4_define([b4_public_types_declare],
235260
/// Constructor from (external) token numbers.
236261
by_type (kind_type t);
237262
263+
/// Record that this symbol is empty.
264+
void clear ();
265+
238266
/// Steal the symbol type from \a that.
239267
void move (by_type& that);
240268
241269
/// The (internal) type number (corresponding to \a type).
242-
/// -1 when this symbol is empty.
270+
/// \a empty when empty.
243271
symbol_number_type type_get () const;
244272
245273
/// The token.
246274
token_type token () const;
247275
248-
enum { empty = 0 };
249-
250276
/// The symbol type.
251-
/// -1 when this symbol is empty.
252-
token_number_type type;
277+
/// \a empty_symbol when empty.
278+
/// An int, not token_number_type, to be able to store empty_symbol.
279+
int type;
253280
};
254281
255282
/// "External" symbols: returned by the scanner.
@@ -318,9 +345,19 @@ m4_define([b4_public_types_define],
318345
template <typename Base>
319346
inline
320347
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
348+
{
349+
clear ();
350+
}
351+
352+
template <typename Base>
353+
inline
354+
void
355+
]b4_parser_class_name[::basic_symbol<Base>::clear ()
321356
{]b4_variant_if([[
322357
// User destructor.
323358
symbol_number_type yytype = this->type_get ();
359+
basic_symbol<Base>& yysym = *this;
360+
(void) yysym;
324361
switch (yytype)
325362
{
326363
]b4_symbol_foreach([b4_symbol_destructor])dnl
@@ -330,6 +367,15 @@ m4_define([b4_public_types_define],
330367
331368
// Type destructor.
332369
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
370+
Base::clear ();
371+
}
372+
373+
template <typename Base>
374+
inline
375+
bool
376+
]b4_parser_class_name[::basic_symbol<Base>::empty () const
377+
{
378+
return Base::type_get () == empty_symbol;
333379
}
334380
335381
template <typename Base>
@@ -347,7 +393,7 @@ m4_define([b4_public_types_define],
347393
// by_type.
348394
inline
349395
]b4_parser_class_name[::by_type::by_type ()
350-
: type (empty)
396+
: type (empty_symbol)
351397
{}
352398
353399
inline
@@ -360,12 +406,19 @@ m4_define([b4_public_types_define],
360406
: type (yytranslate_ (t))
361407
{}
362408
409+
inline
410+
void
411+
]b4_parser_class_name[::by_type::clear ()
412+
{
413+
type = empty_symbol;
414+
}
415+
363416
inline
364417
void
365418
]b4_parser_class_name[::by_type::move (by_type& that)
366419
{
367420
type = that.type;
368-
that.type = empty;
421+
that.clear ();
369422
}
370423
371424
inline

bison/data/c-like.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Common code for C-like languages (C, C++, Java, etc.)
44

5-
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
5+
# Copyright (C) 2012-2015 Free Software Foundation, Inc.
66

77
# This program is free software: you can redistribute it and/or modify
88
# it under the terms of the GNU General Public License as published by

bison/data/c-skel.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# C skeleton dispatching for Bison.
44

5-
# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
5+
# Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
66

77
# This program is free software: you can redistribute it and/or modify
88
# it under the terms of the GNU General Public License as published by

bison/data/c.m4

+45-24
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# C M4 Macros for Bison.
44

5-
# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc.
5+
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
66

77
# This program is free software: you can redistribute it and/or modify
88
# it under the terms of the GNU General Public License as published by
@@ -97,7 +97,8 @@ m4_define([b4_api_PREFIX],
9797
m4_define_default([b4_prefix], [b4_api_prefix])
9898

9999
# If the %union is not named, its name is YYSTYPE.
100-
m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE])
100+
b4_percent_define_default([[api.value.union.name]],
101+
[b4_api_PREFIX[][STYPE]])
101102

102103

103104
## ------------------------ ##
@@ -205,13 +206,32 @@ m4_define([b4_table_value_equals],
205206

206207
# b4_attribute_define
207208
# -------------------
208-
# Provide portability for __attribute__.
209+
# Provide portable compiler "attributes".
209210
m4_define([b4_attribute_define],
210-
[#ifndef __attribute__
211-
/* This feature is available in gcc versions 2.5 and later. */
212-
# if (! defined __GNUC__ || __GNUC__ < 2 \
213-
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
214-
# define __attribute__(Spec) /* empty */
211+
[#ifndef YY_ATTRIBUTE
212+
# if (defined __GNUC__ \
213+
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
214+
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
215+
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
216+
# else
217+
# define YY_ATTRIBUTE(Spec) /* empty */
218+
# endif
219+
#endif
220+
221+
#ifndef YY_ATTRIBUTE_PURE
222+
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
223+
#endif
224+
225+
#ifndef YY_ATTRIBUTE_UNUSED
226+
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
227+
#endif
228+
229+
#if !defined _Noreturn \
230+
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
231+
# if defined _MSC_VER && 1200 <= _MSC_VER
232+
# define _Noreturn __declspec (noreturn)
233+
# else
234+
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
215235
# endif
216236
#endif
217237
@@ -250,14 +270,14 @@ m4_define([b4_attribute_define],
250270

251271
# b4_null_define
252272
# --------------
253-
# Portability issues: define a YY_NULL appropriate for the current
273+
# Portability issues: define a YY_NULLPTR appropriate for the current
254274
# language (C, C++98, or C++11).
255275
m4_define([b4_null_define],
256-
[# ifndef YY_NULL
276+
[# ifndef YY_NULLPTR
257277
# if defined __cplusplus && 201103L <= __cplusplus
258-
# define YY_NULL nullptr
278+
# define YY_NULLPTR nullptr
259279
# else
260-
# define YY_NULL 0
280+
# define YY_NULLPTR 0
261281
# endif
262282
# endif[]dnl
263283
])
@@ -266,7 +286,7 @@ m4_define([b4_null_define],
266286
# b4_null
267287
# -------
268288
# Return a null pointer constant.
269-
m4_define([b4_null], [YY_NULL])
289+
m4_define([b4_null], [YY_NULLPTR])
270290

271291
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
272292
# -------------------------------------------------------------
@@ -541,15 +561,15 @@ b4_locations_if([, yylocationp])[]b4_user_args[);
541561
# b4_symbol_type_register(SYMBOL-NUM)
542562
# -----------------------------------
543563
# Symbol SYMBOL-NUM has a type (for variant) instead of a type-tag.
544-
# Extend the definition of %union's body with a field of that type,
545-
# and extend the symbol's "type" field to point to the field name,
546-
# instead of the type name.
564+
# Extend the definition of %union's body (b4_union_members) with a
565+
# field of that type, and extend the symbol's "type" field to point to
566+
# the field name, instead of the type name.
547567
m4_define([b4_symbol_type_register],
548568
[m4_define([b4_symbol($1, type_tag)],
549569
[b4_symbol_if([$1], [has_id],
550570
[b4_symbol([$1], [id])],
551571
[yytype_[]b4_symbol([$1], [number])])])dnl
552-
m4_append([b4_user_union_members],
572+
m4_append([b4_union_members],
553573
m4_expand([
554574
b4_symbol_tag_comment([$1])dnl
555575
b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]))
@@ -589,10 +609,9 @@ m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
589609
])
590610

591611

592-
# ---------------- #
593-
# api.value.type. #
594-
# ---------------- #
595-
612+
# -------------------------- #
613+
# api.value.type = variant. #
614+
# -------------------------- #
596615

597616
# b4_value_type_setup_variant
598617
# ---------------------------
@@ -667,11 +686,13 @@ typedef ]b4_percent_define_get([[api.value.type]])[ ]b4_api_PREFIX[STYPE;
667686
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
668687
[union\|union-directive],
669688
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
670-
typedef union ]b4_union_name[ ]b4_api_PREFIX[STYPE;
671-
union ]b4_union_name[
689+
]b4_percent_define_get_syncline([[api.value.union.name]])[
690+
union ]b4_percent_define_get([[api.value.union.name]])[
672691
{
673692
]b4_user_union_members[
674693
};
694+
]b4_percent_define_get_syncline([[api.value.union.name]])[
695+
typedef union ]b4_percent_define_get([[api.value.union.name]])[ ]b4_api_PREFIX[STYPE;
675696
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1
676697
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
677698
#endif
@@ -783,7 +804,7 @@ m4_define([b4_yy_location_print_define],
783804
784805
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
785806
786-
__attribute__((__unused__))
807+
YY_ATTRIBUTE_UNUSED
787808
]b4_function_define([yy_location_print_],
788809
[static unsigned],
789810
[[FILE *yyo], [yyo]],

0 commit comments

Comments
 (0)