@cryptotaxi247 / netdata-1 / commits / 12b178cf1

Properly detect attribute format types (#17685)

vkalintiris committed May 17, 2024 at 15:21 UTC 12b178cf1821cac1e59c4ad8ab9749109801d52f
4 files changed +12 -6
CMakeLists.txt
+6 -1
@@ -486,10 +486,15 @@ int main() {
486 }
487 " HAVE_BUILTIN_ATOMICS)
488
489 +check_c_source_compiles("
490 +void my_printf(char const *s, ...) __attribute__((format(gnu_printf, 1, 2)));
491 +int main() { return 0; }
492 +" HAVE_FUNC_ATTRIBUTE_FORMAT_GNU_PRINTF FAIL_REGEX "warning:")
493 +
494 check_c_source_compiles("
495 void my_printf(char const *s, ...) __attribute__((format(printf, 1, 2)));
496 int main() { return 0; }
492 -" HAVE_FUNC_ATTRIBUTE_FORMAT)
497 +" HAVE_FUNC_ATTRIBUTE_FORMAT_PRINTF FAIL_REGEX "warning:")
498
499 check_c_source_compiles("
500 #include <stdio.h>
packaging/cmake/config.cmake.h.in
+2 -1
@@ -94,7 +94,8 @@
94 #cmakedefine HAVE_STRNDUP
95 #cmakedefine SSL_HAS_PENDING
96
97 -#cmakedefine HAVE_FUNC_ATTRIBUTE_FORMAT
97 +#cmakedefine HAVE_FUNC_ATTRIBUTE_FORMAT_GNU_PRINTF
98 +#cmakedefine HAVE_FUNC_ATTRIBUTE_FORMAT_PRINTF
99 #cmakedefine HAVE_FUNC_ATTRIBUTE_MALLOC
100 #cmakedefine HAVE_FUNC_ATTRIBUTE_NOINLINE
101 #cmakedefine HAVE_FUNC_ATTRIBUTE_NORETURN
src/collectors/log2journal/log2journal.h
+2 -2
@@ -32,9 +32,9 @@ static inline char *os_strndup( const char *s1, size_t n)
32 #define strndup(s, n) os_strndup(s, n)
33 #endif
34
35 -#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT) && !defined(COMPILED_FOR_MACOS)
35 +#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT_GNU_PRINTF)
36 #define PRINTFLIKE(f, a) __attribute__ ((format(gnu_printf, f, a)))
37 -#elif defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
37 +#elif defined(HAVE_FUNC_ATTRIBUTE_FORMAT_PRINTF)
38 #define PRINTFLIKE(f, a) __attribute__ ((format(printf, f, a)))
39 #else
40 #define PRINTFLIKE(f, a)
src/libnetdata/libnetdata.h
+2 -2
@@ -291,9 +291,9 @@ typedef uint32_t uid_t;
291 #define MALLOCLIKE
292 #endif
293
294 -#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT) && !defined(COMPILED_FOR_MACOS)
294 +#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT_GNU_PRINTF)
295 #define PRINTFLIKE(f, a) __attribute__ ((format(gnu_printf, f, a)))
296 -#elif defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
296 +#elif defined(HAVE_FUNC_ATTRIBUTE_FORMAT_PRINTF)
297 #define PRINTFLIKE(f, a) __attribute__ ((format(printf, f, a)))
298 #else
299 #define PRINTFLIKE(f, a)