[cfe-dev] Is there a language/target option to specify the sign of 'int' bitfields?

Douglas Gregor dgregor at apple.com
Wed Jul 1 08:27:48 PDT 2009


On Jul 1, 2009, at 7:52 AM, Enea Zaffanella wrote:

> Hello.
>
> According to the C99 standard (6.7.2p5):
>
> "[...] it is implementation-defined whether the specifier 'int'
> designates the same type as 'signed int' or the same type as 'unsigned
> int'."
>
> Similarly, in the C89 standard I have found:
>
> "Each of the above comma-separated lists designates the same type,
> except that for bit-field declarations, signed int (or signed ) may
> differ from int (or no type specifiers)."
>
>
> I have searched for a language or target specific option to specify  
> this
> implementation-defined behavior ... but I found nothing.
> Was I looking in the wrong places?

I don't believe we have any way to specify this implementation-defined  
behavior. If we did, we'd expose it by supporting the GNU -fsigned- 
bitfields/-funsigned-bitfields command-line options.

> If not, are there plans to add such an option?


No specific plans that I know of. However, we will eventually need to  
support these options to improve our compatibility with GCC. If you're  
inclined to submit a patch to add support for this feature, that's  
wonderful; if not, please file a bug report against Clang so we don't  
forget about this feature.

   - Doug



More information about the cfe-dev mailing list