Skip to content

Commit

Permalink
Merge pull request #4412 from vicentebolea/update-kwsys
Browse files Browse the repository at this point in the history
thirdparty: Update kwsys
  • Loading branch information
vicentebolea authored Jan 8, 2025
2 parents f80ad82 + 30f822e commit 1253523
Showing 17 changed files with 326 additions and 509 deletions.
60 changes: 25 additions & 35 deletions thirdparty/KWSys/adios2sys/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -298,14 +298,6 @@ endif()
set(KWSYS_HEADER_INSTALL_DIR)
set(KWSYS_LIBRARY_INSTALL_DIR)

# Generated source files will need this header.
string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}"
KWSYS_IN_SOURCE_BUILD)
if(NOT KWSYS_IN_SOURCE_BUILD)
configure_file(${PROJECT_SOURCE_DIR}/kwsysPrivate.h
${PROJECT_BINARY_DIR}/kwsysPrivate.h COPYONLY IMMEDIATE)
endif()

# Select plugin module file name convention.
if(NOT KWSYS_DynamicLoader_PREFIX)
set(KWSYS_DynamicLoader_PREFIX ${CMAKE_SHARED_MODULE_PREFIX})
@@ -418,14 +410,6 @@ if(KWSYS_USE_DynamicLoader)
endif()

if(KWSYS_USE_SystemTools)
if (NOT DEFINED KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP)
set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 1)
endif ()
if (KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP)
set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 1)
else ()
set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 0)
endif ()
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_SETENV
"Checking whether CXX compiler has setenv" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_UNSETENV
@@ -634,7 +618,7 @@ set(cppclasses
Directory DynamicLoader Encoding Glob RegularExpression SystemTools
CommandLineArguments FStream SystemInformation ConsoleBuf Status
)
foreach(cpp ${cppclasses})
foreach(cpp IN LISTS cppclasses)
if(KWSYS_USE_${cpp})
# Use the corresponding class.
set(KWSYS_CLASSES ${KWSYS_CLASSES} ${cpp})
@@ -647,7 +631,7 @@ foreach(cpp ${cppclasses})
endforeach()

# Add selected C components.
foreach(c
foreach(c IN ITEMS
Process Base64 Encoding MD5 Terminal System String
)
if(KWSYS_USE_${c})
@@ -679,7 +663,7 @@ if(KWSYS_USE_Process)
endif()

# Add selected C sources.
foreach(c Base64 Encoding MD5 Terminal System String)
foreach(c IN ITEMS Base64 Encoding MD5 Terminal System String)
if(KWSYS_USE_${c})
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${c}C.c)
list(APPEND KWSYS_C_SRCS ${c}C.c)
@@ -690,7 +674,7 @@ foreach(c Base64 Encoding MD5 Terminal System String)
endforeach()

# Configure headers of C++ classes and construct the list of sources.
foreach(c ${KWSYS_CLASSES})
foreach(c IN LISTS KWSYS_CLASSES)
# Add this source to the list of source files for the library.
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${c}CXX.cxx)
list(APPEND KWSYS_CXX_SRCS ${c}CXX.cxx)
@@ -700,7 +684,7 @@ foreach(c ${KWSYS_CLASSES})

# Configure the header for this class.
configure_file(${PROJECT_SOURCE_DIR}/${c}.hxx.in ${KWSYS_HEADER_DIR}/${c}.hxx
@ONLY IMMEDIATE)
@ONLY)
set(KWSYS_CXX_SRCS ${KWSYS_CXX_SRCS} ${KWSYS_HEADER_DIR}/${c}.hxx)

# Create an install target for the header.
@@ -712,10 +696,10 @@ foreach(c ${KWSYS_CLASSES})
endforeach()

# Configure C headers.
foreach(h ${KWSYS_H_FILES})
foreach(h IN LISTS KWSYS_H_FILES)
# Configure the header into the given directory.
configure_file(${PROJECT_SOURCE_DIR}/${h}.h.in ${KWSYS_HEADER_DIR}/${h}.h
@ONLY IMMEDIATE)
@ONLY)
set(KWSYS_C_SRCS ${KWSYS_C_SRCS} ${KWSYS_HEADER_DIR}/${h}.h)

# Create an install target for the header.
@@ -727,10 +711,10 @@ foreach(h ${KWSYS_H_FILES})
endforeach()

