Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4142460pxb; Mon, 1 Feb 2021 13:40:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWrFTsxBTmOeyLiledjDHvCwzZF0skY8keoSSN7/GH5mKrsD4IV2N7ZwnuvPcjv2YY6cxL X-Received: by 2002:a17:906:7cd8:: with SMTP id h24mr19288965ejp.511.1612215646479; Mon, 01 Feb 2021 13:40:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612215646; cv=none; d=google.com; s=arc-20160816; b=DXA3daSlUz1SWjnlGIB35FzXviULDzVF6BTHyd1bSGj83XnsQVA2wzS4ecA6RYlFhV nx3xHPgqgikwO8bFqatJPPddUrg1wsOJqt+ARGdD8Qjp9cBSh/l0CGPl2+D9Xt4fBCuq Oq8h64Agn/825Tgq8OIP+tf12odUv+DY3/Il9CzV34FSzAC8u5tekibp4D83GTOA2hQL 6PrFNNqG5qG0W8TnpXuJD0nDCDAsgkQKkqWlqFdNqC04I4T60Z+c9P6fMGyBEit/k5Oz mRx30MZCY35AvkowpcS+6hY7pxi6fjSebfpRhtrk12WiGusZhNzafB8OIqBQ6ytsOW8/ 8QvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=7hLLuBN3vJnPglMTwqCa1N6UHLHq/lHYgpCcr6vMqlc=; b=HCfZQzjuwaZGC0Je4Tjk6h0nRbpBks6bux9IwPUrkQINPIpl2p7e2aUSNQR4r4zP8s 6vBEjKYVXA1QJJONpO0q5IDwZHFiYDphMkc37Zhe2Hiw3ImR3sjotmg+OLfyWeEto0wn fEcxTaLDxmeet1Z4uFOnx9gaCnPsK3BySN20rczdLZ64ch7yOE2YKZqqxBmboZMMGPjX oxvmYwNnCebOdhDUHGUIDWzPJ8V1+IvdnI+cjBjc2GIKUOfssTh2iFB7uT4K+2ECtPez EzWLbLc6QC4MDNVcsvsocSOCb0wJZd9bd+NPJpSfgYoW1ZtEjb6CSTuYB23Ym4KzjstR jhJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dj14si10902488edb.210.2021.02.01.13.40.19; Mon, 01 Feb 2021 13:40:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231704AbhBAVjQ (ORCPT + 99 others); Mon, 1 Feb 2021 16:39:16 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:58674 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229608AbhBAVjO (ORCPT ); Mon, 1 Feb 2021 16:39:14 -0500 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 111LcKLj027550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 1 Feb 2021 16:38:20 -0500 Received: by cwcc.thunk.org (Postfix, from userid 15806) id F0DAD15C39E2; Mon, 1 Feb 2021 16:38:19 -0500 (EST) Date: Mon, 1 Feb 2021 16:38:19 -0500 From: "Theodore Ts'o" To: Nick Desaulniers Cc: Vinicius Tinti , Christoph Hellwig , Andreas Dilger , Nathan Chancellor , Ext4 Developers List , LKML , clang-built-linux Subject: Re: [PATCH v2] ext4: Enable code path when DX_DEBUG is set Message-ID: References: <20210201003125.90257-1-viniciustinti@gmail.com> <20210201124924.GA3284018@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 01, 2021 at 01:16:19PM -0800, Nick Desaulniers wrote: > I agree; Vinicius, my recommendation for -Wunreachable-* with Clang > was to see whether dead code identified by this more aggressive > diagnostic (than -Wunused-function) was to ask maintainers whether > code identified by it was intentionally dead and if they would > consider removing it. If they say "no," that's fine, and doesn't need > to be pushed. It's not clear to maintainers that: > 1. this warning is not on by default > 2. we're not looking to pursue turning this on by default > > If maintainers want to keep the dead code, that's fine, let them and > move on to the next instance to see if that's interesting (or not). It should be noted that in Documenting/process/coding-style.rst, there is an expicit recommendation to code in a way that will result in dead code warnings: Within code, where possible, use the IS_ENABLED macro to convert a Kconfig symbol into a C boolean expression, and use it in a normal C conditional: .. code-block:: c if (IS_ENABLED(CONFIG_SOMETHING)) { ... } The compiler will constant-fold the conditional away, and include or exclude the block of code just as with an #ifdef, so this will not add any runtime overhead. However, this approach still allows the C compiler to see the code inside the block, and check it for correctness (syntax, types, symbol references, etc). Thus, you still have to use an #ifdef if the code inside the block references symbols that will not exist if the condition is not met. So our process documentation *explicitly* recommends against using #ifdef CONFIG_XXX ... #endif, and instead use something that will -Wunreachable-code-aggressive to cause the compiler to complain. Hence, this is not a warning that we will *ever* be able to enable unconditionally --- so why work hard to remove such warnings from the code? If the goal is to see if we can detect real bugs using this technique, well and good. If the data shows that this warning actually is useful in finding bugs, then manybe we can figure out a way that we can explicitly hint to the compiler that in *this* case, the maintainer actually knew what they were doing. But if an examination of the warnings shows that -Wunreachable-code-aggressive isn't actually finding any real bugs, then perhaps it's not worth it. Cheers, - Ted