Hiding the only using of bpf_link_type_strs[] in an #ifdef causes an unused-variable warning: kernel/bpf/syscall.c:2280:20: error: 'bpf_link_type_strs' defined but not used [-Werror=unused-variable] 2280 | static const char *bpf_link_type_strs[] = { Move the definition into the same #ifdef.
Unified · Split
| @@ -2271,6 +2271,7 @@ static int bpf_link_release(struct inode *inode, struct file *filp) · 2270 unmodified lines | ||
| 2271 | 2271 | return 0; |
| 2272 | 2272 | } |
| 2273 | 2273 | |
| 2274 | +#ifdef CONFIG_PROC_FS | |
| 2274 | 2275 | #define BPF_PROG_TYPE(_id, _name, prog_ctx_type, kern_ctx_type) |
| 2275 | 2276 | #define BPF_MAP_TYPE(_id, _ops) |
| 2276 | 2277 | #define BPF_LINK_TYPE(_id, _name) [_id] = #_name, |
| @@ -2282,7 +2283,6 @@ static const char *bpf_link_type_strs[] = { · 5 unmodified lines | ||
| 2282 | 2283 | #undef BPF_MAP_TYPE |
| 2283 | 2284 | #undef BPF_LINK_TYPE |
| 2284 | 2285 | |
| 2285 | −#ifdef CONFIG_PROC_FS | |
| 2286 | 2286 | static void bpf_link_show_fdinfo(struct seq_file *m, struct file *filp) |
| 2287 | 2287 | { |
| 2288 | 2288 | const struct bpf_link *link = filp->private_data; |