# Configure other C++ headers.
foreach(h ${KWSYS_HXX_FILES})
foreach(h IN LISTS KWSYS_HXX_FILES)
# Configure the header into the given directory.
configure_file(${PROJECT_SOURCE_DIR}/${h}.hxx.in ${KWSYS_HEADER_DIR}/${h}.hxx
@ONLY IMMEDIATE)
@ONLY)
set(KWSYS_CXX_SRCS ${KWSYS_CXX_SRCS} ${KWSYS_HEADER_DIR}/${h}.hxx)

# Create an install target for the header.
@@ -956,9 +940,11 @@ if(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
add_executable(${KWSYS_NAMESPACE}TestsC ${KWSYS_C_TEST_SRCS})
set_property(TARGET ${KWSYS_NAMESPACE}TestsC PROPERTY LABELS ${KWSYS_LABELS_EXE})
target_link_libraries(${KWSYS_NAMESPACE}TestsC ${KWSYS_TARGET_C_LINK})
foreach(testfile ${KWSYS_C_TESTS})
foreach(testfile IN LISTS KWSYS_C_TESTS)
get_filename_component(test "${testfile}" NAME_WE)
add_test(kwsys.${test} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestsC ${test} ${KWSYS_TEST_ARGS_${test}})
add_test(NAME kwsys.${test}
COMMAND ${EXEC_DIR}/${KWSYS_NAMESPACE}TestsC ${test} ${KWSYS_TEST_ARGS_${test}}
)
set_property(TEST kwsys.${test} PROPERTY LABELS ${KWSYS_LABELS_TEST})
endforeach()

@@ -1080,9 +1066,11 @@ if(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
-p
some junk at the end
)
foreach(testfile ${KWSYS_CXX_TESTS})
foreach(testfile IN LISTS KWSYS_CXX_TESTS)
get_filename_component(test "${testfile}" NAME_WE)
add_test(kwsys.${test} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestsCxx ${test} ${KWSYS_TEST_ARGS_${test}})
add_test(NAME kwsys.${test}
COMMAND ${EXEC_DIR}/${KWSYS_NAMESPACE}TestsCxx ${test} ${KWSYS_TEST_ARGS_${test}}
)
set_property(TEST kwsys.${test} PROPERTY LABELS ${KWSYS_LABELS_TEST})
endforeach()

@@ -1091,10 +1079,12 @@ if(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
set_property(TARGET ${KWSYS_NAMESPACE}TestProcess PROPERTY LABELS ${KWSYS_LABELS_EXE})
target_link_libraries(${KWSYS_NAMESPACE}TestProcess ${KWSYS_TARGET_C_LINK})
#set(KWSYS_TEST_PROCESS_7 7) # uncomment to run timing-sensitive test locally
foreach(n 1 2 3 4 5 6 ${KWSYS_TEST_PROCESS_7} 9 10)
add_test(kwsys.testProcess-${n} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestProcess ${n})
foreach(n IN ITEMS 1 2 3 4 5 6 ${KWSYS_TEST_PROCESS_7} 9 10)
add_test(NAME kwsys.testProcess-${n}
COMMAND ${EXEC_DIR}/${KWSYS_NAMESPACE}TestProcess ${n}
)
set_property(TEST kwsys.testProcess-${n} PROPERTY LABELS ${KWSYS_LABELS_TEST})
set_tests_properties(kwsys.testProcess-${n} PROPERTIES TIMEOUT 120)
set_property(TEST kwsys.testProcess-${n} PROPERTY TIMEOUT 120)
endforeach()

set(testProcess_COMPILE_FLAGS "")
@@ -1121,9 +1111,9 @@ if(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
# Configure some test properties.
if(KWSYS_STANDALONE)
# We expect test to fail
set_tests_properties(kwsys.testFail PROPERTIES WILL_FAIL ON)
set_property(TEST kwsys.testFail PROPERTY WILL_FAIL ON)
get_test_property(kwsys.testFail WILL_FAIL wfv)
set_tests_properties(kwsys.testFail PROPERTIES MEASUREMENT "Some Key=Some Value")
set_property(TEST kwsys.testFail PROPERTY MEASUREMENT "Some Key=Some Value")
message(STATUS "GET_TEST_PROPERTY returned: ${wfv}")
endif()

@@ -1133,7 +1123,7 @@ if(KWSYS_STANDALONE OR CMake_SOURCE_DIR)

# Suppress known consistent failures on buggy systems.
if(KWSYS_TEST_BOGUS_FAILURES)
set_tests_properties(${KWSYS_TEST_BOGUS_FAILURES} PROPERTIES WILL_FAIL ON)
set_property(TEST ${KWSYS_TEST_BOGUS_FAILURES} PROPERTY WILL_FAIL ON)
endif()

endif()
2 changes: 1 addition & 1 deletion thirdparty/KWSys/adios2sys/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ code. It automatically runs ``clang-format`` on the set of source files
for which we enforce style. The script also has options to format only
a subset of files, such as those that are locally modified.

.. _`clang-format`: http://clang.llvm.org/docs/ClangFormat.html
.. _`clang-format`: https://clang.llvm.org/docs/ClangFormat.html
.. _`.clang-format`: .clang-format
.. _`clang-format.bash`: clang-format.bash

16 changes: 8 additions & 8 deletions thirdparty/KWSys/adios2sys/CommandLineArguments.cxx
Original file line number Diff line number Diff line change
@@ -132,7 +132,7 @@ bool CommandLineArguments::GetMatchedArguments(

// Does the argument match to any we know about?
for (it = this->Internals->Callbacks.begin();
it != this->Internals->Callbacks.end(); it++) {
it != this->Internals->Callbacks.end(); ++it) {
const CommandLineArguments::Internal::String& parg = it->first;
CommandLineArgumentsCallbackStructure* cs = &it->second;
if (cs->ArgumentType == CommandLineArguments::NO_ARGUMENT ||
@@ -467,7 +467,7 @@ void CommandLineArguments::GenerateHelp()
MapArgs mp;
MapArgs::iterator mpit, smpit;
for (it = this->Internals->Callbacks.begin();
it != this->Internals->Callbacks.end(); it++) {
it != this->Internals->Callbacks.end(); ++it) {
CommandLineArgumentsCallbackStructure* cs = &(it->second);
mpit = mp.find(cs->Help);
if (mpit != mp.end()) {
@@ -478,14 +478,14 @@ void CommandLineArguments::GenerateHelp()
}
}
for (it = this->Internals->Callbacks.begin();
it != this->Internals->Callbacks.end(); it++) {
it != this->Internals->Callbacks.end(); ++it) {
CommandLineArgumentsCallbackStructure* cs = &(it->second);
mpit = mp.find(cs->Help);
if (mpit != mp.end()) {
mpit->second.insert(it->first);
smpit = mp.find(it->first);
CommandLineArguments::Internal::SetOfStrings::iterator sit;
for (sit = smpit->second.begin(); sit != smpit->second.end(); sit++) {
for (sit = smpit->second.begin(); sit != smpit->second.end(); ++sit) {
mpit->second.insert(*sit);
}
mp.erase(smpit);
@@ -496,9 +496,9 @@ void CommandLineArguments::GenerateHelp()

// Find the length of the longest string
CommandLineArguments::Internal::String::size_type maxlen = 0;
for (mpit = mp.begin(); mpit != mp.end(); mpit++) {
for (mpit = mp.begin(); mpit != mp.end(); ++mpit) {
CommandLineArguments::Internal::SetOfStrings::iterator sit;
for (sit = mpit->second.begin(); sit != mpit->second.end(); sit++) {
for (sit = mpit->second.begin(); sit != mpit->second.end(); ++sit) {
CommandLineArguments::Internal::String::size_type clen = sit->size();
switch (this->Internals->Callbacks[*sit].ArgumentType) {
case CommandLineArguments::NO_ARGUMENT:
@@ -524,9 +524,9 @@ void CommandLineArguments::GenerateHelp()
maxlen += 4; // For the space before and after the option

// Print help for each option
for (mpit = mp.begin(); mpit != mp.end(); mpit++) {
for (mpit = mp.begin(); mpit != mp.end(); ++mpit) {
CommandLineArguments::Internal::SetOfStrings::iterator sit;
for (sit = mpit->second.begin(); sit != mpit->second.end(); sit++) {
for (sit = mpit->second.begin(); sit != mpit->second.end(); ++sit) {
str << std::endl;
std::string argument = *sit;
switch (this->Internals->Callbacks[*sit].ArgumentType) {
5 changes: 0 additions & 5 deletions thirdparty/KWSys/adios2sys/Configure.hxx.in
Original file line number Diff line number Diff line change
@@ -11,9 +11,6 @@
/* Whether <ext/stdio_filebuf.h> is available. */
#define @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H \
@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@
/* Whether the translation map is available or not. */
#define @KWSYS_NAMESPACE@_SYSTEMTOOLS_USE_TRANSLATION_MAP \
@KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@

#if defined(__SUNPRO_CC) && __SUNPRO_CC > 0x5130 && defined(__has_attribute)
# define @KWSYS_NAMESPACE@_has_cpp_attribute(x) __has_attribute(x)
@@ -58,8 +55,6 @@
# define KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H \
@KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H
# define KWSYS_FALLTHROUGH @KWSYS_NAMESPACE@_FALLTHROUGH
# define KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP \
@KWSYS_NAMESPACE@_SYSTEMTOOLS_USE_TRANSLATION_MAP
#endif

#endif
10 changes: 5 additions & 5 deletions thirdparty/KWSys/adios2sys/Directory.cxx
Original file line number Diff line number Diff line change
@@ -269,7 +269,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
# include <string.h>

// PGI with glibc has trouble with dirent and large file support:
// http://www.pgroup.com/userforum/viewtopic.php?
// https://www.pgroup.com/userforum/viewtopic.php?
// p=1992&sid=f16167f51964f1a68fe5041b8eb213b6
// Work around the problem by mapping dirent the same way as readdir.
# if defined(__PGI) && defined(__GLIBC__)
@@ -292,7 +292,7 @@ Status Directory::Load(std::string const& name, std::string* errorMessage)
DIR* dir = opendir(name.c_str());

if (!dir) {
if (errorMessage != nullptr) {
if (errorMessage) {
*errorMessage = std::string(strerror(errno));
}
return Status::POSIX_errno();
@@ -303,7 +303,7 @@ Status Directory::Load(std::string const& name, std::string* errorMessage)
this->Internal->Files.emplace_back(d->d_name);
}
if (errno != 0) {
if (errorMessage != nullptr) {
if (errorMessage) {
*errorMessage = std::string(strerror(errno));
}
return Status::POSIX_errno();
@@ -321,7 +321,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
DIR* dir = opendir(name.c_str());

if (!dir) {
if (errorMessage != nullptr) {
if (errorMessage) {
*errorMessage = std::string(strerror(errno));
}
return 0;
@@ -332,7 +332,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
count++;
}
if (errno != 0) {
if (errorMessage != nullptr) {
if (errorMessage) {
*errorMessage = std::string(strerror(errno));
}
return false;
2 changes: 1 addition & 1 deletion thirdparty/KWSys/adios2sys/Glob.cxx
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
#include <cstdio>
#include <cstring>
namespace KWSYS_NAMESPACE {
#if defined(_WIN32) || defined(__APPLE__)
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__APPLE__)
// On Windows and Apple, no difference between lower and upper case
# define KWSYS_GLOB_CASE_INDEPENDENT
#endif
2 changes: 1 addition & 1 deletion thirdparty/KWSys/adios2sys/MD5.c
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@
This code implements the MD5 Algorithm defined in RFC 1321, whose
text is available at
http://www.ietf.org/rfc/rfc1321.txt
https://www.ietf.org/rfc/rfc1321.txt
The code is derived from the text of the RFC, including the test suite
(section A.5) but excluding the rest of Appendix A. It does not include
any code or documentation that is identified in the RFC as being
2 changes: 1 addition & 1 deletion thirdparty/KWSys/adios2sys/ProcessUNIX.c
Original file line number Diff line number Diff line change
@@ -2541,7 +2541,7 @@ static void kwsysProcessKill(pid_t process_id)
/* Kill all children if we can find them. */
#if defined(__linux__) || defined(__CYGWIN__)
/* First try using the /proc filesystem. */
if ((procdir = opendir("/proc")) != NULL) {
if ((procdir = opendir("/proc"))) {
# if defined(MAXPATHLEN)
char fname[MAXPATHLEN];
# elif defined(PATH_MAX)
4 changes: 2 additions & 2 deletions thirdparty/KWSys/adios2sys/ProcessWin32.c
Original file line number Diff line number Diff line change
@@ -666,14 +666,14 @@ int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
if (dir && dir[0]) {
wchar_t* wdir = kwsysEncoding_DupToWide(dir);
/* We must convert the working directory to a full path. */
DWORD length = GetFullPathNameW(wdir, 0, 0, 0);
DWORD length = GetFullPathNameW(wdir, 0, NULL, NULL);
if (length > 0) {
wchar_t* work_dir = malloc(length * sizeof(wchar_t));
if (!work_dir) {
free(wdir);
return 0;
}
if (!GetFullPathNameW(wdir, length, work_dir, 0)) {
if (!GetFullPathNameW(wdir, length, work_dir, NULL)) {
free(work_dir);
free(wdir);
return 0;
Loading

0 comments on commit 1253523

Please sign in to comment.