[FFmpeg-devel] [PATCH 1/4] lavu/attributes: introduce AV_NOWARN_DEPRECATED.

Nicolas George nicolas.george at normalesup.org
Wed Sep 14 21:17:12 CEST 2011


Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavutil/attributes.h |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)


The same result could be obtained using "GCC diagnostic warning" to restore
the warning, instead of push/pop; this would work with 4.2 and later instead
of 4.6 and later.



diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index e97fdfd..3f761ef 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -88,6 +88,24 @@
 #endif
 #endif
 
+/**
+ * Disable warnings about deprecated features
+ * This is useful for sections of code kept for backward compatibility and
+ * scheduled for removal.
+ */
+#ifndef AV_NOWARN_DEPRECATED
+#if AV_GCC_VERSION_AT_LEAST(4,6)
+#    define AV_NOWARN_DEPRECATED(code) \
+        _Pragma("GCC diagnostic push") \
+        _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
+        code \
+        _Pragma("GCC diagnostic pop")
+#else
+#    define AV_NOWARN_DEPRECATED(code) code
+#endif
+#endif
+
+
 #ifndef av_unused
 #if defined(__GNUC__)
 #    define av_unused __attribute__((unused))
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list