cmDocumentationEntry: Drop all user provided ctors for C++ >= 14

There is no need for them cuz:

- the last field has a default value
- all static instances use 2 arguments convertible to `std::string`
- "dynamic" instances used for _Generator_ doc entries access
  fields diectly using default constructed instance

Moreover, compiler may generate move ctor/assign when needed.
This commit is contained in:
Alex Turbov
2022-08-24 08:41:41 +04:00
parent 439d2cf9cb
commit 69918b07e1
8 changed files with 33 additions and 34 deletions

View File

@@ -36,11 +36,11 @@
namespace {
const cmDocumentationEntry cmDocumentationName = {
nullptr, " cpack - Packaging driver provided by CMake."
{},
" cpack - Packaging driver provided by CMake."
};
const cmDocumentationEntry cmDocumentationUsage = { nullptr,
" cpack [options]" };
const cmDocumentationEntry cmDocumentationUsage = { {}, " cpack [options]" };
const cmDocumentationEntry cmDocumentationOptions[14] = {
{ "-G <generators>", "Override/define CPACK_GENERATOR" },

View File

@@ -25,21 +25,23 @@
namespace {
const cmDocumentationEntry cmDocumentationName = {
nullptr, " ccmake - Curses Interface for CMake."
{},
" ccmake - Curses Interface for CMake."
};
const cmDocumentationEntry cmDocumentationUsage[2] = {
{ nullptr,
{ {},
" ccmake <path-to-source>\n"
" ccmake <path-to-existing-build>" },
{ nullptr,
{ {},
"Specify a source directory to (re-)generate a build system for "
"it in the current working directory. Specify an existing build "
"directory to re-generate its build system." },
};
const cmDocumentationEntry cmDocumentationUsageNote = {
nullptr, "Run 'ccmake --help' for more information."
{},
"Run 'ccmake --help' for more information."
};
#ifndef _WIN32

View File

@@ -24,11 +24,12 @@
namespace {
const cmDocumentationEntry cmDocumentationName = {
nullptr, " cmake-gui - CMake GUI."
{},
" cmake-gui - CMake GUI."
};
const cmDocumentationEntry cmDocumentationUsage = {
nullptr,
{},
" cmake-gui [options]\n"
" cmake-gui [options] <path-to-source>\n"
" cmake-gui [options] <path-to-existing-build>\n"

View File

@@ -47,11 +47,12 @@ const cmDocumentationEntry cmDocumentationStandardOptions[20] = {
};
const cmDocumentationEntry cmDocumentationCPackGeneratorsHeader = {
nullptr, "The following generators are available on this platform:"
{},
"The following generators are available on this platform:"
};
const cmDocumentationEntry cmDocumentationCMakeGeneratorsHeader = {
nullptr,
{},
"The following generators are available on this platform (* marks "
"default):"
};

View File

@@ -9,17 +9,16 @@
/** Standard documentation entry for cmDocumentation's formatting. */
struct cmDocumentationEntry
{
std::string Name;
std::string Brief;
char CustomNamePrefix = ' ';
#if __cplusplus <= 201103L
cmDocumentationEntry() = default;
cmDocumentationEntry(const char* const n, const char* const b)
cmDocumentationEntry(const std::string& name, const std::string& brief)
: Name{ name }
, Brief{ brief }
{
if (n) {
this->Name = n;
}
if (b) {
this->Brief = b;
}
}
#endif
std::string Name = {};
std::string Brief = {};
char CustomNamePrefix = ' ';
};

View File

@@ -52,12 +52,6 @@ public:
std::end(entries));
}
/** Append an entry to this section using NULL terminated chars */
void Append(const char* n, const char* b)
{
this->Entries.emplace_back(n, b);
}
/** prepend some documentation to this section */
template <typename Iterable>
void Prepend(const Iterable& entries)

View File

@@ -47,22 +47,24 @@
namespace {
#ifndef CMAKE_BOOTSTRAP
const cmDocumentationEntry cmDocumentationName = {
nullptr, " cmake - Cross-Platform Makefile Generator."
{},
" cmake - Cross-Platform Makefile Generator."
};
const cmDocumentationEntry cmDocumentationUsage[2] = {
{ nullptr,
{ {},
" cmake [options] <path-to-source>\n"
" cmake [options] <path-to-existing-build>\n"
" cmake [options] -S <path-to-source> -B <path-to-build>" },
{ nullptr,
{ {},
"Specify a source directory to (re-)generate a build system for "
"it in the current working directory. Specify an existing build "
"directory to re-generate its build system." }
};
const cmDocumentationEntry cmDocumentationUsageNote = {
nullptr, "Run 'cmake --help' for more information."
{},
"Run 'cmake --help' for more information."
};
const cmDocumentationEntry cmDocumentationOptions[31] = {

View File

@@ -19,11 +19,11 @@
namespace {
const cmDocumentationEntry cmDocumentationName = {
nullptr, " ctest - Testing driver provided by CMake."
{},
" ctest - Testing driver provided by CMake."
};
const cmDocumentationEntry cmDocumentationUsage = { nullptr,
" ctest [options]" };
const cmDocumentationEntry cmDocumentationUsage = { {}, " ctest [options]" };
const cmDocumentationEntry cmDocumentationOptions[74] = {
{ "--preset <preset>, --preset=<preset>",