While I am seeing the OVS source code, I found very strange codes i never seen before.
https://github.com/openvswitch/ovs/blob/master/lib/ovs-rcu.h
void ovsrcu_postpone__(void (*function)(void *aux), void *aux);
#define ovsrcu_postpone(FUNCTION, ARG) \
((void) sizeof((FUNCTION)(ARG), 1), \
(void) sizeof(*(ARG)), \
ovsrcu_postpone__((void (*)(void *))(FUNCTION), ARG))
I got the meaning of multi argument sizeof by searching
Why call sizeof operator with two arguments? http://www.vxdev.com/docs/vx55man/diab5.0ppc/c-additi.htm#3001432
If return of FUNCTION is int and type of ARG is char, macro becomes this form.
((void) 4, (void) 1, ovsrcu_postpone__((void (*)(void *))(function), arg))
I cannot catch the roles of two arguments before ovsrcu_postpone__ method.
So let's look at the example that they give in the source code:
ovsrcu_postpone(free, ovsrcu_get_protected(struct flow *, &flowp));
This will be expanded into:
(
(void) sizeof((free)(ovsrcu_get_protected(struct flow *, &flowp)), 1),
(void) sizeof(*(ovsrcu_get_protected(struct flow *, &flowp))),
ovsrcu_postpone__((void (*)(void *))(free), ovsrcu_get_protected(struct flow *, &flowp))
)
So what we have here, is some type safety, and then the expected call. Here's what I can tease out of the requirements:
We can also understand this:
sizeof(free, 1);
That's using the comma operator, so other than making sure the syntax is valid, it will have the same return value as sizeof(1)
.