The main motivation is to enable it for debug traces too, but for that we need !6852 merged first.
Clang is too strict about `%I` using the same type as `size_t`, which is `int` on 32-bit Windows targets. Ideally, it would be fixed in Clang, but we already have a hack for it in mingw mode, so I just extended it for now.
Changing type of `LONG_PTR` is pretty invasive, especially for C++ code (I'd expect it to break @rbernon's libc++ builds). We could probably guard it with `__cplusplus`. I restricted it even further with `__WINESRC__` under the assumption that external header users are less likely to care about this particular warning problem than about underlying type in general.
From: Jacek Caban jacek@codeweavers.com
--- dlls/msvcrt/tests/printf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcrt/tests/printf.c b/dlls/msvcrt/tests/printf.c index d221a590a59..dc0038b3372 100644 --- a/dlls/msvcrt/tests/printf.c +++ b/dlls/msvcrt/tests/printf.c @@ -459,10 +459,12 @@ static void test_snprintf (void) const int bufsiz = sizeof buffer; unsigned int i;
+ int (__cdecl *p_snprintf)(char*,size_t,const char*,...) = _snprintf; + for (i = 0; i < ARRAY_SIZE(tests); i++) { const char *fmt = tests[i].format; const int expect = tests[i].expected; - const int n = _snprintf (buffer, bufsiz, fmt); + const int n = p_snprintf(buffer, bufsiz, fmt); const int valid = n < 0 ? bufsiz : (n == bufsiz ? n : n+1);
ok (n == expect, ""%s": expected %d, returned %d\n",
From: Jacek Caban jacek@codeweavers.com
--- include/basetsd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/basetsd.h b/include/basetsd.h index bd47f15d295..84669125c6a 100644 --- a/include/basetsd.h +++ b/include/basetsd.h @@ -132,7 +132,7 @@ typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
typedef int INT_PTR, *PINT_PTR; typedef unsigned int UINT_PTR, *PUINT_PTR; -#if defined(__clang__) && defined(__MINGW32__) /* llvm-mingw warns about long type in %I formats */ +#if defined(__WINESRC__) && defined(__clang__) && defined(__MINGW32__) /* llvm-mingw warns about long type in %I formats */ typedef int LONG_PTR, *PLONG_PTR; typedef unsigned int ULONG_PTR, *PULONG_PTR; #else
From: Jacek Caban jacek@codeweavers.com
The problem is not specific to mingw mode. --- include/basetsd.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/basetsd.h b/include/basetsd.h index 84669125c6a..3f1f8557aa4 100644 --- a/include/basetsd.h +++ b/include/basetsd.h @@ -132,7 +132,8 @@ typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
typedef int INT_PTR, *PINT_PTR; typedef unsigned int UINT_PTR, *PUINT_PTR; -#if defined(__WINESRC__) && defined(__clang__) && defined(__MINGW32__) /* llvm-mingw warns about long type in %I formats */ +/* clang warns about long type in %I formats */ +#if defined(__WINESRC__) && defined(__clang__) && (defined(__MINGW32__) || defined(_MSC_VER)) typedef int LONG_PTR, *PLONG_PTR; typedef unsigned int ULONG_PTR, *PULONG_PTR; #else
From: Jacek Caban jacek@codeweavers.com
--- include/msvcrt/corecrt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index 65357a13403..8f6ed6ae6c6 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -314,7 +314,7 @@ typedef struct threadlocaleinfostruct { #define _THREADLOCALEINFO #endif
-#ifdef __MINGW32__ +#if defined(__MINGW32__) || (defined(_MSC_VER) && defined(__clang__)) #define __WINE_CRT_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args))) #define __WINE_CRT_SCANF_ATTR(fmt,args) __attribute__((format (scanf,fmt,args))) #else
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=149882
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: win.c:4070: Test failed: Expected active window 0000000004540168, got 0000000000000000. win.c:4071: Test failed: Expected focus window 0000000004540168, got 0000000000000000.
FWIW, build failure is just a timeout (a few commits touch very common headers, causing full rebuilds).