summaryrefslogtreecommitdiff
path: root/cli/source.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-09 18:02:40 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-09 18:02:40 +0200
commit9bf40e4a91f6a792c3279d9184b67451cf58bf49 (patch)
treea242a923ec7d309dc488c60f1233fbc91fcbae70 /cli/source.cxx
parentbd21176187a55fa7f6e80b5cfe86f5e756971b4f (diff)
Add --std option with c++{98,11,14} values; use function-static in C++11
This way we can use option descriptions during static initialization (e.g., of an Apache module).
Diffstat (limited to 'cli/source.cxx')
-rw-r--r--cli/source.cxx25
1 files changed, 13 insertions, 12 deletions
diff --git a/cli/source.cxx b/cli/source.cxx
index 38df449..eae40dc 100644
--- a/cli/source.cxx
+++ b/cli/source.cxx
@@ -924,23 +924,20 @@ namespace
{
string desc ("_cli_" + name + "_desc");
- os << "static " << cli << "::options " << desc << "_;"
- << endl;
-
- os << "struct " << desc << "_init"
+ os << "struct " << desc << "_type: " << cli << "::options"
<< "{"
- << desc << "_init (" << cli << "::options& os)"
+ << desc << "_type ()"
<< "{"
- << name << "::fill (os);"
+ << fq_name (c) << "::fill (*this);"
<< "}"
<< "};";
- os << "static " << desc << "_init " << desc << "_init_ (" <<
- desc << "_);"
- << endl;
+ if (options.std () < cxx_version::cxx11)
+ os << "static " << desc << "_type " << desc << "_;"
+ << endl;
os << "void " << name << "::" << endl
- << "fill (" << cli << "::options& " << (ho || hb ? " os)" : ")")
+ << "fill (" << cli << "::options&" << (ho || hb ? " os)" : ")")
<< "{";
// Add the entries from our bases first so that our entires
@@ -953,8 +950,12 @@ namespace
os << "const " << cli << "::options& " << name << "::" << endl
<< "description ()"
- << "{"
- << "return " << desc << "_;"
+ << "{";
+
+ if (options.std () >= cxx_version::cxx11)
+ os << "static ::" << desc << "_type " << desc << "_;";
+
+ os << "return " << desc << "_;"
<< "};";
}