From patchwork Fri Jul 19 11:36:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 169243 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3740229ilk; Fri, 19 Jul 2019 04:36:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIelFx2de2cdrGA5DP/vmq8Y8SvKbFZyu2srVm1jEdvmoOKaa+RUmHrZU0J7ivo8Q3Uv0u X-Received: by 2002:a63:30c6:: with SMTP id w189mr51871418pgw.398.1563536215769; Fri, 19 Jul 2019 04:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563536215; cv=none; d=google.com; s=arc-20160816; b=CRWH6vM/YsSgdwf4H59LUB/rlPAP3iaA5ECf9h9+Tw/i0LV5nvEIqWM8pXhwSmOO6E MhhuKb3Zb7mXWyd1t+FPEscJhc1A5v+yYqOdBogioz7hsByVMW3FvY51ZusqChqPUH2o 0r0fJNC1K6H1lhKD7D+QeRSriSVaulVDnAIIAFpI0MUqTPAKDi1CeAX7X0/Npg0li4SA N6alXhsXwUyW0Y6Ccgfg+XYFlnDIGjVObCOMrR1YXDPRXV+dHHLcjovYCgc9UWoyMOPb x/ZhUqA4VjAPscvg5aDkwdJXKb3/ZK5EzZTOVTydJa+owXUMJc3STZ+T19YyXGWXzhd9 y32w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ijNfqXBjc7+uzKftyZA9AeyFP5xg5Ol6L7Nn8StIrXU=; b=rGuqu/aTd9d/+swvXEBt7l2uBrd/OYy/f4j9qtJPLgy+yL06N3NAcxs7NQrl5B7xUw 7FI9WVBStIaVckqPC9qPwGJPdvuTQ+xeQYMadfCqn2+zpSouaMqp+07bdFXjyHv44n/p BVbU5O1CMr3Dwf9KozIVRlRgNy54plG7uf6lQUEAfWCA6Y5tFEHcUJ3JCimvPdnCC0sB 8sdNKwiFHSBU5y/40kGCKmDvO7XyNB+lWIF6VAVVN+JBTzDsVohVzhZAf+g7D/VdgxCk 2400fjRXzHNWN5avLvBKK+FOKuvpP948CMtMy8AUe/i31VHl1Q0WL9n0A7TzmJgjGmnf WYLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6si2363955pgs.96.2019.07.19.04.36.55; Fri, 19 Jul 2019 04:36:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727828AbfGSLgy (ORCPT + 29 others); Fri, 19 Jul 2019 07:36:54 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:49867 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfGSLgw (ORCPT ); Fri, 19 Jul 2019 07:36:52 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1N8oOk-1iTbMT0DmY-015ovh; Fri, 19 Jul 2019 13:36:43 +0200 From: Arnd Bergmann To: Ingo Molnar , Peter Zijlstra Cc: Arnd Bergmann , Nathan Chancellor , Andrew Morton , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] [v2] waitqueue: shut up clang -Wuninitialized warnings Date: Fri, 19 Jul 2019 13:36:00 +0200 Message-Id: <20190719113638.4189771-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:x4+Cu1ASADiy/TbeMxC/JpZ4Hr+PHiYnuXbOqr4YY9JuJSpeng2 3f9Gv8/AO2G4WxmO68xqn9d3RwvDe9mxBGI5CUxFNJPDCg0QiArroD7xGIRZwk+hXUBIXlA 0x3gN1Voe7tuES9yOqd27PpTJZs0P6DO03C0/UY7ekCZfmL1fIHWnwSkqEAygUyvmQnxqoV c5Jecl7JhGU8xwpKrJUbQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:7KfZFP7XH+Q=:Sn529HJGwLvCwrDi6Sgmzi +fliR/ktHw/W5AYSQhDmM/bxLESMIymifufmMeaWI/i5RMLb2RxzaXQcBH6q5nHnYmRcwTsdX Kll+kpldL7cqtevGoLOH33Yqt+6oUCO2uvbleralr8HS1J0WdjAoXA3OhpaQQq8pHUgLERDVf XxtFeemwa27Oe/cDd1i/hMZzlSaui1TvJZLopkdyU0LlMjAv88c/f7JzOs+EcWgrQFDkhImIg HJSXtFBK8Ikd+3v0mFYssMKumwhjMLenmbGH5GNgxjbzim5EBbaibDgoxoqN8Jn5EY+H2Kq6K X0MExrlW22nEiW46wLpYqmpkN7Wygsav9IsAyZVUNKlpAdDG+GkCcZ5Lpborb09YROrXdW7hK bbrIB88olZcwFvfwZZPDrT88aSTicaSSRM9MnZ6jVJsj/6dTH3SrK4bkf87gmyyJEp9y9HYWM pmbv7MI5/m8NAdDweu99zx3PptL2AUlaycJ61aTEYECauAhLjwUfTSvTFGYmgK74zDvusaZcB caF1VFYZsRVX+ey+hNDRs+aL1a2g0jBWdg6nFHOJLmnDv9T+xnTXdQKJ9txjXhkoyoLz08/CD I/4V/uBReZfUHLxqX3x2Cc4c5UXOveCZoY/SeO5q1HWoXBORJVd1DHP0OwpH9pFVtHcgDdfun xhacoCdNcU9kOi/dCWl77O389gffoYnPtnGwo+TFkAI2LM0HZOwSYATF5ljnOmpWEQ1jPT7b/ iVslKq2SbVc0nSP2oQ1UaArDfdXf3cSLtU7M/w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_LOCKDEP is set, every use of DECLARE_WAIT_QUEUE_HEAD_ONSTACK() produces an bogus warning from clang, which is particularly annoying for allmodconfig builds: fs/namei.c:1646:34: error: variable 'wq' is uninitialized when used within its own initialization [-Werror,-Wuninitialized] DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq); ^~ include/linux/wait.h:74:63: note: expanded from macro 'DECLARE_WAIT_QUEUE_HEAD_ONSTACK' struct wait_queue_head name = __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) ~~~~ ^~~~ include/linux/wait.h:72:33: note: expanded from macro '__WAIT_QUEUE_HEAD_INIT_ONSTACK' ({ init_waitqueue_head(&name); name; }) ^~~~ A patch for clang has already been proposed and should soon be merged for clang-9, but for now all clang versions produce the warning in an otherwise (almost) clean allmodconfig build. Link: https://bugs.llvm.org/show_bug.cgi?id=31829 Link: https://bugs.llvm.org/show_bug.cgi?id=42604 Link: https://lore.kernel.org/lkml/20190703081119.209976-1-arnd@arndb.de/ Link: https://reviews.llvm.org/D64678 Link: https://storage.kernelci.org/next/master/next-20190717/arm64/allmodconfig/clang-8/build-warnings.log Suggested-by: Nathan Chancellor Cc: Peter Zijlstra Signed-off-by: Arnd Bergmann --- v2: given that kernelci is getting close to reporting a clean build for clang, I'm trying again with a less invasive approach after my first version was not too popular. --- include/linux/wait.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 2.20.0 Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor diff --git a/include/linux/wait.h b/include/linux/wait.h index ddb959641709..276499ae1a3e 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -70,8 +70,17 @@ extern void __init_waitqueue_head(struct wait_queue_head *wq_head, const char *n #ifdef CONFIG_LOCKDEP # define __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) \ ({ init_waitqueue_head(&name); name; }) -# define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) \ +# if defined(__clang__) && __clang_major__ <= 9 +/* work around https://bugs.llvm.org/show_bug.cgi?id=42604 */ +# define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wuninitialized\"") \ + struct wait_queue_head name = __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) \ + _Pragma("clang diagnostic pop") +# else +# define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) \ struct wait_queue_head name = __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) +# endif #else # define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) DECLARE_WAIT_QUEUE_HEAD(name) #endif