On Wed, Jul 22, 2020 at 09:35:14AM +0300, 'Gal Pressman' via Clang Built Linux wrote: > On 21/07/2020 20:10, Nick Desaulniers wrote: > > On Tue, Jul 21, 2020 at 4:27 AM 'Gal Pressman' via Clang Built Linux > > <clang-built-linux@xxxxxxxxxxxxxxxx> wrote: > >> > >> On 20/07/2020 20:08, kernel test robot wrote: > >>> Hi Gal, > >>> > >>> I love your patch! Yet something to improve: > >>> > >>> [auto build test ERROR on 5f0b2a6093a4d9aab093964c65083fe801ef1e58] > >>> > >>> url: https://github.com/0day-ci/linux/commits/Gal-Pressman/Add-support-for-0xefa1-device/20200720-160419 > >>> base: 5f0b2a6093a4d9aab093964c65083fe801ef1e58 > >>> config: x86_64-allyesconfig (attached as .config) > >>> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cf1105069648446d58adfb7a6cc590013d6886ba) > >> > >> Uh, looks like I use some gcc specific stuff here.. I guess it's time to start > >> checking clang compilation as well :). > >> > >> Will fix and resubmit. > > > >>> drivers/infiniband/hw/efa/efa_verbs.c:1539:18: error: invalid application of 'sizeof' to an incomplete type 'struct (anonymous struct at drivers/infiniband/hw/efa/efa_verbs.c:1529:2) []' > > for (i = 0; i < ARRAY_SIZE(user_comp_handshakes); i++) { > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > is user_comp_handshakes forward declared but not defined for an allyesconfig? > > > > I don't think that's the issue here, the real problem is the first error: > > >> drivers/infiniband/hw/efa/efa_verbs.c:1533:3: error: function definition is not allowed here > DEFINE_COMP_HANDSHAKE(max_tx_batch, EFA_ALLOC_UCONTEXT_CMD_COMP_TX_BATCH), > ^ > drivers/infiniband/hw/efa/efa_verbs.c:1520:4: note: expanded from macro 'DEFINE_COMP_HANDSHAKE' > DEFINE_GET_DEV_ATTR_FUNC(_attr) \ > ^ > drivers/infiniband/hw/efa/efa_verbs.c:1506:2: note: expanded from macro 'DEFINE_GET_DEV_ATTR_FUNC' > > > Apparently the braced group (is that how its called?) is supported by gcc, but not clang. > I believe you are trying to use nested functions, which are not supported by clang: https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html clang supports both scoped statements and GNU C statement expressions but you are trying to define a function within a GNU C statement expression and use it in a designated initializer (in DEFINE_COMP_HANDSHAKE with DEFINE_GET_DEV_ATTR_FUNC and DEFINE_CHECK_COMP_FUNC), which causes a problem with clang. Cheers, Nathan