From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752836AbdBAQkk (ORCPT ); Wed, 1 Feb 2017 11:40:40 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:64287 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752680AbdBAQki (ORCPT ); Wed, 1 Feb 2017 11:40:38 -0500 From: Arnd Bergmann To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Arnd Bergmann , Ingo Molnar Subject: [PATCH] [RFC v2] sched: make DECLARE_COMPLETION_ONSTACK() work with clang Date: Wed, 1 Feb 2017 17:40:19 +0100 Message-Id: <20170201164030.2379546-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:WwdwRYOdTrkUTCjPkNX6uQaiWsJyDZJEI8ue6yF3FxT2Inj4gHH mOqA/GWdNKpQk7K9pD3sZCVr+CauwSTaRRr+sItsuJyO7qpFMrECxeWZaR7iqN2qoQFU+IU ZJVmEzyYRBFddFpNBjliW+ieHuyeo1ypLDN/4SlFWSBCbwTallxzDMynC+V2zVkRkRTXzWR exHqKbe7ZOspKvd/gHLXQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:q2jJ6tyFxIg=:n5L8fgh4YSGzOTb2Ptssfr WfAA+vzLOjK2uLH8mknYmJr1H4i1dj8AgDx7Rmg0o52uNgoYxtPWm5bLOlkNo2yc5tYKj8Z5p 3h/EGqJ59LOkGaQhEYL+tIwG2yBswCFwZN/Yfc2Q4b59gGjLPbtY3FrxV1VDMv58ix/Wh4Sbh ebYfiKbGwjhWQcOT1vzvzU62tffgnfSPeCVcY6A2mMoV8ns73Mik8V/4ifRDhifRzb4czCRXO d7XGvJv56U+gXO3hGxFI5gsKEc6r6q6TXdWX8pqEF/zeF2YzbJM+H5QTj6tMhuPYOI7CHX5pE FYOgW7xsA1etTWmhE40BK2SahVO7PDx+9uMlJ25Y3jIRzO+4B43wzxNMwW9nEwiVpodHFeege Vsa+O2O2HjeNut3sMJZ1X8EwgQHUm1+r10uuqbeZiOUJZeeiWJgqVa+tvl3vYchkZ9EDStV1w uXkgJyVCcuJiOvgAuoMhsUB3wmhGf4Mos9C8h5tVY51WE8omX/8kokZeuViwyWD+MmbUbnskz BfhgzVveoaGt1pbqqnPKYcmqKOFaTX0CAexkhzu7vNoQdPV/ZzQRtyr/nVCNZ7f9xMZiBNYkm MugU3xfwMonAG3c9uqm60aXTn8IwePFtCE4rOqQ5oPfLjIF/iNlVyo0DKKDKmxbM7oeSEcb8x /kmMzyT4mpPogplm+4E+60vLaukB1Z2yZTmvMcBSjytYMSMviuRifnMtxrXh/G3IawvU= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Arnd Bergmann --- 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