diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2021-08-25 12:30:06 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-25 12:30:06 -0400 |
| commit | efc4e7e56a7b8a406e37ef7b6444996b9e377cc7 (patch) | |
| tree | daacc7828c7270ce400cffd056f23ac4b81e522a /src/cc-compat.h | |
| parent | 0850b1722cbd5095aa6f6e307b9c1bac49228d53 (diff) | |
| parent | 991ccdc5bd2f42669389a0cad7c4cb816615da67 (diff) | |
| download | libgit2-efc4e7e56a7b8a406e37ef7b6444996b9e377cc7.tar.gz | |
Merge pull request #5802 from lhchavez/git-warn-unused-result
Introduce GIT_WARN_UNUSED_RESULT
Diffstat (limited to 'src/cc-compat.h')
| -rw-r--r-- | src/cc-compat.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cc-compat.h b/src/cc-compat.h index de1469da8..6bdc65145 100644 --- a/src/cc-compat.h +++ b/src/cc-compat.h @@ -43,7 +43,15 @@ # define GIT_ALIGN(x,size) x #endif -#define GIT_UNUSED(x) ((void)(x)) +#if defined(__GNUC__) +# define GIT_UNUSED(x) \ + do { \ + typeof(x) _unused __attribute__((unused)); \ + _unused = (x); \ + } while (0) +#else +# define GIT_UNUSED(x) ((void)(x)) +#endif /* Define the printf format specifier to use for size_t output */ #if defined(_MSC_VER) || defined(__MINGW32__) |
