Remove the gcc
-pedantic
option if you don't want to get the warning.
In C99, gcc
issues a warning with -pedantic
but it is permitted to have an implementation defined type for the bit-field (like unsigned char
).
(C99, 6.7.2.1p4) "A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed int, unsigned int, or some other implementation-defined type."
In C90, only int
, unsigned int
and signed int
are permitted.
(C90, 6.5.2.1) "A bit-field shall have a type that is a qualified or unqualified version of one of int, unsigned int, or signed int"
Actually in both C90 and C99 the warning is not required by C (it is undefined behavior in C90 only but C doesn't not require a warning for undefined behavior). The warning is added by gcc
with -pedantic
for information only.