[libav-devel] [PATCH] attributes: Add av_unreachable()

Luca Barbato lu_zero at gentoo.org
Thu Mar 6 10:42:42 CET 2014


Some compilers prefer __builtin_unreachable() over a normal abort() to
mark unreachable branches.
---
 doc/APIchanges         | 3 +++
 libavutil/attributes.h | 6 ++++++
 libavutil/version.h    | 2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index d6134f9..f5e6da6 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2013-12-xx
 
 API changes, most recent first:
 
+2014-xx-xx - xxxxxxx - lavu 53.06.0 - attributes.h
+  Add av_unreachable() for marking unreachable branches.
+
 2014-xx-xx - xxxxxxx - lavu 53.05.0 - frame.h
   Add av_frame_copy() for copying the frame data.
 
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index d7f2bb5..b030f6a 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -123,4 +123,10 @@
 #    define av_noreturn
 #endif
 
+#if AV_GCC_VERSION_AT_LEAST(4,5)
+#   define av_unreachable() __builtin_unreachable()
+#else
+#   define av_unreachable() abort()
+#endif
+
 #endif /* AVUTIL_ATTRIBUTES_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index cd0981c..36070b2 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -54,7 +54,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR 53
-#define LIBAVUTIL_VERSION_MINOR  5
+#define LIBAVUTIL_VERSION_MINOR  6
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
1.8.5.1



More information about the libav-devel mailing list