From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752704AbdBAQeh (ORCPT ); Wed, 1 Feb 2017 11:34:37 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:57241 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751289AbdBAQeg (ORCPT ); Wed, 1 Feb 2017 11:34:36 -0500 From: Arnd Bergmann To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Arnd Bergmann , Ingo Molnar Subject: [PATCH] [RFC] sched: make DECLARE_COMPLETION_ONSTACK() work with clang Date: Wed, 1 Feb 2017 17:34:14 +0100 Message-Id: <20170201163426.2287910-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:oniLQqmssXKnk+FY6bITNFdvC9dwnwScWy7fy+UPE66Bim+KknW rscf/mPFKL7rwYCmrits93NB8qyGkuyauMEfof6iWEbzTIy2qbPQPATij47SzI96BlryLYN s3G0CCah21lefFA0DLzjubXOyQgupqdCe6MxiBNLDZASTaQBRLjj99NifRi8vUgKywHS3nk jFK2m1UbjHaYc86/u/18w== X-UI-Out-Filterresults: notjunk:1;V01:K0:FkznGQaSZIs=:4g5BZefo4NroMXULGaxyhM QPUY9ZOgjjGUwv7qa9u+cCcP35X6yUNCBFJCDcdXjQEIjA+ekUH50ql5XGBzPoHug/AXiQ+CZ 94bstXhQMO0bGDiYKOYxlebu++yfUh0fH3Pj4Q/u1lSMdPhIn/B9BpZ1O6snyfTxTlkojFAP+ 3jEYbiDezEH6Wv3h8sDUhI7iFUm8rt/9RNOPnrGmM69PaZMFpFtIy1QP/AugehygBsd6nR5fi CgQ7/4weCohkuQS+9ZgSJ0WrXVaQvUMAdCVImuQLBeJo6zMqgjlI4vxabgjEzVFcpnZiQKdv6 VRyk1FCwaChg76yzcVP4hL3PRE1Q7TuvUwsA495JF+HX5+ENeSkj7pLF4cAnbZEAv/HtqNFMz Hau0WBTbNG/PWn0wgRij4PVQqNjevbIEZ45/TfgJxW/mTtiYtB7DEenbVi6j0kLU1xC6JktAt uA+02rUOlUF4Sj6bYJuOCqTXtdRLZZnbiniEQA1SQ1vx5xS4dYq6ewkH6tpbynOXmskehCXRz AIZdTVOpT/WEg5YMwUkB9Vu2kZv971YN50snbdM3RN5ztDsWgfd+Ng2n4GI3ItC/ow+35CS12 AbXpI1n3ts4deumuwHLalnUGdfUA/yBf8CxpI9uiwBLKALxQlhQYt6+RfiXrod8G0+in/B2TJ ELajL2eTmcRlpLwLpSI5X4ihI9u/yOtCOxOzndkK9SkCMWT/Hv54FgDAHrmsbwHXlInQ= 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 --- include/linux/completion.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/completion.h b/include/linux/completion.h index fa5d3efaba56..5d5aaae3af43 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)) + ({ init_completion(&work); work; }) /** * DECLARE_COMPLETION - declare and initialize a completion structure @@ -70,11 +70,10 @@ struct completion { * This inline function will initialize a dynamically created completion * structure. */ -static inline struct completion *init_completion(struct completion *x) +static inline void init_completion(struct completion *x) { x->done = 0; init_waitqueue_head(&x->wait); - return x; } /** -- 2.9.0