$OpenBSD: patch-include_vlc_fixups_h,v 1.2 2017/05/22 10:22:25 espie Exp $ Adjust fixes for clang's libc++ From 51ce6cdaf598754e617900994c1943c6cba6d604 Mon Sep 17 00:00:00 2001 From: Thomas Guillem Date: Thu, 30 Apr 2015 15:29:50 +0200 Subject: [PATCH] Fix build when using C99 and C++11 From 6faf9066670db6e0d241ead6a3926b2d9cc6a041 Mon Sep 17 00:00:00 2001 From: Thomas Guillem Date: Mon, 14 Dec 2015 10:08:25 +0100 Subject: [PATCH] compat: fix static_assert Index: include/vlc_fixups.h --- include/vlc_fixups.h.orig +++ include/vlc_fixups.h @@ -218,6 +218,8 @@ int posix_memalign (void **, size_t, size_t); /* locale.h */ #ifndef HAVE_USELOCALE +/// XXX we have this in C++ on clang +#if !(defined(__cplusplus) && defined(XXX_CLANG_WORKAROUND)) #define LC_ALL_MASK 0 #define LC_NUMERIC_MASK 0 #define LC_MESSAGES_MASK 0 @@ -238,9 +240,12 @@ static inline locale_t newlocale(int mask, const char return NULL; } #endif +#endif -#if !defined (HAVE_STATIC_ASSERT) -# define _Static_assert(x, s) ((void) sizeof (struct { unsigned:-!(x); })) +#if !defined (HAVE_STATIC_ASSERT) && !defined(__cpp_static_assert) && !defined(static_assert) +# 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