This patch is not quite correct. Given:<div><br><div>typedef int A;</div><div>typedef signed int B;</div><div>struct S { A a : 1; B b : 1; };</div><div><br></div></div><div>... -funsigned-bitfields should give 'a' an unsigned type and 'b' a signed type.</div>
<div><br></div><div>In C++, this is non-conforming -- 'plain' bitfields are required to be signed in C++, since otherwise you would get incoherent behavior inside class templates -- and I'd like us to reject the flag in C++ mode unless there's some strong compatibility argument.</div>
<div><br></div><div>In C99 onwards, this behavior is conforming but makes no sense in some cases, since the same typedef can be redeclared with and without an explicit 'signed' type specifier. We should diagnose such cases.</div>
<div><br></div><div>What is the motivation for allowing this?</div><br><div>On Mon Jan 27 2014 at 9:10:38 AM, Artyom Skrobov <<a href="mailto:Artyom.Skrobov@arm.com">Artyom.Skrobov@arm.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
The attached patch adds the support for -funsigned-bitfields and<br>
-fsigned-bitfields command-line options, as available in GCC.<br>
<br>
Regarding the implementation: DeclSpec::TypeSpecSign for a bitfield was not<br>
accessible directly via the FieldDecl, so it took a bit of plumbing-through.<br>
<br>
OK to commit?_______________________<u></u>________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a><br>
</blockquote>