Since beginning of the times I've used to believe that __attribute__((packed)) can be put on a struct or typedef, like that:
typedef struct __attribute__((packed)) { uint8_t m1; uint16_t m2; uint8_t m3; uint32_t m4; uint8_t m5; } junk; But then someone pointed out that this obvious usage is not documented in the recent gcc manuals, for already several releases. Rather it says (in v.12): "The [packed] attribute does not apply to non-member objects."
A whole struct is not a member object, correct?
So is the above example legal, or does it rely on UB (that can bite later)?