Skip to content

Commit ded6dff

Browse files
anakryikoborkmann
authored andcommitted
libbpf: Fix use #ifdef instead of #if to avoid compiler warning
As reported by Naresh: perf build errors on i386 [1] on Linux next-20220407 [2] usdt.c:1181:5: error: "__x86_64__" is not defined, evaluates to 0 [-Werror=undef] 1181 | #if __x86_64__ | ^~~~~~~~~~ usdt.c:1196:5: error: "__x86_64__" is not defined, evaluates to 0 [-Werror=undef] 1196 | #if __x86_64__ | ^~~~~~~~~~ cc1: all warnings being treated as errors Use #ifdef instead of #if to avoid this. Fixes: 4c59e58 ("libbpf: Add x86-specific USDT arg spec parsing logic") Reported-by: Naresh Kamboju <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent e58c5c9 commit ded6dff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/lib/bpf/usdt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ static int calc_pt_regs_off(const char *reg_name)
11781178
const char *names[4];
11791179
size_t pt_regs_off;
11801180
} reg_map[] = {
1181-
#if __x86_64__
1181+
#ifdef __x86_64__
11821182
#define reg_off(reg64, reg32) offsetof(struct pt_regs, reg64)
11831183
#else
11841184
#define reg_off(reg64, reg32) offsetof(struct pt_regs, reg32)
@@ -1193,7 +1193,7 @@ static int calc_pt_regs_off(const char *reg_name)
11931193
{ {"rbp", "ebp", "bp", "bpl"}, reg_off(rbp, ebp) },
11941194
{ {"rsp", "esp", "sp", "spl"}, reg_off(rsp, esp) },
11951195
#undef reg_off
1196-
#if __x86_64__
1196+
#ifdef __x86_64__
11971197
{ {"r8", "r8d", "r8w", "r8b"}, offsetof(struct pt_regs, r8) },
11981198
{ {"r9", "r9d", "r9w", "r9b"}, offsetof(struct pt_regs, r9) },
11991199
{ {"r10", "r10d", "r10w", "r10b"}, offsetof(struct pt_regs, r10) },

0 commit comments

Comments
 (0)