From 992e6d7c5dd3a8cdf330bea9cc988d8974f5e3d5 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Thu, 25 Nov 2021 20:17:10 +0100 Subject: mingw: fix calling convention for strftime() `strftime` uses `__cdecl` and not `__stdcall`. This was exposed by refactoring in commit 26c9fbab46 (MINGW-w64: Fix string(TIMESTAMP) build on 32bits, 2021-11-16, v3.22.0~1^2). This fixes a crash creating a timestamp with clang+mingw-w64 targeting x86. Fixes: #22939 --- Source/cmTimestamp.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index c8f5a4b..3826577 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -197,7 +197,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag, #ifdef __MINGW32__ /* See a bug in MinGW: https://sourceforge.net/p/mingw-w64/bugs/793/. A work * around is to try to use strftime() from ucrtbase.dll. */ - using T = size_t(WINAPI*)(char*, size_t, const char*, const struct tm*); + using T = size_t(__cdecl*)(char*, size_t, const char*, const struct tm*); auto loadUcrtStrftime = []() -> T { auto handle = LoadLibraryExA("ucrtbase.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); -- cgit v0.12