mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 22:03:02 +00:00
variables: use parse.assert' instead of assert'.
* TODO (assert): Remove. * data/bison.m4 (b4_assert_if): Replace with... (b4_parse_assert_if): this. * data/lalr1.cc, data/variant.hh, tests/c++.at: Adjust. * doc/bison.texinfo (Decl Summary): Document parse.assert.
This commit is contained in:
@@ -677,17 +677,17 @@ m4_define([b4_percent_define_if_define],
|
||||
b4_percent_define_if_define_([$1], $[1], $[2])])
|
||||
|
||||
|
||||
# b4_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
||||
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
||||
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
||||
# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT])
|
||||
# b4_lex_symbol_if([IF-YYLEX-RETURNS-A-COMPLETE-SYMBOL], [IF-NOT])
|
||||
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
||||
# ----------------------------------------------
|
||||
b4_percent_define_if_define([assert])
|
||||
b4_percent_define_if_define([parse.trace])
|
||||
b4_percent_define_if_define([error_verbose])
|
||||
b4_percent_define_if_define([lex_symbol])
|
||||
b4_percent_define_if_define([locations]) # Whether locations are tracked.
|
||||
b4_percent_define_if_define([parse.assert])
|
||||
b4_percent_define_if_define([parse.trace])
|
||||
b4_percent_define_if_define([variant])
|
||||
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ dnl FIXME: This is wrong, we want computed header guards.
|
||||
|
||||
]b4_percent_code_get([[requires]])[
|
||||
|
||||
]b4_assert_if([#include <cassert>])[
|
||||
]b4_parse_assert_if([#include <cassert>])[
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include "stack.hh"
|
||||
|
||||
@@ -87,13 +87,13 @@ m4_define([b4_variant_define],
|
||||
/// via the current state.
|
||||
template <size_t S>
|
||||
struct variant
|
||||
{]b4_assert_if([
|
||||
{]b4_parse_assert_if([
|
||||
/// Whether something is contained.
|
||||
bool built;
|
||||
])[
|
||||
/// Empty construction.
|
||||
inline
|
||||
variant ()]b4_assert_if([
|
||||
variant ()]b4_parse_assert_if([
|
||||
: built (false)])[
|
||||
{}
|
||||
|
||||
@@ -101,7 +101,7 @@ m4_define([b4_variant_define],
|
||||
template <typename T>
|
||||
inline T&
|
||||
build ()
|
||||
{]b4_assert_if([
|
||||
{]b4_parse_assert_if([
|
||||
assert (!built);
|
||||
built = true;])[
|
||||
return *new (buffer.raw) T;
|
||||
@@ -111,7 +111,7 @@ m4_define([b4_variant_define],
|
||||
template <typename T>
|
||||
inline T&
|
||||
build (const T& t)
|
||||
{]b4_assert_if([
|
||||
{]b4_parse_assert_if([
|
||||
assert(!built);
|
||||
built = true;])[
|
||||
return *new (buffer.raw) T(t);
|
||||
@@ -120,7 +120,7 @@ m4_define([b4_variant_define],
|
||||
/// Construct and fill.
|
||||
template <typename T>
|
||||
inline
|
||||
variant (const T& t)]b4_assert_if([
|
||||
variant (const T& t)]b4_parse_assert_if([
|
||||
: built (true)])[
|
||||
{
|
||||
new (buffer.raw) T(t);
|
||||
@@ -130,7 +130,7 @@ m4_define([b4_variant_define],
|
||||
template <typename T>
|
||||
inline T&
|
||||
as ()
|
||||
{]b4_assert_if([
|
||||
{]b4_parse_assert_if([
|
||||
assert (built);])[
|
||||
return reinterpret_cast<T&>(buffer.raw);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ m4_define([b4_variant_define],
|
||||
template <typename T>
|
||||
inline const T&
|
||||
as () const
|
||||
{]b4_assert_if([
|
||||
{]b4_parse_assert_if([
|
||||
assert(built);])[
|
||||
return reinterpret_cast<const T&>(buffer.raw);
|
||||
}
|
||||
@@ -168,7 +168,7 @@ m4_define([b4_variant_define],
|
||||
inline void
|
||||
destroy ()
|
||||
{
|
||||
as<T>().~T();]b4_assert_if([
|
||||
as<T>().~T();]b4_parse_assert_if([
|
||||
built = false;])[
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user