Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4143642pxb; Mon, 1 Feb 2021 13:43:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJy03xggAoKYh4c+uHabEnJtNrSRPIurViB2U0ZVb5Lj9ocP5mZcVTdZMxR6TNrXjJ/c6nZf X-Received: by 2002:aa7:c354:: with SMTP id j20mr3341154edr.351.1612215780477; Mon, 01 Feb 2021 13:43:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612215780; cv=none; d=google.com; s=arc-20160816; b=q8KAxQQ5UsO0iegpnecVZGR0QwbiprTZPVExj1iamJEHXds5fUAt0qvNRfTw6Kau/m 0OfsiTiuegf56B7uQtRWMFU8QkObKYz8UatTXUOSTZcd0vicaOB3B6BvEEJ66/8zdyoN k4A5r2/1pL3ynSZwRb1WDdkY+YMV7RwO/NSOGLI5jNmNFsmvGFPPEcTLwrIX0V7pm5vv +VIsTQ4Avw1IUgXZjGaGISCOY/FCfk6jLNzdvMq0HjmOI9ViKHElLGNYNCeOms0IVUkW LLL+qOULUW+4BhNU9Ves8G45NIsIMOjm7uHxuL5h1aT3qxLMp4YN0h3wNS01uAK1bwFT KdFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=omXjXu9fWF573tSXobtbnzQwWlvXEFA3qfAQWygo3mA=; b=tXNH9IdrvzaCJEaMy8tL/bE+AJd/ac+jlUxCnK3DpNnV7T/r1UqS4AFfySjqZYoRgw arfbkm2Ye1ZlgqAkEhjBAwa8zJFOz3GSu3akANHZ7577OtPv0T1A/Lr09WdmT3UITt+f bCNri/8EeRuOlRrsm0ip9pFF8pYBvn9NmxuISjdMSbi+BmX5/MDDQ5JnGDC1NsttlLkL lnbVatNogm9kf4lMTduCnrITiz5lFKf/aPFA7//Qi7lneXSP4gm3A1UkJ/upYIRxohBx sWlWq2GfrAOrgQSOogIxQCHVp8meTNoFPxtFyKdDFJcrrTTtPb/if37mmVqL6qf1tLaG x7Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XVEcRzdK; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si10685149ejh.224.2021.02.01.13.42.34; Mon, 01 Feb 2021 13:43:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XVEcRzdK; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229816AbhBAVma (ORCPT + 99 others); Mon, 1 Feb 2021 16:42:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbhBAVm1 (ORCPT ); Mon, 1 Feb 2021 16:42:27 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19D86C061756 for ; Mon, 1 Feb 2021 13:41:47 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id o20so12553675pfu.0 for ; Mon, 01 Feb 2021 13:41:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=omXjXu9fWF573tSXobtbnzQwWlvXEFA3qfAQWygo3mA=; b=XVEcRzdKTgv6oWVIC7ldetczFBWdAjRFmTpbYbTZlHtB6H7aUwHVj0akiYZk5N2RM2 fOIZIALS6ikaDlMI//E6lPAcXY6Z+PjbTQ5gZXCdWTmqq1DLJfR57yiEVRt3nxeSkvAb tJGHfp/uPFelHfb5tuN3owSy7DvcjlthJ+Dd2X/R7foMOSdoK+NL6nfpmRnHRewU2l9k 6IDMnINUEGsGQZLUgWtcVIamUe5SDNfH89cT6pZZeJW1hckLpPkvRu3q0s+WvmxRlyE7 Jf0wqrbeZ+cAii6BVkF8c66ir5MuHQlAkBd+pusa8d9Q1J6BGTc1POEP3BipeTjEk+Bz S4cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=omXjXu9fWF573tSXobtbnzQwWlvXEFA3qfAQWygo3mA=; b=oARAePNVwPgRe1kw/SdvY7iY/eA43cO0WKZPnW1cRokSS6KP4IVozpq5sXVvGhoZvQ /xMVWVfYB80ubnO8nL/N3DyG9uq/hQVva9HbQ2s281s9IHduWUq8D7g5yLRLeId69tCe 0VCvZ872DCk99jLNC8yN1D2hGXcV5BdmP3I6nWT7TRy4FQorsaroyAq950m+1OJMWgt7 +aS/+TrSixIFSfAUjE6HGHiAr9ocXC11KZ6jtILgCssIJEV/n+ekgpS1g3TlUPbtQ2P8 W+wjU6pc7Kgf0NovMAaje6pi4SyYMeHIeCdSIkYu2y/INmSl4gUigpMsbjX9GUtT7NhF Q8Fg== X-Gm-Message-State: AOAM5334nn5k1SGccGEFWnssqnNqOIm/NVjXbpCChbxOTbSqo4csDJGQ 7DUSpXWPVPf0ag4ONHbRuMdnosZpXwiZpZsLLJYHJw== X-Received: by 2002:a65:4201:: with SMTP id c1mr18769495pgq.10.1612215706453; Mon, 01 Feb 2021 13:41:46 -0800 (PST) MIME-Version: 1.0 References: <20210201003125.90257-1-viniciustinti@gmail.com> <20210201124924.GA3284018@infradead.org> In-Reply-To: From: Nick Desaulniers Date: Mon, 1 Feb 2021 13:41:35 -0800 Message-ID: Subject: Re: [PATCH v2] ext4: Enable code path when DX_DEBUG is set To: "Theodore Ts'o" Cc: Vinicius Tinti , Christoph Hellwig , Andreas Dilger , Nathan Chancellor , Ext4 Developers List , LKML , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Feb 1, 2021 at 1:38 PM Theodore Ts'o wrote: > > 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. I agree. > > Hence, this is not a warning that we will *ever* be able to enable > unconditionally --- I agree. > 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 Because not every instance of -Wunreachable-code-aggressive may be that pattern. > 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. I agree. Hence the examination of instances found by Vinicius. -- Thanks, ~Nick Desaulniers