Browse Source

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.
Alex Turbov 3 years ago
parent
commit
69918b07e1

+ 3 - 3
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" },

+ 6 - 4
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

+ 3 - 2
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"

+ 3 - 2
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):"
 };

+ 9 - 10
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 = ' ';
 };

+ 0 - 6
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)

+ 6 - 4
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] = {

+ 3 - 3
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>",