[vlc-commits] compat: fix static_assert

Thomas Guillem git at videolan.org
Mon Dec 14 19:15:30 CET 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Dec 14 10:08:25 2015 +0100| [6faf9066670db6e0d241ead6a3926b2d9cc6a041] | committer: Rémi Denis-Courmont

compat: fix static_assert

It was not possible to use it outside of functions.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6faf9066670db6e0d241ead6a3926b2d9cc6a041
---

 include/vlc_fixups.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index 213d3f3..bd798d0 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -273,7 +273,9 @@ static inline locale_t newlocale(int mask, const char * locale, locale_t base)
 #endif
 
 #if !defined (HAVE_STATIC_ASSERT) && !defined(__cpp_static_assert)
-# define _Static_assert(x, s) ((void) sizeof (struct { unsigned:-!(x); }))
+# define STATIC_ASSERT_CONCAT_(a, b) a##b
+# define STATIC_ASSERT_CONCAT(a, b) STATIC_ASSERT_CONCAT_(a, b)
+# define _Static_assert(x, s) extern char STATIC_ASSERT_CONCAT(static_assert_, __LINE__)[sizeof(struct { unsigned:-!(x); })]
 # define static_assert _Static_assert
 #endif
 



More information about the vlc-commits mailing list