From: M Hickford Date: Tue, 18 Feb 2025 07:45:51 +0000 (+0100) Subject: contrib/credential: fix compilation of wincred helper with MSVC X-Git-Tag: v2.49.0-rc1~3^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f8d95a323a088d88b5db1dd1cb2d554ac73caa10;p=thirdparty%2Fgit.git contrib/credential: fix compilation of wincred helper with MSVC The git-credential-wincred helper does not compile on Windows with Microsoft Visual Studio because of our use of `__attribute__()`, which its compiler doesn't support. While the rest of our codebase would know to handle this because we redefine the macro in "compat/msvc.h", this stub isn't available here because we don't include "git-compat-util.h" in the first place. Fix the issue by making the attribute depend on the `_MSC_VER` preprocessor macro. Signed-off-by: M Hickford Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c index 4be0d58cd8..04145b5118 100644 --- a/contrib/credential/wincred/git-credential-wincred.c +++ b/contrib/credential/wincred/git-credential-wincred.c @@ -12,7 +12,9 @@ #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) +#ifndef _MSC_VER __attribute__((format (printf, 1, 2))) +#endif static void die(const char *err, ...) { char msg[4096];