[vlc-devel] GCC 4.8 and max_align_t

Francois Cartegnie fcvlcdev at free.fr
Thu Sep 15 13:28:31 CEST 2016

Le 15/09/2016 à 12:57, Sean McGovern a écrit :
> Hi,
> It looks like max_align_t is already defined by GCC 4.8 in a compiler-specific 
> copy of stddef.h (somewhere under something like 
> /usr/lib/<triplet>/gcc/4.8/include on my Ubuntu 14.04 machine). Is there a way 
> we can account for this issue in compat/ somehow?

Defines it ONLY if C++11 or C11

> #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
>   || (defined(__cplusplus) && __cplusplus >= 201103L)
> #ifndef _GCC_MAX_ALIGN_T
> #define _GCC_MAX_ALIGN_T
> /* Type whose alignment is supported in every context and is at least
>    as great as that of any standard type not using alignment
>    specifiers.  */
> typedef struct {
>   long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
>   long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
> } max_align_t;
> #endif
> #endif /* C11 or C++11.  */

If you compiled C in C99, then it was broken for max_align.
If you tried to compile with -std=c11, then you failed with the atomics
Thus the vlc_fixups definition.

But if you now compile with C++ 11, then you break on a double
definition of max_align.

So you're now borked with pre GCC 4.9 unless you
#if !defined(__cplusplus) || __cplusplus < 201103L
the above mentioned max_align definition in vlc_fixup.


More information about the vlc-devel mailing list