Commit 2705576b by Russell Belfer

Simplify GIT_UNUSED macros

Since casting to void works to eliminate errors with unused
parameters on all platforms, avoid the various special cases.
Over time, it will make sense to eliminate the GIT_UNUSED
macro completely and just have GIT_UNUSED_ARG.
parent 3a5ad90a
...@@ -33,21 +33,8 @@ ...@@ -33,21 +33,8 @@
# define GIT_TYPEOF(x) # define GIT_TYPEOF(x)
#endif #endif
#ifdef __cplusplus #define GIT_UNUSED(x) x
# define GIT_UNUSED(x) #define GIT_UNUSED_ARG(x) ((void)(x))
#else
# ifdef __GNUC__
# define GIT_UNUSED(x) x __attribute__ ((__unused__))
# else
# define GIT_UNUSED(x) x
# endif
#endif
#if defined(_MSC_VER)
#define GIT_UNUSED_ARG(x) ((void)(x)); /* note trailing ; */
#else
#define GIT_UNUSED_ARG(x)
#endif
/* Define the printf format specifer to use for size_t output */ /* Define the printf format specifer to use for size_t output */
#if defined(_MSC_VER) || defined(__MINGW32__) #if defined(_MSC_VER) || defined(__MINGW32__)
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
GIT_INLINE(int) p_link(const char *GIT_UNUSED(old), const char *GIT_UNUSED(new)) GIT_INLINE(int) p_link(const char *GIT_UNUSED(old), const char *GIT_UNUSED(new))
{ {
GIT_UNUSED_ARG(old) GIT_UNUSED_ARG(old);
GIT_UNUSED_ARG(new) GIT_UNUSED_ARG(new);
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
...@@ -24,7 +24,7 @@ GIT_INLINE(int) p_mkdir(const char *path, mode_t GIT_UNUSED(mode)) ...@@ -24,7 +24,7 @@ GIT_INLINE(int) p_mkdir(const char *path, mode_t GIT_UNUSED(mode))
wchar_t* buf = gitwin_to_utf16(path); wchar_t* buf = gitwin_to_utf16(path);
int ret = _wmkdir(buf); int ret = _wmkdir(buf);
GIT_UNUSED_ARG(mode) GIT_UNUSED_ARG(mode);
git__free(buf); git__free(buf);
return ret; return ret;
......
...@@ -90,8 +90,8 @@ static int one_entry(void *state, git_buf *path) ...@@ -90,8 +90,8 @@ static int one_entry(void *state, git_buf *path)
static int dont_call_me(void *GIT_UNUSED(state), git_buf *GIT_UNUSED(path)) static int dont_call_me(void *GIT_UNUSED(state), git_buf *GIT_UNUSED(path))
{ {
GIT_UNUSED_ARG(state) GIT_UNUSED_ARG(state);
GIT_UNUSED_ARG(path) GIT_UNUSED_ARG(path);
return GIT_ERROR; return GIT_ERROR;
} }
......
...@@ -426,8 +426,8 @@ static walk_data empty = { ...@@ -426,8 +426,8 @@ static walk_data empty = {
static int dont_call_me(void *GIT_UNUSED(state), git_buf *GIT_UNUSED(path)) static int dont_call_me(void *GIT_UNUSED(state), git_buf *GIT_UNUSED(path))
{ {
GIT_UNUSED_ARG(state) GIT_UNUSED_ARG(state);
GIT_UNUSED_ARG(path) GIT_UNUSED_ARG(path);
return GIT_ERROR; return GIT_ERROR;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment