Merge branch 'upstream-KWSys' into ci-fedora-ninja-flags

# By KWSys Upstream
* upstream-KWSys:
  KWSys 2026-04-16 (ff373dff)
This commit is contained in:
Brad King
2026-04-16 09:23:53 -04:00
4 changed files with 33 additions and 23 deletions
+20 -18
View File
@@ -1706,16 +1706,17 @@ DWORD kwsysProcessCreate(kwsysProcess* cp, int index,
}
/* Create inherited copies of the handles. */
(error = kwsysProcessCreateChildHandle(&si->StartupInfo.hStdInput,
si->hStdInput, 1)) ||
(error = kwsysProcessCreateChildHandle(&si->StartupInfo.hStdOutput,
si->hStdOutput, 0)) ||
(error = kwsysProcessCreateChildHandle(&si->StartupInfo.hStdError,
si->hStdError, 0)) ||
/* Create the process. */
(!CreateProcessW(0, cp->Commands[index], 0, 0, TRUE, creationFlags, 0, 0,
&si->StartupInfo, &cp->ProcessInformation[index]) &&
(error = GetLastError()));
(void)((error = kwsysProcessCreateChildHandle(&si->StartupInfo.hStdInput,
si->hStdInput, 1)) ||
(error = kwsysProcessCreateChildHandle(&si->StartupInfo.hStdOutput,
si->hStdOutput, 0)) ||
(error = kwsysProcessCreateChildHandle(&si->StartupInfo.hStdError,
si->hStdError, 0)) ||
/* Create the process. */
(!CreateProcessW(0, cp->Commands[index], 0, 0, TRUE, creationFlags, 0,
0, &si->StartupInfo,
&cp->ProcessInformation[index]) &&
(error = GetLastError())));
/* Close the inherited copies of the handles. */
if (si->StartupInfo.hStdInput != si->hStdInput) {
@@ -2354,7 +2355,7 @@ static int kwsysProcess_List__New_NT4(kwsysProcess_List* self)
if (hNT) {
/* Get pointers to the needed API functions. */
self->P_ZwQuerySystemInformation =
((ZwQuerySystemInformationType)GetProcAddress(
((ZwQuerySystemInformationType)(void*)GetProcAddress(
hNT, "ZwQuerySystemInformation"));
}
if (!self->P_ZwQuerySystemInformation) {
@@ -2418,12 +2419,13 @@ static int kwsysProcess_List__Next_NT4(kwsysProcess_List* self)
static int kwsysProcess_List__GetProcessId_NT4(kwsysProcess_List* self)
{
return self->CurrentInfo ? self->CurrentInfo->ProcessId : -1;
return self->CurrentInfo ? (int)self->CurrentInfo->ProcessId : -1;
}
static int kwsysProcess_List__GetParentId_NT4(kwsysProcess_List* self)
{
return self->CurrentInfo ? self->CurrentInfo->InheritedFromProcessId : -1;
return self->CurrentInfo ? (int)self->CurrentInfo->InheritedFromProcessId
: -1;
}
static int kwsysProcess_List__New_Snapshot(kwsysProcess_List* self)
@@ -2435,12 +2437,12 @@ static int kwsysProcess_List__New_Snapshot(kwsysProcess_List* self)
HMODULE hKernel = GetModuleHandleW(L"kernel32.dll");
if (hKernel) {
self->P_CreateToolhelp32Snapshot =
((CreateToolhelp32SnapshotType)GetProcAddress(
((CreateToolhelp32SnapshotType)(void*)GetProcAddress(
hKernel, "CreateToolhelp32Snapshot"));
self->P_Process32First =
((Process32FirstType)GetProcAddress(hKernel, "Process32First"));
((Process32FirstType)(void*)GetProcAddress(hKernel, "Process32First"));
self->P_Process32Next =
((Process32NextType)GetProcAddress(hKernel, "Process32Next"));
((Process32NextType)(void*)GetProcAddress(hKernel, "Process32Next"));
}
return (self->P_CreateToolhelp32Snapshot && self->P_Process32First &&
self->P_Process32Next)
@@ -2488,12 +2490,12 @@ static int kwsysProcess_List__Next_Snapshot(kwsysProcess_List* self)
static int kwsysProcess_List__GetProcessId_Snapshot(kwsysProcess_List* self)
{
return self->Snapshot ? self->CurrentEntry.th32ProcessID : -1;
return self->Snapshot ? (int)self->CurrentEntry.th32ProcessID : -1;
}
static int kwsysProcess_List__GetParentId_Snapshot(kwsysProcess_List* self)
{
return self->Snapshot ? self->CurrentEntry.th32ParentProcessID : -1;
return self->Snapshot ? (int)self->CurrentEntry.th32ParentProcessID : -1;
}
static void kwsysProcessKill(DWORD pid)
+1 -1
View File
@@ -46,7 +46,7 @@ std::string Status::GetString() const
#ifdef _WIN32
case Kind::Windows: {
LPWSTR message = NULL;
DWORD size = FormatMessageW(
FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, this->Windows_, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+5 -4
View File
@@ -3919,8 +3919,8 @@ double SystemInformationImplementation::GetLoadAverage()
// Old windows.h headers do not provide GetSystemTimes.
using GetSystemTimesType = BOOL(WINAPI*)(LPFILETIME, LPFILETIME, LPFILETIME);
static GetSystemTimesType pGetSystemTimes =
(GetSystemTimesType)GetProcAddress(GetModuleHandleW(L"kernel32"),
"GetSystemTimes");
(GetSystemTimesType)(void*)GetProcAddress(GetModuleHandleW(L"kernel32"),
"GetSystemTimes");
FILETIME idleTime, kernelTime, userTime;
if (pGetSystemTimes && pGetSystemTimes(&idleTime, &kernelTime, &userTime)) {
unsigned __int64 const idleTicks = fileTimeToUInt64(idleTime);
@@ -4469,7 +4469,7 @@ void SystemInformationImplementation::CPUCountWindows()
using GetLogicalProcessorInformationType =
BOOL(WINAPI*)(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, PDWORD);
static GetLogicalProcessorInformationType pGetLogicalProcessorInformation =
reinterpret_cast<GetLogicalProcessorInformationType>(GetProcAddress(
reinterpret_cast<GetLogicalProcessorInformationType>((void*)GetProcAddress(
GetModuleHandleW(L"kernel32"), "GetLogicalProcessorInformation"));
if (!pGetLogicalProcessorInformation) {
@@ -5330,7 +5330,8 @@ bool SystemInformationImplementation::QueryOSInformation()
this->OSName = "Windows";
OSVERSIONINFOEXW osvi = { sizeof(osvi) };
OSVERSIONINFOEXW osvi = {};
osvi.dwOSVersionInfoSize = sizeof(osvi);
# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning(push)
# ifdef __INTEL_COMPILER
+7
View File
@@ -133,9 +133,16 @@ static int test4(int argc, char const* argv[])
#ifdef CRASH_USING_ABORT
abort();
#else
# if defined(__GNUC__) || defined(__clang__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Warray-bounds"
# endif
assert(invalidAddress); /* Quiet Clang scan-build. */
/* Provoke deliberate crash by writing to the invalid address. */
*invalidAddress = 0;
# if defined(__GNUC__) || defined(__clang__)
# pragma GCC diagnostic pop
# endif
#endif
fprintf(stdout, "Output after crash on stdout from crash test.\n");
fprintf(stderr, "Output after crash on stderr from crash test.\n");