mirror of
https://github.com/boostorg/spirit.git
synced 2026-01-19 04:42:11 +00:00
Use concepts for attribute category overload resolution (#812)
* Use concepts for attribute category overload resolution
`x3::traits::move_to`: Dump tag dispatching and use concepts for
overload resolution. This drastically improves compilation speed and
prints significantly concise errors on ill-formed programs, thanks to
the reduced nesting level on the entire control flow of X3. Also
partially (but not yet completely) improves #346 due to reduced MPL usage.
`x3::detail::parse_into_container`: Ditto.
`support/traits/optional_traits.hpp`:
`BOOST_SPIRIT_X3_USE_BOOST_OPTIONAL`: new macro.
Default to `boost::optional` unless above macro is defined as `0`. Implements
`std::optional` handling regardless of the value; fixes #270.
Note that most test suites are intentionally not defining above macro as `1`
(yet) to make sure the change does not break existing codes.
`x3::optional`: Ideally this should've split into a separate PR, but the
new attribute category handling requires the overhaul on this.
`core/proxy.hpp`: Removed. `x3::optional` was the only derived parser
which used this feature for years. We shouldn't support any overly
generic 'core' features whose extandable use case is unknown even to the
core components.
`extract_int`, etc.: Adjusted to properly "move" the local attribute
variable before passing it to `x3::traits::move_to`.
`char_parser`: Ditto, but this constructs temporary value instead of
applying `std::as_const`. Const references are costly for primitive type
like `Char` thus prvalue should be constructed here.
tests: No semantic changes intended. All changes exists solely for
adapting to the new attribute category handling (implementation details.)
* Fix incorrect `noexcept` specification
* Compensate for potential GCC bug on constraint satisfaction
It turns out that GCC 14 does not like the form below, resulting
in silently defining the flipped value (!) without raising any sort of
hard/soft errors in well-formed code.
```
struct S : std::bool_constant<requires(...) { ... }> {};
```
* Use the correct path to retrieve action cache
<638ed79f9d/restore (ensuring-proper-restores-and-save-happen-across-the-actions)>
> It is very important to use the same key and path that were used by either actions/cache or actions/cache/save while saving the cache.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2017-2021 Nikita Kniazev
|
||||
Copyright (c) 2025 Nana Sakisaka
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
|
||||
#include <boost/spirit/home/x3.hpp>
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2014 Joel de Guzman
|
||||
Copyright (c) 2025 Nana Sakisaka
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#include "test.hpp"
|
||||
|
||||
#include <boost/spirit/home/x3.hpp>
|
||||
#include <boost/fusion/include/std_pair.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "test.hpp"
|
||||
|
||||
using boost::spirit::x3::rule;
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2012 Joel de Guzman
|
||||
Copyright (c) 2025 Nana Sakisaka
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
#include <boost/spirit/home/x3.hpp>
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
#include <boost/fusion/include/std_pair.hpp>
|
||||
@@ -14,7 +17,6 @@
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include "test.hpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// bogus https://developercommunity.visualstudio.com/t/buggy-warning-c4709/471956
|
||||
@@ -34,9 +36,10 @@ struct f
|
||||
};
|
||||
|
||||
|
||||
struct stationary : boost::noncopyable
|
||||
struct stationary
|
||||
{
|
||||
explicit stationary(int i) : val{i} {}
|
||||
stationary(stationary const&) = delete;
|
||||
stationary& operator=(int i) { val = i; return *this; }
|
||||
|
||||
int val;
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2015 Joel de Guzman
|
||||
Copyright (c) 2025 Nana Sakisaka
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
#include <boost/spirit/home/x3.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include "test.hpp"
|
||||
|
||||
namespace x3 = boost::spirit::x3;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user