DanShaders wrote:

@MaskRay 

> I am now confused by the subject "[clang] Stub out gcc_struct attribute".

The user-facing change is `[[gcc_struct]]` attribute implemented for Itanium 
C++ ABI. Better handling of `-mms-bitfields` is just a byproduct. I agree that 
commit message should be more specific about changes to them.

> `-mms-bitfields` wants to be supported by all architectures, or just x86 
> Darwin targets.

It's not like supporting `-mms-bitfields` for all targets adds a big 
maintenance burden. The architecture check you are talking about can be easily 
added in the future if proves to be needed.

------

As Andrew said, I indeed was referring to code used by cross-platform Ladybird 
browser.

Microsoft bit-field layout didn't break an overly-specific regression test but 
rendered unusable double to string conversion. The culprit was the following 
snippet:
```c++
union Extractor {
  double value;
  struct {
    bool sign : 1;
    u32 exponent : 11;
    u64 mantissa : 52;
  };
};
```
According to MSVC ABI, there should be padding between fields. I hope you agree 
that this is not an intuitive and expected behavior.

I later found that, in Wasi implementation, we have more bit-fields that rely 
on the absence of padding which are susceptible to the same problem (they look 
like `struct { 
bool flag1 : 1; bool flag2 : 1; u32 _unused : 30 };`). To fix them, we have to 
split single `_unused` field into 3 (and this field cannot be a transformed to 
a padding since we have to ensure it is zeroed).

https://github.com/llvm/llvm-project/pull/71148
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to