bitfields support in jextract

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Jul 2 09:25:59 UTC 2018


I've checked the compatibility link last week - and also found nothing 
relevant.

I know that bitfield layout is impl specific (the C language spec, I 
checked say nothing about that - just that there's some storage unit of 
some kind).

That said, I'm using  the offsets returned by the clang API to add 
bitfields support. As long as clang in Windows does the sensible thing - 
e.g. be compatible with MSC - and I have not seen any proof pointing at 
the opposite direction, we should be ok, I think.

As for your claim on scope, this is (i) not the right mailing list where 
to raise such concerns (you should use the panama-spec-experts alias), 
and (ii) you seem to keep forgetting that our current incarnation of 
jextract is deliberately that of a tool that is built on whatever 
support clang has to offer. The start of the show is not jextract, it's 
the binder - nothing prevents us (or the community) to have a different 
jextract on windows that is based on MSVC (the work carried out around 
project Roselyn few years ago might help in that direction?).

If your broader point is that we should verify what's the compatibility 
status w.r.t. MSVC with any of the features we have added to jextract 
(not just bitfields) - yes, that's something that has occurred to us.

Maurizio



On 30/06/18 08:26, Samuel Audet wrote:
> Hi,
>
> Looks like the packing of bit fields is implementation dependent:
> https://stackoverflow.com/questions/1490092/c-c-force-bit-field-order-and-alignment 
>
>
> Clang is probably using GCC's extensions by default, but you should be 
> thinking about supporting at least MSVC! GCC seems to have support for 
> that with TARGET_MS_BITFIELD_LAYOUT_P:
> https://gcc.gnu.org/onlinedocs/gccint/Storage-Layout.html
>
> Not sure about Clang though, nothing mentioned here:
> https://clang.llvm.org/docs/MSVCCompatibility.html
>
> So, again, the scope of Panama is very ill defined. It would help if 
> you could define it better. In the case of bit fields, it sounds like 
> you will not be supporting any other bit-field layout than GCC/Clang..
>
> Samuel
>
> On 06/30/2018 02:36 AM, Maurizio Cimadamore wrote:
>> Hi,
>> I'm sending this internally as an headsup...



More information about the panama-dev mailing list