[Cmake-commits] CMake branch, master, updated. v3.15.3-1112-g3c060ae

Kitware Robot kwrobot at kitware.com
Fri Sep 20 10:18:04 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  3c060ae6ca01464d507d6c7b6cef38639084418f (commit)
       via  7cf36407be6c8d5206b4c005e099519ce24f1350 (commit)
       via  ffc7a59417619ec07728a8dea158e949155aa02b (commit)
       via  c578caa68bf7ee55077a3efa25aba46e9e1f562a (commit)
       via  cc3cbf91d23275cc11cf333e14f03886e54a8185 (commit)
       via  8e9b855a4f66da20067937735c87a2b104363872 (commit)
       via  1d0d4167cfa53ac85658998980c28e29d0ab537a (commit)
       via  56879273dc87a69e1d1491a73e0f74cd4424494c (commit)
       via  3327c0402a1ce31615c7ad22c5ff5d5330fb75da (commit)
      from  073cfa5ae812b44e97bac2034a10c1379e8d02be (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3c060ae6ca01464d507d6c7b6cef38639084418f
commit 3c060ae6ca01464d507d6c7b6cef38639084418f
Merge: 7cf3640 1d0d416
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Sep 20 14:09:00 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Fri Sep 20 10:15:35 2019 -0400

    Merge topic 'null-warning'
    
    1d0d4167cf TestDriver: Fix -Wzero-as-null-pointer-constant warnings
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Acked-by: Brad King <brad.king at kitware.com>
    Merge-request: !3824


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7cf36407be6c8d5206b4c005e099519ce24f1350
commit 7cf36407be6c8d5206b4c005e099519ce24f1350
Merge: ffc7a59 c578caa
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Sep 20 14:10:43 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Fri Sep 20 10:12:56 2019 -0400

    Merge topic 'update-kwsys'
    
    c578caa68b Tests: Decouple Plugin test from KWSys
    56879273dc Merge branch 'upstream-KWSys' into update-kwsys
    3327c0402a KWSys 2019-09-18 (c6bc38c1)
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3828


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ffc7a59417619ec07728a8dea158e949155aa02b
commit ffc7a59417619ec07728a8dea158e949155aa02b
Merge: 073cfa5 cc3cbf9
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Sep 20 14:08:33 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Fri Sep 20 10:10:16 2019 -0400

    Merge topic 'cmake-e-doc-order'
    
    cc3cbf91d2 Help: Fix indentation of create_symlink note
    8e9b855a4f Help: Fix ordering of cmake -E commands
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3833


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c578caa68bf7ee55077a3efa25aba46e9e1f562a
commit c578caa68bf7ee55077a3efa25aba46e9e1f562a
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Sep 19 10:10:52 2019 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Sep 19 10:42:51 2019 -0400

    Tests: Decouple Plugin test from KWSys
    
    KWSys now requires C++11 but we want this test to be able to run as
    C++98.  Copy the KWSys DynamicLoader implementation (with original
    notice headers and license reference) and update it to work alone.

diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt
index 8e8fa07..729bba3 100644
--- a/Tests/Plugin/CMakeLists.txt
+++ b/Tests/Plugin/CMakeLists.txt
@@ -10,14 +10,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/bin)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/plugin)
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/static)
 
-# We need the dynamic loader support from KWSys to load the plugin in
-# the executable.
-set(KWSYS_NAMESPACE kwsys)
-set(KWSYS_HEADER_ROOT ${Plugin_BINARY_DIR}/include)
-set(KWSYS_USE_DynamicLoader 1)
-set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8)
-add_subdirectory(${Plugin_SOURCE_DIR}/../../Source/kwsys src/kwsys)
-
 # Configure the location of plugins.
 configure_file(${Plugin_SOURCE_DIR}/src/example_exe.h.in
                ${Plugin_BINARY_DIR}/include/example_exe.h @ONLY)
@@ -36,14 +28,14 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
 endif()
 
 # Create an executable that exports an API for use by plugins.
-add_executable(example_exe src/example_exe.cxx)
+add_executable(example_exe src/example_exe.cxx src/DynamicLoader.cxx)
 set_target_properties(example_exe PROPERTIES
   ENABLE_EXPORTS 1
   OUTPUT_NAME example
   # Test placing exe import library in unique directory.
   ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/exe
   )
-target_link_libraries(example_exe kwsys)
+target_link_libraries(example_exe ${CMAKE_DL_LIBS})
 
 # Create a plugin that uses the API provided by the executable.
 # This module "links" to the executable to use the symbols.
diff --git a/Tests/Plugin/include/DynamicLoader.hxx b/Tests/Plugin/include/DynamicLoader.hxx
new file mode 100644
index 0000000..20b37de
--- /dev/null
+++ b/Tests/Plugin/include/DynamicLoader.hxx
@@ -0,0 +1,49 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.
+   See https://cmake.org/licensing#kwsys for details.  */
+#ifndef DynamicLoader_hxx
+#define DynamicLoader_hxx
+
+#include <string>
+
+#if defined(__hpux)
+#  include <dl.h>
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+#  include <windows.h>
+#elif defined(__APPLE__)
+#  include <AvailabilityMacros.h>
+#  if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
+#    include <mach-o/dyld.h>
+#  endif
+#elif defined(__BEOS__)
+#  include <be/kernel/image.h>
+#endif
+
+class DynamicLoader
+{
+public:
+#if defined(__hpux)
+  typedef shl_t LibraryHandle;
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+  typedef HMODULE LibraryHandle;
+#elif defined(__APPLE__)
+#  if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
+  typedef NSModule LibraryHandle;
+#  else
+  typedef void* LibraryHandle;
+#  endif
+#elif defined(__BEOS__)
+  typedef image_id LibraryHandle;
+#else // POSIX
+  typedef void* LibraryHandle;
+#endif
+
+  typedef void (*SymbolPointer)();
+
+  static LibraryHandle OpenLibrary(const std::string&);
+
+  static int CloseLibrary(LibraryHandle);
+
+  static SymbolPointer GetSymbolAddress(LibraryHandle, const std::string&);
+};
+
+#endif
diff --git a/Tests/Plugin/src/DynamicLoader.cxx b/Tests/Plugin/src/DynamicLoader.cxx
new file mode 100644
index 0000000..d4a2637
--- /dev/null
+++ b/Tests/Plugin/src/DynamicLoader.cxx
@@ -0,0 +1,263 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.
+   See https://cmake.org/licensing#kwsys for details.  */
+#if defined(_WIN32)
+#  define NOMINMAX // hide min,max to not conflict with <limits>
+#endif
+
+#include <DynamicLoader.hxx>
+
+#if defined(__hpux)
+#  include <dl.h>
+
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
+  const std::string& libname)
+{
+  return shl_load(libname.c_str(), BIND_DEFERRED | DYNAMIC_PATH, 0L);
+}
+
+int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
+{
+  if (!lib) {
+    return 0;
+  }
+  return !shl_unload(lib);
+}
+
+DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
+  DynamicLoader::LibraryHandle lib, const std::string& sym)
+{
+  void* addr;
+  int status;
+
+  /* TYPE_PROCEDURE Look for a function or procedure. (This used to be default)
+   * TYPE_DATA      Look for a symbol in the data segment (for example,
+   * variables).
+   * TYPE_UNDEFINED Look for any symbol.
+   */
+  status = shl_findsym(&lib, sym.c_str(), TYPE_UNDEFINED, &addr);
+  void* result = (status < 0) ? (void*)0 : addr;
+
+  // Hack to cast pointer-to-data to pointer-to-function.
+  return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
+}
+
+#elif defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1030)
+#  include <mach-o/dyld.h>
+
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
+  const std::string& libname)
+{
+  NSObjectFileImageReturnCode rc;
+  NSObjectFileImage image = 0;
+
+  rc = NSCreateObjectFileImageFromFile(libname.c_str(), &image);
+  // rc == NSObjectFileImageInappropriateFile when trying to load a dylib file
+  if (rc != NSObjectFileImageSuccess) {
+    return 0;
+  }
+  NSModule handle = NSLinkModule(image, libname.c_str(),
+                                 NSLINKMODULE_OPTION_BINDNOW |
+                                   NSLINKMODULE_OPTION_RETURN_ON_ERROR);
+  NSDestroyObjectFileImage(image);
+  return handle;
+}
+
+int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
+{
+  bool success = NSUnLinkModule(lib, NSUNLINKMODULE_OPTION_NONE);
+  return success;
+}
+
+DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
+  DynamicLoader::LibraryHandle lib, const std::string& sym)
+{
+  void* result = 0;
+  // Need to prepend symbols with '_' on Apple-gcc compilers
+  std::string rsym = '_' + sym;
+
+  NSSymbol symbol = NSLookupSymbolInModule(lib, rsym.c_str());
+  if (symbol) {
+    result = NSAddressOfSymbol(symbol);
+  }
+
+  // Hack to cast pointer-to-data to pointer-to-function.
+  return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
+}
+
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+#  include <windows.h>
+
+#  include <stdio.h>
+
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
+  const std::string& libname)
+{
+  DynamicLoader::LibraryHandle lh;
+  int length = MultiByteToWideChar(CP_UTF8, 0, libname.c_str(), -1, NULL, 0);
+  wchar_t* wchars = new wchar_t[length + 1];
+  wchars[0] = '\0';
+  MultiByteToWideChar(CP_UTF8, 0, libname.c_str(), -1, wchars, length);
+  lh = LoadLibraryW(wchars);
+  delete[] wchars;
+  return lh;
+}
+
+int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
+{
+  return (int)FreeLibrary(lib);
+}
+
+DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
+  DynamicLoader::LibraryHandle lib, const std::string& sym)
+{
+  void* result;
+#  if defined(__BORLANDC__) || defined(__WATCOMC__)
+  // Need to prepend symbols with '_'
+  std::string ssym = '_' + sym;
+  const char* rsym = ssym.c_str();
+#  else
+  const char* rsym = sym.c_str();
+#  endif
+  result = (void*)GetProcAddress(lib, rsym);
+// Hack to cast pointer-to-data to pointer-to-function.
+#  ifdef __WATCOMC__
+  return *(DynamicLoader::SymbolPointer*)(&result);
+#  else
+  return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
+#  endif
+}
+
+#elif defined(__BEOS__)
+#  include <be/kernel/image.h>
+#  include <be/support/Errors.h>
+
+static image_id last_dynamic_err = B_OK;
+
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
+  const std::string& libname)
+{
+  // image_id's are integers, errors are negative. Add one just in case we
+  //  get a valid image_id of zero (is that even possible?).
+  image_id rc = load_add_on(libname.c_str());
+  if (rc < 0) {
+    last_dynamic_err = rc;
+    return 0;
+  }
+
+  return rc + 1;
+}
+
+int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
+{
+  if (!lib) {
+    last_dynamic_err = B_BAD_VALUE;
+    return 0;
+  } else {
+    // The function dlclose() returns 0 on success, and non-zero on error.
+    status_t rc = unload_add_on(lib - 1);
+    if (rc != B_OK) {
+      last_dynamic_err = rc;
+      return 0;
+    }
+  }
+
+  return 1;
+}
+
+DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
+  DynamicLoader::LibraryHandle lib, const std::string& sym)
+{
+  // Hack to cast pointer-to-data to pointer-to-function.
+  union
+  {
+    void* pvoid;
+    DynamicLoader::SymbolPointer psym;
+  } result;
+
+  result.psym = NULL;
+
+  if (!lib) {
+    last_dynamic_err = B_BAD_VALUE;
+  } else {
+    // !!! FIXME: BeOS can do function-only lookups...does this ever
+    // !!! FIXME:  actually _want_ a data symbol lookup, or was this union
+    // !!! FIXME:  a leftover of dlsym()? (s/ANY/TEXT for functions only).
+    status_t rc =
+      get_image_symbol(lib - 1, sym.c_str(), B_SYMBOL_TYPE_ANY, &result.pvoid);
+    if (rc != B_OK) {
+      last_dynamic_err = rc;
+      result.psym = NULL;
+    }
+  }
+  return result.psym;
+}
+
+#elif defined(__MINT__)
+#  define _GNU_SOURCE /* for program_invocation_name */
+#  include <dld.h>
+#  include <errno.h>
+#  include <malloc.h>
+
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
+  const std::string& libname)
+{
+  char* name = (char*)calloc(1, libname.size() + 1);
+  dld_init(program_invocation_name);
+  strncpy(name, libname.c_str(), libname.size());
+  dld_link(libname.c_str());
+  return (void*)name;
+}
+
+int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
+{
+  dld_unlink_by_file((char*)lib, 0);
+  free(lib);
+  return 0;
+}
+
+DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
+  DynamicLoader::LibraryHandle lib, const std::string& sym)
+{
+  // Hack to cast pointer-to-data to pointer-to-function.
+  union
+  {
+    void* pvoid;
+    DynamicLoader::SymbolPointer psym;
+  } result;
+  result.pvoid = dld_get_symbol(sym.c_str());
+  return result.psym;
+}
+
+#else
+#  include <dlfcn.h>
+
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
+  const std::string& libname)
+{
+  return dlopen(libname.c_str(), RTLD_LAZY);
+}
+
+int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
+{
+  if (lib) {
+    // The function dlclose() returns 0 on success, and non-zero on error.
+    return !dlclose(lib);
+  }
+  // else
+  return 0;
+}
+
+DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
+  DynamicLoader::LibraryHandle lib, const std::string& sym)
+{
+  // Hack to cast pointer-to-data to pointer-to-function.
+  union
+  {
+    void* pvoid;
+    DynamicLoader::SymbolPointer psym;
+  } result;
+  result.pvoid = dlsym(lib, sym.c_str());
+  return result.psym;
+}
+
+#endif
diff --git a/Tests/Plugin/src/example_exe.cxx b/Tests/Plugin/src/example_exe.cxx
index 257a35c..fd810a9 100644
--- a/Tests/Plugin/src/example_exe.cxx
+++ b/Tests/Plugin/src/example_exe.cxx
@@ -1,4 +1,4 @@
-#include <kwsys/DynamicLoader.hxx>
+#include "DynamicLoader.hxx"
 
 #include <example.h>
 
@@ -24,20 +24,17 @@ extern "C" int example_exe_function()
 
 int main()
 {
-  std::string libName = EXAMPLE_EXE_PLUGIN_DIR CONFIG_DIR "/";
-  libName += kwsys::DynamicLoader::LibPrefix();
-  libName += "example_mod_1";
-  libName += kwsys::DynamicLoader::LibExtension();
-  kwsys::DynamicLoader::LibraryHandle handle =
-    kwsys::DynamicLoader::OpenLibrary(libName.c_str());
+  std::string const libName = EXAMPLE_EXE_PLUGIN_DIR CONFIG_DIR
+    "/" EXAMPLE_EXE_MOD_PREFIX "example_mod_1" EXAMPLE_EXE_MOD_SUFFIX;
+  DynamicLoader::LibraryHandle handle = DynamicLoader::OpenLibrary(libName);
   if (!handle) {
     // Leave the .c_str() on this one.  It is needed on OpenWatcom.
     std::cerr << "Could not open plugin \"" << libName.c_str() << "\"!"
               << std::endl;
     return 1;
   }
-  kwsys::DynamicLoader::SymbolPointer sym =
-    kwsys::DynamicLoader::GetSymbolAddress(handle, "example_mod_1_function");
+  DynamicLoader::SymbolPointer sym =
+    DynamicLoader::GetSymbolAddress(handle, "example_mod_1_function");
   if (!sym) {
     std::cerr << "Could not get plugin symbol \"example_mod_1_function\"!"
               << std::endl;
@@ -52,6 +49,6 @@ int main()
     std::cerr << "Incorrect return value from plugin!" << std::endl;
     return 1;
   }
-  kwsys::DynamicLoader::CloseLibrary(handle);
+  DynamicLoader::CloseLibrary(handle);
   return 0;
 }
diff --git a/Tests/Plugin/src/example_exe.h.in b/Tests/Plugin/src/example_exe.h.in
index 62f0d9f..af71021 100644
--- a/Tests/Plugin/src/example_exe.h.in
+++ b/Tests/Plugin/src/example_exe.h.in
@@ -2,5 +2,7 @@
 #define example_exe_h
 
 #define EXAMPLE_EXE_PLUGIN_DIR "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@"
