On Tue, Mar 26, 2013 at 9:46 AM, Serge Pavlov <[email protected]> wrote:

> sepavloff added you to the CC list for the revision "Fix recognition of
> empty structures/unions".
>
> Hi all,
>
> This change fixes the recognition of empty structures/unions so that a
> structure with a bit field of zero length is correctly recognized as empty.
> To make it possible, the recognition is moved from parser to semantic
> analyzer. The fix is required to correctly warn about issues with C/C++
> compatibility.
>
> Could someone please review this fix?
>

Patch looks reasonable, but (if you don't mind) I'd prefer a slightly more
ambitious fix. There are two problem cases here:

1) Per C 6.7.2.1/8, if the struct does not have any named members, behavior
is undefined, and
2) If the struct does not have any members other than zero-width bitfields,
it will have size 0 in C and size 1 in C++.

The former case should give the ExtWarn, the latter case (which happens in
fewer situations) should give the Warning. Example:

struct S { int : 4 };

... should produce the ExtWarn, but not the CXX98Compat warning.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to