summaryrefslogtreecommitdiff
path: root/libavutil/internal.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-04-25 00:55:00 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-04-25 00:55:40 +0200
commit06e664366a66a373358aacacde8e86348d55bd22 (patch)
tree420f5a64cc848964341ab5e9358634d9c5ef3e29 /libavutil/internal.h
parent5ac10d40fb9b65e476d1d591a892e0ff51cda6d5 (diff)
parenta88e1d1c598e641eecd5d43730211d91c82787c6 (diff)
Merge commit 'a88e1d1c598e641eecd5d43730211d91c82787c6'
* commit 'a88e1d1c598e641eecd5d43730211d91c82787c6': lavu: add CHK_OFFS as AV_CHECK_OFFSET to check struct member offsets Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/internal.h')
-rw-r--r--libavutil/internal.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h
index c6c0aa8d38..9a04fa5a2f 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -93,6 +93,13 @@
// to be forced to tokenize __VA_ARGS__
#define E1(x) x
+/* Check if the hard coded offset of a struct member still matches reality.
+ * Induce a compilation failure if not.
+ */
+#define AV_CHECK_OFFSET(s, m, o) struct check_##o { \
+ int x_##o[offsetof(s, m) == o? 1: -1]; \
+ }
+
#define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
uint8_t la_##v[sizeof(t s o) + (a)]; \
t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)