On 4/26/23 8:53 AM, Stanislav Fomichev wrote:
From: Peng Wei <pengweiprc@xxxxxxxxxx> Compiling C++ BPF programs with existing bpf_helper_defs.h is not possible due to stricter C++ type conversions. C++ complains about (void *) type conversions: $ clang++ --include linux/types.h ./tools/lib/bpf/bpf_helper_defs.h bpf_helper_defs.h:57:67: error: invalid conversion from ‘void*’ to ‘void* (*)(void*, const void*)’ [-fpermissive] 57 | static void *(*bpf_map_lookup_elem)(void *map, const void *key) = (void *) 1; | ^~~~~~~~~~ | | | void* Extend bpf_doc.py to use proper function type instead of void. Before: static void *(*bpf_map_lookup_elem)(void *map, const void *key) = (void *) 1; After: static void *(*bpf_map_lookup_elem)(void *map, const void *key) = (void *(*)(void *map, const void *key)) 1; v2: - add clang++ invocation example (Yonghong) Cc: Yonghong Song <yhs@xxxxxxxx> Signed-off-by: Peng Wei <pengweiprc@xxxxxxxxxx> Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxx>
Acked-by: Yonghong Song <yhs@xxxxxx>