Skip to content

Commit

Permalink
Merge branch 'upstream-KWSys' into update-kwsys
Browse files Browse the repository at this point in the history
* upstream-KWSys:
  KWSys 2024-11-23 (3e9b0b88)
  • Loading branch information
vicentebolea committed Dec 6, 2024
2 parents 15d25a4 + cc7d2db commit b3de92e
Show file tree
Hide file tree
Showing 16 changed files with 322 additions and 505 deletions.
54 changes: 22 additions & 32 deletions thirdparty/KWSys/adios2sys/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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})
Expand All @@ -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})
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -712,7 +696,7 @@ 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)
Expand All @@ -727,7 +711,7 @@ 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)
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand All @@ -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 "")
Expand All @@ -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()

Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/KWSys/adios2sys/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 8 additions & 8 deletions thirdparty/KWSys/adios2sys/CommandLineArguments.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down Expand Up @@ -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()) {
Expand All @@ -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);
Expand All @@ -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:
Expand All @@ -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) {
Expand Down
5 changes: 0 additions & 5 deletions thirdparty/KWSys/adios2sys/Configure.hxx.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Up @@ -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__)
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/KWSys/adios2sys/MD5.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/KWSys/adios2sys/ProcessUNIX.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions thirdparty/KWSys/adios2sys/ProcessWin32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit b3de92e

Please sign in to comment.