| Hi PicoLisp Community! I'm working on a macOS system, where clang is the system compiler and so I'm interested in getting PicoLisp to work there. The current code uses a barely documented, non-standard GCC extension, name vla-members in structs inside of functions. This is a minimal demonstration of the feature: void f() { struct { int vla[g()]; // vla-member, int array of size g() } s; } This feature is not, and will not be, supported by clang, see http://releases.llvm.org/6.0.0/tools/clang/docs/UsersManual.html unter "Intentionally unsupported BCC extensions". VLA-Members is not to be confused with flexible array members ("<type> <name>[]" as the last member), which are a valid C99 feature. The patch attached translates all uses of bindFrame as an anonymous struct with a VLA-member to a combination of a regular byte-vla for memory and a bindFrame pointer into that memory. This requires the bindFrame uses in question to use indirection, rendering the patch a bit noisy. As far as I'm aware and able to test, the behavior is identical. The assembly generated by gcc is very similar, albeit slightly different. Overall the code is slightly shorter because the bindFrame struct is not redefined as an anonymous struct 11 times throughout the code. I'm not able to fully test everything because I'm struggling with the test suite; I don't know whether this is due to me using macOS or misusing PicoLisp. Cursory tests were successful however. The patch is generated from the git mirror but applies to the source in picoLisp-18.6.tgz I'm happy about all feedback. Best Regards, Alexander Matz |
0001-no-vla-member-in-anonymous-bindFrame-clang-compatibi.patch
Description: Binary data
