Given this program in the file t.c: enum e { zero }; struct { enum e field: 2; } s; The command "gcc -Wpedantic -S t.c" outputs: t.c:2:15: warning: type of bit-field 'field' is a GCC extension [-Wpedantic] struct { enum e field: 2; } s; This diagnostic should not be output. -Wpedantic is supposed to generate only diagnostics required by the standard. But this diagnostic is not required by C99 or by C11, since these standards allow this GCC extension and do not require a diagnostic if the extension is used. And the diagnostic is not required by C89 since no constraint is violated.
Yeah, I think you're right. Confirmed.
After all, I think it'd be wise to keep the warning for ISO C, but turn if off for C99/C11. I have a patch for that.
Author: mpolacek Date: Mon Jan 6 18:53:01 2014 New Revision: 206373 URL: http://gcc.gnu.org/viewcvs?rev=206373&root=gcc&view=rev Log: PR c/57773 * doc/implement-c.texi: Mention that other integer types are permitted as bit-field types in strictly conforming mode. c/ * c-decl.c (check_bitfield_type_and_width): Warn for implementation defined bit-field types only in ISO C. testsuite/ * gcc.dg/pr57773.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr57773.c Modified: trunk/gcc/ChangeLog trunk/gcc/c/ChangeLog trunk/gcc/c/c-decl.c trunk/gcc/doc/implement-c.texi trunk/gcc/testsuite/ChangeLog
Fixed.