net: Build assert issue with llvm
Remove the build assert from NET_L3_REGISTER() macro as that
is causing an issue with llvm. Add runtime check of the handler
pointer value.
subsys/net/l2/ethernet/arp.c:1044:1: error: static_assert expression
is not an integral constant expression
ETH_NET_L3_REGISTER(ARP, NET_ETH_PTYPE_ARP, arp_recv);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/net/ethernet.h:1272:2: note: expanded from
macro 'ETH_NET_L3_REGISTER'
NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/net/net_core.h:190:2: note: expanded from
macro 'NET_L3_REGISTER'
BUILD_ASSERT((_handler) != NULL, "Handler is not defined")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/toolchain/gcc.h:87:51: note: expanded from
macro 'BUILD_ASSERT'
define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
^~~~~~
subsys/net/l2/ethernet/arp.c:1044:1: note: cast from 'void *' is not
allowed in a constant expression
include/zephyr/net/ethernet.h:1272:2: note: expanded from
macro 'ETH_NET_L3_REGISTER'
NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
^
include/zephyr/net/net_core.h:190:29: note: expanded from
macro 'NET_L3_REGISTER'
BUILD_ASSERT((_handler) != NULL, "Handler is not defined")
^
/usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h:89:16: note: expanded
from macro 'NULL'
define NULL ((void*)0)
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
parent
04205ae24f
commit
ab9b85b199
2 changed files with 3 additions and 3 deletions
|
|
@ -186,8 +186,7 @@ struct net_l3_register {
|
|||
.handler = _handler, \
|
||||
.name = STRINGIFY(_name), \
|
||||
.l2 = _l2_type, \
|
||||
}; \
|
||||
BUILD_ASSERT((_handler) != NULL, "Handler is not defined")
|
||||
};
|
||||
|
||||
/* @endcond */
|
||||
|
||||
|
|
|
|||
|
|
@ -353,7 +353,8 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
|
|||
net_buf_pull(pkt->frags, hdr_len);
|
||||
|
||||
STRUCT_SECTION_FOREACH(net_l3_register, l3) {
|
||||
if (l3->ptype != type || l3->l2 != &NET_L2_GET_NAME(ETHERNET)) {
|
||||
if (l3->ptype != type || l3->l2 != &NET_L2_GET_NAME(ETHERNET) ||
|
||||
l3->handler == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue