2
0
mirror of https://github.com/boostorg/parser.git synced 2026-02-21 03:12:08 +00:00

Add define BOOST_PARSER_DISABLE_TRACE to disable trace mode at compile time.

The trace feature doubles the compile time, even if never used.
This patch introduces the preprocessor define BOOST_PARSER_DISABLE_TRACE
to deactivate this feature at compile time.
This commit is contained in:
Andreas Buhr
2025-08-07 14:10:37 +02:00
committed by Zach Laine
parent 1b984e3546
commit 4a200a4074
10 changed files with 206 additions and 17 deletions

27
test/disable_trace.cpp Normal file
View File

@@ -0,0 +1,27 @@
/**
* Copyright (C) 2025
*
* 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)
*/
#define BOOST_PARSER_DISABLE_TRACE
#include <boost/core/lightweight_test.hpp>
#include <boost/parser/parser.hpp>
int main()
{
namespace bp = boost::parser;
{
auto const parser =
bp::string("FOO") >> -(bp::string("bar") | bp::string("foo"));
auto result = bp::parse("FOOfoo", parser);
BOOST_TEST(result);
BOOST_TEST(bp::get(*result, bp::llong<0>{}) == std::string("FOO"));
BOOST_TEST(bp::get(*result, bp::llong<1>{}) == std::string("foo"));
}
return boost::report_errors();
}