summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2021-06-28 17:30:45 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-28 17:32:22 (GMT)
commitbf4ae1c2b242e6a37034fac7efd86b0786130bfb (patch)
tree689fcff61ffa49c1f12f1fbd47eb6f9edebc4e08
parentfc5b7905ed8e2ddc45de1cabe0f9dbd8c1484dbb (diff)
downloadCMake-bf4ae1c2b242e6a37034fac7efd86b0786130bfb.zip
CMake-bf4ae1c2b242e6a37034fac7efd86b0786130bfb.tar.gz
CMake-bf4ae1c2b242e6a37034fac7efd86b0786130bfb.tar.bz2
KWSys 2021-06-28 (0648cb1a)
Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit 0648cb1ac5c91430b190f32319c528345b280dc3 (master). Upstream Shortlog ----------------- Ben Boeckel (2): df91e5f1 EncodingC: use NULL for pointers ab959cd2 SystemInformation: fix typo in comment Björn Esser (2): b4a2a03c testDynamicLoader: Use LIBDL_SO macro if defined. b954dd54 testDynamicLoader: Use LIBC_SO if LIBDL_SO is not defined by glibc anymore.
-rw-r--r--EncodingC.c2
-rw-r--r--SystemInformation.cxx2
-rw-r--r--testDynamicLoader.cxx23
3 files changed, 23 insertions, 4 deletions
diff --git a/EncodingC.c b/EncodingC.c
index e12236a..13127f1 100644
--- a/EncodingC.c
+++ b/EncodingC.c
@@ -60,7 +60,7 @@ size_t kwsysEncoding_wcstombs(char* dest, const wchar_t* str, size_t n)
char* kwsysEncoding_DupToNarrow(const wchar_t* str)
{
char* ret = NULL;
- size_t length = kwsysEncoding_wcstombs(0, str, 0) + 1;
+ size_t length = kwsysEncoding_wcstombs(NULL, str, 0) + 1;
if (length > 0) {
ret = (char*)malloc(length);
if (ret) {
diff --git a/SystemInformation.cxx b/SystemInformation.cxx
index 117ff8d..12f9139 100644
--- a/SystemInformation.cxx
+++ b/SystemInformation.cxx
@@ -1383,7 +1383,7 @@ void SymbolProperties::Initialize(void* address)
}
# else
// second fallback use builtin backtrace_symbols
-// to decode the bactrace.
+// to decode the backtrace.
# endif
}
#endif // don't define this class if we're not using it
diff --git a/testDynamicLoader.cxx b/testDynamicLoader.cxx
index 703ad4d..9ba204e 100644
--- a/testDynamicLoader.cxx
+++ b/testDynamicLoader.cxx
@@ -8,6 +8,25 @@
# include <be/kernel/OS.h> /* disable_debugger() API. */
#endif
+// Needed for __GLIBC__ test macro.
+#ifdef __linux__
+# include <features.h>
+#endif
+
+// Will define LIBDL_SO macro on systems with glibc.
+#ifdef __GLIBC__
+# include <gnu/lib-names.h>
+// Define to LIBC_SO, if not defined by above header.
+# ifndef LIBDL_SO
+# define LIBDL_SO LIBC_SO
+# endif
+#endif
+
+// Define the LIBDL_SO macro, if not defined above.
+#ifndef LIBDL_SO
+# define LIBDL_SO "libdl.so"
+#endif
+
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
@@ -107,8 +126,8 @@ int testDynamicLoader(int argc, char* argv[])
// This one is actually fun to test, since dlopen is by default
// loaded...wonder why :)
res += TestDynamicLoader("foobar.lib", "dlopen", 0, 1, 0);
- res += TestDynamicLoader("libdl.so", "dlopen", 1, 1, 1);
- res += TestDynamicLoader("libdl.so", "TestDynamicLoader", 1, 0, 1);
+ res += TestDynamicLoader(LIBDL_SO, "dlopen", 1, 1, 1);
+ res += TestDynamicLoader(LIBDL_SO, "TestDynamicLoader", 1, 0, 1);
#endif
// Now try on the generated library
std::string libname = GetLibName(KWSYS_NAMESPACE_STRING "TestDynload");