From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>
Cc: <andrii@kernel.org>, <kernel-team@fb.com>,
Naresh Kamboju <naresh.kamboju@linaro.org>,
Stephen Rothwell <sfr@canb.auug.org.au>
Subject: [PATCH bpf-next] libbpf: fix use #ifdef instead of #if to avoid compiler warning
Date: Thu, 7 Apr 2022 13:38:42 -0700 [thread overview]
Message-ID: <20220407203842.3019904-1-andrii@kernel.org> (raw)
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.
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: 4c59e584d158 ("libbpf: Add x86-specific USDT arg spec parsing logic")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/lib/bpf/usdt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c
index bb1e88613343..b699e720136a 100644
--- a/tools/lib/bpf/usdt.c
+++ b/tools/lib/bpf/usdt.c
@@ -1178,7 +1178,7 @@ static int calc_pt_regs_off(const char *reg_name)
const char *names[4];
size_t pt_regs_off;
} reg_map[] = {
-#if __x86_64__
+#ifdef __x86_64__
#define reg_off(reg64, reg32) offsetof(struct pt_regs, reg64)
#else
#define reg_off(reg64, reg32) offsetof(struct pt_regs, reg32)
@@ -1193,7 +1193,7 @@ static int calc_pt_regs_off(const char *reg_name)
{ {"rbp", "ebp", "bp", "bpl"}, reg_off(rbp, ebp) },
{ {"rsp", "esp", "sp", "spl"}, reg_off(rsp, esp) },
#undef reg_off
-#if __x86_64__
+#ifdef __x86_64__
{ {"r8", "r8d", "r8w", "r8b"}, offsetof(struct pt_regs, r8) },
{ {"r9", "r9d", "r9w", "r9b"}, offsetof(struct pt_regs, r9) },
{ {"r10", "r10d", "r10w", "r10b"}, offsetof(struct pt_regs, r10) },
--
2.30.2
next reply other threads:[~2022-04-07 20:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 20:38 Andrii Nakryiko [this message]
2022-04-07 21:40 ` [PATCH bpf-next] libbpf: fix use #ifdef instead of #if to avoid compiler warning patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220407203842.3019904-1-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=naresh.kamboju@linaro.org \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox