package/vlc: backport upstream patches to fix compat function for static_assert

Fixes
http://autobuild.buildroot.net/results/3b9/3b9d15f226057706c185270788050dace7b7b535/

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
Bernd Kuhls 2016-10-16 23:01:26 +02:00 committed by Thomas Petazzoni
parent d7b74f07a5
commit 70dbd3227d
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,25 @@
From: Thomas Guillem <thomas@gllm.fr>
Date: Thu, 30 Apr 2015 13:29:50 +0000 (+0200)
Subject: Fix build when using C99 and C++11
X-Git-Url: http://git.videolan.org/?p=vlc.git;a=commitdiff_plain;h=51ce6cdaf598754e617900994c1943c6cba6d604
Fix build when using C99 and C++11
Indeed, C99 doesn't have static_assert and C++11 has it.
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index b949d24..ee168d7 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -239,7 +239,7 @@ static inline locale_t newlocale(int mask, const char * locale, locale_t base)
}
#endif
-#if !defined (HAVE_STATIC_ASSERT)
+#if !defined (HAVE_STATIC_ASSERT) && !defined(__cpp_static_assert)
# define _Static_assert(x, s) ((void) sizeof (struct { unsigned:-!(x); }))
# define static_assert _Static_assert
#endif

View File

@ -0,0 +1,28 @@
From: Thomas Guillem <thomas@gllm.fr>
Date: Mon, 14 Dec 2015 09:08:25 +0000 (+0100)
Subject: compat: fix static_assert
X-Git-Url: http://git.videolan.org/?p=vlc.git;a=commitdiff_plain;h=6faf9066670db6e0d241ead6a3926b2d9cc6a041
compat: fix static_assert
It was not possible to use it outside of functions.
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
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