From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
To: kvm-ppc@vger.kernel.org
Subject: Subject: [PATCH] kvmppc: kvmtrace: fix TRACE_REC_* macro definitions
Date: Wed, 02 Jul 2008 11:55:31 +0000 [thread overview]
Message-ID: <486B6CB3.5030501@linux.vnet.ibm.com> (raw)
Subject: [PATCH] kvmppc: kvmtrace: fix TRACE_REC_* macro definitions
From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
The current patch kvm_trace_nobitfields.diff in the kvmppc.hg-dev repo
doesn't compile.
code:
rec.rec_val |= TRACE_REC_EVENT_ID(va_arg(*args, u32));
+makro
#define TRACE_REC_EVENT_ID (val) \
(0x0fffffff & (val))
extended to:
rec.rec_val |= (val) (0x0fffffff & (val))(__builtin_va_arg(*args,u32));
failing with:
kvm_trace.c: In function 'kvm_add_trace':
kvm_trace.c:66: error: 'val' undeclared (first use in this function)
kvm_trace.c:66: error: (Each undeclared identifier is reported only once
kvm_trace.c:66: error: for each function it appears in.)
Obviously caused by the blank between macro definition and (val) which makes
it a non-parameter macro.
Additionally the two macro definitions below don't put () around the
parameter
which is one of the golden macro rules to keep operator precedence
independent
to what someone passes as argument to your macro.
This patch fixes both issues, Hollis could you please fold it into
"kvm_trace_nobitfields.diff" and add my signed-off-by then.
Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
---
[diffstat]
kvm.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
[diff]
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -331,12 +331,12 @@ struct kvm_trace_rec {
} u;
} __attribute__((packed));
-#define TRACE_REC_EVENT_ID (val) \
+#define TRACE_REC_EVENT_ID(val) \
(0x0fffffff & (val))
-#define TRACE_REC_NUM_DATA_ARGS (val) \
- (0x70000000 & (val << 28))
-#define TRACE_REC_TCS (val) \
- (0x80000000 & (val << 31))
+#define TRACE_REC_NUM_DATA_ARGS(val) \
+ (0x70000000 & ((val) << 28))
+#define TRACE_REC_TCS(val) \
+ (0x80000000 & ((val) << 31))
#define KVMIO 0xAE
--
Grüsse / regards,
Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization
next reply other threads:[~2008-07-02 11:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-02 11:55 Christian Ehrhardt [this message]
2008-07-02 18:05 ` Subject: [PATCH] kvmppc: kvmtrace: fix TRACE_REC_* macro Hollis Blanchard
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=486B6CB3.5030501@linux.vnet.ibm.com \
--to=ehrhardt@linux.vnet.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.