On Tue, Mar 26, 2013 at 9:46 AM, Serge Pavlov <span dir="ltr"><<a href="mailto:sepavloff@gmail.com" target="_blank">sepavloff@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
sepavloff added you to the CC list for the revision "Fix recognition of empty structures/unions".<br>
<br>
Hi all,<br>
<br>
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.<br>

<br>
Could someone please review this fix?<br></blockquote><div><br></div><div>Patch looks reasonable, but (if you don't mind) I'd prefer a slightly more ambitious fix. There are two problem cases here:</div><div><br>
</div><div>1) Per C <a href="http://6.7.2.1/8">6.7.2.1/8</a>, if the struct does not have any named members, behavior is undefined, and</div><div>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++.</div>
<div><br></div><div>The former case should give the ExtWarn, the latter case (which happens in fewer situations) should give the Warning. Example:</div><div><br></div><div>struct S { int : 4 };</div><div><br></div><div>... should produce the ExtWarn, but not the CXX98Compat warning.</div>
</div>