@ Shafiq Yagmur pushed me in the right direction. Inspecting the error message he mentioned gave me the correct answer:
... but the main problem is that alignment by typedefs is not supported. the attribute ((aligned)) in the template arguments seems to have no effect.
Source: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48138
This led to the position __attribute__(aligned(16)) being the key. If I put it either after the keyword structure or from the closing brace, the warning will disappear, for example:
typedef struct __attribute__((aligned (16))) _STRUCT {
or
_STRUCT(): a(0), b(0) {}; uint32_t a; uint32_t b; } __attribute__((aligned (16))) STRUCT;
The first is a proposal from a GCC document. http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
For an enumeration type, structure, or union, you can specify attributes either between the enum, struct, or union tag and the type name, or simply behind the closing brace of the definition. The previous syntax is preferred.
So, in the event that the first implementation set alignment for the typedef, the solution sets alignment for the structure that was the target in the first place.
source share