summaryrefslogtreecommitdiff
path: root/libavutil/attributes.h
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-01-31 02:19:30 +0000
committerMichael Niedermayer <michaelni@gmx.at>2011-01-31 18:25:48 +0100
commit0374152f8926bb3d0f2cd9cca56d12521fe0f71b (patch)
treed0d65e4222b34952f3a4f153b3535bd0528a9321 /libavutil/attributes.h
parenta735bbbb7a27fa89318d60b91558c3045b6b27c6 (diff)
downloadffmpeg-0374152f8926bb3d0f2cd9cca56d12521fe0f71b.tar.gz
Rename attribute_used to av_used and move it to attributes.h
This is consistent with most of the other attribute macros. Signed-off-by: Mans Rullgard <mans@mansr.com> (cherry picked from commit 365e3c7878e4e821d5dec922d2d51f92ce13f926)
Diffstat (limited to 'libavutil/attributes.h')
-rw-r--r--libavutil/attributes.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index d93f46093c..65a9249cd5 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -96,6 +96,19 @@
#endif
#endif
+/**
+ * Mark a variable as used and prevent the compiler from optimizing it
+ * away. This is useful for variables accessed only from inline
+ * assembler without the compiler being aware.
+ */
+#ifndef av_used
+#if AV_GCC_VERSION_AT_LEAST(3,1)
+# define av_used __attribute__((used))
+#else
+# define av_used
+#endif
+#endif
+
#ifndef av_alias
#if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(3,3)
# define av_alias __attribute__((may_alias))