summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2017-09-19 15:10:04 -0700
committerJunio C Hamano <gitster@pobox.com>2017-09-20 15:00:41 +0900
commit5de3de329ac2fafa4b5762a6d0384312897793e5 (patch)
tree95e3c737eec70018e6ad6bd3b546d3c03be3144f
parent0e5bba53af7d6f911e99589d736cdf06badad0fe (diff)
downloadgit-jk/leak-checkers.tar.gz
git-compat-util: make UNLEAK less error-pronejk/leak-checkers
Commit 0e5bba5 ("add UNLEAK annotation for reducing leak false positives", 2017-09-08) introduced an UNLEAK macro to be used as "UNLEAK(var);", but its existing definitions leave semicolons that act as empty statements, which will lead to syntax errors, e.g. if (condition) UNLEAK(var); else something_else(var); would be broken with two statements between if (condition) and else. Lose the excess semicolon from the end of the macro replacement text. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--git-compat-util.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 003e444c46..9bc15b0363 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1184,9 +1184,9 @@ extern int cmd_main(int, const char **);
*/
#ifdef SUPPRESS_ANNOTATED_LEAKS
extern void unleak_memory(const void *ptr, size_t len);
-#define UNLEAK(var) unleak_memory(&(var), sizeof(var));
+#define UNLEAK(var) unleak_memory(&(var), sizeof(var))
#else
-#define UNLEAK(var)
+#define UNLEAK(var) do {} while (0)
#endif
#endif