From: Vinzenz 'evilissimo' Feenstra <vfeenstr@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, qemu-trivial@nongnu.org,
Vinzenz Feenstra <vfeenstr@redhat.com>
Subject: [Qemu-devel] [PATCH] checkpatch: Supress warning in function pointer typedefs
Date: Thu, 16 Mar 2017 12:14:16 +0100 [thread overview]
Message-ID: <20170316111416.25587-1-vfeenstr@redhat.com> (raw)
From: Vinzenz Feenstra <vfeenstr@redhat.com>
When importing dynamically functions via `GetProcAddress` in windows
related code, it is quite common to make a typedef for the resulting
function pointer. When the function to be imported, has a stdcall
calling convention, usually the `WINAPI` macro is used. This patch adds an
exception in the checkpatch.pl script to allow the calling convention
specification in function pointer typedefs, to be `WINAPI`.
Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com>
---
scripts/checkpatch.pl | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f084542..33bf585 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1774,7 +1774,14 @@ sub process {
# likely a typedef for a function.
} elsif ($ctx =~ /$Type$/) {
- } else {
+ # If this is a typedef we need to allow WINAPI as a calling
+ # convention. Even though there should be only one space around the
+ # star, we allow none or any, to suppress the following warning.
+ # The check for the number of spaces around the star is checked
+ # elsewhere.
+ } elsif($ctx =~ /^\s*typedef\s+$Type\(WINAPI\s*\*\s*$Ident\)/) {
+
+ } else {
ERROR("space prohibited between function name and open parenthesis '('\n" . $herecurr);
}
}
--
2.9.3
next reply other threads:[~2017-03-21 12:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-16 11:14 Vinzenz 'evilissimo' Feenstra [this message]
2017-03-21 12:37 ` [Qemu-devel] [PATCH] checkpatch: Supress warning in function pointer typedefs Peter Maydell
2017-03-21 13:01 ` Vinzenz Feenstra
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=20170316111416.25587-1-vfeenstr@redhat.com \
--to=vfeenstr@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).