iPXE discussion forum

Full Version: Building with Clang
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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
VLA in struct is a GCC extension, not allowed by the standard, so I suppose clang will never allow it:

https://stackoverflow.com/questions/1462...id-for-gcc
https://stackoverflow.com/questions/1205...-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)
Reference URL's