Compare commits

..
1 Commits
Author SHA1 Message Date
Akim Demaille 0accf65570 version 3.2.1.0
* NEWS: Record release date.
2018-11-09 06:31:50 +01:00
18 changed files with 107 additions and 319 deletions
+1 -1
View File
@@ -1 +1 @@
3.2.3
3.2
+5 -22
View File
@@ -30,9 +30,7 @@ matrix:
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'"
# ASAN is time consuming, and we timeout the 50min granted by
# Travis if we run all the tests in on go. Run in two parts.
- name: "Clang 7 libc++ and ASAN part 1"
- name: "Clang 7 libc++ and ASAN"
os: linux
addons:
apt:
@@ -45,22 +43,7 @@ matrix:
- libc++abi-7-dev
env:
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
- MATRIX_EVAL="PART=1 CC='clang-7 -fsanitize=address' CXX='clang++-7 -fsanitize=address -stdlib=libc++'"
- name: "Clang 7 libc++ and ASAN part 2"
os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-7
- ubuntu-toolchain-r-test
packages:
- clang-7
- libc++-7-dev
- libc++abi-7-dev
env:
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
- MATRIX_EVAL="PART=2 CC='clang-7 -fsanitize=address' CXX='clang++-7 -fsanitize=address -stdlib=libc++'"
- MATRIX_EVAL="CC='clang-7 -fsanitize=address' CXX='clang++-7 -fsanitize=address -stdlib=libc++'"
- name: "ICC"
os: linux
@@ -309,9 +292,9 @@ script:
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
- ./configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
- make -j2 $MAKE_ARGS
- if test ${PART-1} = 1; then make check VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
- if test ${PART-1} = 1; then make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
- if test ${PART-2} = 2; then make maintainer-check-g++ VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
- make check VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }
- make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }
- make maintainer-check-g++ VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }
after_script:
- if [[ $CC == "icc" ]]; then uninstall_intel_software; fi
+1 -22
View File
@@ -1,27 +1,6 @@
GNU Bison NEWS
* Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
** Bug fixes
Fix the move constructor of symbol_type.
Always provide a copy constructor for symbol_type, even in modern C++.
* Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
** Bug fixes
Properly support token constructors in C++ with types that include commas
(e.g., std::pair<int, int>). A regression introduced in Bison 3.2.
* Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
** Bug fixes
C++ portability issues.
* Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
* Noteworthy changes in release 3.2.1.0 (2018-11-09) [stable]
** Bug fixes
-2
View File
@@ -151,7 +151,6 @@ Roland Levillain [email protected]
Satya Kiran Popuri [email protected]
Sebastian Setzer [email protected]
Sebastien Fricker [email protected]
Sébastien Villemot [email protected]
Sergei Steshenko [email protected]
Shura [email protected]
Simon Sobisch [email protected]
@@ -179,7 +178,6 @@ Wayne Green [email protected]
Wei Song [email protected]
Wojciech Polak [email protected]
Wolfgang S. Kechel [email protected]
Wolfgang Thaller [email protected]
Wolfram Wagner [email protected]
Wwp [email protected]
xolodho [email protected]
+15 -51
View File
@@ -53,14 +53,8 @@ m4_define([b4_inline],
# b4_cxx_portability
# ------------------
m4_define([b4_cxx_portability],
[#if defined __cplusplus
# define YY_CPLUSPLUS __cplusplus
#else
# define YY_CPLUSPLUS 199711L
#endif
// Support move semantics when possible.
#if 201103L <= YY_CPLUSPLUS
[// Support move semantics when possible.
#if defined __cplusplus && 201103L <= __cplusplus
# define YY_MOVE std::move
# define YY_MOVE_OR_COPY move
# define YY_MOVE_REF(Type) Type&&
@@ -244,13 +238,8 @@ m4_define([b4_symbol_type_declare],
/// Default constructor.
basic_symbol ();
#if 201103L <= YY_CPLUSPLUS
/// Move constructor.
basic_symbol (basic_symbol&& that);
#endif
/// Copy constructor.
basic_symbol (const basic_symbol& that);
/// Move or copy constructor.
basic_symbol (YY_RVREF (basic_symbol) other);
]b4_variant_if([[
/// Constructor for valueless symbols, and symbols from each type.
@@ -283,9 +272,9 @@ m4_define([b4_symbol_type_declare],
location_type location;])[
private:
#if YY_CPLUSPLUS < 201103L
#if !defined __cplusplus || __cplusplus < 201103L
/// Assignment operator.
basic_symbol& operator= (const basic_symbol& that);
basic_symbol& operator= (const basic_symbol& other);
#endif
};
@@ -295,13 +284,8 @@ m4_define([b4_symbol_type_declare],
/// Default constructor.
by_type ();
#if 201103L <= YY_CPLUSPLUS
/// Move constructor.
by_type (by_type&& that);
#endif
/// Copy constructor.
by_type (const by_type& that);
by_type (const by_type& other);
/// The symbol type as needed by the constructor.
typedef token_type kind_type;
@@ -349,26 +333,14 @@ m4_define([b4_public_types_define],
, location ()])[
{}
#if 201103L <= YY_CPLUSPLUS
template <typename Base>
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (basic_symbol&& that)
: Base (std::move (that))
, value (]b4_variant_if([], [std::move (that.value)]))b4_locations_if([
, location (std::move (that.location))])[
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (YY_RVREF (basic_symbol) other)
: Base (YY_MOVE (other))
, value (]b4_variant_if([], [YY_MOVE (other.value)]))b4_locations_if([
, location (YY_MOVE (other.location))])[
{]b4_variant_if([
b4_symbol_variant([this->type_get ()], [value], [move],
[std::move (that.value)])])[
}
#endif
template <typename Base>
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
: Base (that)
, value (]b4_variant_if([], [that.value]))b4_locations_if([
, location (that.location)])[
{]b4_variant_if([
b4_symbol_variant([this->type_get ()], [value], [copy],
[that.value])])[
b4_symbol_variant([other.type_get ()], [value], [YY_MOVE_OR_COPY],
[YY_MOVE (other.value)])])[
}
]b4_variant_if([[
@@ -445,16 +417,8 @@ m4_define([b4_public_types_define],
: type (empty_symbol)
{}
#if 201103L <= YY_CPLUSPLUS
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (by_type&& that)
: type (that.type)
{
that.clear ();
}
#endif
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& that)
: type (that.type)
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& other)
: type (other.type)
{}
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (token_type t)
+2 -2
View File
@@ -706,7 +706,7 @@ struct yyGLRStack {
static void yyexpandGLRStack (yyGLRStack* yystackp);
#endif
_Noreturn static void
static _Noreturn void
yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
{
if (yymsg != YY_NULLPTR)
@@ -714,7 +714,7 @@ yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
YYLONGJMP (yystackp->yyexception_buffer, 1);
}
_Noreturn static void
static _Noreturn void
yyMemoryExhausted (yyGLRStack* yystackp)
{
YYLONGJMP (yystackp->yyexception_buffer, 2);
+4 -4
View File
@@ -336,7 +336,7 @@ m4_define([b4_shared_declarations],
stack_symbol_type (YY_RVREF (stack_symbol_type) that);
/// Steal the contents from \a sym to build this.
stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
#if YY_CPLUSPLUS < 201103L
#if !defined __cplusplus || __cplusplus < 201103L
/// Assignment, needed by push_back by some old implementations.
/// Moves the contents of that.
stack_symbol_type& operator= (stack_symbol_type& that);
@@ -612,7 +612,7 @@ m4_if(b4_prefix, [yy], [],
{]b4_variant_if([
b4_symbol_variant([that.type_get ()],
[value], [YY_MOVE_OR_COPY], [YY_MOVE (that.value)])])[
#if 201103L <= YY_CPLUSPLUS
#if defined __cplusplus && 201103L <= __cplusplus
// that is emptied.
that.state = empty_state;
#endif
@@ -627,7 +627,7 @@ m4_if(b4_prefix, [yy], [],
that.type = empty_symbol;
}
#if YY_CPLUSPLUS < 201103L
#if !defined __cplusplus || __cplusplus < 201103L
]b4_parser_class_name[::stack_symbol_type&
]b4_parser_class_name[::stack_symbol_type::operator= (stack_symbol_type& that)
{
@@ -685,7 +685,7 @@ m4_if(b4_prefix, [yy], [],
void
]b4_parser_class_name[::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)
{
#if 201103L <= YY_CPLUSPLUS
#if defined __cplusplus && 201103L <= __cplusplus
yypush_ (m, stack_symbol_type (s, std::move (sym)));
#else
stack_symbol_type ss (s, sym);
+22 -61
View File
@@ -125,7 +125,7 @@ m4_define([b4_variant_define],
return *new (yyas_<T> ()) T ();
}
# if 201103L <= YY_CPLUSPLUS
# if defined __cplusplus && 201103L <= __cplusplus
/// Instantiate a \a T in here from \a t.
template <typename T, typename U>
T&
@@ -213,7 +213,7 @@ m4_define([b4_variant_define],
void
move (self_type& other)
{
# if 201103L <= YY_CPLUSPLUS
# if defined __cplusplus && 201103L <= __cplusplus
emplace<T> (std::move (other.as<T> ()));
# else
emplace<T> ();
@@ -222,7 +222,7 @@ m4_define([b4_variant_define],
other.destroy<T> ();
}
# if 201103L <= YY_CPLUSPLUS
# if defined __cplusplus && 201103L <= __cplusplus
/// Move the content of \a other to this.
template <typename T>
void
@@ -335,21 +335,13 @@ m4_define([b4_symbol_value_template],
# these SYMBOL-NUMBERS. Use at class-level.
m4_define([_b4_symbol_constructor_declare],
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
[#if 201103L <= YY_CPLUSPLUS
static
[ static
symbol_type
make_[]_b4_symbol([$1], [id]) (dnl
b4_join(b4_symbol_if([$1], [has_type],
[b4_symbol([$1], [type]) v]),
b4_locations_if([location_type l])));
#else
static
symbol_type
make_[]_b4_symbol([$1], [id]) (dnl
b4_join(b4_symbol_if([$1], [has_type],
[const b4_symbol([$1], [type])& v]),
b4_locations_if([const location_type& l])));
#endif
[YY_COPY (b4_symbol([$1], [type])) v]),
b4_locations_if([YY_COPY (location_type) l])));
])])])
@@ -368,31 +360,18 @@ b4_symbol_foreach([_b4_symbol_constructor_declare])])
# Define symbol constructor for this SYMBOL-NUMBER.
m4_define([_b4_symbol_constructor_define],
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
[# if 201103L <= YY_CPLUSPLUS
inline
[ inline
b4_parser_class_name::symbol_type
b4_parser_class_name::make_[]_b4_symbol([$1], [id]) (dnl
b4_join(b4_symbol_if([$1], [has_type],
[b4_symbol([$1], [type]) v]),
b4_locations_if([location_type l])))
[YY_COPY (b4_symbol([$1], [type])) v]),
b4_locations_if([YY_COPY (location_type) l])))
{
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
b4_symbol_if([$1], [has_type], [std::move (v)]),
b4_locations_if([std::move (l)])));
b4_symbol_if([$1], [has_type], [YY_MOVE (v)]),
b4_locations_if([YY_MOVE (l)])));
}
#else
inline
b4_parser_class_name::symbol_type
b4_parser_class_name::make_[]_b4_symbol([$1], [id]) (dnl
b4_join(b4_symbol_if([$1], [has_type],
[const b4_symbol([$1], [type])& v]),
b4_locations_if([const location_type& l])))
{
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
b4_symbol_if([$1], [has_type], [v]),
b4_locations_if([l])));
}
#endif
])])])
@@ -400,44 +379,26 @@ b4_join(b4_symbol_if([$1], [has_type],
# -----------------------------------
# Generate a constructor declaration for basic_symbol from given type.
m4_define([b4_basic_symbol_constructor_declare],
[[# if 201103L <= YY_CPLUSPLUS
basic_symbol (]b4_join(
[[ basic_symbol (]b4_join(
[typename Base::kind_type t],
b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type])&& v]),
b4_locations_if([location_type&& l]))[);
#else
basic_symbol (]b4_join(
[typename Base::kind_type t],
b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]),
b4_locations_if([const location_type& l]))[);
#endif
b4_symbol_if([$1], [has_type], [YY_RVREF (b4_symbol([$1], [type])) v]),
b4_locations_if([YY_RVREF (location_type) l]))[);
]])
# b4_basic_symbol_constructor_define
# ----------------------------------
# Generate a constructor implementation for basic_symbol from given type.
m4_define([b4_basic_symbol_constructor_define],
[[# if 201103L <= YY_CPLUSPLUS
template <typename Base>
[[ template <typename Base>
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
[typename Base::kind_type t],
b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type])&& v]),
b4_locations_if([location_type&& l]))[)
b4_symbol_if([$1], [has_type], [YY_RVREF (b4_symbol([$1], [type])) v]),
b4_locations_if([YY_RVREF (location_type) l]))[)
: Base (t)]b4_symbol_if([$1], [has_type], [
, value (std::move (v))])[]b4_locations_if([
, location (std::move (l))])[
, value (YY_MOVE (v))])[]b4_locations_if([
, location (YY_MOVE (l))])[
{}
#else
template <typename Base>
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
[typename Base::kind_type t],
b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]),
b4_locations_if([const location_type& l]))[)
: Base (t)]b4_symbol_if([$1], [has_type], [
, value (v)])[]b4_locations_if([
, location (l)])[
{}
#endif
]])
# b4_symbol_constructor_define
+2 -2
View File
@@ -32,7 +32,7 @@ if ENABLE_CXX14
check_PROGRAMS += %D%/simple
nodist_%C%_simple_SOURCES = $(simple_sources)
%C%_simple_CXXFLAGS = $(CXX11_CXXFLAGS) $(WARN_CXXFLAGS_TEST)
%C%_simple_CXXFLAGS = $(CXX11_CXXFLAGS)
# Don't use gnulib's system headers.
%C%_simple_CPPFLAGS = -I$(top_builddir)
TESTS += %D%/simple.test
@@ -58,7 +58,7 @@ EXTRA_DIST += %D%/variant.test
if ENABLE_CXX11
check_PROGRAMS += %D%/variant-11
nodist_%C%_variant_11_SOURCES = %D%/variant-11.yy
%C%_variant_11_CXXFLAGS = $(CXX11_CXXFLAGS) $(WARN_CXXFLAGS_TEST)
%C%_variant_11_CXXFLAGS = $(CXX11_CXXFLAGS)
# Don't use gnulib's system headers.
%C%_variant_11_CPPFLAGS = -I$(top_builddir)
TESTS += %D%/variant-11.test
+3 -5
View File
@@ -37,8 +37,9 @@
%code // *.cc
{
#include <climits> // INT_MIN, INT_MAX
#include <algorithm>
#include <iostream>
#include <iterator>
#include <sstream>
namespace yy
@@ -140,10 +141,7 @@ int
main (int argc, const char *argv[])
{
if (2 <= argc && isdigit (*argv[1]))
{
auto maxl = strtol (argv[1], nullptr, 10);
max = INT_MIN <= maxl && maxl <= INT_MAX ? int(maxl) : 4;
}
max = strtol (argv[1], nullptr, 10);
auto&& p = yy::parser{};
p.set_debug_level (!!getenv ("YYDEBUG"));
return p.parse ();
+2
View File
@@ -33,7 +33,9 @@ typedef std::vector<std::string> strings_type;
%code // *.cc
{
#include <algorithm>
#include <iostream>
#include <iterator>
#include <sstream>
namespace yy
+1 -1
Submodule gnulib updated: 48a6c46b0b...a79f2a2871
-1
View File
@@ -190,4 +190,3 @@
/localtime-buffer.m4
/sys_resource_h.m4
/timespec.m4
/intl-thread-locale.m4
+13 -39
View File
@@ -103,7 +103,7 @@ AT_KEYWORDS([variant])
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" %debug $1])
# Store strings and integers in a vector of strings.
AT_DATA_GRAMMAR([list.yy],
AT_DATA_GRAMMAR([list.y],
[[%skeleton "lalr1.cc"
%define api.value.type variant
%define parse.assert
@@ -142,52 +142,24 @@ exp: "int" { $$.push_back ($1); }
]AT_YYERROR_DEFINE[
]AT_YYLEX_DEFINE[
template <typename Exp, typename Eff>
void assert_eq (const Exp& exp, const Eff& eff)
{
if (getenv ("DEBUG"))
std::cerr << "Assert: " << exp << " == " << eff << '\n';
if (exp != eff)
std::cerr << "Assertion failed: " << exp << " != " << eff << '\n';
}
int main()
{
using yy::parser;
// symbol_type: construction, accessor.
{
parser::symbol_type s = parser::make_INT (12);
assert_eq (s.value.as<int> (), 12);
}
// symbol_type: move constructor.
#if 201103L <= YY_CPLUSPLUS
{
auto s = parser::make_INT (42);
auto s2 = std::move (s);
assert_eq (s2.value.as<int> (), 42);
// Used to crash here, because s was improperly cleared, and
// its destructor tried to delete its (moved) value.
}
#endif
// symbol_type: copy constructor.
{
parser::symbol_type s = parser::make_INT (51);
parser::symbol_type s2 = s;
assert_eq (s.value.as<int> (), 51);
assert_eq (s2.value.as<int> (), 51);
parser::symbol_type s = parser::make_INT(12);
std::cerr << s.value.as<int>() << '\n';
}
// stack_symbol_type: construction, accessor.
{
#if 201103L <= YY_CPLUSPLUS
#if defined __cplusplus && 201103L <= __cplusplus
auto ss = parser::stack_symbol_type(1, parser::make_INT(123));
#else
parser::symbol_type s = parser::make_INT (123);
parser::symbol_type s = parser::make_INT(123);
parser::stack_symbol_type ss(1, s);
#endif
assert_eq (ss.value.as<int> (), 123);
std::cerr << ss.value.as<int>() << '\n';
}
// Pushing on the stack.
@@ -198,7 +170,7 @@ int main()
const int mucho = 1700;
for (int i = 0; i < mucho; ++i)
{
#if 201103L <= YY_CPLUSPLUS
#if defined __cplusplus && 201103L <= __cplusplus
st.push(parser::stack_symbol_type{1, parser::make_INT (i)});
#else
parser::symbol_type s = parser::make_INT (i);
@@ -208,17 +180,19 @@ int main()
}
for (int i = mucho - 1; 0 <= i; --i)
{
assert_eq (st[0].value.as<int>(), i);
assert (st[0].value.as<int>() == i);
st.pop ();
}
}
}
]])
AT_BISON_CHECK([[-o list.cc list.yy]])
AT_FOR_EACH_CXX([
AT_COMPILE_CXX([list])
AT_PARSER_CHECK([./list])
AT_FULL_COMPILE([list])
AT_PARSER_CHECK([./list], 0, [],
[12
123
])
])
AT_BISON_OPTION_POPDEFS
-1
View File
@@ -317,7 +317,6 @@ AT_CHECK([[$PERL -n -0777 -e '
|YYUSE
|YY_ATTRIBUTE(?:_PURE|_UNUSED)?
|YY_COPY
|YY_CPLUSPLUS
|YY_IGNORE_MAYBE_UNINITIALIZED_(?:BEGIN|END)
|YY_INITIAL_VALUE
|YY_MOVE
+31 -58
View File
@@ -248,25 +248,16 @@ m4_pushdef([AT_YYLTYPE],
[AT_CXX_IF([AT_NAMESPACE[::parser::location_type]],
[AT_API_PREFIX[LTYPE]])])
AT_TOKEN_CTOR_IF(
[m4_pushdef([AT_LOC], [[(]AT_NAME_PREFIX[lloc)]])
m4_pushdef([AT_VAL], [[(]AT_NAME_PREFIX[lval)]])
m4_pushdef([AT_YYLEX_FORMALS], [])
m4_pushdef([AT_YYLEX_RETURN], [yy::parser::symbol_type])
m4_pushdef([AT_YYLEX_ARGS], [])
m4_pushdef([AT_USE_LEX_ARGS], [])
m4_pushdef([AT_YYLEX_PRE_FORMALS], [])
m4_pushdef([AT_YYLEX_PRE_ARGS], [])],
[AT_PURE_LEX_IF(
AT_PURE_LEX_IF(
[m4_pushdef([AT_LOC], [(*llocp)])
m4_pushdef([AT_VAL], [(*lvalp)])
m4_pushdef([AT_YYLEX_FORMALS],
[AT_YYSTYPE *lvalp[]AT_LOCATION_IF([, AT_YYLTYPE *llocp])])
m4_pushdef([AT_YYLEX_RETURN], [int])
m4_pushdef([AT_YYLEX_ARGS],
[lvalp[]AT_LOCATION_IF([, llocp])])
m4_pushdef([AT_USE_LEX_ARGS],
[(void) lvalp;AT_LOCATION_IF([(void) llocp;])])
[(void) lvalp;AT_LOCATION_IF([(void) llocp])])
m4_pushdef([AT_YYLEX_PRE_FORMALS],
[AT_YYLEX_FORMALS, ])
m4_pushdef([AT_YYLEX_PRE_ARGS],
@@ -275,12 +266,11 @@ AT_TOKEN_CTOR_IF(
[m4_pushdef([AT_LOC], [[(]AT_NAME_PREFIX[lloc)]])
m4_pushdef([AT_VAL], [[(]AT_NAME_PREFIX[lval)]])
m4_pushdef([AT_YYLEX_FORMALS], [void])
m4_pushdef([AT_YYLEX_RETURN], [int])
m4_pushdef([AT_YYLEX_ARGS], [])
m4_pushdef([AT_USE_LEX_ARGS], [])
m4_pushdef([AT_USE_LEX_ARGS], [])
m4_pushdef([AT_YYLEX_PRE_FORMALS], [])
m4_pushdef([AT_YYLEX_PRE_ARGS], [])
])])
])
# Handle the different types of location components.
@@ -413,7 +403,7 @@ $2])
# ACTION may compute yylval for instance, using "res" as token type,
# and "toknum" as the number of calls to yylex (starting at 0).
m4_define([AT_YYLEX_PROTOTYPE],
[AT_YYLEX_RETURN AT_NAME_PREFIX[]lex (]AT_YYLEX_FORMALS[)[]dnl
[int AT_NAME_PREFIX[]lex (]AT_YYLEX_FORMALS[)[]dnl
])
m4_define([AT_YYLEX_DECLARE_EXTERN],
@@ -434,15 +424,15 @@ static
[[static int const input[] = ]$1])[;
static size_t toknum = 0;
int res;
]AT_USE_LEX_ARGS[
]AT_USE_LEX_ARGS[;
assert (toknum < sizeof input / sizeof input[0]);
res = input[toknum++];
]$2[;]AT_TOKEN_CTOR_IF([], [[
]AT_LOCATION_IF([[
]$2[;]AT_LOCATION_IF([[
]AT_LOC_FIRST_LINE[ = ]AT_LOC_LAST_LINE[ = 1;
]AT_LOC_FIRST_COLUMN[ = ]AT_LOC_LAST_COLUMN[ = ]AT_CXX_IF([(unsigned )], [(int)])[toknum;]])[
return res;]])[
}]])
return res;
}]dnl
])
# AT_YYERROR_FORMALS
# AT_YYERROR_PROTOTYPE
@@ -549,9 +539,6 @@ main (int argc, char const* argv[])
return ]AT_NAME_PREFIX[parse ();
}]])
m4_define([AT_LANG_FOR_EACH_STD(c)],
[$1])
## ----- ##
## C++. ##
@@ -586,24 +573,21 @@ main (int argc, char const* argv[])
return p.parse ();
}]])
m4_define([AT_LANG_FOR_EACH_STD(c++)],
[AT_FOR_EACH_CXX([$1])])
m4_define([AT_FOR_EACH_CXX],
[[at_for_each_std_CXXFLAGS_save=$CXXFLAGS
for at_std in '' \
${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \
${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \
${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \
${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \
${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \
${CXX2A_CXXFLAGS:+"$CXX2A_CXXFLAGS"}
[[at_for_each_cxx_CXXFLAGS_save=$CXXFLAGS
for at_cxx_std in '' \
${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \
${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \
${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \
${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \
${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \
${CXX2A_CXXFLAGS:+"$CXX2A_CXXFLAGS"}
do
]AS_ECHO(["======== Testing with C++ standard flags: '$at_cxx_std'"])[
CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std"
CXXFLAGS="$at_for_each_cxx_CXXFLAGS_save $at_cxx_std"
]$1[
done
CXXFLAGS=$at_for_each_std_CXXFLAGS_save
CXXFLAGS=$at_for_each_cxx_CXXFLAGS_save
]])
## ------ ##
@@ -635,8 +619,7 @@ m4_define([AT_MAIN_DEFINE(java)],
}
}]])
m4_define([AT_LANG_FOR_EACH_STD(java)],
[$1])
## --------------- ##
## Running Bison. ##
@@ -836,11 +819,6 @@ AT_CHECK([[$SHELL ../../../javacomp.sh ]$1],
[[0]], [ignore], [ignore])])
# AT_LANG_FOR_EACH_STD(BODY)
# -------------------------------
m4_define([AT_LANG_FOR_EACH_STD], [AT_LANG_DISPATCH([$0], $@)])
# AT_LANG_COMPILE(OUTPUT, [SOURCES = OUTPUT.c], [EXTRA-COMPILER-FLAGS])
# ---------------------------------------------------------------------
# Compile SOURCES into OUTPUT. Skip if compiler does not work.
@@ -926,11 +904,11 @@ AT_PARSER_CHECK([./c-and-cxx])
])
# AT_REQUIRE_CXX_STD(STD, [IF-FAIL = SKIP])
# -----------------------------------------
# AT_REQUIRE_CXX_VERSION(STD)
# ---------------------------
# Skip unless this compiler supports at least C++ STD (e.g., "11",
# "14", etc.).
m4_define([AT_REQUIRE_CXX_STD],
m4_define([AT_REQUIRE_CXX_VERSION],
[AT_DATA([check.cc],
[[int main ()
{
@@ -942,19 +920,14 @@ m4_define([AT_REQUIRE_CXX_STD],
[17], [201703],
[2a], [201709],
[m4_fatal([$0: invalid arguments: $@])])[
return 1;
return 77;
#else
return 0;
#endif
}
]])
AT_COMPILE_CXX([check])
AT_CHECK([@&t@./check], [ignore])
m4_ifval([$2],
[if test $at_status != 0; then
$2
fi],
[SKIP_IF([test $at_status != 0])])
AT_CHECK([@&t@./check])
])
@@ -967,11 +940,11 @@ m4_define([AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR],
[[#include <iostream>
#include <stdexcept>
void foo ()
void foo()
{
try
{
throw std::runtime_error ("foo");
throw std::runtime_error("foo");
}
catch (...)
{
@@ -980,11 +953,11 @@ void foo ()
}
}
int main ()
int main()
{
try
{
foo ();
foo();
}
catch (...)
{
+1 -1
View File
@@ -396,7 +396,7 @@ AT_BISON_OPTION_PUSHDEFS([%skeleton "$1"])
# properly to the linker, and is unable to save a file named this way.
# Don't try with such compilers.
AT_DATA([\"\\\"\".c],
[[int main (void) { return 0; }
[[int main() { return 0; }
]])
AT_CHECK([AT_CXX_IF([$CXX $CXXFLAGS], [$CC $CFLAGS]) $CPPFLAGS \"\\\"\".c -o \"\\\"\" ||
+4 -46
View File
@@ -78,7 +78,7 @@ m4_pushdef([_AT_TEST],
[
AT_SETUP([$1])
AT_KEYWORDS([api.value.type])
$7
AT_BISON_OPTION_PUSHDEFS([%debug $1 $2])
AT_DATA_GRAMMAR([test.y],
[[%debug
@@ -104,12 +104,9 @@ start: $3;
]AT_MAIN_DEFINE[
]])
AT_LANG_FOR_EACH_STD([
$7
AT_FULL_COMPILE([[test]])
AT_PARSER_CHECK([[./test]], 0, [[$6
AT_FULL_COMPILE([[test]])
AT_PARSER_CHECK([[./test]], 0, [[$6
]])
])
AT_BISON_OPTION_POPDEFS
AT_CLEANUP
@@ -270,44 +267,6 @@ m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc]],
AT_VAL.build<std::string> ("two");],
[10, two])
# Test a regression where we passed user types (we can include
# commas) to a CPP macro.
AT_TEST([%skeleton "]b4_skel["
%define api.value.type variant],
[%token <std::pair<int, int>> '1';
%token <std::pair<std::string, std::string>> '2';],
['1' '2'
{
std::cout << $1.first << ':' << $1.second << ", "
<< $2.first << ':' << $2.second << '\n';
}],
["12"],
[if (res == '1')
AT_VAL.build (std::make_pair (10, 11));
else if (res == '2')
AT_VAL.build (std::make_pair<std::string, std::string> ("two", "deux"));],
[10:11, two:deux])
AT_TEST([%skeleton "]b4_skel["
%code requires { #include <memory> }
%define api.value.type variant
%define api.token.constructor],
[[%token <std::unique_ptr<int>> ONE;
%token <std::pair<int, int>> TWO;
%token EOI 0;]],
[ONE TWO { std::cout << *$1 << ", "
<< $2.first << ", "
<< $2.second << '\n'; }],
["12"],
[[if (res == '1')
return yy::parser::make_ONE (std::make_unique<int> (10));
else if (res == '2')
return yy::parser::make_TWO (std::make_pair<int, int> (21, 22));
else
return yy::parser::make_EOI ()]],
[10, 21, 22],
[AT_REQUIRE_CXX_STD(14, [echo "$at_std not supported"; continue])])
# Move-only types.
AT_TEST([%skeleton "]b4_skel["
%code requires { #include <memory> }
@@ -323,8 +282,7 @@ m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc]],
]AT_VAL[.emplace <std::unique_ptr<std::string>>
(std::make_unique <std::string> ("two"));]],
[10, two],
[AT_REQUIRE_CXX_STD(14, [echo "$at_std not supported"; continue])])
[AT_REQUIRE_CXX_VERSION(14)])])
])
])