msvc: Fix some "unreferenced formal parameter" warnings Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
diff --git a/src/cc-compat.h b/src/cc-compat.h
index aefe66d..5071d53 100644
--- a/src/cc-compat.h
+++ b/src/cc-compat.h
@@ -40,6 +40,12 @@
# endif
#endif
+#if defined(_MSC_VER)
+#define GIT_UNUSED_ARG(x) ((void)(x)); /* note trailing ; */
+#else
+#define GIT_UNUSED_ARG(x)
+#endif
+
/*
* Does our compiler/platform support the C99 <inttypes.h> and
* <stdint.h> header files. (C99 requires that <inttypes.h>
diff --git a/src/fileops.h b/src/fileops.h
index c5c58a0..53495ca 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -15,12 +15,15 @@
#ifdef GIT_WIN32
GIT_INLINE(int) link(const char *GIT_UNUSED(old), const char *GIT_UNUSED(new))
{
+ GIT_UNUSED_ARG(old)
+ GIT_UNUSED_ARG(new)
errno = ENOSYS;
return -1;
}
GIT_INLINE(int) git__mkdir(const char *path, int GIT_UNUSED(mode))
{
+ GIT_UNUSED_ARG(mode)
return mkdir(path);
}
diff --git a/tests/t0020-dirent.c b/tests/t0020-dirent.c
index 334fff1..399b7d5 100644
--- a/tests/t0020-dirent.c
+++ b/tests/t0020-dirent.c
@@ -186,6 +186,8 @@ static walk_data empty = {
static int dont_call_me(void *GIT_UNUSED(state), char *GIT_UNUSED(path))
{
+ GIT_UNUSED_ARG(state)
+ GIT_UNUSED_ARG(path)
test_die("dont_call_me: unexpected callback!");
}