From 356eef72675cde4dc5627c1e2f1a01846ec6eb1d Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Sat, 24 Oct 2015 15:48:26 +0200 Subject: TESTS: Add warning for unused result of leak check functions Reviewed-by: Petr Cech --- src/tests/common.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tests/common.h b/src/tests/common.h index ac9ba402..794218c5 100644 --- a/src/tests/common.h +++ b/src/tests/common.h @@ -25,11 +25,20 @@ #ifndef __TESTS_COMMON_H__ #define __TESTS_COMMON_H__ +#include "config.h" + #include #include "util/util.h" #include "providers/data_provider.h" #include "providers/ldap/sdap.h" + +#ifdef HAVE_FUNCTION_ATTRIBUTE_WARN_UNUSED_RESULT +#define SSS_ATTRIBUTE_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +#else +#define SSS_ATTRIBUTE_WARN_UNUSED_RESULT +#endif + #define N_ELEMENTS(arr) (sizeof(arr) / sizeof(arr[0])) extern TALLOC_CTX *global_talloc_context; @@ -37,10 +46,11 @@ extern TALLOC_CTX *global_talloc_context; void check_leaks_push(TALLOC_CTX *ctx); #define check_leaks_pop(ctx) _check_leaks_pop((ctx), __location__) -bool _check_leaks_pop(TALLOC_CTX *ctx, const char *location); +bool _check_leaks_pop(TALLOC_CTX *ctx, const char *location) + SSS_ATTRIBUTE_WARN_UNUSED_RESULT; -bool leak_check_setup(void); -bool leak_check_teardown(void); +bool leak_check_setup(void) SSS_ATTRIBUTE_WARN_UNUSED_RESULT; +bool leak_check_teardown(void) SSS_ATTRIBUTE_WARN_UNUSED_RESULT; const char *check_leaks_err_msg(void); void tests_set_cwd(void); -- cgit