Issue
gcc throws following error with musl
libc
device_achat.c:192:29: error: expected expression before ‘struct’
return container_of(_iocb, struct ffs_request, iocb);
^~~~~~
device_achat.c:52:45: note: in definition of macro ‘container_of’
(type *)( (char *)__mptr - offsetof(type,member) );})
^~~~
device_achat.c
...
...
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
...
...
/* Use container_of() to get ffs_request from iocb */
static inline struct ffs_request *to_ffs_request(struct iocb *_iocb)
{
return container_of(_iocb, struct ffs_request, iocb);
}
...
...
Solution
Without seeing any more of the code, my best guess is that the program has not included stddef.h
to get offsetof
, and GCC is (wrongly; this really really should be a hard error) treating it as an implicitly declared function rather than a macro.
If this only happens on musl, not glibc or some other system you've tried it on, it's probably that the other libc is mildly violating namespace by implicitly including stddef.h
from some other header.
Note that you can make the implicit function thing an error with -Werror=implicit-function-declaration
to catch errors like this.
Answered By - R.. GitHub STOP HELPING ICE