Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Building with Clang
2018-09-07, 16:01
Post: #1
Building with Clang
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.
Find all posts by this user
Quote this message in a reply
2018-09-07, 21:58
Post: #2
RE: Building with Clang
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
Visit this user's website Find all posts by this user
Quote this message in a reply
2018-09-09, 01:57
Post: #3
RE: Building with Clang
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)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)