Gankra / abi-cafe

Pair your compilers up at The ABI Cafe!
https://faultlore.com/abi-cafe/book/
228 stars 15 forks source link

Implement @align in C backend #26

Open Gankra opened 4 months ago

Gankra commented 4 months ago

kdl-script supports an align attribute, which the rust backend implements. The C backend should implement it too (currently it bails if it finds any attributes at all, pending implementations like this one). Currently the C backend contains a commented-out version of the rust impl, so you can roughly see what should be done:

https://github.com/Gankra/abi-cafe/blob/6ba68656bd74d05692e3abb83a51a0bfc2b7ce32/src/abis/c/declare.rs#L345-L356

The main issue is picking the attribute to use, perhaps by checking what compiler we're using. I know there's like, way too many different attributes here. Someone with more C experience than me hopefully has Opinions on which to use where.

Gankra commented 4 months ago

https://en.cppreference.com/w/c/language/_Alignas