diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-10-07 10:26:24 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-10-07 10:26:24 +0000 |
commit | 68c2f66c0d155e4cfba0392dd4da5e4c3ae9db46 (patch) | |
tree | 2c85c7da97aa29a4dd7f82a08395409a2e9780f9 /sys/kern/init_main.c | |
parent | 5224a5e41a802053f9b269e779eaa27feb6fa5f9 (diff) |
Correct handling of enum attributes with g++
gcc and g++ can currently have different ideas on the size of a
packed enum type:
enum __attribute__((packed)) foo { a = 0, b};
gcc: 1
g++: 4
enum foo { a = 0, b} __attribute__((packed));
gcc: 1
g++: 1
The first format is actually the preferred one according to the
documentation.
https://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Type-Attributes.html
g++ will accept the first format and silently not actually choose a
smaller size.
This was responsible for memory corruption with recent versions
of Mesa where c and c++ code share a header with a packed enum type.
The problem was reported in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39219
and fixed in gcc >= 4.3.6 in rev 144284.
This was after the switch from gplv2 but it's a trivial one line change.
ok guenther@ deraadt@ kettenis@
Diffstat (limited to 'sys/kern/init_main.c')
0 files changed, 0 insertions, 0 deletions