From dbf66ec0bb6f731ab0ff61476b4da5c5cf9befad Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Sat, 28 Jul 2018 17:57:54 +0300 Subject: [PATCH] mdbx: add __printf_args into defs.h Change-Id: I0e6da5115bc427d04eb3ab59184152275c2a7cae --- src/defs.h | 7 +++++++ test/log.h | 9 --------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/defs.h b/src/defs.h index b6076cc1..4b045efc 100644 --- a/src/defs.h +++ b/src/defs.h @@ -327,6 +327,13 @@ # define mdbx_func_ "" #endif +#if defined(__GNUC__) || __has_attribute(format) +#define __printf_args(format_index, first_arg) \ + __attribute__((format(printf, format_index, first_arg))) +#else +#define __printf_args(format_index, first_arg) +#endif + /*----------------------------------------------------------------------------*/ #if defined(USE_VALGRIND) diff --git a/test/log.h b/test/log.h index e97e954c..3e9f9483 100644 --- a/test/log.h +++ b/test/log.h @@ -17,16 +17,7 @@ #include "base.h" void __noreturn usage(void); - -#ifdef __GNUC__ -#define __printf_args(format_index, first_arg) \ - __attribute__((format(printf, format_index, first_arg))) -#else -#define __printf_args(format_index, first_arg) -#endif - void __noreturn __printf_args(1, 2) failure(const char *fmt, ...); - void __noreturn failure_perror(const char *what, int errnum); const char *test_strerror(int errnum);