PR #20677 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20677
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20677.patch

Maybe useful and to fix MSVC preprocessor warnings.

Fixes: afad332d77278232662e6d8c95c2fc80cb44c8dd


From 3a8ea78b88d14ac2a3d6dddbf22a3f00ba1ee8d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Thu, 9 Oct 2025 06:22:39 +0200
Subject: [PATCH] avutil/attributes: add AV_HAS_ATTRIBUTE
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Maybe useful and to fix MSVC preprocessor warnings.

Fixes: afad332d77278232662e6d8c95c2fc80cb44c8dd
Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavutil/attributes.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 2bdf5ed4e4..9e0222a691 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -40,6 +40,12 @@
 #    define AV_HAS_BUILTIN(x) 0
 #endif
 
+#ifdef __has_attribute
+#    define AV_HAS_ATTRIBUTE(x) __has_attribute(x)
+#else
+#    define AV_HAS_ATTRIBUTE(x) 0
+#endif
+
 #if defined(__cplusplus) && defined(__has_cpp_attribute)
 #    define AV_HAS_STD_ATTRIBUTE(x) __has_cpp_attribute(x)
 #elif !defined(__cplusplus) && defined(__has_c_attribute)
@@ -183,13 +189,13 @@
 
 #ifdef __MINGW_PRINTF_FORMAT
 #    define AV_PRINTF_FMT __MINGW_PRINTF_FORMAT
-#elif defined(__has_attribute) && __has_attribute(format)
+#elif AV_HAS_ATTRIBUTE(format)
 #    define AV_PRINTF_FMT __printf__
 #endif
 
 #ifdef __MINGW_SCANF_FORMAT
 #    define AV_SCANF_FMT __MINGW_SCANF_FORMAT
-#elif defined(__has_attribute) && __has_attribute(format)
+#elif AV_HAS_ATTRIBUTE(format)
 #    define AV_SCANF_FMT __scanf__
 #endif
 
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to