+#define EXAMPLE_EXE_MOD_PREFIX "@CMAKE_SHARED_MODULE_PREFIX@"
+#define EXAMPLE_EXE_MOD_SUFFIX "@CMAKE_SHARED_MODULE_SUFFIX@"
 
 #endif

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cc3cbf91d23275cc11cf333e14f03886e54a8185
commit cc3cbf91d23275cc11cf333e14f03886e54a8185
Author:     Kyle Edwards <kyle.edwards at kitware.com>
AuthorDate: Thu Sep 19 09:57:11 2019 -0400
Commit:     Kyle Edwards <kyle.edwards at kitware.com>
CommitDate: Thu Sep 19 09:57:11 2019 -0400

    Help: Fix indentation of create_symlink note

diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 28ebb70..754f14b 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -476,8 +476,8 @@ Available commands are:
 ``create_symlink <old> <new>``
   Create a symbolic link ``<new>`` naming ``<old>``.
 
-.. note::
-  Path to where ``<new>`` symbolic link will be created has to exist beforehand.
+  .. note::
+    Path to where ``<new>`` symbolic link will be created has to exist beforehand.
 
 ``echo [<string>...]``
   Displays arguments as text.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8e9b855a4f66da20067937735c87a2b104363872
commit 8e9b855a4f66da20067937735c87a2b104363872
Author:     Kyle Edwards <kyle.edwards at kitware.com>
AuthorDate: Wed Sep 18 15:21:10 2019 -0400
Commit:     Kyle Edwards <kyle.edwards at kitware.com>
CommitDate: Wed Sep 18 15:21:10 2019 -0400

    Help: Fix ordering of cmake -E commands
    
    Several of the commands were not in alphabetical order. Fix the
    ordering.

diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 2576cde..28ebb70 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -473,6 +473,12 @@ Available commands are:
   directory and it must exist.
   ``copy_if_different`` does follow symlinks.
 
+``create_symlink <old> <new>``
+  Create a symbolic link ``<new>`` naming ``<old>``.
+
+.. note::
+  Path to where ``<new>`` symbolic link will be created has to exist beforehand.
+
 ``echo [<string>...]``
   Displays arguments as text.
 
@@ -485,6 +491,9 @@ Available commands are:
 ``environment``
   Display the current environment variables.
 
+``false``
+  Do nothing, with an exit code of 1.
+
 ``make_directory <dir>...``
   Create ``<dir>`` directories.  If necessary, create parent
   directories too.  If a directory already exists it will be
@@ -602,18 +611,9 @@ Available commands are:
   Touch a file if it exists but do not create it.  If a file does
   not exist it will be silently ignored.
 
-``create_symlink <old> <new>``
-  Create a symbolic link ``<new>`` naming ``<old>``.
-
-.. note::
-  Path to where ``<new>`` symbolic link will be created has to exist beforehand.
-
 ``true``
   Do nothing, with an exit code of 0.
 
-``false``
-  Do nothing, with an exit code of 1.
-
 Windows-specific Command-Line Tools
 -----------------------------------
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d0d4167cfa53ac85658998980c28e29d0ab537a
commit 1d0d4167cfa53ac85658998980c28e29d0ab537a
Author:     Sean McBride <sean at rogue-research.com>
AuthorDate: Mon Sep 16 19:08:43 2019 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 14:05:39 2019 -0400

    TestDriver: Fix -Wzero-as-null-pointer-constant warnings

diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in
index c58ef71..ad8bfb0 100644
--- a/Templates/TestDriver.cxx.in
+++ b/Templates/TestDriver.cxx.in
@@ -13,9 +13,15 @@
 @CMAKE_FORWARD_DECLARE_TESTS@
 
 #ifdef __cplusplus
-#define CM_CAST(TYPE, EXPR) static_cast<TYPE>(EXPR)
+#  define CM_CAST(TYPE, EXPR) static_cast<TYPE>(EXPR)
+#  if __cplusplus >= 201103L
+#    define CM_NULL nullptr
+#  else
+#    define CM_NULL NULL
+#  endif
 #else
-#define CM_CAST(TYPE, EXPR) (TYPE)(EXPR)
+#  define CM_CAST(TYPE, EXPR) (TYPE)(EXPR)
+#  define CM_NULL NULL
 #endif
 
 /* Create map.  */
@@ -29,7 +35,7 @@ typedef struct /* NOLINT */
 
 static functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
   @CMAKE_FUNCTION_TABLE_ENTIRES@
