From ce1681f2524e512f461a446ee5ca86adfe9116df Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 20 Jun 2016 13:13:12 +0200 Subject: Support suppressing CLI runtime generation (--suppress-cli) This is useful in pure-help pages. --- cli/generator.cxx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'cli/generator.cxx') diff --git a/cli/generator.cxx b/cli/generator.cxx index 01f77d5..3a0a55b 100644 --- a/cli/generator.cxx +++ b/cli/generator.cxx @@ -204,13 +204,20 @@ generate (options const& ops, semantics::cli_unit& unit, path const& p) // have to include in the generated header file, we will still // need to generate some template code in the source file. // - bool runtime (true); - for (semantics::cli_unit::includes_iterator i (unit.includes_begin ()); - runtime && i != unit.includes_end (); - ++i) + bool runtime (!ops.suppress_cli ()); + + if (runtime) { - if (i->is_a ()) - runtime = false; + for (semantics::cli_unit::includes_iterator i (unit.includes_begin ()); + i != unit.includes_end (); + ++i) + { + if (i->is_a ()) + { + runtime = false; + break; + } + } } // @@ -391,7 +398,8 @@ generate (options const& ops, semantics::cli_unit& unit, path const& p) if (runtime && !inl) generate_runtime_inline (ctx); - generate_runtime_source (ctx, runtime); + if (!ops.suppress_cli ()) + generate_runtime_source (ctx, runtime); if (!inl) generate_inline (ctx); -- cgit v1.1