-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clang format 14 #8
Conversation
clang-format-14 is support by ubuntu-24.04.
libbpfgo.c
Outdated
@@ -6,8 +6,8 @@ extern void perfLostCallback(void *ctx, int cpu, __u64 cnt); | |||
extern int ringbufferCallback(void *ctx, void *data, size_t size); | |||
|
|||
int libbpf_print_fn(enum libbpf_print_level level, // libbpf print level | |||
const char *format, // format used for the msg | |||
va_list args) // args used by format | |||
const char *format, // format used for the msg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do prefer the old indentation, it resembles Golang formatting. Which clang-format option should be returned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's AlignTrailingComments
.
libbpfgo.c
Outdated
struct bpf_iter_attach_opts * | ||
cgo_bpf_iter_attach_opts_new(__u32 map_fd, enum bpf_cgroup_iter_order order, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can notice that some wrapping is being done due to the limit PenaltyReturnTypeOnItsOwnLine
. So some functions with the small signature has the return type and name in the same line and others will have it with break line.
That's my proposal, enforce it as FreeBSD does: https://github.com/freebsd/freebsd-src/blob/main/.clang-format.
Can we give it a try, disregarding the linux one?
libbpfgo.c
Outdated
struct bpf_map_create_opts *cgo_bpf_map_create_opts_new( | ||
__u32 btf_fd, __u32 btf_key_type_id, __u32 btf_value_type_id, | ||
__u32 btf_vmlinux_value_type_id, __u32 inner_map_fd, __u32 map_flags, | ||
__u64 map_extra, __u32 numa_node, __u32 map_ifindex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's other oddity (ugliness)... some functions will align its params using the first line, others like this will break to the next.
I've pushed a modified PR, without touching |
No description provided.