[PATCH 03/12] contrib/credential: fix compilation of wincred helper with MSVC
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Feb 18, 2025, 07:45 UTC
- Message-ID
- <20250218-b4-pks-meson-contrib-v1-3-c3edd292beb8@pks.im>
- In-Reply-To
- <20250218-b4-pks-meson-contrib-v1-0-c3edd292beb8@pks.im>
From: M Hickford <mirth.hickford@gmail.com>
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 <mirth.hickford@gmail.com> Signed-off-by: Patrick Steinhardt <ps@pks.im> --- contrib/credential/wincred/git-credential-wincred.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c index 4be0d58cd89..04145b51183 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];
-- 2.48.1.666.gff9fcf71b7.dirty