Building with Clang - Printable Version +- iPXE discussion forum (https://forum.ipxe.org) +-- Forum: iPXE user forums (/forumdisplay.php?fid=1) +--- Forum: General (/forumdisplay.php?fid=2) +--- Thread: Building with Clang (/showthread.php?tid=12953) |
Building with Clang - mtg - 2018-09-07 16:01 It appears that iPXE can't be built with Clang. I tried and ran into issues, particularly: core/settings.c:310:8: error: fields must have a constant size: 'variable length array in structure' extension will never be supported char name[ strlen ( name ) + 1 /* NUL */ ]; This is after making with NO_WERROR=1 to get around several clang warning as well. This is with clang version 4.0.1-10. RE: Building with Clang - NiKiZe - 2018-09-07 21:58 you can find the requirements at http://ipxe.org/download#source_code Where Gcc is used. If you want to have Clang support you probably need to get that fixed yourselves, however you might be able to get some help from mcb30 via IRC or the mailing list. Also any patches should be sent to the list, see http://ipxe.org/admin RE: Building with Clang - sherpya - 2018-09-09 01:57 VLA in struct is a GCC extension, not allowed by the standard, so I suppose clang will never allow it: https://stackoverflow.com/questions/14629504/variable-length-array-in-the-middle-of-struct-why-this-c-code-is-valid-for-gcc https://stackoverflow.com/questions/12058760/undocumented-gcc-extension-vla-in-struct you can use flexible array members defining the field as char name[] and add strlen(name) + 1 to: Code: new_child = zalloc ( sizeof ( *new_child ) + strlen(name) + 1 ); but sometime it will allocate less space (2 bytes, because of aligment) |