Message ID | 20210928181127.1392891-1-fallentree@fb.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | BPF |
Headers | show |
Series | [bpf] tools/bpftool: Avoid using "?:" in generated code | expand |
Context | Check | Description |
---|---|---|
bpf/vmtest-bpf | pending | VM_Test |
bpf/vmtest-bpf-PR | pending | PR summary |
netdev/cover_letter | success | Link |
netdev/fixes_present | fail | Series targets non-next tree, but doesn't contain any Fixes tags |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for bpf |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 9 maintainers not CCed: ast@kernel.org kpsingh@kernel.org kafai@fb.com netdev@vger.kernel.org john.fastabend@gmail.com quentin@isovalent.com daniel@iogearbox.net yhs@fb.com songliubraving@fb.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: line length of 92 exceeds 80 columns |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On Tue, Sep 28, 2021 at 11:11 AM Yucong Sun <fallentree@fb.com> wrote: > > "?:" is a GNU C extension, some environment has warning flags for its > use, or even prohibit it directly. This patch avoid triggering these > problems by simply expand it to its full form, no functionality change. > > Signed-off-by: Yucong Sun <fallentree@fb.com> > --- Given there is no bug in the first place, it's not a fix, and thus should target bpf-next tree. > tools/bpf/bpftool/gen.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c > index d40d92bbf0e4..85071b6fa4ad 100644 > --- a/tools/bpf/bpftool/gen.c > +++ b/tools/bpf/bpftool/gen.c > @@ -803,7 +803,7 @@ static int do_skeleton(int argc, char **argv) > } \n\ > \n\ > err = %1$s__create_skeleton(obj); \n\ > - err = err ?: bpf_object__open_skeleton(obj->skeleton, opts);\n\ > + err = err ? err : bpf_object__open_skeleton(obj->skeleton, opts);\n\ err+err+err in one row looks quite bad. If we can't use ?: for shortness, maybe let's just do if (!err) err = <some operation> It's more verbose than the original version, but it's more obvious and sort of canonical C? > if (err) \n\ > goto err_out; \n\ > \n\ > -- > 2.30.2 >
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c index d40d92bbf0e4..85071b6fa4ad 100644 --- a/tools/bpf/bpftool/gen.c +++ b/tools/bpf/bpftool/gen.c @@ -803,7 +803,7 @@ static int do_skeleton(int argc, char **argv) } \n\ \n\ err = %1$s__create_skeleton(obj); \n\ - err = err ?: bpf_object__open_skeleton(obj->skeleton, opts);\n\ + err = err ? err : bpf_object__open_skeleton(obj->skeleton, opts);\n\ if (err) \n\ goto err_out; \n\ \n\
"?:" is a GNU C extension, some environment has warning flags for its use, or even prohibit it directly. This patch avoid triggering these problems by simply expand it to its full form, no functionality change. Signed-off-by: Yucong Sun <fallentree@fb.com> --- tools/bpf/bpftool/gen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)