Messages in this thread | | | From | Florent Revest <> | Date | Tue, 25 May 2021 22:04:12 +0200 | Subject | Re: [PATCH bpf] libbpf: Move BPF_SEQ_PRINTF and BPF_SNPRINTF to bpf_helpers.h |
| |
On Tue, May 25, 2021 at 9:51 PM Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote: > > On Tue, May 25, 2021 at 4:38 AM Florent Revest <revest@chromium.org> wrote: > > +#define ___bpf_concat(a, b) a ## b > > +#define ___bpf_apply(fn, n) ___bpf_concat(fn, n) > > +#define ___bpf_nth(_, _1, _2, _3, _4, _5, _6, _7, _8, _9, _a, _b, _c, N, ...) N > > +#define ___bpf_narg(...) \ > > + ___bpf_nth(_, ##__VA_ARGS__, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) > > wouldn't this conflict if both bpf_tracing.h and bpf_helpers.h are > included in the same file?
Oh, yeah, somehow I thought that double macro definitions wouldn't generate warnings but it would, indeed. Silly me :)
> We can probably guard this block with > custom #ifdef both in bpf_helpers.h and bpf_tracing.h to avoid > dependency on order of includes?
Indeed, I think the cleanest would be: #ifndef ___bpf_concat #define ___bpf_concat(a, b) a ## b #endif #ifndef ___bpf_apply etc...
I'm sending a v2.
| |