[clang] [C23] Implement WG14 N3037 (PR #132939)

Martin Uecker via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 27 00:09:35 PDT 2025


uecker wrote:

> It seems to me that we could simplify the implementation by being a bit more literal in the interpretation of the requirements: look only at the type, alignment, name, and bitfield-width of members. Just don't bother checking other stuff
> 
> I'd hope it can look more like a simple loop over the fields of the two record types (similar to mergeFunctionTypes's checks of the functions' param types), rather than starting with the very-complex ASTStructuralEquivalence.cpp, and adding even more complexity to validate attributes.

What I do in GCC is mostly look at those things required in the standard and I make sure that all field offsets are the same (e.g. if some attribute would change how fields are layed out, this would catch it).  This is a simple loop. GCC already had a generic mechanism to compare attributes on types which decides whether an attribute makes a type incompatible (.e.g. affects ABI such as "packed"), or requires a warning, or whether it is just fine. 

https://github.com/llvm/llvm-project/pull/132939


More information about the cfe-commits mailing list