|
| 1 | +// Boost header-integrity + version gate. |
| 2 | +// |
| 3 | +// Compiles ONE TU that exercises the four exact subsystems whose torn-header |
| 4 | +// signatures surfaced the Boost 1.90.0 / GCC-13 CI flakes, and static_asserts |
| 5 | +// the resolved Boost is 1.90.0 (catches a stray apt Boost 1.83 filling holes |
| 6 | +// via include-path fallback). Green here == intact single-version tree, right |
| 7 | +// version resolved, compiled archives link. See ci-boost-stream.md ss.D. |
| 8 | +#include <boost/version.hpp> |
| 9 | +static_assert(BOOST_VERSION == 109000, "wrong Boost tree resolved: expected 1.90.0"); |
| 10 | + |
| 11 | +#include <boost/asio/cancel_after.hpp> // pulls detail/timed_cancel_op.hpp (stage-1 casualty) |
| 12 | +#include <boost/asio/io_context.hpp> |
| 13 | +#include <boost/asio/steady_timer.hpp> |
| 14 | + |
| 15 | +#include <boost/log/sources/record_ostream.hpp> |
| 16 | +#include <boost/log/sources/severity_logger.hpp> // A.1 site (BOOST_PP expansion) |
| 17 | +#include <boost/log/trivial.hpp> |
| 18 | +#include <boost/log/utility/setup/console.hpp> |
| 19 | + |
| 20 | +#include <boost/signals2/signal.hpp> // A.2 site (slot_template.hpp) |
| 21 | + |
| 22 | +#include <boost/fusion/adapted/std_pair.hpp> |
| 23 | +#include <boost/spirit/home/x3.hpp> // A.3 site (operator/detail/sequence.hpp) |
| 24 | + |
| 25 | +#include <chrono> |
| 26 | +#include <cstdio> |
| 27 | +#include <memory> |
| 28 | +#include <string> |
| 29 | +#include <utility> |
| 30 | + |
| 31 | +int main() |
| 32 | +{ |
| 33 | + // asio: timed cancellation machinery |
| 34 | + boost::asio::io_context io; |
| 35 | + boost::asio::steady_timer timer(io, std::chrono::milliseconds(100)); |
| 36 | + bool aborted = false; |
| 37 | + timer.async_wait(boost::asio::cancel_after( |
| 38 | + std::chrono::milliseconds(10), |
| 39 | + [&](boost::system::error_code ec) { aborted = (ec == boost::asio::error::operation_aborted); })); |
| 40 | + io.run(); |
| 41 | + if (!aborted) { std::puts("FAIL asio"); return 1; } |
| 42 | + |
| 43 | + // log: severity_logger (header) + libboost_log / log_setup (link check) |
| 44 | + boost::log::add_console_log(); |
| 45 | + boost::log::sources::severity_logger<boost::log::trivial::severity_level> lg; |
| 46 | + BOOST_LOG_SEV(lg, boost::log::trivial::info) << "sentinel: log ok"; |
| 47 | + |
| 48 | + // signals2: std::shared_ptr tracking -> the exact foreign_void_weak_ptr push_back path |
| 49 | + using sig_t = boost::signals2::signal<int(int)>; |
| 50 | + sig_t sig; |
| 51 | + auto tracked = std::make_shared<int>(1); |
| 52 | + sig.connect(sig_t::slot_type([&](int x) { return x + *tracked; }).track_foreign(tracked)); |
| 53 | + if (sig(41).value_or(0) != 42) { std::puts("FAIL signals2"); return 1; } |
| 54 | + |
| 55 | + // spirit.x3: sequence operator -> partition_attribute static_asserts |
| 56 | + namespace x3 = boost::spirit::x3; |
| 57 | + std::pair<int, int> out{}; |
| 58 | + std::string const in = "12,34"; |
| 59 | + auto it = in.begin(); |
| 60 | + if (!x3::parse(it, in.end(), x3::int_ >> ',' >> x3::int_, out) |
| 61 | + || it != in.end() || out.first != 12 || out.second != 34) { |
| 62 | + std::puts("FAIL spirit.x3"); return 1; |
| 63 | + } |
| 64 | + |
| 65 | + std::puts("boost_sentinel: asio+log+signals2+spirit.x3 OK"); |
| 66 | + return 0; |
| 67 | +} |
0 commit comments