0011-static-assert.patch 1.1 KB

12345678910111213141516171819202122232425262728
  1. From: Thomas Guillem <thomas@gllm.fr>
  2. Date: Mon, 14 Dec 2015 09:08:25 +0000 (+0100)
  3. Subject: compat: fix static_assert
  4. X-Git-Url: http://git.videolan.org/?p=vlc.git;a=commitdiff_plain;h=6faf9066670db6e0d241ead6a3926b2d9cc6a041
  5. compat: fix static_assert
  6. It was not possible to use it outside of functions.
  7. Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
  8. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  9. ---
  10. diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
  11. index 213d3f3..bd798d0 100644
  12. --- a/include/vlc_fixups.h
  13. +++ b/include/vlc_fixups.h
  14. @@ -273,7 +273,9 @@ static inline locale_t newlocale(int mask, const char * locale, locale_t base)
  15. #endif
  16. #if !defined (HAVE_STATIC_ASSERT) && !defined(__cpp_static_assert)
  17. -# define _Static_assert(x, s) ((void) sizeof (struct { unsigned:-!(x); }))
  18. +# define STATIC_ASSERT_CONCAT_(a, b) a##b
  19. +# define STATIC_ASSERT_CONCAT(a, b) STATIC_ASSERT_CONCAT_(a, b)
  20. +# define _Static_assert(x, s) extern char STATIC_ASSERT_CONCAT(static_assert_, __LINE__)[sizeof(struct { unsigned:-!(x); })]
  21. # define static_assert _Static_assert
  22. #endif