Skip to contentSkip to conversation

net/mac80211/./trace.h:253:1: warning: redefinition of typedef 'btf_trace_local_only_evt' is a C11 feature

PATCH Alexei Starovoitov 2 participants 2 messages Oct 14, 2019 2 messages not in the archive BPF

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 201910032202.OVnkgkNP%[email protected]

A message that is not in the archive (sent off-list or not yet received): 20191011200059.GA30072@ubuntu-m2-xlarge-x86

#2 lore raw
Quoted 33 lines · Nathan Chancellor
Quoted 22 lines · kbuild test robot

CC: [email protected]
TO: Alexei Starovoitov <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git btf_vmlinux
head:   cc9b0a180111f856b93a805fdfc2fb288c41fab2
commit: 82b70116b6ba453e1dda06c7126e100d594b8e0a [1/7] bpf: add typecast to help vmlinux BTF generation
config: x86_64-rhel-7.6 (attached as .config)
compiler: clang version 10.0.0 (git://gitmirror/llvm_project 38ac6bdb83a9bb76c109901960c20d1714339891)
reproduce:
        git checkout 82b70116b6ba453e1dda06c7126e100d594b8e0a
        # save the attached .config to linux build tree
        make ARCH=x86_64

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

In file included from net/mac80211/trace.c:11:
In file included from net/mac80211/./trace.h:2717:
In file included from include/trace/define_trace.h:104:
In file included from include/trace/bpf_probe.h:110:

Quoted 8 lines
Quoted 1 line
Quoted 1 line

net/mac80211/./trace.h:253:1: warning: redefinition of typedef 'btf_trace_local_only_evt' is a C11 feature [-Wtypedef-redefinition]

DEFINE_EVENT(local_only_evt, drv_start,
^
include/trace/bpf_probe.h:104:2: note: expanded from macro 'DEFINE_EVENT'
__DEFINE_EVENT(template, call, PARAMS(proto), PARAMS(args), 0) ^
include/trace/bpf_probe.h:77:16: note: expanded from macro '__DEFINE_EVENT'
typedef void (*btf_trace_##template)(void *__data, proto); \

Quoted 8 lines

Hi Alexei,

The 0day team has been running clang builds for us for a little bit and this one popped up. It looks like there are certain tracepoints that use the same template so clang warns because there are two identical typedefs. Is there any way to improve this so we don't get noisey builds? This still occurs as of your latest btf_vmlinux branch even though this report is from a week ago.

Thanks for headsup. That was indeed a valid bug in my branch. Interestingly gcc didn't complain.
I knew that 0day bot is testing my development tree, but I didn't know it's doing it with clang.
And for some reason I didn't receive any reports about this breakage.
More so I got 'build success' email from 0day for my branch. Something to improve in the bot, I guess.

If you're curious the fix was:
-typedef void (*btf_trace_##template)(void *__data, proto); \
+typedef void (*btf_trace_##call)(void *__data, proto); \

I forced pushed my btf_vmlinux branch.
Please let me know if you still see this issue.

Thanks!

#3 lore raw
Quoted 57 lines · Alexei Starovoitov
Quoted 33 lines · Nathan Chancellor
Quoted 22 lines · kbuild test robot

CC: [email protected]
TO: Alexei Starovoitov <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git btf_vmlinux
head:   cc9b0a180111f856b93a805fdfc2fb288c41fab2
commit: 82b70116b6ba453e1dda06c7126e100d594b8e0a [1/7] bpf: add typecast to help vmlinux BTF generation
config: x86_64-rhel-7.6 (attached as .config)
compiler: clang version 10.0.0 (git://gitmirror/llvm_project 38ac6bdb83a9bb76c109901960c20d1714339891)
reproduce:
        git checkout 82b70116b6ba453e1dda06c7126e100d594b8e0a
        # save the attached .config to linux build tree
        make ARCH=x86_64

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

In file included from net/mac80211/trace.c:11:
In file included from net/mac80211/./trace.h:2717:
In file included from include/trace/define_trace.h:104:
In file included from include/trace/bpf_probe.h:110:

Quoted 8 lines
Quoted 1 line
Quoted 1 line

net/mac80211/./trace.h:253:1: warning: redefinition of typedef 'btf_trace_local_only_evt' is a C11 feature [-Wtypedef-redefinition]

DEFINE_EVENT(local_only_evt, drv_start,
^
include/trace/bpf_probe.h:104:2: note: expanded from macro 'DEFINE_EVENT'
__DEFINE_EVENT(template, call, PARAMS(proto), PARAMS(args), 0) ^
include/trace/bpf_probe.h:77:16: note: expanded from macro '__DEFINE_EVENT'
typedef void (*btf_trace_##template)(void *__data, proto); \

Quoted 8 lines

Hi Alexei,

The 0day team has been running clang builds for us for a little bit and this one popped up. It looks like there are certain tracepoints that use the same template so clang warns because there are two identical typedefs. Is there any way to improve this so we don't get noisey builds? This still occurs as of your latest btf_vmlinux branch even though this report is from a week ago.

Thanks for headsup. That was indeed a valid bug in my branch. Interestingly gcc didn't complain.
I knew that 0day bot is testing my development tree, but I didn't know it's doing it with clang.
And for some reason I didn't receive any reports about this breakage.
More so I got 'build success' email from 0day for my branch. Something to improve in the bot, I guess.

If you're curious the fix was:

(quoted diff) +1 -1
-typedef void (*btf_trace_##template)(void *__data, proto);             \
+typedef void (*btf_trace_##call)(void *__data, proto);                 \
Quoted 4 lines

I forced pushed my btf_vmlinux branch.
Please let me know if you still see this issue.

Thanks!

Yes, right now, the 0day build reports for clang are only getting sent to our mailing list ([email protected]) because there is a lot of overlap with GCC. We have been manually triaging the build warnings and forwarding them along. I think the 0day maintainers eventually intend to make these emails more public (maybe have an opt in system when maintainers want to see clang build results, with the understanding there might be duplicates?). Unfortunately, I cannot speak for them.

I brought down your branch and built the net/ subdirectory with the config that produced this warning and I do not see any warnings. Thanks for the quick response!

Nathan