-  { NULL, NULL } /* NOLINT */
+  { CM_NULL, CM_NULL } /* NOLINT */
 };
 
 static const int NumTests = CM_CAST(int,
@@ -45,8 +51,8 @@ static char* lowercase(const char* string)
   stringSize = CM_CAST(size_t, strlen(string) + 1);
   new_string = CM_CAST(char*, malloc(sizeof(char) * stringSize));
 
-  if (new_string == NULL) { /* NOLINT */
-    return NULL;            /* NOLINT */
+  if (new_string == CM_NULL) { /* NOLINT */
+    return CM_NULL;            /* NOLINT */
   }
   strcpy(new_string, string);
   for (p = new_string; *p != 0; ++p) {
@@ -86,7 +92,7 @@ int main(int ac, char* av[])
     av++;
   }
   partial_match = 0;
-  arg = NULL; /* NOLINT */
+  arg = CM_NULL; /* NOLINT */
   /* If partial match is requested.  */
   if (testToRun == -1 && ac > 1) {
     partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
@@ -100,7 +106,7 @@ int main(int ac, char* av[])
   }
   for (i = 0; i < NumTests && testToRun == -1; ++i) {
     char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
-    if (partial_match != 0 && strstr(test_name, arg) != NULL) { /* NOLINT */
+    if (partial_match != 0 && strstr(test_name, arg) != CM_NULL) { /* NOLINT */
       testToRun = i;
       ac -= 2;
       av += 2;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=56879273dc87a69e1d1491a73e0f74cd4424494c
commit 56879273dc87a69e1d1491a73e0f74cd4424494c
Merge: 45b7d52 3327c04
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 18 09:26:40 2019 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 09:26:40 2019 -0400

    Merge branch 'upstream-KWSys' into update-kwsys
    
    # By KWSys Upstream
    * upstream-KWSys:
      KWSys 2019-09-18 (c6bc38c1)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3327c0402a1ce31615c7ad22c5ff5d5330fb75da
commit 3327c0402a1ce31615c7ad22c5ff5d5330fb75da
Author:     KWSys Upstream <kwrobot at kitware.com>
AuthorDate: Wed Sep 18 08:13:53 2019 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 09:26:35 2019 -0400

    KWSys 2019-09-18 (c6bc38c1)
    
    Code extracted from:
    
        https://gitlab.kitware.com/utils/kwsys.git
    
    at commit c6bc38c11a3a11e393f0608486b08dadc8dbacc3 (master).
    
    Upstream Shortlog
    -----------------
    
    Sean McBride (5):
          4de1241f Fixed -Wextra-semi-stmt warning
          30de8e17 Fixed -Wsign-conversion warnings by adding casts
          750da75a Fixed 64 to 32 bit truncation warning by casting
          419aaa35 Fixed -Wunused-macros warnings
          46c55893 Replaced several 0, NULL, and KWSYS_NULLPTR with nullptr

diff --git a/CommandLineArguments.cxx b/CommandLineArguments.cxx
index dc9f01d..3fd1955 100644
--- a/CommandLineArguments.cxx
+++ b/CommandLineArguments.cxx
@@ -67,8 +67,8 @@ class CommandLineArgumentsInternal
 {
 public:
   CommandLineArgumentsInternal()
-    : UnknownArgumentCallback{ KWSYS_NULLPTR }
-    , ClientData{ KWSYS_NULLPTR }
+    : UnknownArgumentCallback{ nullptr }
+    , ClientData{ nullptr }
     , LastArgument{ 0 }
   {
   }
@@ -187,7 +187,7 @@ int CommandLineArguments::Parse()
       switch (cs->ArgumentType) {
         case NO_ARGUMENT:
           // No value
-          if (!this->PopulateVariable(cs, KWSYS_NULLPTR)) {
+          if (!this->PopulateVariable(cs, nullptr)) {
             return 0;
           }
           break;
@@ -340,7 +340,7 @@ void CommandLineArguments::AddCallback(const char* argument,
   s.Callback = callback;
   s.CallData = call_data;
   s.VariableType = CommandLineArguments::NO_VARIABLE_TYPE;
-  s.Variable = KWSYS_NULLPTR;
+  s.Variable = nullptr;
   s.Help = help;
 
   this->Internals->Callbacks[argument] = s;
@@ -355,8 +355,8 @@ void CommandLineArguments::AddArgument(const char* argument,
   CommandLineArgumentsCallbackStructure s;
   s.Argument = argument;
   s.ArgumentType = type;
-  s.Callback = KWSYS_NULLPTR;
-  s.CallData = KWSYS_NULLPTR;
+  s.Callback = nullptr;
+  s.CallData = nullptr;
   s.VariableType = vtype;
   s.Variable = variable;
   s.Help = help;
@@ -427,7 +427,7 @@ const char* CommandLineArguments::GetHelp(const char* arg)
   CommandLineArguments::Internal::CallbacksMap::iterator it =
     this->Internals->Callbacks.find(arg);
   if (it == this->Internals->Callbacks.end()) {
-    return KWSYS_NULLPTR;
+    return nullptr;
   }
 
   // Since several arguments may point to the same argument, find the one this
@@ -621,7 +621,7 @@ void CommandLineArguments::PopulateVariable(bool* variable,
 void CommandLineArguments::PopulateVariable(int* variable,
                                             const std::string& value)
 {
-  char* res = KWSYS_NULLPTR;
+  char* res = nullptr;
   *variable = static_cast<int>(strtol(value.c_str(), &res, 10));
   // if ( res && *res )
   //  {
@@ -632,7 +632,7 @@ void CommandLineArguments::PopulateVariable(int* variable,
 void CommandLineArguments::PopulateVariable(double* variable,
                                             const std::string& value)
 {
-  char* res = KWSYS_NULLPTR;
+  char* res = nullptr;
   *variable = strtod(value.c_str(), &res);
   // if ( res && *res )
   //  {
@@ -669,7 +669,7 @@ void CommandLineArguments::PopulateVariable(std::vector<bool>* variable,
 void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
                                             const std::string& value)
 {
-  char* res = KWSYS_NULLPTR;
+  char* res = nullptr;
   variable->push_back(static_cast<int>(strtol(value.c_str(), &res, 10)));
   // if ( res && *res )
   //  {
@@ -680,7 +680,7 @@ void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
 void CommandLineArguments::PopulateVariable(std::vector<double>* variable,
                                             const std::string& value)
 {
-  char* res = KWSYS_NULLPTR;
+  char* res = nullptr;
   variable->push_back(strtod(value.c_str(), &res));
   // if ( res && *res )
   //  {
diff --git a/Configure.hxx.in b/Configure.hxx.in
index 92ffea3..29a2dd1 100644
--- a/Configure.hxx.in
+++ b/Configure.hxx.in
@@ -58,7 +58,6 @@
 #  define KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H                                   \
     @KWSYS_NAMESPACE at _CXX_HAS_EXT_STDIO_FILEBUF_H
 #  define KWSYS_FALLTHROUGH @KWSYS_NAMESPACE at _FALLTHROUGH
-#  define KWSYS_NULLPTR @KWSYS_NAMESPACE at _NULLPTR
 #  define KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP                               \
     @KWSYS_NAMESPACE at _SYSTEMTOOLS_USE_TRANSLATION_MAP
 #endif
diff --git a/ConsoleBuf.hxx.in b/ConsoleBuf.hxx.in
index 73a1efb..49dbdf7 100644
--- a/ConsoleBuf.hxx.in
+++ b/ConsoleBuf.hxx.in
@@ -116,7 +116,7 @@ protected:
         DWORD charsWritten;
         success =
           ::WriteConsoleW(m_hOutput, wbuffer.c_str(), (DWORD)wbuffer.size(),
-                          &charsWritten, NULL) == 0
+                          &charsWritten, nullptr) == 0
           ? false
           : true;
       } else {
@@ -124,8 +124,9 @@ protected:
         std::string buffer;
         success = encodeOutputBuffer(wbuffer, buffer);
         if (success) {
-          success = ::WriteFile(m_hOutput, buffer.c_str(),
-                                (DWORD)buffer.size(), &bytesWritten, NULL) == 0
+          success =
+            ::WriteFile(m_hOutput, buffer.c_str(), (DWORD)buffer.size(),
+                        &bytesWritten, nullptr) == 0
             ? false
             : true;
         }
@@ -152,7 +153,7 @@ protected:
         DWORD charsRead;
         if (ReadConsoleW(m_hInput, wbuffer,
                          (sizeof(wbuffer) / sizeof(wbuffer[0])), &charsRead,
-                         NULL) == 0 ||
+                         nullptr) == 0 ||
             charsRead == 0) {
           _setg(true);
           return Traits::eof();
@@ -168,7 +169,7 @@ protected:
           return Traits::eof();
         }
         char* buffer = new char[size.LowPart];
-        while (ReadFile(m_hInput, buffer, size.LowPart, &bytesRead, NULL) ==
+        while (ReadFile(m_hInput, buffer, size.LowPart, &bytesRead, nullptr) ==
                0) {
           if (GetLastError() == ERROR_MORE_DATA) {
             strbuffer += std::string(buffer, bytesRead);
@@ -327,11 +328,12 @@ private:
     }
     const int length =
       WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
-                          (int)wbuffer.size(), NULL, 0, NULL, NULL);
+                          (int)wbuffer.size(), nullptr, 0, nullptr, nullptr);
     char* buf = new char[length];
     const bool success =
       WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
-                          (int)wbuffer.size(), buf, length, NULL, NULL) > 0
+                          (int)wbuffer.size(), buf, length, nullptr,
+                          nullptr) > 0
       ? true
       : false;
     buffer = std::string(buf, length);
@@ -356,7 +358,7 @@ private:
       length -= BOMsize;
     }
     const size_t wlength = static_cast<size_t>(MultiByteToWideChar(
-      actualCodepage, 0, data, static_cast<int>(length), NULL, 0));
+      actualCodepage, 0, data, static_cast<int>(length), nullptr, 0));
     wchar_t* wbuf = new wchar_t[wlength];
     const bool success =
       MultiByteToWideChar(actualCodepage, 0, data, static_cast<int>(length),
diff --git a/Directory.cxx b/Directory.cxx
index 59530a4..e379182 100644
--- a/Directory.cxx
+++ b/Directory.cxx
@@ -48,7 +48,7 @@ unsigned long Directory::GetNumberOfFiles() const
 const char* Directory::GetFile(unsigned long dindex) const
 {
   if (dindex >= this->Internal->Files.size()) {
-    return KWSYS_NULLPTR;
+    return nullptr;
   }
   return this->Internal->Files[dindex].c_str();
 }
diff --git a/DynamicLoader.cxx b/DynamicLoader.cxx
index b93a215..a4b8641 100644
--- a/DynamicLoader.cxx
+++ b/DynamicLoader.cxx
@@ -223,15 +223,15 @@ namespace KWSYS_NAMESPACE {
 DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
   const std::string& libname, int flags)
 {
-  CHECK_OPEN_FLAGS(flags, SearchBesideLibrary, NULL);
+  CHECK_OPEN_FLAGS(flags, SearchBesideLibrary, nullptr);
 
   DWORD llFlags = 0;
   if (flags & SearchBesideLibrary) {
     llFlags |= LOAD_WITH_ALTERED_SEARCH_PATH;
   }
 
-  return LoadLibraryExW(Encoding::ToWindowsExtendedPath(libname).c_str(), NULL,
-                        llFlags);
+  return LoadLibraryExW(Encoding::ToWindowsExtendedPath(libname).c_str(),
+                        nullptr, llFlags);
 }
 
 int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
@@ -289,9 +289,9 @@ const char* DynamicLoader::LastError()
 
   DWORD error = GetLastError();
   DWORD length = FormatMessageW(
-    FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error,
+    FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, error,
     MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
-    lpMsgBuf, DYNLOAD_ERROR_BUFFER_SIZE, NULL);
+    lpMsgBuf, DYNLOAD_ERROR_BUFFER_SIZE, nullptr);
 
   static char str[DYNLOAD_ERROR_BUFFER_SIZE + 1];
 
@@ -305,7 +305,7 @@ const char* DynamicLoader::LastError()
   }
 
   if (!WideCharToMultiByte(CP_UTF8, 0, lpMsgBuf, -1, str,
-                           DYNLOAD_ERROR_BUFFER_SIZE, NULL, NULL)) {
+                           DYNLOAD_ERROR_BUFFER_SIZE, nullptr, nullptr)) {
     /* WideCharToMultiByte failed.  Use a default message.  */
     _snprintf(str, DYNLOAD_ERROR_BUFFER_SIZE,
               "DynamicLoader encountered error 0x%X.  "
@@ -372,7 +372,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
     DynamicLoader::SymbolPointer psym;
   } result;
 
-  result.psym = NULL;
+  result.psym = nullptr;
 
   if (!lib) {
     last_dynamic_err = B_BAD_VALUE;
@@ -384,7 +384,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
       get_image_symbol(lib - 1, sym.c_str(), B_SYMBOL_TYPE_ANY, &result.pvoid);
     if (rc != B_OK) {
       last_dynamic_err = rc;
-      result.psym = NULL;
+      result.psym = nullptr;
     }
   }
   return result.psym;
@@ -412,7 +412,7 @@ namespace KWSYS_NAMESPACE {
 DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
   const std::string& libname, int flags)
 {
-  CHECK_OPEN_FLAGS(flags, 0, NULL);
+  CHECK_OPEN_FLAGS(flags, 0, nullptr);
 
   char* name = (char*)calloc(1, libname.size() + 1);
   dld_init(program_invocation_name);
@@ -458,7 +458,7 @@ namespace KWSYS_NAMESPACE {
 DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
   const std::string& libname, int flags)
 {
-  CHECK_OPEN_FLAGS(flags, 0, NULL);
+  CHECK_OPEN_FLAGS(flags, 0, nullptr);
 
   return dlopen(libname.c_str(), RTLD_LAZY);
 }
diff --git a/EncodingCXX.cxx b/EncodingCXX.cxx
index 251deef..4593c92 100644
--- a/EncodingCXX.cxx
+++ b/EncodingCXX.cxx
@@ -65,7 +65,7 @@ Encoding::CommandLineArguments::CommandLineArguments(int ac,
   for (int i = 0; i < ac; i++) {
     this->argv_[i] = strdup(av[i]);
   }
-  this->argv_[ac] = KWSYS_NULLPTR;
+  this->argv_[ac] = nullptr;
 }
 
 Encoding::CommandLineArguments::CommandLineArguments(int ac,
@@ -75,7 +75,7 @@ Encoding::CommandLineArguments::CommandLineArguments(int ac,
   for (int i = 0; i < ac; i++) {
     this->argv_[i] = kwsysEncoding_DupToNarrow(av[i]);
   }
-  this->argv_[ac] = KWSYS_NULLPTR;
+  this->argv_[ac] = nullptr;
 }
 
 Encoding::CommandLineArguments::~CommandLineArguments()
@@ -90,7 +90,7 @@ Encoding::CommandLineArguments::CommandLineArguments(
 {
   this->argv_.resize(other.argv_.size());
   for (size_t i = 0; i < this->argv_.size(); i++) {
-    this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : KWSYS_NULLPTR;
+    this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : nullptr;
   }
 }
 
@@ -105,7 +105,7 @@ Encoding::CommandLineArguments& Encoding::CommandLineArguments::operator=(
 
     this->argv_.resize(other.argv_.size());
     for (i = 0; i < this->argv_.size(); i++) {
-      this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : KWSYS_NULLPTR;
+      this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : nullptr;
     }
   }
 
@@ -128,8 +128,9 @@ std::wstring Encoding::ToWide(const std::string& str)
 {
   std::wstring wstr;
 #  if defined(_WIN32)
-  const int wlength = MultiByteToWideChar(
-    KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(), int(str.size()), NULL, 0);
+  const int wlength =
+    MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(),
+                        int(str.size()), nullptr, 0);
   if (wlength > 0) {
     wchar_t* wdata = new wchar_t[wlength];
     int r = MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(),
@@ -162,12 +163,12 @@ std::string Encoding::ToNarrow(const std::wstring& str)
 #  if defined(_WIN32)
   int length =
     WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.c_str(),
-                        int(str.size()), NULL, 0, NULL, NULL);
+                        int(str.size()), nullptr, 0, nullptr, nullptr);
   if (length > 0) {
     char* data = new char[length];
     int r =
       WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.c_str(),
-                          int(str.size()), data, length, NULL, NULL);
+                          int(str.size()), data, length, nullptr, nullptr);
     if (r > 0) {
       nstr = std::string(data, length);
     }
@@ -193,7 +194,7 @@ std::string Encoding::ToNarrow(const std::wstring& str)
 std::wstring Encoding::ToWide(const char* cstr)
 {
   std::wstring wstr;
-  size_t length = kwsysEncoding_mbstowcs(KWSYS_NULLPTR, cstr, 0) + 1;
+  size_t length = kwsysEncoding_mbstowcs(nullptr, cstr, 0) + 1;
   if (length > 0) {
     std::vector<wchar_t> wchars(length);
     if (kwsysEncoding_mbstowcs(&wchars[0], cstr, length) > 0) {
@@ -206,7 +207,7 @@ std::wstring Encoding::ToWide(const char* cstr)
 std::string Encoding::ToNarrow(const wchar_t* wcstr)
 {
   std::string str;
-  size_t length = kwsysEncoding_wcstombs(KWSYS_NULLPTR, wcstr, 0) + 1;
+  size_t length = kwsysEncoding_wcstombs(nullptr, wcstr, 0) + 1;
   if (length > 0) {
     std::vector<char> chars(length);
     if (kwsysEncoding_wcstombs(&chars[0], wcstr, length) > 0) {
@@ -227,9 +228,9 @@ std::wstring Encoding::ToWindowsExtendedPath(std::string const& source)
 
   /* The +3 is a workaround for a bug in some versions of GetFullPathNameW that
    * won't return a large enough buffer size if the input is too small */
-  wfull_len = GetFullPathNameW(wsource.c_str(), 0, NULL, NULL) + 3;
+  wfull_len = GetFullPathNameW(wsource.c_str(), 0, nullptr, nullptr) + 3;
   std::vector<wchar_t> wfull(wfull_len);
-  GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], NULL);
+  GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], nullptr);
 
   /* This should get the correct size without any extra padding from the
    * previous size workaround. */
diff --git a/Glob.cxx b/Glob.cxx
index 829c138..34bb0d0 100644
--- a/Glob.cxx
+++ b/Glob.cxx
@@ -431,7 +431,7 @@ void Glob::SetRelative(const char* dir)
 const char* Glob::GetRelative()
 {
   if (this->Relative.empty()) {
-    return KWSYS_NULLPTR;
+    return nullptr;
   }
   return this->Relative.c_str();
 }
diff --git a/Glob.hxx.in b/Glob.hxx.in
index 4c3bde1..170766f 100644
--- a/Glob.hxx.in
+++ b/Glob.hxx.in
@@ -54,7 +54,7 @@ public:
   ~Glob();
 
   //! Find all files that match the pattern.
-  bool FindFiles(const std::string& inexpr, GlobMessages* messages = 0);
+  bool FindFiles(const std::string& inexpr, GlobMessages* messages = nullptr);
 
   //! Return the list of files that matched.
   std::vector<std::string>& GetFiles();
diff --git a/RegularExpression.cxx b/RegularExpression.cxx
index 3e10765..5e6f8da 100644
--- a/RegularExpression.cxx
+++ b/RegularExpression.cxx
@@ -37,7 +37,7 @@ namespace KWSYS_NAMESPACE {
 RegularExpression::RegularExpression(const RegularExpression& rxp)
 {
   if (!rxp.program) {
-    this->program = KWSYS_NULLPTR;
+    this->program = nullptr;
     return;
   }
   int ind;
@@ -48,7 +48,7 @@ RegularExpression::RegularExpression(const RegularExpression& rxp)
   // Copy pointers into last successful "find" operation
   this->regmatch = rxp.regmatch;
   this->regmust = rxp.regmust; // Copy field
-  if (rxp.regmust != KWSYS_NULLPTR) {
+  if (rxp.regmust != nullptr) {
     char* dum = rxp.program;
     ind = 0;
     while (dum != rxp.regmust) {
@@ -69,7 +69,7 @@ RegularExpression& RegularExpression::operator=(const RegularExpression& rxp)
     return *this;
   }
   if (!rxp.program) {
-    this->program = KWSYS_NULLPTR;
+    this->program = nullptr;
     return *this;
   }
   int ind;
@@ -81,7 +81,7 @@ RegularExpression& RegularExpression::operator=(const RegularExpression& rxp)
   // Copy pointers into last successful "find" operation
   this->regmatch = rxp.regmatch;
   this->regmust = rxp.regmust; // Copy field
-  if (rxp.regmust != KWSYS_NULLPTR) {
+  if (rxp.regmust != nullptr) {
     char* dum = rxp.program;
     ind = 0;
     while (dum != rxp.regmust) {
@@ -164,8 +164,8 @@ bool RegularExpression::deep_equal(const RegularExpression& rxp) const
  *
  * regstart     char that must begin a match; '\0' if none obvious
  * reganch      is the match anchored (at beginning-of-line only)?
- * regmust      string (pointer into program) that match must include, or NULL
- * regmlen      length of regmust string
+ * regmust      string (pointer into program) that match must include, or
+ * nullptr regmlen      length of regmust string
  *
  * Regstart and reganch permit very fast decisions on suitable starting points
  * for a match, cutting down the work a lot.  Regmust permits fast rejection
@@ -339,7 +339,7 @@ bool RegularExpression::compile(const char* exp)
   const char* longest;
   int flags;
 
-  if (exp == KWSYS_NULLPTR) {
+  if (exp == nullptr) {
     // RAISE Error, SYM(RegularExpression), SYM(No_Expr),
     printf("RegularExpression::compile(): No expression supplied.\n");
     return false;
@@ -367,13 +367,13 @@ bool RegularExpression::compile(const char* exp)
 
   // Allocate space.
   //#ifndef _WIN32
-  if (this->program != KWSYS_NULLPTR)
+  if (this->program != nullptr)
     delete[] this->program;
   //#endif
   this->program = new char[comp.regsize];
   this->progsize = static_cast<int>(comp.regsize);
 
-  if (this->program == KWSYS_NULLPTR) {
+  if (this->program == nullptr) {
     // RAISE Error, SYM(RegularExpression), SYM(Out_Of_Memory),
     printf("RegularExpression::compile(): Out of memory.\n");
     return false;
@@ -389,7 +389,7 @@ bool RegularExpression::compile(const char* exp)
   // Dig out information for optimizations.
   this->regstart = '\0'; // Worst-case defaults.
   this->reganch = 0;
-  this->regmust = KWSYS_NULLPTR;
+  this->regmust = nullptr;
   this->regmlen = 0;
   scan = this->program + 1;       // First BRANCH.
   if (OP(regnext(scan)) == END) { // Only one top-level choice.
@@ -410,9 +410,9 @@ bool RegularExpression::compile(const char* exp)
     // absence of others.
     //
     if (flags & SPSTART) {
-      longest = KWSYS_NULLPTR;
+      longest = nullptr;
       size_t len = 0;
-      for (; scan != KWSYS_NULLPTR; scan = regnext(scan))
+      for (; scan != nullptr; scan = regnext(scan))
         if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
           longest = OPERAND(scan);
           len = strlen(OPERAND(scan));
@@ -448,19 +448,19 @@ char* RegExpCompile::reg(int paren, int* flagp)
     if (regnpar >= RegularExpressionMatch::NSUBEXP) {
       // RAISE Error, SYM(RegularExpression), SYM(Too_Many_Parens),
       printf("RegularExpression::compile(): Too many parentheses.\n");
-      return KWSYS_NULLPTR;
+      return nullptr;
     }
     parno = regnpar;
     regnpar++;
     ret = regnode(static_cast<char>(OPEN + parno));
   } else
-    ret = KWSYS_NULLPTR;
+    ret = nullptr;
 
   // Pick up the branches, linking them together.
   br = regbranch(&flags);
-  if (br == KWSYS_NULLPTR)
-    return (KWSYS_NULLPTR);
-  if (ret != KWSYS_NULLPTR)
+  if (br == nullptr)
+    return (nullptr);
+  if (ret != nullptr)
     regtail(ret, br); // OPEN -> first.
   else
     ret = br;
@@ -470,8 +470,8 @@ char* RegExpCompile::reg(int paren, int* flagp)
   while (*regparse == '|') {
     regparse++;
     br = regbranch(&flags);
-    if (br == KWSYS_NULLPTR)
-      return (KWSYS_NULLPTR);
+    if (br == nullptr)
+      return (nullptr);
     regtail(ret, br); // BRANCH -> BRANCH.
     if (!(flags & HASWIDTH))
       *flagp &= ~HASWIDTH;
@@ -483,23 +483,23 @@ char* RegExpCompile::reg(int paren, int* flagp)
   regtail(ret, ender);
 
   // Hook the tails of the branches to the closing node.
-  for (br = ret; br != KWSYS_NULLPTR; br = regnext(br))
+  for (br = ret; br != nullptr; br = regnext(br))
     regoptail(br, ender);
 
   // Check for proper termination.
   if (paren && *regparse++ != ')') {
     // RAISE Error, SYM(RegularExpression), SYM(Unmatched_Parens),
     printf("RegularExpression::compile(): Unmatched parentheses.\n");
-    return KWSYS_NULLPTR;
+    return nullptr;
   } else if (!paren && *regparse != '\0') {
     if (*regparse == ')') {
       // RAISE Error, SYM(RegularExpression), SYM(Unmatched_Parens),
       printf("RegularExpression::compile(): Unmatched parentheses.\n");
-      return KWSYS_NULLPTR;
+      return nullptr;
     } else {
       // RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
       printf("RegularExpression::compile(): Internal error.\n");
-      return KWSYS_NULLPTR;
+      return nullptr;
     }
     // NOTREACHED
   }
@@ -521,19 +521,19 @@ char* RegExpCompile::regbranch(int* flagp)
   *flagp = WORST; // Tentatively.
 
   ret = regnode(BRANCH);
-  chain = KWSYS_NULLPTR;
+  chain = nullptr;
   while (*regparse != '\0' && *regparse != '|' && *regparse != ')') {
     latest = regpiece(&flags);
-    if (latest == KWSYS_NULLPTR)
-      return (KWSYS_NULLPTR);
+    if (latest == nullptr)
+      return (nullptr);
     *flagp |= flags & HASWIDTH;
-    if (chain == KWSYS_NULLPTR) // First piece.
+    if (chain == nullptr) // First piece.
       *flagp |= flags & SPSTART;
     else
       regtail(chain, latest);
     chain = latest;
   }
-  if (chain == KWSYS_NULLPTR) // Loop ran zero times.
+  if (chain == nullptr) // Loop ran zero times.
     regnode(NOTHING);
 
   return (ret);
@@ -556,8 +556,8 @@ char* RegExpCompile::regpiece(int* flagp)
   int flags;
 
   ret = regatom(&flags);
-  if (ret == KWSYS_NULLPTR)
-    return (KWSYS_NULLPTR);
+  if (ret == nullptr)
+    return (nullptr);
 
   op = *regparse;
   if (!ISMULT(op)) {
@@ -568,7 +568,7 @@ char* RegExpCompile::regpiece(int* flagp)
   if (!(flags & HASWIDTH) && op != '?') {
     // RAISE Error, SYM(RegularExpression), SYM(Empty_Operand),
     printf("RegularExpression::compile() : *+ operand could be empty.\n");
-    return KWSYS_NULLPTR;
+    return nullptr;
   }
   *flagp = (op != '+') ? (WORST | SPSTART) : (WORST | HASWIDTH);
 
@@ -602,7 +602,7 @@ char* RegExpCompile::regpiece(int* flagp)
   if (ISMULT(*regparse)) {
     // RAISE Error, SYM(RegularExpression), SYM(Nested_Operand),
     printf("RegularExpression::compile(): Nested *?+.\n");
-    return KWSYS_NULLPTR;
+    return nullptr;
   }
   return (ret);
 }
@@ -655,7 +655,7 @@ char* RegExpCompile::regatom(int* flagp)
             if (rxpclass > rxpclassend + 1) {
               // RAISE Error, SYM(RegularExpression), SYM(Invalid_Range),
               printf("RegularExpression::compile(): Invalid range in [].\n");
-              return KWSYS_NULLPTR;
+              return nullptr;
             }
             for (; rxpclass <= rxpclassend; rxpclass++)
               regc(static_cast<char>(rxpclass));
@@ -668,15 +668,15 @@ char* RegExpCompile::regatom(int* flagp)
       if (*regparse != ']') {
         // RAISE Error, SYM(RegularExpression), SYM(Unmatched_Bracket),
         printf("RegularExpression::compile(): Unmatched [].\n");
-        return KWSYS_NULLPTR;
+        return nullptr;
       }
       regparse++;
       *flagp |= HASWIDTH | SIMPLE;
     } break;
     case '(':
       ret = reg(1, &flags);
-      if (ret == KWSYS_NULLPTR)
-        return (KWSYS_NULLPTR);
+      if (ret == nullptr)
+        return (nullptr);
       *flagp |= flags & (HASWIDTH | SPSTART);
       break;
     case '\0':
@@ -684,18 +684,18 @@ char* RegExpCompile::regatom(int* flagp)
     case ')':
       // RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
       printf("RegularExpression::compile(): Internal error.\n"); // Never here
-      return KWSYS_NULLPTR;
+      return nullptr;
     case '?':
     case '+':
     case '*':
       // RAISE Error, SYM(RegularExpression), SYM(No_Operand),
       printf("RegularExpression::compile(): ?+* follows nothing.\n");
-      return KWSYS_NULLPTR;
+      return nullptr;
     case '\\':
       if (*regparse == '\0') {
         // RAISE Error, SYM(RegularExpression), SYM(Trailing_Backslash),
         printf("RegularExpression::compile(): Trailing backslash.\n");
-        return KWSYS_NULLPTR;
+        return nullptr;
       }
       ret = regnode(EXACTLY);
       regc(*regparse++);
@@ -711,7 +711,7 @@ char* RegExpCompile::regatom(int* flagp)
       if (len <= 0) {
         // RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
         printf("RegularExpression::compile(): Internal error.\n");
-        return KWSYS_NULLPTR;
+        return nullptr;
       }
       ender = *(regparse + len);
       if (len > 1 && ISMULT(ender))
@@ -809,7 +809,7 @@ void RegExpCompile::regtail(char* p, const char* val)
   scan = p;
   for (;;) {
     temp = regnext(scan);
-    if (temp == KWSYS_NULLPTR)
+    if (temp == nullptr)
       break;
     scan = temp;
   }
@@ -828,7 +828,7 @@ void RegExpCompile::regtail(char* p, const char* val)
 void RegExpCompile::regoptail(char* p, const char* val)
 {
   // "Operandless" and "op != BRANCH" are synonymous in practice.
-  if (p == KWSYS_NULLPTR || p == regdummyptr || OP(p) != BRANCH)
+  if (p == nullptr || p == regdummyptr || OP(p) != BRANCH)
     return;
   regtail(OPERAND(p), val);
 }
@@ -878,14 +878,14 @@ bool RegularExpression::find(char const* string,
   }
 
   // If there is a "must appear" string, look for it.
-  if (this->regmust != KWSYS_NULLPTR) {
+  if (this->regmust != nullptr) {
     s = string;
-    while ((s = strchr(s, this->regmust[0])) != KWSYS_NULLPTR) {
+    while ((s = strchr(s, this->regmust[0])) != nullptr) {
       if (strncmp(s, this->regmust, this->regmlen) == 0)
         break; // Found it.
       s++;
     }
-    if (s == KWSYS_NULLPTR) // Not present.
+    if (s == nullptr) // Not present.
       return false;
   }
 
@@ -903,7 +903,7 @@ bool RegularExpression::find(char const* string,
   s = string;
   if (this->regstart != '\0')
     // We know what char it must start with.
-    while ((s = strchr(s, this->regstart)) != KWSYS_NULLPTR) {
+    while ((s = strchr(s, this->regstart)) != nullptr) {
       if (regFind.regtry(s, rmatch.startp, rmatch.endp, this->program))
         return true;
       s++;
@@ -937,8 +937,8 @@ int RegExpFind::regtry(const char* string, const char** start,
   sp1 = start;
   ep = end;
   for (i = RegularExpressionMatch::NSUBEXP; i > 0; i--) {
-    *sp1++ = KWSYS_NULLPTR;
-    *ep++ = KWSYS_NULLPTR;
+    *sp1++ = nullptr;
+    *ep++ = nullptr;
   }
   if (regmatch(prog + 1)) {
     start[0] = string;
@@ -966,7 +966,7 @@ int RegExpFind::regmatch(const char* prog)
 
   scan = prog;
 
-  while (scan != KWSYS_NULLPTR) {
+  while (scan != nullptr) {
 
     next = regnext(scan);
 
@@ -998,14 +998,12 @@ int RegExpFind::regmatch(const char* prog)
         reginput += len;
       } break;
       case ANYOF:
-        if (*reginput == '\0' ||
-            strchr(OPERAND(scan), *reginput) == KWSYS_NULLPTR)
+        if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == nullptr)
           return (0);
         reginput++;
         break;
       case ANYBUT:
-        if (*reginput == '\0' ||
-            strchr(OPERAND(scan), *reginput) != KWSYS_NULLPTR)
+        if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != nullptr)
           return (0);
         reginput++;
         break;
@@ -1034,7 +1032,7 @@ int RegExpFind::regmatch(const char* prog)
           // Don't set startp if some later invocation of the
           // same parentheses already has.
           //
-          if (regstartp[no] == KWSYS_NULLPTR)
+          if (regstartp[no] == nullptr)
             regstartp[no] = save;
           return (1);
         } else
@@ -1062,7 +1060,7 @@ int RegExpFind::regmatch(const char* prog)
           // Don't set endp if some later invocation of the
           // same parentheses already has.
           //
-          if (regendp[no] == KWSYS_NULLPTR)
+          if (regendp[no] == nullptr)
             regendp[no] = save;
           return (1);
         } else
@@ -1082,7 +1080,7 @@ int RegExpFind::regmatch(const char* prog)
               return (1);
             reginput = save;
             scan = regnext(scan);
-          } while (scan != KWSYS_NULLPTR && OP(scan) == BRANCH);
+          } while (scan != nullptr && OP(scan) == BRANCH);
           return (0);
           // NOTREACHED
         }
@@ -1160,13 +1158,13 @@ int RegExpFind::regrepeat(const char* p)
       }
       break;
     case ANYOF:
-      while (*scan != '\0' && strchr(opnd, *scan) != KWSYS_NULLPTR) {
+      while (*scan != '\0' && strchr(opnd, *scan) != nullptr) {
         count++;
         scan++;
       }
       break;
     case ANYBUT:
-      while (*scan != '\0' && strchr(opnd, *scan) == KWSYS_NULLPTR) {
+      while (*scan != '\0' && strchr(opnd, *scan) == nullptr) {
         count++;
         scan++;
       }
@@ -1188,11 +1186,11 @@ static const char* regnext(const char* p)
   int offset;
 
   if (p == regdummyptr)
-    return (KWSYS_NULLPTR);
+    return (nullptr);
 
   offset = NEXT(p);
   if (offset == 0)
-    return (KWSYS_NULLPTR);
+    return (nullptr);
 
   if (OP(p) == BACK)
     return (p - offset);
@@ -1205,11 +1203,11 @@ static char* regnext(char* p)
   int offset;
 
   if (p == regdummyptr)
-    return (KWSYS_NULLPTR);
+    return (nullptr);
 
   offset = NEXT(p);
   if (offset == 0)
-    return (KWSYS_NULLPTR);
+    return (nullptr);
 
   if (OP(p) == BACK)
     return (p - offset);
diff --git a/RegularExpression.hxx.in b/RegularExpression.hxx.in
index ed86418..df7eb45 100644
--- a/RegularExpression.hxx.in
+++ b/RegularExpression.hxx.in
@@ -71,9 +71,9 @@ private:
  */
 inline RegularExpressionMatch::RegularExpressionMatch()
 {
-  startp[0] = 0;
-  endp[0] = 0;
-  searchstring = 0;
+  startp[0] = nullptr;
+  endp[0] = nullptr;
+  searchstring = nullptr;
 }
 
 /**
@@ -81,7 +81,7 @@ inline RegularExpressionMatch::RegularExpressionMatch()
  */
 inline bool RegularExpressionMatch::isValid() const
 {
-  return (this->startp[0] != 0);
+  return (this->startp[0] != nullptr);
 }
 
 /**
@@ -89,9 +89,9 @@ inline bool RegularExpressionMatch::isValid() const
  */
 inline void RegularExpressionMatch::clear()
 {
-  startp[0] = 0;
-  endp[0] = 0;
-  searchstring = 0;
+  startp[0] = nullptr;
+  endp[0] = nullptr;
+  searchstring = nullptr;
 }
 
 /**
@@ -135,7 +135,7 @@ inline std::string::size_type RegularExpressionMatch::end(int n) const
  */
 inline std::string RegularExpressionMatch::match(int n) const
 {
-  if (this->startp[n] == 0) {
+  if (this->startp[n] == nullptr) {
     return std::string();
   } else {
     return std::string(
@@ -230,10 +230,11 @@ inline std::string RegularExpressionMatch::match(int n) const
  * into the object's private data fields.  The == and  != operators only check
  * the  to see  if   the compiled  regular  expression   is the same, and  the
  * deep_equal functions also checks  to see if the  start and end pointers are
- * the same.  The is_valid  function returns false if  program is set to NULL,
- * (i.e. there is no valid compiled  expression).  The  set_invalid   function
- * sets the program to NULL (Warning:  this deletes the compiled  expression).
- * The following examples may help clarify regular expression usage:
+ * the same.  The is_valid  function returns false if  program is set to
+ * nullptr, (i.e. there is no valid compiled  expression).  The  set_invalid
+ * function sets the program to nullptr (Warning:  this deletes the compiled
+ * expression). The following examples may help clarify regular expression
+ * usage:
  *
  *   *  The regular expression  "^hello" matches  a "hello"  only at  the
  *      beginning of a  line.  It would match "hello  there" but not "hi,
@@ -288,7 +289,7 @@ class @KWSYS_NAMESPACE at _EXPORT RegularExpression
 {
 public:
   /**
-   * Instantiate RegularExpression with program=NULL.
+   * Instantiate RegularExpression with program=nullptr.
    */
   inline RegularExpression();
 
@@ -410,7 +411,7 @@ inline RegularExpression::RegularExpression()
   : regstart{}
   , reganch{}
   , regmust{}
-  , program{ 0 }
+  , program{ nullptr }
   , progsize{}
 {
 }
@@ -423,7 +424,7 @@ inline RegularExpression::RegularExpression(const char* s)
   : regstart{}
   , reganch{}
   , regmust{}
-  , program{ 0 }
+  , program{ nullptr }
   , progsize{}
 {
   if (s) {
@@ -439,7 +440,7 @@ inline RegularExpression::RegularExpression(const std::string& s)
   : regstart{}
   , reganch{}
   , regmust{}
-  , program{ 0 }
+  , program{ nullptr }
   , progsize{}
 {
   this->compile(s);
@@ -545,7 +546,7 @@ inline bool RegularExpression::operator!=(const RegularExpression& r) const
  */
 inline bool RegularExpression::is_valid() const
 {
-  return (this->program != 0);
+  return (this->program != nullptr);
 }
 
 inline void RegularExpression::set_invalid()
@@ -553,7 +554,7 @@ inline void RegularExpression::set_invalid()
   //#ifndef _WIN32
   delete[] this->program;
   //#endif
-  this->program = 0;
+  this->program = nullptr;
 }
 
 } // namespace @KWSYS_NAMESPACE@
diff --git a/SystemInformation.cxx b/SystemInformation.cxx
index 7dc6cf4..6ec6e48 100644
--- a/SystemInformation.cxx
+++ b/SystemInformation.cxx
@@ -847,31 +847,16 @@ void SystemInformation::RunMemoryCheck()
 
 // SystemInformationImplementation starts here
 
-#define STORE_TLBCACHE_INFO(x, y) x = (x < (y)) ? (y) : x
-#define TLBCACHE_INFO_UNITS (15)
-#define CLASSICAL_CPU_FREQ_LOOP 10000000
-#define RDTSC_INSTRUCTION _asm _emit 0x0f _asm _emit 0x31
-
-// Status Flag
-#define HT_NOT_CAPABLE 0
-#define HT_ENABLED 1
-#define HT_DISABLED 2
-#define HT_SUPPORTED_NOT_ENABLED 3
-#define HT_CANNOT_DETECT 4
-
-// EDX[28]  Bit 28 is set if HT is supported
-#define HT_BIT 0x10000000
-
-// EAX[11:8] Bit 8-11 contains family processor ID.
-#define FAMILY_ID 0x0F00
-#define PENTIUM4_ID 0x0F00
-// EAX[23:20] Bit 20-23 contains extended family processor ID
-#define EXT_FAMILY_ID 0x0F00000
-// EBX[23:16] Bit 16-23 in ebx contains the number of logical
-#define NUM_LOGICAL_BITS 0x00FF0000
-// processors per physical processor when execute cpuid with
-// eax set to 1
-// EBX[31:24] Bits 24-31 (8 bits) return the 8-bit unique
+#if USE_CPUID
+#  define STORE_TLBCACHE_INFO(x, y) x = (x < (y)) ? (y) : x
+#  define TLBCACHE_INFO_UNITS (15)
+#endif
+
+#if USE_ASM_INSTRUCTIONS
+#  define CLASSICAL_CPU_FREQ_LOOP 10000000
+#  define RDTSC_INSTRUCTION _asm _emit 0x0f _asm _emit 0x31
+#endif
+
 #define INITIAL_APIC_ID_BITS 0xFF000000
 // initial APIC ID for the processor this code is running on.
 // Default value = 0xff if HT is not supported
@@ -888,7 +873,7 @@ int LoadLines(FILE* file, std::vector<std::string>& lines)
   char buf[bufSize] = { '\0' };
   while (!feof(file) && !ferror(file)) {
     errno = 0;
-    if (fgets(buf, bufSize, file) == KWSYS_NULLPTR) {
+    if (fgets(buf, bufSize, file) == nullptr) {
       if (ferror(file) && (errno == EINTR)) {
         clearerr(file);
       }
@@ -952,7 +937,7 @@ int GetFieldsFromFile(const char* fileName, const char** fieldNames, T* values)
     return -1;
   }
   int i = 0;
-  while (fieldNames[i] != NULL) {
+  while (fieldNames[i] != nullptr) {
     int ierr = NameValue(fields, fieldNames[i], values[i]);
     if (ierr) {
       return -(i + 2);
@@ -966,7 +951,7 @@ int GetFieldsFromFile(const char* fileName, const char** fieldNames, T* values)
 template <typename T>
 int GetFieldFromFile(const char* fileName, const char* fieldName, T& value)
 {
-  const char* fieldNames[2] = { fieldName, NULL };
+  const char* fieldNames[2] = { fieldName, nullptr };
   T values[1] = { T(0) };
   int ierr = GetFieldsFromFile(fileName, fieldNames, values);
   if (ierr) {
@@ -984,7 +969,7 @@ int GetFieldsFromCommand(const char* command, const char** fieldNames,
                          T* values)
 {
   FILE* file = popen(command, "r");
-  if (file == KWSYS_NULLPTR) {
+  if (file == nullptr) {
     return -1;
   }
   std::vector<std::string> fields;
@@ -994,7 +979,7 @@ int GetFieldsFromCommand(const char* command, const char** fieldNames,
     return -1;
   }
   int i = 0;
-  while (fieldNames[i] != KWSYS_NULLPTR) {
+  while (fieldNames[i] != nullptr) {
     int ierr = NameValue(fields, fieldNames[i], values[i]);
     if (ierr) {
       return -(i + 2);
@@ -1030,8 +1015,7 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo,
       break;
 
     case SIGFPE:
-      oss << "Caught SIGFPE at "
-          << (sigInfo->si_addr == KWSYS_NULLPTR ? "0x" : "")
+      oss << "Caught SIGFPE at " << (sigInfo->si_addr == nullptr ? "0x" : "")
           << sigInfo->si_addr << " ";
       switch (sigInfo->si_code) {
 #    if defined(FPE_INTDIV)
@@ -1079,8 +1063,7 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo,
       break;
 
     case SIGSEGV:
-      oss << "Caught SIGSEGV at "
-          << (sigInfo->si_addr == KWSYS_NULLPTR ? "0x" : "")
+      oss << "Caught SIGSEGV at " << (sigInfo->si_addr == nullptr ? "0x" : "")
           << sigInfo->si_addr << " ";
       switch (sigInfo->si_code) {
         case SEGV_MAPERR:
@@ -1098,8 +1081,7 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo,
       break;
 
     case SIGBUS:
-      oss << "Caught SIGBUS at "
-          << (sigInfo->si_addr == KWSYS_NULLPTR ? "0x" : "")
+      oss << "Caught SIGBUS at " << (sigInfo->si_addr == nullptr ? "0x" : "")
           << sigInfo->si_addr << " ";
       switch (sigInfo->si_code) {
         case BUS_ADRALN:
@@ -1139,8 +1121,7 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo,
       break;
 
     case SIGILL:
-      oss << "Caught SIGILL at "
-          << (sigInfo->si_addr == KWSYS_NULLPTR ? "0x" : "")
+      oss << "Caught SIGILL at " << (sigInfo->si_addr == nullptr ? "0x" : "")
           << sigInfo->si_addr << " ";
       switch (sigInfo->si_code) {
         case ILL_ILLOPC:
@@ -1324,8 +1305,8 @@ SymbolProperties::SymbolProperties()
   // not using an initializer list
   // to avoid some PGI compiler warnings
   this->SetBinary("???");
-  this->SetBinaryBaseAddress(KWSYS_NULLPTR);
-  this->Address = KWSYS_NULLPTR;
+  this->SetBinaryBaseAddress(nullptr);
+  this->Address = nullptr;
   this->SetSourceFile("???");
   this->SetFunction("???");
   this->SetLineNumber(-1);
@@ -1682,7 +1663,7 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
     return -2;
   }
 
-  for (ifa = ifas; ifa != KWSYS_NULLPTR; ifa = ifa->ifa_next) {
+  for (ifa = ifas; ifa != nullptr; ifa = ifa->ifa_next) {
     int fam = ifa->ifa_addr ? ifa->ifa_addr->sa_family : -1;
     // Skip Loopback interfaces
     if (((fam == AF_INET) || (fam == AF_INET6)) &&
@@ -1693,7 +1674,7 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
                                              : sizeof(struct sockaddr_in6));
 
       ierr = getnameinfo(ifa->ifa_addr, static_cast<socklen_t>(addrlen), host,
-                         NI_MAXHOST, KWSYS_NULLPTR, 0, NI_NAMEREQD);
+                         NI_MAXHOST, nullptr, 0, NI_NAMEREQD);
       if (ierr) {
         // don't report the failure now since we may succeed on another
         // interface. If all attempts fail then return the failure code.
@@ -2577,7 +2558,7 @@ bool SystemInformationImplementation::RetrieveCPUClockSpeed()
   // If RDTSC is not supported, we fallback to trying to read this value
   // from the registry:
   if (!retrieved) {
-    HKEY hKey = NULL;
+    HKEY hKey = nullptr;
     LONG err =
       RegOpenKeyExW(HKEY_LOCAL_MACHINE,
                     L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 0,
@@ -2597,7 +2578,7 @@ bool SystemInformationImplementation::RetrieveCPUClockSpeed()
       }
 
       RegCloseKey(hKey);
-      hKey = NULL;
+      hKey = nullptr;
     }
   }
 #endif
@@ -3628,7 +3609,7 @@ SystemInformationImplementation::GetHostMemoryTotal()
 #elif defined(__APPLE__)
   uint64_t mem;
   size_t len = sizeof(mem);
-  int ierr = sysctlbyname("hw.memsize", &mem, &len, KWSYS_NULLPTR, 0);
+  int ierr = sysctlbyname("hw.memsize", &mem, &len, nullptr, 0);
   if (ierr) {
     return -1;
   }
@@ -3745,12 +3726,12 @@ SystemInformationImplementation::GetHostMemoryUsed()
 #  endif
 #elif defined(__linux)
   // First try to use MemAvailable, but it only works on newer kernels
-  const char* names2[3] = { "MemTotal:", "MemAvailable:", NULL };
+  const char* names2[3] = { "MemTotal:", "MemAvailable:", nullptr };
   SystemInformation::LongLong values2[2] = { SystemInformation::LongLong(0) };
   int ierr = GetFieldsFromFile("/proc/meminfo", names2, values2);
   if (ierr) {
     const char* names4[5] = { "MemTotal:", "MemFree:", "Buffers:", "Cached:",
-                              NULL };
+                              nullptr };
     SystemInformation::LongLong values4[4] = { SystemInformation::LongLong(
       0) };
     ierr = GetFieldsFromFile("/proc/meminfo", names4, values4);
@@ -3771,8 +3752,7 @@ SystemInformationImplementation::GetHostMemoryUsed()
   if (psz < 1) {
     return -1;
   }
-  const char* names[3] = { "Pages wired down:", "Pages active:",
-                           KWSYS_NULLPTR };
+  const char* names[3] = { "Pages wired down:", "Pages active:", nullptr };
   SystemInformation::LongLong values[2] = { SystemInformation::LongLong(0) };
   int ierr = GetFieldsFromCommand("vm_stat", names, values);
   if (ierr) {
@@ -3820,7 +3800,7 @@ SystemInformationImplementation::GetProcMemoryUsed()
   std::ostringstream oss;
   oss << "ps -o rss= -p " << pid;
   FILE* file = popen(oss.str().c_str(), "r");
-  if (file == KWSYS_NULLPTR) {
+  if (file == nullptr) {
     return -1;
   }
   oss.str("");
@@ -3920,9 +3900,9 @@ std::string SystemInformationImplementation::GetProgramStack(int firstFrame,
 
   void* stack[TRACE_MAX_STACK_FRAMES];
   HANDLE process = GetCurrentProcess();
-  SymInitialize(process, NULL, TRUE);
+  SymInitialize(process, nullptr, TRUE);
   WORD numberOfFrames =
-    CaptureStackBackTrace(firstFrame, TRACE_MAX_STACK_FRAMES, stack, NULL);
+    CaptureStackBackTrace(firstFrame, TRACE_MAX_STACK_FRAMES, stack, nullptr);
   SYMBOL_INFO* symbol = static_cast<SYMBOL_INFO*>(
     malloc(sizeof(SYMBOL_INFO) +
            (TRACE_MAX_FUNCTION_NAME_LENGTH - 1) * sizeof(TCHAR)));
@@ -3933,7 +3913,7 @@ std::string SystemInformationImplementation::GetProgramStack(int firstFrame,
   line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
   for (int i = 0; i < numberOfFrames; i++) {
     DWORD64 address = reinterpret_cast<DWORD64>(stack[i]);
-    SymFromAddr(process, address, NULL, symbol);
+    SymFromAddr(process, address, nullptr, symbol);
     if (SymGetLineFromAddr64(process, address, &displacement, &line)) {
       oss << " at " << symbol->Name << " in " << line.FileName << " line "
           << line.LineNumber << std::endl;
@@ -4000,13 +3980,13 @@ void SystemInformationImplementation::SetStackTraceOnError(int enable)
 
   if (enable && !saOrigValid) {
     // save the current actions
-    sigaction(SIGABRT, KWSYS_NULLPTR, &saABRTOrig);
-    sigaction(SIGSEGV, KWSYS_NULLPTR, &saSEGVOrig);
-    sigaction(SIGTERM, KWSYS_NULLPTR, &saTERMOrig);
-    sigaction(SIGINT, KWSYS_NULLPTR, &saINTOrig);
-    sigaction(SIGILL, KWSYS_NULLPTR, &saILLOrig);
-    sigaction(SIGBUS, KWSYS_NULLPTR, &saBUSOrig);
-    sigaction(SIGFPE, KWSYS_NULLPTR, &saFPEOrig);
+    sigaction(SIGABRT, nullptr, &saABRTOrig);
+    sigaction(SIGSEGV, nullptr, &saSEGVOrig);
+    sigaction(SIGTERM, nullptr, &saTERMOrig);
+    sigaction(SIGINT, nullptr, &saINTOrig);
+    sigaction(SIGILL, nullptr, &saILLOrig);
+    sigaction(SIGBUS, nullptr, &saBUSOrig);
+    sigaction(SIGFPE, nullptr, &saFPEOrig);
 
     // enable read, disable write
     saOrigValid = 1;
@@ -4020,22 +4000,22 @@ void SystemInformationImplementation::SetStackTraceOnError(int enable)
 #  endif
     sigemptyset(&sa.sa_mask);
 
-    sigaction(SIGABRT, &sa, KWSYS_NULLPTR);
-    sigaction(SIGSEGV, &sa, KWSYS_NULLPTR);
-    sigaction(SIGTERM, &sa, KWSYS_NULLPTR);
-    sigaction(SIGINT, &sa, KWSYS_NULLPTR);
-    sigaction(SIGILL, &sa, KWSYS_NULLPTR);
-    sigaction(SIGBUS, &sa, KWSYS_NULLPTR);
-    sigaction(SIGFPE, &sa, KWSYS_NULLPTR);
+    sigaction(SIGABRT, &sa, nullptr);
+    sigaction(SIGSEGV, &sa, nullptr);
+    sigaction(SIGTERM, &sa, nullptr);
+    sigaction(SIGINT, &sa, nullptr);
+    sigaction(SIGILL, &sa, nullptr);
+    sigaction(SIGBUS, &sa, nullptr);
+    sigaction(SIGFPE, &sa, nullptr);
   } else if (!enable && saOrigValid) {
     // restore previous actions
-    sigaction(SIGABRT, &saABRTOrig, KWSYS_NULLPTR);
-    sigaction(SIGSEGV, &saSEGVOrig, KWSYS_NULLPTR);
-    sigaction(SIGTERM, &saTERMOrig, KWSYS_NULLPTR);
-    sigaction(SIGINT, &saINTOrig, KWSYS_NULLPTR);
-    sigaction(SIGILL, &saILLOrig, KWSYS_NULLPTR);
-    sigaction(SIGBUS, &saBUSOrig, KWSYS_NULLPTR);
-    sigaction(SIGFPE, &saFPEOrig, KWSYS_NULLPTR);
+    sigaction(SIGABRT, &saABRTOrig, nullptr);
+    sigaction(SIGSEGV, &saSEGVOrig, nullptr);
+    sigaction(SIGTERM, &saTERMOrig, nullptr);
+    sigaction(SIGINT, &saINTOrig, nullptr);
+    sigaction(SIGILL, &saILLOrig, nullptr);
+    sigaction(SIGBUS, &saBUSOrig, nullptr);
+    sigaction(SIGFPE, &saFPEOrig, nullptr);
 
     // enable write, disable read
     saOrigValid = 0;
@@ -4417,7 +4397,7 @@ void SystemInformationImplementation::CPUCountWindows()
   std::vector<SYSTEM_LOGICAL_PROCESSOR_INFORMATION> ProcInfo;
   {
     DWORD Length = 0;
-    DWORD rc = pGetLogicalProcessorInformation(NULL, &Length);
+    DWORD rc = pGetLogicalProcessorInformation(nullptr, &Length);
     assert(FALSE == rc);
     (void)rc; // Silence unused variable warning in Borland C++ 5.81
     assert(GetLastError() == ERROR_INSUFFICIENT_BUFFER);
@@ -4471,7 +4451,7 @@ bool SystemInformationImplementation::ParseSysCtl()
   int err = 0;
   uint64_t value = 0;
   size_t len = sizeof(value);
-  sysctlbyname("hw.memsize", &value, &len, KWSYS_NULLPTR, 0);
+  sysctlbyname("hw.memsize", &value, &len, nullptr, 0);
   this->TotalPhysicalMemory = static_cast<size_t>(value / 1048576);
 
   // Parse values for Mac
@@ -4481,7 +4461,7 @@ bool SystemInformationImplementation::ParseSysCtl()
   if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmstat,
                       &count) == KERN_SUCCESS) {
     len = sizeof(value);
-    err = sysctlbyname("hw.pagesize", &value, &len, KWSYS_NULLPTR, 0);
+    err = sysctlbyname("hw.pagesize", &value, &len, nullptr, 0);
     int64_t available_memory =
       (vmstat.free_count + vmstat.inactive_count) * value;
     this->AvailablePhysicalMemory =
@@ -4491,10 +4471,11 @@ bool SystemInformationImplementation::ParseSysCtl()
 #  ifdef VM_SWAPUSAGE
   // Virtual memory.
   int mib[2] = { CTL_VM, VM_SWAPUSAGE };
-  size_t miblen = sizeof(mib) / sizeof(mib[0]);
+  unsigned int miblen =
+    static_cast<unsigned int>(sizeof(mib) / sizeof(mib[0]));
   struct xsw_usage swap;
   len = sizeof(swap);
-  err = sysctl(mib, miblen, &swap, &len, KWSYS_NULLPTR, 0);
+  err = sysctl(mib, miblen, &swap, &len, nullptr, 0);
   if (err == 0) {
     this->AvailableVirtualMemory =
       static_cast<size_t>(swap.xsu_avail / 1048576);
@@ -4507,75 +4488,72 @@ bool SystemInformationImplementation::ParseSysCtl()
 
   // CPU Info
   len = sizeof(this->NumberOfPhysicalCPU);
-  sysctlbyname("hw.physicalcpu", &this->NumberOfPhysicalCPU, &len,
-               KWSYS_NULLPTR, 0);
+  sysctlbyname("hw.physicalcpu", &this->NumberOfPhysicalCPU, &len, nullptr, 0);
   len = sizeof(this->NumberOfLogicalCPU);
-  sysctlbyname("hw.logicalcpu", &this->NumberOfLogicalCPU, &len, KWSYS_NULLPTR,
-               0);
+  sysctlbyname("hw.logicalcpu", &this->NumberOfLogicalCPU, &len, nullptr, 0);
 
   int cores_per_package = 0;
   len = sizeof(cores_per_package);
   err = sysctlbyname("machdep.cpu.cores_per_package", &cores_per_package, &len,
-                     KWSYS_NULLPTR, 0);
+                     nullptr, 0);
   // That name was not found, default to 1
   this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical =
     err != 0 ? 1 : static_cast<unsigned char>(cores_per_package);
 
   len = sizeof(value);
-  sysctlbyname("hw.cpufrequency", &value, &len, KWSYS_NULLPTR, 0);
+  sysctlbyname("hw.cpufrequency", &value, &len, nullptr, 0);
   this->CPUSpeedInMHz = static_cast<float>(value) / 1000000;
 
   // Chip family
   len = sizeof(this->ChipID.Family);
   // Seems only the intel chips will have this name so if this fails it is
   // probably a PPC machine
-  err = sysctlbyname("machdep.cpu.family", &this->ChipID.Family, &len,
-                     KWSYS_NULLPTR, 0);
+  err =
+    sysctlbyname("machdep.cpu.family", &this->ChipID.Family, &len, nullptr, 0);
   if (err != 0) // Go back to names we know but are less descriptive
   {
     this->ChipID.Family = 0;
     ::memset(retBuf, 0, 128);
     len = 32;
-    err = sysctlbyname("hw.machine", &retBuf, &len, KWSYS_NULLPTR, 0);
+    err = sysctlbyname("hw.machine", &retBuf, &len, nullptr, 0);
     std::string machineBuf(retBuf);
     if (machineBuf.find_first_of("Power") != std::string::npos) {
       this->ChipID.Vendor = "IBM";
       len = sizeof(this->ChipID.Family);
-      err = sysctlbyname("hw.cputype", &this->ChipID.Family, &len,
-                         KWSYS_NULLPTR, 0);
+      err = sysctlbyname("hw.cputype", &this->ChipID.Family, &len, nullptr, 0);
       len = sizeof(this->ChipID.Model);
-      err = sysctlbyname("hw.cpusubtype", &this->ChipID.Model, &len,
-                         KWSYS_NULLPTR, 0);
+      err =
+        sysctlbyname("hw.cpusubtype", &this->ChipID.Model, &len, nullptr, 0);
       this->FindManufacturer();
     }
   } else // Should be an Intel Chip.
   {
     len = sizeof(this->ChipID.Family);
     err = sysctlbyname("machdep.cpu.family", &this->ChipID.Family, &len,
-                       KWSYS_NULLPTR, 0);
+                       nullptr, 0);
 
     ::memset(retBuf, 0, 128);
     len = 128;
-    err = sysctlbyname("machdep.cpu.vendor", retBuf, &len, KWSYS_NULLPTR, 0);
+    err = sysctlbyname("machdep.cpu.vendor", retBuf, &len, nullptr, 0);
     // Chip Vendor
     this->ChipID.Vendor = retBuf;
     this->FindManufacturer();
 
     // Chip Model
     len = sizeof(value);
-    err = sysctlbyname("machdep.cpu.model", &value, &len, KWSYS_NULLPTR, 0);
+    err = sysctlbyname("machdep.cpu.model", &value, &len, nullptr, 0);
     this->ChipID.Model = static_cast<int>(value);
 
     // Chip Stepping
     len = sizeof(value);
     value = 0;
-    err = sysctlbyname("machdep.cpu.stepping", &value, &len, KWSYS_NULLPTR, 0);
+    err = sysctlbyname("machdep.cpu.stepping", &value, &len, nullptr, 0);
     if (!err) {
       this->ChipID.Revision = static_cast<int>(value);
     }
 
     // feature string
-    char* buf = KWSYS_NULLPTR;
+    char* buf = nullptr;
     size_t allocSize = 128;
 
     err = 0;
@@ -4592,8 +4570,7 @@ bool SystemInformationImplementation::ParseSysCtl()
       }
       buf[0] = ' ';
       len = allocSize - 2; // keep space for leading and trailing space
-      err =
-        sysctlbyname("machdep.cpu.features", buf + 1, &len, KWSYS_NULLPTR, 0);
+      err = sysctlbyname("machdep.cpu.features", buf + 1, &len, nullptr, 0);
     }
     if (!err && buf && len) {
       // now we can match every flags as space + flag + space
@@ -4634,8 +4611,7 @@ bool SystemInformationImplementation::ParseSysCtl()
   // brand string
   ::memset(retBuf, 0, sizeof(retBuf));
   len = sizeof(retBuf);
-  err =
-    sysctlbyname("machdep.cpu.brand_string", retBuf, &len, KWSYS_NULLPTR, 0);
+  err = sysctlbyname("machdep.cpu.brand_string", retBuf, &len, nullptr, 0);
   if (!err) {
     this->ChipID.ProcessorName = retBuf;
     this->ChipID.ModelName = retBuf;
@@ -4643,10 +4619,10 @@ bool SystemInformationImplementation::ParseSysCtl()
 
   // Cache size
   len = sizeof(value);
-  err = sysctlbyname("hw.l1icachesize", &value, &len, KWSYS_NULLPTR, 0);
+  err = sysctlbyname("hw.l1icachesize", &value, &len, nullptr, 0);
   this->Features.L1CacheSize = static_cast<int>(value);
   len = sizeof(value);
-  err = sysctlbyname("hw.l2cachesize", &value, &len, KWSYS_NULLPTR, 0);
+  err = sysctlbyname("hw.l2cachesize", &value, &len, nullptr, 0);
   this->Features.L2CacheSize = static_cast<int>(value);
 
   return true;
@@ -4683,7 +4659,7 @@ std::string SystemInformationImplementation::RunProcess(
 
   kwsysProcess_Execute(gp);
 
-  char* data = KWSYS_NULLPTR;
+  char* data = nullptr;
   int length;
   double timeout = 255;
   int pipe; // pipe id as returned by kwsysProcess_WaitForData()
@@ -4695,7 +4671,7 @@ std::string SystemInformationImplementation::RunProcess(
   {
     buffer.append(data, length);
   }
-  kwsysProcess_WaitForExit(gp, KWSYS_NULLPTR);
+  kwsysProcess_WaitForExit(gp, nullptr);
 
   int result = 0;
   switch (kwsysProcess_GetState(gp)) {
@@ -4766,7 +4742,7 @@ std::string SystemInformationImplementation::ParseValueFromKStat(
   for (size_t i = 0; i < args_string.size(); ++i) {
     args.push_back(args_string[i].c_str());
   }
-  args.push_back(KWSYS_NULLPTR);
+  args.push_back(nullptr);
 
   std::string buffer = this->RunProcess(args);
 
@@ -4965,7 +4941,7 @@ bool SystemInformationImplementation::QueryBSDMemory()
 #  endif
   size_t sz = sizeof(k);
 
-  if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) {
+  if (sysctl(ctrl, 2, &k, &sz, nullptr, 0) != 0) {
     return false;
   }
 
@@ -5036,7 +5012,7 @@ bool SystemInformationImplementation::QueryBSDProcessor()
   size_t sz = sizeof(k);
   int ctrl[2] = { CTL_HW, HW_NCPU };
 
-  if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) {
+  if (sysctl(ctrl, 2, &k, &sz, nullptr, 0) != 0) {
     return false;
   }
 
@@ -5046,7 +5022,7 @@ bool SystemInformationImplementation::QueryBSDProcessor()
 #  if defined(HW_CPUSPEED)
   ctrl[1] = HW_CPUSPEED;
 
-  if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) {
+  if (sysctl(ctrl, 2, &k, &sz, nullptr, 0) != 0) {
     return false;
   }
 
@@ -5057,7 +5033,7 @@ bool SystemInformationImplementation::QueryBSDProcessor()
   ctrl[0] = CTL_MACHDEP;
   ctrl[1] = CPU_SSE;
 
-  if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) {
+  if (sysctl(ctrl, 2, &k, &sz, nullptr, 0) != 0) {
     return false;
   }
 
@@ -5068,7 +5044,7 @@ bool SystemInformationImplementation::QueryBSDProcessor()
   ctrl[0] = CTL_MACHDEP;
   ctrl[1] = CPU_SSE2;
 
-  if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) {
+  if (sysctl(ctrl, 2, &k, &sz, nullptr, 0) != 0) {
     return false;
   }
 
@@ -5081,7 +5057,7 @@ bool SystemInformationImplementation::QueryBSDProcessor()
   char vbuf[25];
   ::memset(vbuf, 0, sizeof(vbuf));
   sz = sizeof(vbuf) - 1;
-  if (sysctl(ctrl, 2, vbuf, &sz, NULL, 0) != 0) {
+  if (sysctl(ctrl, 2, vbuf, &sz, nullptr, 0) != 0) {
     return false;
   }
 
@@ -5293,7 +5269,7 @@ bool SystemInformationImplementation::QueryOSInformation()
         RegOpenKeyExW(HKEY_LOCAL_MACHINE,
                       L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions", 0,
                       KEY_QUERY_VALUE, &hKey);
-        RegQueryValueExW(hKey, L"ProductType", NULL, NULL,
+        RegQueryValueExW(hKey, L"ProductType", nullptr, nullptr,
                          (LPBYTE)szProductType, &dwBufLen);
         RegCloseKey(hKey);
 
@@ -5335,13 +5311,13 @@ bool SystemInformationImplementation::QueryOSInformation()
 
         // Load the Kernel32 DLL.
         hKernelDLL = LoadLibraryW(L"kernel32");
-        if (hKernelDLL != NULL) {
+        if (hKernelDLL != nullptr) {
           // Only XP and .NET Server support IsWOW64Process so... Load
           // dynamically!
           DLLProc = (LPFNPROC)GetProcAddress(hKernelDLL, "IsWow64Process");
 
           // If the function address is valid, call the function.
-          if (DLLProc != NULL)
+          if (DLLProc != nullptr)
             (DLLProc)(GetCurrentProcess(), &bIsWindows64Bit);
           else
             bIsWindows64Bit = false;
@@ -5456,7 +5432,7 @@ int SystemInformationImplementation::CallSwVers(const char* arg,
   std::vector<const char*> args;
   args.push_back("sw_vers");
   args.push_back(arg);
-  args.push_back(KWSYS_NULLPTR);
+  args.push_back(nullptr);
   ver = this->RunProcess(args);
   this->TrimNewline(ver);
 #else
diff --git a/SystemInformation.hxx.in b/SystemInformation.hxx.in
index 5e93878..fc42e9d 100644
--- a/SystemInformation.hxx.in
+++ b/SystemInformation.hxx.in
@@ -115,8 +115,8 @@ public:
   // returns an informative general description if the installed and
   // available ram on this system. See the GetHostMemoryTotal, and
   // Get{Host,Proc}MemoryAvailable methods for more information.
-  std::string GetMemoryDescription(const char* hostLimitEnvVarName = NULL,
-                                   const char* procLimitEnvVarName = NULL);
+  std::string GetMemoryDescription(const char* hostLimitEnvVarName = nullptr,
+                                   const char* procLimitEnvVarName = nullptr);
 
   // Retrieve amount of physical memory installed on the system in KiB
   // units.
@@ -128,7 +128,7 @@ public:
   // parallel. The amount of memory reported may differ from the host
   // total if a host wide resource limit is applied. Such reource limits
   // are reported to us via an application specified environment variable.
-  LongLong GetHostMemoryAvailable(const char* hostLimitEnvVarName = NULL);
+  LongLong GetHostMemoryAvailable(const char* hostLimitEnvVarName = nullptr);
 
   // Get total system RAM in units of KiB available to this process.
   // This may differ from the host available if a per-process resource
@@ -136,8 +136,8 @@ public:
   // system via rlimit API. Resource limits that are not imposed via
   // rlimit API may be reported to us via an application specified
   // environment variable.
-  LongLong GetProcMemoryAvailable(const char* hostLimitEnvVarName = NULL,
-                                  const char* procLimitEnvVarName = NULL);
+  LongLong GetProcMemoryAvailable(const char* hostLimitEnvVarName = nullptr,
+                                  const char* procLimitEnvVarName = nullptr);
 
   // Get the system RAM used by all processes on the host, in units of KiB.
   LongLong GetHostMemoryUsed();
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 8571477..ce4d6ef 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -192,15 +192,15 @@ static inline char* realpath(const char* path, char* resolved_path)
 {
   const size_t maxlen = KWSYS_SYSTEMTOOLS_MAXPATH;
   snprintf(resolved_path, maxlen, "%s", path);
-  BPath normalized(resolved_path, NULL, true);
+  BPath normalized(resolved_path, nullptr, true);
   const char* resolved = normalized.Path();
-  if (resolved != NULL) // NULL == No such file.
+  if (resolved != nullptr) // nullptr == No such file.
   {
     if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen) {
       return resolved_path;
     }
   }
-  return NULL; // something went wrong.
+  return nullptr; // something went wrong.
 }
 #endif
 
@@ -273,12 +273,12 @@ inline void Realpath(const std::string& path, std::string& resolved_path,
     if (bufferLen) {
       *errorMessage = "Destination path buffer size too small.";
     } else if (unsigned int errorId = GetLastError()) {
-      LPSTR message = NULL;
+      LPSTR message = nullptr;
       DWORD size = FormatMessageA(
         FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
           FORMAT_MESSAGE_IGNORE_INSERTS,
-        NULL, errorId, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-        (LPSTR)&message, 0, NULL);
+        nullptr, errorId, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+        (LPSTR)&message, 0, nullptr);
       *errorMessage = std::string(message, size);
       LocalFree(message);
     } else {
@@ -313,7 +313,7 @@ inline int Chdir(const std::string& dir)
   return chdir(dir.c_str());
 }
 inline void Realpath(const std::string& path, std::string& resolved_path,
-                     std::string* errorMessage = KWSYS_NULLPTR)
+                     std::string* errorMessage = nullptr)
 {
   char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH];
 
@@ -359,7 +359,7 @@ double SystemTools::GetTime(void)
           11644473600.0);
 #else
   struct timeval t;
-  gettimeofday(&t, KWSYS_NULLPTR);
+  gettimeofday(&t, nullptr);
   return 1.0 * double(t.tv_sec) + 0.000001 * double(t.tv_usec);
 #endif
 }
@@ -389,8 +389,8 @@ struct kwsysEnvCompare
 #else
     const char* leq = strchr(l, '=');
     const char* req = strchr(r, '=');
-    size_t llen = leq ? (leq - l) : strlen(l);
-    size_t rlen = req ? (req - r) : strlen(r);
+    size_t llen = leq ? static_cast<size_t>(leq - l) : strlen(l);
+    size_t rlen = req ? static_cast<size_t>(req - r) : strlen(r);
     if (llen == rlen) {
       return strncmp(l, r, llen) < 0;
     } else {
@@ -420,7 +420,7 @@ public:
 
   const envchar* Release(const envchar* env)
   {
-    const envchar* old = KWSYS_NULLPTR;
+    const envchar* old = nullptr;
     iterator i = this->find(env);
     if (i != this->end()) {
       old = *i;
@@ -630,7 +630,7 @@ const char* SystemToolsStatic::GetEnvBuffered(const char* key)
     }
     return menv.c_str();
   }
-  return KWSYS_NULLPTR;
+  return nullptr;
 }
 #endif
 
@@ -684,7 +684,7 @@ bool SystemTools::HasEnv(const char* key)
 #else
   const char* v = getenv(key);
 #endif
-  return v != KWSYS_NULLPTR;
+  return v != nullptr;
 }
 
 bool SystemTools::HasEnv(const std::string& key)
@@ -915,7 +915,7 @@ bool SystemTools::MakeDirectory(const std::string& path, const mode_t* mode)
   while ((pos = dir.find('/', pos)) != std::string::npos) {
     topdir = dir.substr(0, pos);
 
-    if (Mkdir(topdir) == 0 && mode != KWSYS_NULLPTR) {
+    if (Mkdir(topdir) == 0 && mode != nullptr) {
       SystemTools::SetPermissions(topdir, *mode);
     }
 
@@ -934,7 +934,7 @@ bool SystemTools::MakeDirectory(const std::string& path, const mode_t* mode)
     ) {
       return false;
     }
-  } else if (mode != KWSYS_NULLPTR) {
+  } else if (mode != nullptr) {
     SystemTools::SetPermissions(topdir, *mode);
   }
 
@@ -1055,7 +1055,7 @@ static DWORD SystemToolsMakeRegistryMode(DWORD mode,
   // only add the modes when on a system that supports Wow64.
   static FARPROC wow64p =
     GetProcAddress(GetModuleHandleW(L"kernel32"), "IsWow64Process");
-  if (wow64p == NULL) {
+  if (wow64p == nullptr) {
     return mode;
   }
 
@@ -1136,7 +1136,7 @@ bool SystemTools::ReadRegistryValue(const std::string& key, std::string& value,
     DWORD dwType, dwSize;
     dwSize = 1023;
     wchar_t data[1024];
-    if (RegQueryValueExW(hKey, Encoding::ToWide(valuename).c_str(), NULL,
+    if (RegQueryValueExW(hKey, Encoding::ToWide(valuename).c_str(), nullptr,
                          &dwType, (BYTE*)data, &dwSize) == ERROR_SUCCESS) {
       if (dwType == REG_SZ) {
         value = Encoding::ToNarrow(data);
@@ -1186,7 +1186,7 @@ bool SystemTools::WriteRegistryValue(const std::string& key,
   wchar_t lpClass[] = L"";
   if (RegCreateKeyExW(primaryKey, Encoding::ToWide(second).c_str(), 0, lpClass,
                       REG_OPTION_NON_VOLATILE,
-                      SystemToolsMakeRegistryMode(KEY_WRITE, view), NULL,
+                      SystemToolsMakeRegistryMode(KEY_WRITE, view), nullptr,
                       &hKey, &dwDummy) != ERROR_SUCCESS) {
     return false;
   }
@@ -1252,10 +1252,10 @@ bool SystemTools::SameFile(const std::string& file1, const std::string& file2)
 
   hFile1 =
     CreateFileW(Encoding::ToWide(file1).c_str(), GENERIC_READ, FILE_SHARE_READ,
-                NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+                nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
   hFile2 =
     CreateFileW(Encoding::ToWide(file2).c_str(), GENERIC_READ, FILE_SHARE_READ,
-                NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+                nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
   if (hFile1 == INVALID_HANDLE_VALUE || hFile2 == INVALID_HANDLE_VALUE) {
     if (hFile1 != INVALID_HANDLE_VALUE) {
       CloseHandle(hFile1);
@@ -1347,7 +1347,7 @@ bool SystemTools::FileExists(const std::string& filename)
     // even if we do not have permission to read the file itself
     HANDLE handle =
       CreateFileW(Encoding::ToWindowsExtendedPath(filename).c_str(), 0, 0,
-                  NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+                  nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
 
     if (handle == INVALID_HANDLE_VALUE) {
       return false;
@@ -1493,12 +1493,12 @@ bool SystemTools::Touch(const std::string& filename, bool create)
   CloseHandle(h);
 #elif KWSYS_CXX_HAS_UTIMENSAT
   // utimensat is only available on newer Unixes and macOS 10.13+
-  if (utimensat(AT_FDCWD, filename.c_str(), NULL, 0) < 0) {
+  if (utimensat(AT_FDCWD, filename.c_str(), nullptr, 0) < 0) {
     return false;
   }
 #else
   // fall back to utimes
-  if (utimes(filename.c_str(), NULL) < 0) {
+  if (utimes(filename.c_str(), nullptr) < 0) {
     return false;
   }
 #endif
@@ -1653,7 +1653,7 @@ char* SystemTools::AppendStrings(const char* str1, const char* str2)
   size_t len1 = strlen(str1);
   char* newstr = new char[len1 + strlen(str2) + 1];
   if (!newstr) {
-    return KWSYS_NULLPTR;
+    return nullptr;
   }
   strcpy(newstr, str1);
   strcat(newstr + len1, str2);
@@ -1676,7 +1676,7 @@ char* SystemTools::AppendStrings(const char* str1, const char* str2,
   size_t len1 = strlen(str1), len2 = strlen(str2);
   char* newstr = new char[len1 + len2 + strlen(str3) + 1];
   if (!newstr) {
-    return KWSYS_NULLPTR;
+    return nullptr;
   }
   strcpy(newstr, str1);
   strcat(newstr + len1, str2);
@@ -1726,7 +1726,7 @@ size_t SystemTools::CountChar(const char* str, char c)
 char* SystemTools::RemoveChars(const char* str, const char* toremove)
 {
   if (!str) {
-    return KWSYS_NULLPTR;
+    return nullptr;
   }
   char* clean_str = new char[strlen(str) + 1];
   char* ptr = clean_str;
@@ -1748,7 +1748,7 @@ char* SystemTools::RemoveChars(const char* str, const char* toremove)
 char* SystemTools::RemoveCharsButUpperHex(const char* str)
 {
   if (!str) {
-    return KWSYS_NULLPTR;
+    return nullptr;
   }
   char* clean_str = new char[strlen(str) + 1];
   char* ptr = clean_str;
@@ -1829,7 +1829,7 @@ bool SystemTools::StringEndsWith(const std::string& str1, const char* str2)
 const char* SystemTools::FindLastString(const char* str1, const char* str2)
 {
   if (!str1 || !str2) {
-    return KWSYS_NULLPTR;
+    return nullptr;
   }
 
   size_t len1 = strlen(str1), len2 = strlen(str2);
@@ -1842,7 +1842,7 @@ const char* SystemTools::FindLastString(const char* str1, const char* str2)
     } while (ptr-- != str1);
   }
 
-  return KWSYS_NULLPTR;
+  return nullptr;
 }
 
 // Duplicate string
@@ -1852,7 +1852,7 @@ char* SystemTools::DuplicateString(const char* str)
     char* newstr = new char[strlen(str) + 1];
     return strcpy(newstr, str);
   }
-  return KWSYS_NULLPTR;
+  return nullptr;
 }
 
 // Return a cropped string
@@ -3018,16 +3018,16 @@ bool SystemTools::FileIsSymlink(const std::string& name)
       // * a file or directory that has an associated reparse point, or
       // * a file that is a symbolic link.
       HANDLE hFile = CreateFileW(
-        path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
-        FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, NULL);
+        path.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING,
+        FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, nullptr);
       if (hFile == INVALID_HANDLE_VALUE) {
         return false;
       }
       byte buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
       DWORD bytesReturned = 0;
-      if (!DeviceIoControl(hFile, FSCTL_GET_REPARSE_POINT, NULL, 0, buffer,
+      if (!DeviceIoControl(hFile, FSCTL_GET_REPARSE_POINT, nullptr, 0, buffer,
                            MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &bytesReturned,
-                           NULL)) {
+                           nullptr)) {
         CloseHandle(hFile);
         // Since FILE_ATTRIBUTE_REPARSE_POINT is set this file must be
         // a symbolic link if it is not a reparse point.
@@ -3058,7 +3058,7 @@ bool SystemTools::FileIsFIFO(const std::string& name)
 #if defined(_WIN32)
   HANDLE hFile =
     CreateFileW(Encoding::ToWide(name).c_str(), GENERIC_READ, FILE_SHARE_READ,
-                NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+                nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
   if (hFile == INVALID_HANDLE_VALUE) {
     return false;
   }
@@ -3219,7 +3219,7 @@ bool SystemTools::FindProgramPath(const char* argv0, std::string& pathOut,
 
 std::string SystemTools::CollapseFullPath(const std::string& in_relative)
 {
-  return SystemTools::CollapseFullPath(in_relative, KWSYS_NULLPTR);
+  return SystemTools::CollapseFullPath(in_relative, nullptr);
 }
 
 #if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP
@@ -4013,7 +4013,7 @@ bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath)
   }
 
   std::wstring wtempPath = Encoding::ToWide(tempPath);
-  DWORD ret = GetShortPathNameW(wtempPath.c_str(), NULL, 0);
+  DWORD ret = GetShortPathNameW(wtempPath.c_str(), nullptr, 0);
   std::vector<wchar_t> buffer(ret);
   if (ret != 0) {
     ret = GetShortPathNameW(wtempPath.c_str(), &buffer[0],
@@ -4421,7 +4421,7 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
           return 0;
         }
 
-        lRet = RegQueryValueExW(hKey, L"ProductType", NULL, NULL,
+        lRet = RegQueryValueExW(hKey, L"ProductType", nullptr, nullptr,
                                 (LPBYTE)szProductType, &dwBufLen);
 
         if ((lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE)) {
diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in
index dd1266b..c4ab9d4 100644
--- a/SystemTools.hxx.in
+++ b/SystemTools.hxx.in
@@ -400,9 +400,10 @@ public:
    *  installPrefix is a possibly null pointer to the install directory.
    */
   static bool FindProgramPath(const char* argv0, std::string& pathOut,
-                              std::string& errorMsg, const char* exeName = 0,
-                              const char* buildDir = 0,
-                              const char* installPrefix = 0);
+                              std::string& errorMsg,
+                              const char* exeName = nullptr,
+                              const char* buildDir = nullptr,
+                              const char* installPrefix = nullptr);
 
   /**
    * Given a path to a file or directory, convert it to a full path.
@@ -420,11 +421,11 @@ public:
    * Get the real path for a given path, removing all symlinks.  In
    * the event of an error (non-existent path, permissions issue,
    * etc.) the original path is returned if errorMessage pointer is
-   * NULL.  Otherwise empty string is returned and errorMessage
+   * nullptr.  Otherwise empty string is returned and errorMessage
    * contains error description.
    */
   static std::string GetRealPath(const std::string& path,
-                                 std::string* errorMessage = 0);
+                                 std::string* errorMessage = nullptr);
 
   /**
    * Split a path name into its root component and the rest of the
@@ -442,7 +443,7 @@ public:
    * given.
    */
   static const char* SplitPathRootComponent(const std::string& p,
-                                            std::string* root = 0);
+                                            std::string* root = nullptr);
 
   /**
    * Split a path name into its basic components.  The first component
@@ -528,7 +529,8 @@ public:
    * be true when the line read had a newline character.
    */
   static bool GetLineFromStream(std::istream& istr, std::string& line,
-                                bool* has_newline = 0, long sizeLimit = -1);
+                                bool* has_newline = nullptr,
+                                long sizeLimit = -1);
 
   /**
    * Get the parent directory of the directory or file
@@ -563,8 +565,9 @@ public:
    * can make a full path even if none of the directories existed
    * prior to calling this function.
    */
-  static bool MakeDirectory(const char* path, const mode_t* mode = 0);
-  static bool MakeDirectory(const std::string& path, const mode_t* mode = 0);
+  static bool MakeDirectory(const char* path, const mode_t* mode = nullptr);
+  static bool MakeDirectory(const std::string& path,
+                            const mode_t* mode = nullptr);
 
   /**
    * Copy the source file to the destination file only
@@ -842,7 +845,8 @@ public:
    *  string vector passed in.  If env is set then the value
    *  of env will be used instead of PATH.
    */
-  static void GetPath(std::vector<std::string>& path, const char* env = 0);
+  static void GetPath(std::vector<std::string>& path,
+                      const char* env = nullptr);
 
   /**
    * Read an environment variable
diff --git a/hashtable.hxx.in b/hashtable.hxx.in
index 0981c66..8c4b002 100644
--- a/hashtable.hxx.in
+++ b/hashtable.hxx.in
@@ -354,7 +354,7 @@ public:
     return end();
   }
 
-  iterator end() { return iterator(0, this); }
+  iterator end() { return iterator(nullptr, this); }
 
   const_iterator begin() const
   {
@@ -364,7 +364,7 @@ public:
     return end();
   }
 
-  const_iterator end() const { return const_iterator(0, this); }
+  const_iterator end() const { return const_iterator(nullptr, this); }
 
   friend bool operator==<>(const hashtable&, const hashtable&);
 
@@ -510,7 +510,7 @@ private:
   {
     const size_type __n_buckets = _M_next_size(__n);
     _M_buckets.reserve(__n_buckets);
-    _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*)0);
+    _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*)nullptr);
     _M_num_elements = 0;
   }
 
@@ -544,7 +544,7 @@ private:
   _Node* _M_new_node(const value_type& __obj)
   {
     _Node* __n = _M_get_node();
-    __n->_M_next = 0;
+    __n->_M_next = nullptr;
     try {
       construct(&__n->_M_val, __obj);
       return __n;
@@ -839,9 +839,9 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::erase(iterator __first,
   else if (__f_bucket == __l_bucket)
     _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur);
   else {
-    _M_erase_bucket(__f_bucket, __first._M_cur, 0);
+    _M_erase_bucket(__f_bucket, __first._M_cur, nullptr);
     for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n)
-      _M_erase_bucket(__n, 0);
+      _M_erase_bucket(__n, nullptr);
     if (__l_bucket != _M_buckets.size())
       _M_erase_bucket(__l_bucket, __last._M_cur);
   }
@@ -873,7 +873,8 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::resize(
   if (__num_elements_hint > __old_n) {
     const size_type __n = _M_next_size(__num_elements_hint);
     if (__n > __old_n) {
-      _M_buckets_type __tmp(__n, (_Node*)(0), _M_buckets.get_allocator());
+      _M_buckets_type __tmp(__n, (_Node*)(nullptr),
+                            _M_buckets.get_allocator());
       try {
         for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) {
           _Node* __first = _M_buckets[__bucket];
@@ -940,12 +941,12 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::clear()
 {
   for (size_type __i = 0; __i < _M_buckets.size(); ++__i) {
     _Node* __cur = _M_buckets[__i];
-    while (__cur != 0) {
+    while (__cur != nullptr) {
       _Node* __next = __cur->_M_next;
       _M_delete_node(__cur);
       __cur = __next;
     }
-    _M_buckets[__i] = 0;
+    _M_buckets[__i] = nullptr;
   }
   _M_num_elements = 0;
 }
@@ -956,7 +957,7 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_M_copy_from(
 {
   _M_buckets.clear();
   _M_buckets.reserve(__ht._M_buckets.size());
-  _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*)0);
+  _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*)nullptr);
   try {
     for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {
       const _Node* __cur = __ht._M_buckets[__i];
diff --git a/testCommandLineArguments.cxx b/testCommandLineArguments.cxx
index 15f9c02..1778a9b 100644
--- a/testCommandLineArguments.cxx
+++ b/testCommandLineArguments.cxx
@@ -76,7 +76,7 @@ int testCommandLineArguments(int argc, char* argv[])
 
   int some_int_variable = 10;
   double some_double_variable = 10.10;
-  char* some_string_variable = KWSYS_NULLPTR;
+  char* some_string_variable = nullptr;
   std::string some_stl_string_variable;
   bool some_bool_variable = false;
   bool some_bool_variable1 = false;
@@ -203,7 +203,7 @@ int testCommandLineArguments(int argc, char* argv[])
 
   for (cc = 0; cc < strings_argument.size(); ++cc) {
     delete[] strings_argument[cc];
-    strings_argument[cc] = KWSYS_NULLPTR;
+    strings_argument[cc] = nullptr;
   }
   return res;
 }
diff --git a/testCommandLineArguments1.cxx b/testCommandLineArguments1.cxx
index 9895008..64561b1 100644
--- a/testCommandLineArguments1.cxx
+++ b/testCommandLineArguments1.cxx
@@ -21,7 +21,7 @@ int testCommandLineArguments1(int argc, char* argv[])
   arg.Initialize(argc, argv);
 
   int n = 0;
-  char* m = KWSYS_NULLPTR;
+  char* m = nullptr;
   std::string p;
   int res = 0;
 
@@ -55,11 +55,11 @@ int testCommandLineArguments1(int argc, char* argv[])
     delete[] m;
   }
 
-  char** newArgv = KWSYS_NULLPTR;
+  char** newArgv = nullptr;
   int newArgc = 0;
   arg.GetUnusedArguments(&newArgc, &newArgv);
   int cc;
-  const char* valid_unused_args[9] = { KWSYS_NULLPTR,
+  const char* valid_unused_args[9] = { nullptr,
                                        "--ignored",
                                        "--second-ignored",
                                        "third-ignored",
diff --git a/testConsoleBuf.cxx b/testConsoleBuf.cxx
index b6ad118..4b7ddf0 100644
--- a/testConsoleBuf.cxx
+++ b/testConsoleBuf.cxx
@@ -51,7 +51,7 @@ static void displayError(DWORD errorCode)
   LPWSTR message;
   if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                        FORMAT_MESSAGE_FROM_SYSTEM,
-                     NULL, errorCode, 0, (LPWSTR)&message, 0, NULL)) {
+                     nullptr, errorCode, 0, (LPWSTR)&message, 0, nullptr)) {
     std::cerr << "Error message: " << kwsys::Encoding::ToNarrow(message)
               << std::endl;
     HeapFree(GetProcessHeap(), 0, message);
@@ -124,7 +124,7 @@ static bool createProcess(HANDLE hIn, HANDLE hOut, HANDLE hErr)
   }
 
   WCHAR cmd[MAX_PATH];
-  if (GetModuleFileNameW(NULL, cmd, MAX_PATH) == 0) {
+  if (GetModuleFileNameW(nullptr, cmd, MAX_PATH) == 0) {
     std::cerr << "GetModuleFileName failed!" << std::endl;
     return false;
   }
@@ -136,14 +136,14 @@ static bool createProcess(HANDLE hIn, HANDLE hOut, HANDLE hErr)
   wcscat(cmd, L".exe");
 
   bool success =
-    CreateProcessW(NULL,            // No module name (use command line)
+    CreateProcessW(nullptr,         // No module name (use command line)
                    cmd,             // Command line
-                   NULL,            // Process handle not inheritable
-                   NULL,            // Thread handle not inheritable
+                   nullptr,         // Process handle not inheritable
+                   nullptr,         // Thread handle not inheritable
                    bInheritHandles, // Set handle inheritance
                    dwCreationFlags,
-                   NULL,         // Use parent's environment block
-                   NULL,         // Use parent's starting directory
+                   nullptr,      // Use parent's environment block
+                   nullptr,      // Use parent's starting directory
                    &startupInfo, // Pointer to STARTUPINFO structure
                    &processInfo) !=
     0; // Pointer to PROCESS_INFORMATION structure
@@ -174,7 +174,7 @@ static bool createPipe(PHANDLE readPipe, PHANDLE writePipe)
   SECURITY_ATTRIBUTES securityAttributes;
   securityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
   securityAttributes.bInheritHandle = TRUE;
-  securityAttributes.lpSecurityDescriptor = NULL;
+  securityAttributes.lpSecurityDescriptor = nullptr;
   return CreatePipe(readPipe, writePipe, &securityAttributes, 0) == 0 ? false
                                                                       : true;
 }
@@ -194,7 +194,7 @@ static HANDLE createFile(LPCWSTR fileName)
   SECURITY_ATTRIBUTES securityAttributes;
   securityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
   securityAttributes.bInheritHandle = TRUE;
-  securityAttributes.lpSecurityDescriptor = NULL;
+  securityAttributes.lpSecurityDescriptor = nullptr;
 
   HANDLE file =
     CreateFileW(fileName, GENERIC_READ | GENERIC_WRITE,
@@ -202,7 +202,7 @@ static HANDLE createFile(LPCWSTR fileName)
                 &securityAttributes,
                 CREATE_ALWAYS, // overwrite existing
                 FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE,
-                NULL); // no template
+                nullptr); // no template
   if (file == INVALID_HANDLE_VALUE) {
     DWORD lastError = GetLastError();
     std::cerr << "CreateFile(" << kwsys::Encoding::ToNarrow(fileName) << ")"
@@ -288,7 +288,7 @@ static int testPipe()
     DWORD bytesWritten = 0;
     if (!WriteFile(inPipeWrite, encodedInputTestString.c_str(),
                    (DWORD)encodedInputTestString.size(), &bytesWritten,
-                   NULL) ||
+                   nullptr) ||
         bytesWritten == 0) {
       throw std::runtime_error("WriteFile failed!");
     }
@@ -305,7 +305,8 @@ static int testPipe()
           throw std::runtime_error("WaitForSingleObject failed!");
         }
         DWORD bytesRead = 0;
-        if (!ReadFile(outPipeRead, buffer, sizeof(buffer), &bytesRead, NULL) ||
+        if (!ReadFile(outPipeRead, buffer, sizeof(buffer), &bytesRead,
+                      nullptr) ||
             bytesRead == 0) {
           throw std::runtime_error("ReadFile#1 failed!");
         }
@@ -313,7 +314,7 @@ static int testPipe()
         if ((bytesRead <
                encodedTestString.size() + 1 + encodedInputTestString.size() &&
              !ReadFile(outPipeRead, buffer + bytesRead,
-                       sizeof(buffer) - bytesRead, &bytesRead, NULL)) ||
+                       sizeof(buffer) - bytesRead, &bytesRead, nullptr)) ||
             bytesRead == 0) {
           throw std::runtime_error("ReadFile#2 failed!");
         }
@@ -324,7 +325,7 @@ static int testPipe()
                    encodedInputTestString.size()) == 0) {
           bytesRead = 0;
           if (!ReadFile(errPipeRead, buffer2, sizeof(buffer2), &bytesRead,
-                        NULL) ||
+                        nullptr) ||
               bytesRead == 0) {
             throw std::runtime_error("ReadFile#3 failed!");
           }
@@ -383,13 +384,13 @@ static int testFile()
     char buffer2[200];
 
     int length;
-    if ((length =
-           WideCharToMultiByte(TestCodepage, 0, UnicodeInputTestString, -1,
-                               buffer, sizeof(buffer), NULL, NULL)) == 0) {
+    if ((length = WideCharToMultiByte(TestCodepage, 0, UnicodeInputTestString,
+                                      -1, buffer, sizeof(buffer), nullptr,
+                                      nullptr)) == 0) {
       throw std::runtime_error("WideCharToMultiByte failed!");
     }
     buffer[length - 1] = '\n';
-    if (!WriteFile(inFile, buffer, length, &bytesWritten, NULL) ||
+    if (!WriteFile(inFile, buffer, length, &bytesWritten, nullptr) ||
         bytesWritten == 0) {
       throw std::runtime_error("WriteFile failed!");
     }
@@ -413,7 +414,7 @@ static int testFile()
             INVALID_SET_FILE_POINTER) {
           throw std::runtime_error("SetFilePointer#1 failed!");
         }
-        if (!ReadFile(outFile, buffer, sizeof(buffer), &bytesRead, NULL) ||
+        if (!ReadFile(outFile, buffer, sizeof(buffer), &bytesRead, nullptr) ||
             bytesRead == 0) {
           throw std::runtime_error("ReadFile#1 failed!");
         }
@@ -429,7 +430,8 @@ static int testFile()
             throw std::runtime_error("SetFilePointer#2 failed!");
           }
 
-          if (!ReadFile(errFile, buffer2, sizeof(buffer2), &bytesRead, NULL) ||
+          if (!ReadFile(errFile, buffer2, sizeof(buffer2), &bytesRead,
+                        nullptr) ||
               bytesRead == 0) {
             throw std::runtime_error("ReadFile#2 failed!");
           }
@@ -519,12 +521,12 @@ static int testConsole()
     if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Console", 0, KEY_READ | KEY_WRITE,
                       &hConsoleKey) == ERROR_SUCCESS) {
       DWORD dwordSize = sizeof(DWORD);
-      if (RegQueryValueExW(hConsoleKey, L"FontFamily", NULL, NULL,
+      if (RegQueryValueExW(hConsoleKey, L"FontFamily", nullptr, nullptr,
                            (LPBYTE)&FontFamily, &dwordSize) == ERROR_SUCCESS) {
         if (FontFamily != TestFontFamily) {
-          RegQueryValueExW(hConsoleKey, L"FaceName", NULL, NULL,
+          RegQueryValueExW(hConsoleKey, L"FaceName", nullptr, nullptr,
                            (LPBYTE)FaceName, &FaceNameSize);
-          RegQueryValueExW(hConsoleKey, L"FontSize", NULL, NULL,
+          RegQueryValueExW(hConsoleKey, L"FontSize", nullptr, nullptr,
                            (LPBYTE)&FontSize, &dwordSize);
 
           RegSetValueExW(hConsoleKey, L"FontFamily", 0, REG_DWORD,
@@ -557,10 +559,10 @@ static int testConsole()
     SECURITY_ATTRIBUTES securityAttributes;
     securityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
     securityAttributes.bInheritHandle = TRUE;
-    securityAttributes.lpSecurityDescriptor = NULL;
+    securityAttributes.lpSecurityDescriptor = nullptr;
     hIn = CreateFileW(L"CONIN$", GENERIC_READ | GENERIC_WRITE,
                       FILE_SHARE_READ | FILE_SHARE_WRITE, &securityAttributes,
-                      OPEN_EXISTING, 0, NULL);
+                      OPEN_EXISTING, 0, nullptr);
     if (hIn == INVALID_HANDLE_VALUE) {
       DWORD lastError = GetLastError();
       std::cerr << "CreateFile(CONIN$)" << std::endl;
@@ -568,7 +570,7 @@ static int testConsole()
     }
     hOut = CreateFileW(L"CONOUT$", GENERIC_READ | GENERIC_WRITE,
                        FILE_SHARE_READ | FILE_SHARE_WRITE, &securityAttributes,
-                       OPEN_EXISTING, 0, NULL);
+                       OPEN_EXISTING, 0, nullptr);
     if (hOut == INVALID_HANDLE_VALUE) {
       DWORD lastError = GetLastError();
       std::cerr << "CreateFile(CONOUT$)" << std::endl;
@@ -630,7 +632,7 @@ static int testConsole()
   }
 #  endif
 
-  if (createProcess(NULL, NULL, NULL)) {
+  if (createProcess(nullptr, nullptr, nullptr)) {
     try {
       DWORD status;
       if ((status = WaitForSingleObject(beforeInputEvent, waitTimeout)) !=
@@ -746,7 +748,7 @@ int testConsoleBuf(int, char* [])
   int ret = 0;
 
 #if defined(_WIN32)
-  beforeInputEvent = CreateEventW(NULL,
+  beforeInputEvent = CreateEventW(nullptr,
                                   FALSE, // auto-reset event
                                   FALSE, // initial state is nonsignaled
                                   BeforeInputEventName); // object name
@@ -755,7 +757,7 @@ int testConsoleBuf(int, char* [])
     return 1;
   }
 
-  afterOutputEvent = CreateEventW(NULL, FALSE, FALSE, AfterOutputEventName);
+  afterOutputEvent = CreateEventW(nullptr, FALSE, FALSE, AfterOutputEventName);
   if (!afterOutputEvent) {
     std::cerr << "CreateEvent#2 failed " << GetLastError() << std::endl;
     return 1;
diff --git a/testDynamicLoader.cxx b/testDynamicLoader.cxx
index eff2ed7..2421ac0 100644
--- a/testDynamicLoader.cxx
+++ b/testDynamicLoader.cxx
@@ -21,7 +21,7 @@
 // left on disk.
 #include <testSystemTools.h>
 
-static std::string GetLibName(const char* lname, const char* subdir = NULL)
+static std::string GetLibName(const char* lname, const char* subdir = nullptr)
 {
   // Construct proper name of lib
   std::string slname;
diff --git a/testEncoding.cxx b/testEncoding.cxx
index fdad1cd..988697b 100644
--- a/testEncoding.cxx
+++ b/testEncoding.cxx
@@ -84,7 +84,7 @@ static int testRobustEncoding()
   // this conversion could fail
   std::wstring wstr = kwsys::Encoding::ToWide(cstr);
 
-  wstr = kwsys::Encoding::ToWide(KWSYS_NULLPTR);
+  wstr = kwsys::Encoding::ToWide(nullptr);
   if (wstr != L"") {
     const wchar_t* wcstr = wstr.c_str();
     std::cout << "ToWide(NULL) returned";
@@ -112,7 +112,7 @@ static int testRobustEncoding()
   std::string win_str = kwsys::Encoding::ToNarrow(cwstr);
 #endif
 
-  std::string str = kwsys::Encoding::ToNarrow(KWSYS_NULLPTR);
+  std::string str = kwsys::Encoding::ToNarrow(nullptr);
   if (str != "") {
     std::cout << "ToNarrow(NULL) returned " << str << std::endl;
     ret++;
diff --git a/testProcess.c b/testProcess.c
index f139f58..39aaa23 100644
--- a/testProcess.c
+++ b/testProcess.c
@@ -477,7 +477,7 @@ static int runChild2(kwsysProcess* kp, const char* cmd[], int state,
       printf("Error in administrating child process: [%s]\n",
              kwsysProcess_GetErrorString(kp));
       break;
-  };
+  }
 
   if (result) {
     if (exception != kwsysProcess_GetExitException(kp)) {
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index 88277de..1f3a15b 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -52,7 +52,7 @@ static const char* toUnixPaths[][2] = {
   { "\\\\usr\\local\\bin\\passwd", "//usr/local/bin/passwd" },
   { "\\\\usr\\lo cal\\bin\\pa sswd", "//usr/lo cal/bin/pa sswd" },
   { "\\\\usr\\lo\\ cal\\bin\\pa\\ sswd", "//usr/lo/ cal/bin/pa/ sswd" },
-  { KWSYS_NULLPTR, KWSYS_NULLPTR }
+  { nullptr, nullptr }
 };
 
 static bool CheckConvertToUnixSlashes(std::string const& input,
@@ -71,7 +71,7 @@ static bool CheckConvertToUnixSlashes(std::string const& input,
 static const char* checkEscapeChars[][4] = {
   { "1 foo 2 bar 2", "12", "\\", "\\1 foo \\2 bar \\2" },
   { " {} ", "{}", "#", " #{#} " },
-  { KWSYS_NULLPTR, KWSYS_NULLPTR, KWSYS_NULLPTR, KWSYS_NULLPTR }
+  { nullptr, nullptr, nullptr, nullptr }
 };
 
 static bool CheckEscapeChars(std::string const& input,
@@ -160,7 +160,7 @@ static bool CheckFileOperations()
     res = false;
   }
   // calling with 0 pointer should return false
-  if (kwsys::SystemTools::MakeDirectory(KWSYS_NULLPTR)) {
+  if (kwsys::SystemTools::MakeDirectory(nullptr)) {
     std::cerr << "Problem with MakeDirectory(0)" << std::endl;
     res = false;
   }
@@ -218,11 +218,11 @@ static bool CheckFileOperations()
   }
 
   // calling with 0 pointer should return false
-  if (kwsys::SystemTools::FileExists(KWSYS_NULLPTR)) {
+  if (kwsys::SystemTools::FileExists(nullptr)) {
     std::cerr << "Problem with FileExists(0)" << std::endl;
     res = false;
   }
-  if (kwsys::SystemTools::FileExists(KWSYS_NULLPTR, true)) {
+  if (kwsys::SystemTools::FileExists(nullptr, true)) {
     std::cerr << "Problem with FileExists(0) as file" << std::endl;
     res = false;
   }

-----------------------------------------------------------------------

Summary of changes:
 Help/manual/cmake.1.rst                    |  18 +-
 Source/kwsys/CommandLineArguments.cxx      |  22 +--
 Source/kwsys/Configure.hxx.in              |   1 -
 Source/kwsys/ConsoleBuf.hxx.in             |  18 +-
 Source/kwsys/Directory.cxx                 |   2 +-
 Source/kwsys/DynamicLoader.cxx             |  20 +--
 Source/kwsys/EncodingCXX.cxx               |  25 +--
 Source/kwsys/Glob.cxx                      |   2 +-
 Source/kwsys/Glob.hxx.in                   |   2 +-
 Source/kwsys/RegularExpression.cxx         | 122 +++++++------
 Source/kwsys/RegularExpression.hxx.in      |  37 ++--
 Source/kwsys/SystemInformation.cxx         | 208 ++++++++++-------------
 Source/kwsys/SystemInformation.hxx.in      |  10 +-
 Source/kwsys/SystemTools.cxx               |  76 ++++-----
 Source/kwsys/SystemTools.hxx.in            |  24 +--
 Source/kwsys/hashtable.hxx.in              |  21 +--
 Source/kwsys/testCommandLineArguments.cxx  |   4 +-
 Source/kwsys/testCommandLineArguments1.cxx |   6 +-
 Source/kwsys/testConsoleBuf.cxx            |  60 +++----
 Source/kwsys/testDynamicLoader.cxx         |   2 +-
 Source/kwsys/testEncoding.cxx              |   4 +-
 Source/kwsys/testProcess.c                 |   2 +-
 Source/kwsys/testSystemTools.cxx           |  10 +-
 Templates/TestDriver.cxx.in                |  20 ++-
 Tests/Plugin/CMakeLists.txt                |  12 +-
 Tests/Plugin/include/DynamicLoader.hxx     |  49 ++++++
 Tests/Plugin/src/DynamicLoader.cxx         | 263 +++++++++++++++++++++++++++++
 Tests/Plugin/src/example_exe.cxx           |  17 +-
 Tests/Plugin/src/example_exe.h.in          |   2 +
 29 files changed, 676 insertions(+), 383 deletions(-)
 create mode 100644 Tests/Plugin/include/DynamicLoader.hxx
 create mode 100644 Tests/Plugin/src/DynamicLoader.cxx


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list