diff --git a/bm/bm_parse.cpp b/bm/bm_parse.cpp index ed576c343..51be1d304 100644 --- a/bm/bm_parse.cpp +++ b/bm/bm_parse.cpp @@ -235,8 +235,8 @@ void bm_ryml_json_arena_reserve(bm::State& st) ryml::id_type cap = estimate_capacity(src); for(auto _ : st) { - st.PauseTiming(); ONLY_FOR_JSON; + st.PauseTiming(); ryml::Tree tree; tree.reserve(cap); st.ResumeTiming(); @@ -250,8 +250,8 @@ void bm_ryml_json_arena_nofilter(bm::State& st) c4::csubstr src = c4::to_csubstr(s_bm_case->src).trimr('\0'); for(auto _ : st) { - st.PauseTiming(); ONLY_FOR_JSON; + st.PauseTiming(); ryml::EventHandlerTree evth; ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false)); st.ResumeTiming(); @@ -266,8 +266,8 @@ void bm_ryml_json_arena_nofilter_reserve(bm::State& st) ryml::id_type cap = estimate_capacity(src); for(auto _ : st) { - st.PauseTiming(); ONLY_FOR_JSON; + st.PauseTiming(); ryml::EventHandlerTree evth; ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false)); ryml::Tree tree; @@ -299,7 +299,7 @@ void bm_ryml_yaml_inplace_reserve(bm::State& st) for(auto _ : st) { st.PauseTiming(); - s_bm_case->prepare(st, kResetInPlace); + s_bm_case->prepare(kResetInPlace); ryml::Tree tree; tree.reserve(cap); st.ResumeTiming(); @@ -314,7 +314,7 @@ void bm_ryml_yaml_inplace_nofilter(bm::State& st) for(auto _ : st) { st.PauseTiming(); - s_bm_case->prepare(st, kResetInPlace); + s_bm_case->prepare(kResetInPlace); ryml::EventHandlerTree evth; ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false)); st.ResumeTiming(); @@ -330,7 +330,7 @@ void bm_ryml_yaml_inplace_nofilter_reserve(bm::State& st) for(auto _ : st) { st.PauseTiming(); - s_bm_case->prepare(st, kResetInPlace); + s_bm_case->prepare(kResetInPlace); ryml::EventHandlerTree evth; ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false)); ryml::Tree tree; @@ -349,9 +349,9 @@ void bm_ryml_json_inplace(bm::State& st) c4::substr src = c4::to_substr(s_bm_case->in_place).trimr('\0'); for(auto _ : st) { - st.PauseTiming(); ONLY_FOR_JSON; - s_bm_case->prepare(st, kResetInPlace); + st.PauseTiming(); + s_bm_case->prepare(kResetInPlace); st.ResumeTiming(); ryml::Tree tree = ryml::parse_json_in_place(s_bm_case->filename, src); } @@ -364,9 +364,9 @@ void bm_ryml_json_inplace_reserve(bm::State& st) ryml::id_type cap = estimate_capacity(src); for(auto _ : st) { - st.PauseTiming(); ONLY_FOR_JSON; - s_bm_case->prepare(st, kResetInPlace); + st.PauseTiming(); + s_bm_case->prepare(kResetInPlace); ryml::Tree tree; tree.reserve(cap); st.ResumeTiming(); @@ -380,9 +380,9 @@ void bm_ryml_json_inplace_nofilter(bm::State& st) c4::substr src = c4::to_substr(s_bm_case->in_place).trimr('\0'); for(auto _ : st) { - st.PauseTiming(); ONLY_FOR_JSON; - s_bm_case->prepare(st, kResetInPlace); + st.PauseTiming(); + s_bm_case->prepare(kResetInPlace); ryml::EventHandlerTree evth; ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false)); st.ResumeTiming(); @@ -397,9 +397,9 @@ void bm_ryml_json_inplace_nofilter_reserve(bm::State& st) ryml::id_type cap = estimate_capacity(src); for(auto _ : st) { - st.PauseTiming(); ONLY_FOR_JSON; - s_bm_case->prepare(st, kResetInPlace); + st.PauseTiming(); + s_bm_case->prepare(kResetInPlace); ryml::EventHandlerTree evth; ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false)); ryml::Tree tree; diff --git a/src/c4/yml/detail/parser_dbg.hpp b/src/c4/yml/detail/parser_dbg.hpp index 7ce796538..1ca87d068 100644 --- a/src/c4/yml/detail/parser_dbg.hpp +++ b/src/c4/yml/detail/parser_dbg.hpp @@ -42,18 +42,20 @@ #else # define _c4err(fmt, ...) \ do { RYML_DEBUG_BREAK(); this->_err("ERROR:\n" "{}:{}: " fmt, __FILE__, __LINE__, ## __VA_ARGS__); } while(0) -# define _c4dbgt(fmt, ...) this->_dbg ("{}:{}: " fmt , __FILE__, __LINE__, ## __VA_ARGS__) -# define _c4dbgpf(fmt, ...) _dbg_printf("{}:{}: " fmt "\n", __FILE__, __LINE__, ## __VA_ARGS__) -# define _c4dbgpf_(fmt, ...) _dbg_printf("{}:{}: " fmt , __FILE__, __LINE__, ## __VA_ARGS__) -# define _c4dbgp(msg) _dbg_printf("{}:{}: " msg "\n", __FILE__, __LINE__ ) -# define _c4dbgp_(msg) _dbg_printf("{}:{}: " msg , __FILE__, __LINE__ ) -# define _c4dbgq(msg) _dbg_printf(msg "\n") +# define _c4dbgt(fmt, ...) do { if(_dbg_enabled()) { this->_dbg ("{}:{}: " fmt , __FILE__, __LINE__, ## __VA_ARGS__); } } while(0) +# define _c4dbgpf(fmt, ...) do { if(_dbg_enabled()) { _dbg_printf("{}:{}: " fmt "\n", __FILE__, __LINE__, ## __VA_ARGS__); } } while(0) +# define _c4dbgpf_(fmt, ...) do { if(_dbg_enabled()) { _dbg_printf("{}:{}: " fmt , __FILE__, __LINE__, ## __VA_ARGS__); } } while(0) +# define _c4dbgp(msg) do { if(_dbg_enabled()) { _dbg_printf("{}:{}: " msg "\n", __FILE__, __LINE__ ); } } while(0) +# define _c4dbgp_(msg) do { if(_dbg_enabled()) { _dbg_printf("{}:{}: " msg , __FILE__, __LINE__ ); } } while(0) +# define _c4dbgq(msg) do { if(_dbg_enabled()) { _dbg_printf(msg "\n"); } } while(0) # define _c4presc(...) __c4presc(__VA_ARGS__) -# define _c4prscalar(msg, scalar, keep_newlines) \ - do { \ - _c4dbgpf_("{}: [{}]~~~", msg, scalar.len); \ - __c4presc((scalar).str, (scalar).len, (keep_newlines)); \ - _c4dbgq("~~~"); \ +# define _c4prscalar(msg, scalar, keep_newlines) \ + do { \ + _c4dbgpf_("{}: [{}]~~~", msg, scalar.len); \ + if(_dbg_enabled()) { \ + __c4presc((scalar).str, (scalar).len, (keep_newlines)); \ + } \ + _c4dbgq("~~~"); \ } while(0) #endif // RYML_DBG @@ -64,6 +66,8 @@ #include namespace c4 { +inline bool& _dbg_enabled() { static bool enabled = true; return enabled; } +inline void _set_dbg_enabled(bool yes) { _dbg_enabled() = yes; } inline void _dbg_dumper(csubstr s) { if(s.str) diff --git a/test/test_map.cpp b/test/test_map.cpp index a96801fe0..40562d65f 100644 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -1468,39 +1468,19 @@ image: Visual Studio 2017 environment: matrix: - - - compiler: msvc-15-seh - generator: "Visual Studio 15 2017" - configuration: Debug - - compiler: msvc-15-seh - generator: "Visual Studio 15 2017 Win64" - configuration: Debug - compiler: msvc-15-seh - generator: "Visual Studio 15 2017 Win64" - configuration: Debug + - compiler: msvc-15-seh )", N(MB, L{ N(KP|VS, "version", "{build}"), N(KP|VP, "image", "Visual Studio 2017"), N(KP|MB, "environment", L{ N(KP|SB, "matrix", L{ - N(MB, L{ - N(KP|VP, "compiler", "msvc-15-seh"), - N(KP|VD, "generator", "Visual Studio 15 2017"), - N(KP|VP, "configuration", "Debug"), - }), - N(MB, L{ - N(KP|VP, "compiler", "msvc-15-seh"), - N(KP|VD, "generator", "Visual Studio 15 2017 Win64"), - N(KP|VP, "configuration", "Debug"), - }), - N(MB, L{ - N(KP|VP, "compiler", "msvc-15-seh"), - N(KP|VD, "generator", "Visual Studio 15 2017 Win64"), - N(KP|VP, "configuration", "Debug"), - }), + N(MB, L{N(KP|VP, "compiler", "msvc-15-seh"),}), + N(MB, L{N(KP|VP, "compiler", "msvc-15-seh"),}), + N(MB, L{N(KP|VP, "compiler", "msvc-15-seh"),}), }) }) }) @@ -1520,7 +1500,7 @@ R"(matrix: - env: CXX_=g++-7 A=32 BT=Debug SAN=ALL VG=ON )", N(MB, L{ - N(KP|SB, "matrix", L{ + N(KP|MB, "matrix", L{ N(KP|SB, "include", L{ N(MB, L{N(KP|VP, "env", "CXX_=g++-7 A=64 BT=Coverage"),}), N(MB, L{N(KP|VP, "env", "CXX_=g++-7 A=32 BT=Coverage"),}),