From: Arnd Bergmann <arnd@arndb.de>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, Arnd Bergmann <arnd@arndb.de>,
Ingo Molnar <mingo@elte.hu>
Subject: [PATCH] [RFC v2] sched: make DECLARE_COMPLETION_ONSTACK() work with clang
Date: Wed, 1 Feb 2017 17:40:19 +0100 [thread overview]
Message-ID: <20170201164030.2379546-1-arnd@arndb.de> (raw)
Building with clang, we get a warning for each use of COMPLETION_INITIALIZER_ONSTACK, e.g.:
block/blk-exec.c:103:29: warning: variable 'wait' is uninitialized when used within its own initialization [-Wuninitialized]
include/linux/completion.h:61:58: note: expanded from macro 'DECLARE_COMPLETION_ONSTACK'
include/linux/completion.h:34:29: note: expanded from macro 'COMPLETION_INITIALIZER_ONSTACK'
This seems to be a problem in clang, but it's relatively easy to work around
by changing the assignment.
I filed a bug against clang for the warning, but if we want to support old versions,
we may want this change as well.
I have not yet checked if the new version produces worse object code.
Link: https://llvm.org/bugs/show_bug.cgi?id=31829
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: send the correct patch
---
include/linux/completion.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 5d5aaae3af43..fa5d3efaba56 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -31,7 +31,7 @@ struct completion {
{ 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
#define COMPLETION_INITIALIZER_ONSTACK(work) \
- ({ init_completion(&work); work; })
+ (*init_completion(&work))
/**
* DECLARE_COMPLETION - declare and initialize a completion structure
@@ -70,10 +70,11 @@ struct completion {
* This inline function will initialize a dynamically created completion
* structure.
*/
-static inline void init_completion(struct completion *x)
+static inline struct completion *init_completion(struct completion *x)
{
x->done = 0;
init_waitqueue_head(&x->wait);
+ return x;
}
/**
--
2.9.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
reply other threads:[~2017-02-01 16:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20170201164030.2379546-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
/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