On Tue, Jul 30, 2013 at 10:51 AM, Robert Lytton <span dir="ltr"><<a href="mailto:robert@xmos.com" target="_blank">robert@xmos.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">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi,<br>
<br>
I have altered<font> <span style="font-size:10pt"><font><span style="font-size:10pt"></span></font>isSignedCharDefault() to make 'char' unsigned for the xcore target too.<br>
(The signedness of 'char' is an ABI issue as far a the standard is concerned.)<br>
<br>
</span></font>My problem now is that char-bitfields are also being made unsigned.<br>
According to the standard the members of a bitfield are always signed unless explicitly marked unsigned.<br></div></div></blockquote><div><br></div><div>What standard? C++ requires that bit-fields have the same signedness as their underlying type. If 'char' is unsigned, then bit-fields of type 'char' are also unsigned.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="direction:ltr;font-size:10pt;font-family:Tahoma">
Hence I need:<br>
'char' to be unsigned.<br>
but the bit field 'char' to be signed.<br>
<br>
viz:<br>
// ABI requires plain 'char' to be unsigned<br>
char c = (char)-1;<br>
assert(c >= 0);<br>
<br>
// members of a bitfield are always signed unless explicitly marked unsigned<br>
struct char_sign { char x : 1; };<br>
char_sign.x = 1;<br>
assert(char_sign.x < 0);<br>
<br>
<br>
Is this possible in clang?<br>
If not, could anyone like to point me in the right direction to where the fix would be necessary?<br>
<br>
Thank you<span class="HOEnZb"><font color="#888888"><br>
<br>
Robert<br>
<br>
<br>
</font></span></div>
</div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br>