Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

libbpf: Do not use btf_dump__new() macro in C++ mode

As reported in here [0], C++ compilers don't support
__builtin_types_compatible_p(), so at least don't screw up compilation
for them and let C++ users pick btf_dump__new vs
btf_dump__new_deprecated explicitly.

[0] https://github.com/libbpf/libbpf/issues/283#issuecomment-986100727

Fixes: 6084f5dc928f ("libbpf: Ensure btf_dump__new() and btf_dump_opts are future-proof")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20211223131736.483956-1-jolsa@kernel.org

authored by

Jiri Olsa and committed by
Andrii Nakryiko
5652b807 1a1a0b03

+6
+6
tools/lib/bpf/btf.h
··· 313 313 * 314 314 * The rest works just like in case of ___libbpf_override() usage with symbol 315 315 * versioning. 316 + * 317 + * C++ compilers don't support __builtin_types_compatible_p(), so at least 318 + * don't screw up compilation for them and let C++ users pick btf_dump__new 319 + * vs btf_dump__new_deprecated explicitly. 316 320 */ 321 + #ifndef __cplusplus 317 322 #define btf_dump__new(a1, a2, a3, a4) __builtin_choose_expr( \ 318 323 __builtin_types_compatible_p(typeof(a4), btf_dump_printf_fn_t) || \ 319 324 __builtin_types_compatible_p(typeof(a4), void(void *, const char *, va_list)), \ 320 325 btf_dump__new_deprecated((void *)a1, (void *)a2, (void *)a3, (void *)a4), \ 321 326 btf_dump__new((void *)a1, (void *)a2, (void *)a3, (void *)a4)) 327 + #endif 322 328 323 329 LIBBPF_API void btf_dump__free(struct btf_dump *d); 324 330