diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2022-08-24 04:41:41 (GMT) |
---|---|---|
committer | Alex Turbov <i.zaufi@gmail.com> | 2022-11-17 12:37:12 (GMT) |
commit | 69918b07e17cce822ad8f11950da476c42e419ee (patch) | |
tree | 2dec5b12c0b4e3702dbdc31b5bee1b72e21ad8e6 | |
parent | 439d2cf9cb79884747b3d3d56f83b044a108c40a (diff) | |
download | CMake-69918b07e17cce822ad8f11950da476c42e419ee.zip CMake-69918b07e17cce822ad8f11950da476c42e419ee.tar.gz CMake-69918b07e17cce822ad8f11950da476c42e419ee.tar.bz2 |
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.
-rw-r--r-- | Source/CPack/cpack.cxx | 6 | ||||
-rw-r--r-- | Source/CursesDialog/ccmake.cxx | 10 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 5 | ||||
-rw-r--r-- | Source/cmDocumentation.cxx | 5 | ||||
-rw-r--r-- | Source/cmDocumentationEntry.h | 19 | ||||
-rw-r--r-- | Source/cmDocumentationSection.h | 6 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 10 | ||||
-rw-r--r-- | Source/ctest.cxx | 6 |
8 files changed, 33 insertions, 34 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index efb549f..f81c6e8 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -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" }, diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index d61954a..18c1a80 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -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 diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 11f7fe6..50e8e3a 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -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" diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index e626f7e..77c5295 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -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):" }; diff --git a/Source/cmDocumentationEntry.h b/Source/cmDocumentationEntry.h index aa97391..c66b21e 100644 --- a/Source/cmDocumentationEntry.h +++ b/Source/cmDocumentationEntry.h @@ -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 = ' '; }; diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h index b80131d..b5e24fe 100644 --- a/Source/cmDocumentationSection.h +++ b/Source/cmDocumentationSection.h @@ -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) diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 1ca3e55..a155787 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -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] = { diff --git a/Source/ctest.cxx b/Source/ctest.cxx index d26a0d7..fa38a65 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -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>", |