Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1516052lqp; Mon, 15 Apr 2024 08:36:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWkekpgokEh5EfNtpk4gRef3uCYZHoBt5RI2vU/mFb5NPavL6dcZ0QcqvzyoNnPv8T8ClX5Yky7JeWLluxe68AOWa6hQGz3m60DlaUD8Q== X-Google-Smtp-Source: AGHT+IFSqaJWhAOXDYnHzUAOvPX68xbmG1Gfd5i5VhOd4k8kXrMVImm4tFto7huwupJtcjHS9agr X-Received: by 2002:a50:cd82:0:b0:56e:60d:9b16 with SMTP id p2-20020a50cd82000000b0056e060d9b16mr7706721edi.6.1713195362008; Mon, 15 Apr 2024 08:36:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713195361; cv=pass; d=google.com; s=arc-20160816; b=ahhS9TUhz9T8Io0Lhl74L54vktok3b5l7nHJv5CjZW4Z4LM+ByOTG4seIp7kJzfNWS Vlqvu6XF2G4RGRPsGwHcqeMxvP8Kzdg1WEyjxB9ZBQcLl4IpA/ZnGkFmbY5WAPF7MC59 HORVc4s5lDFFcn5nGrEJCnVwxGeDnTSLyLuycaTOK6Wbom43I07yq/yV7B11871mbIol Vbjt7nXzcpo9t53dDJ40pABmFLGDQFVAykY2TJanEPdxMYhVIQBHwqQgGmUNxIXvDxRy h5ppmljosqU1A1HKd2suwCBeMxmCNbAxyHAtSUy1P4yAWQMwngyX8uF/b2yjbs/axzRx wifw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=NKyHVd6O5GxyMIbK6qGm5hs8jJkIZEH0cqFINvkbpUA=; fh=y0jNqSeVvVNnTq6fyGFqJW1N3as51YOouJKwTle/okE=; b=cNKoP2I67OLnFD34+HBebtHsr2+mQ5/3KwuxgpywSYAZwoYBQKN9/AGz2FKxBteIEa B69Z3ota8hEkPadu+GhFiKIhoOItfz3u6dGmg7EFqKTpKxskPcLQODfUxGNhtnaYF1d7 7ZZjMR90bSX0SUmWzfQUhNs2UoN3zVmoc4gXoXNOLaR98jAVnpN7lI8iSRufKLB3gx2s ewI+KD5JOgNNr264Vf901YMFd+JkYSoI2JkpCg/viAFxzuqpdPnP1ETYLf1hGwOT6/l3 NCsDEQP1s6TlIQ7H79s0NaezvNIRSMKOMK7ptbv8odrfAQ0yRnO7gvMzM4tzi+bDoxDm gVuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=nsCdW1U5; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="s/cIWt86"; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-145473-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145473-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n28-20020a50935c000000b00570005a3610si3504188eda.398.2024.04.15.08.36.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 08:36:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145473-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=nsCdW1U5; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="s/cIWt86"; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-145473-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145473-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8E9F81F2187A for ; Mon, 15 Apr 2024 15:36:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F7D479DDB; Mon, 15 Apr 2024 15:35:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="nsCdW1U5"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="s/cIWt86" Received: from fout5-smtp.messagingengine.com (fout5-smtp.messagingengine.com [103.168.172.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBEB378C78; Mon, 15 Apr 2024 15:35:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713195354; cv=none; b=eyogk7nOrkATzI3LWM/hWLkw42uuk7SVV8UxUOVc7kT+k5GYnF2EI82pv23IleSM06Np5sNbqqDYUpe5dnotVHJvWiIxnyyOiueKxFvyz+bjKHYG+KZ4LxxpGVL0aMU1nTH451maWvMOwuJ1dslRYe/q3jS/S/Pn11cF8tiganc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713195354; c=relaxed/simple; bh=+Hr1RSEs61KbR8I+XiQic0F3lvj+u2G4lhHUoJS4y8s=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=quGtutM/NV1sXomgVEROG4VKJ0qHV7S52XKs7CNWhohi/O6vX1EVmSU9an2xGXpnztFfCbmepUgnRNfJTU5SMD0rJtzcA/v2aWYWYDThSMu68RIa52s1JxQvKmzHMtf28wPThUGnExsK+4wl4spx22HOFUo2hPx/dnvfE/SYUCc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=nsCdW1U5; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=s/cIWt86; arc=none smtp.client-ip=103.168.172.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id E4015138008C; Mon, 15 Apr 2024 11:35:51 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 15 Apr 2024 11:35:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1713195351; x=1713281751; bh=NKyHVd6O5G xyMIbK6qGm5hs8jJkIZEH0cqFINvkbpUA=; b=nsCdW1U51jfzeMkyZHn0Fbb0ao ikCGQ2m8sEt8IzFsf2Y91pKjA743pr4et54buHMJ18+wfoUyu3+1T7yMo0N3EMsh hWjPJIREZSzKTcUCEwZ+QOl5GTgcvtYkLYF8kUBxyhPLhWyBqgrc2SVV9U17rNDy uauUhhaFKZCVAoxZz5Ay8zxq6zC5i36nA5JnhbLa/v7qbxKR6I4MkRKkYjADdOwu 4G7RGEeqWX6T097kMoVwWJ+r5PcR3IIsqplnh0PtQe2jVoqaDAISxlQPXrzetgBj MnxKIeEe20mYTZhOWN/bDJRJ7r8ycT0+eC4hE62WUXfgrQ1hKQQ03IJMXb5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1713195351; x=1713281751; bh=NKyHVd6O5GxyMIbK6qGm5hs8jJkI ZEH0cqFINvkbpUA=; b=s/cIWt866OUPpq+SGeHRpY+cwbQKV7lcLczMsPVcaV/F EDnq1h1asCSMTzxemSxR94D2ne4gbYsHdeW+1AE4cLr13usIaEG1EmVhoxDB3rve 7rnXELuXrBx6N01XziYoAIXPdiiVtB9/rEpj5wwnZEaUXRzeTtT3+8mjFrYxPvaf noJ0OL90mNlKaBMKarEqwh4VwXAIXzOaRS+a7BEvH4XRSIRd621Izyrg2gW8Elfo yj2nhZYxmIVYNuW5NkjZe5L1JDtE5GxMvxO1iDpmvKbT2qOwIJ4LwbFHFv10qZ3K Gcog4XGLOGqSWPm2WqhKCJYrtYPFK11WR1PuT62lLw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudejvddgledvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id E9918B6008D; Mon, 15 Apr 2024 11:35:50 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-379-gabd37849b7-fm-20240408.001-gabd37849 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: In-Reply-To: <875xwjcqpl.fsf@mail.lhotse> References: <20240410153212.127477-1-adrian.hunter@intel.com> <87be83da-6102-483d-b1dc-a77eecc9f780@app.fastmail.com> <4d429a10-eb45-4262-8e74-69af810ef1ac@intel.com> <875xwjcqpl.fsf@mail.lhotse> Date: Mon, 15 Apr 2024 17:35:30 +0200 From: "Arnd Bergmann" To: "Michael Ellerman" , "Adrian Hunter" , "Christophe Leroy" Cc: "Peter Zijlstra" , "Dave Hansen" , "John Stultz" , "H. Peter Anvin" , "Alexander Gordeev" , "Vincenzo Frascino" , "linux-s390@vger.kernel.org" , "Naresh Kamboju" , "x86@kernel.org" , "Aneesh Kumar K.V" , "Ingo Molnar" , "Naveen N. Rao" , "Christian Borntraeger" , "Vasily Gorbik" , "Heiko Carstens" , "Nicholas Piggin" , "Borislav Petkov" , "Andy Lutomirski" , "Bjorn Helgaas" , "Thomas Gleixner" , "Anna-Maria Gleixner" , "Stephen Boyd" , "Randy Dunlap" , "linux-kernel@vger.kernel.org" , "Sven Schnelle" , "linuxppc-dev@lists.ozlabs.org" Subject: Re: [PATCH] bug: Fix no-return-statement warning with !CONFIG_BUG Content-Type: text/plain On Mon, Apr 15, 2024, at 04:19, Michael Ellerman wrote: > "Arnd Bergmann" writes: >> On Thu, Apr 11, 2024, at 11:27, Adrian Hunter wrote: >>> On 11/04/24 11:22, Christophe Leroy wrote: >>> >>> That is fragile because it depends on defined(__OPTIMIZE__), >>> so it should still be: >> >> If there is a function that is defined but that must never be >> called, I think we are doing something wrong. > > It's a pretty inevitable result of using IS_ENABLED(), which the docs > encourage people to use. Using IS_ENABLED() is usually a good idea, as it helps avoid adding extra #ifdef checks and just drops static functions as dead code, or lets you call extern functions that are conditionally defined in a different file. The thing is that here it does not do either of those and adds more complexity than it avoids. > In this case it could easily be turned into a build error by just making > it an extern rather than a static inline. > > But I think Christophe's solution is actually better, because it's more > explicit, ie. this function should not be called and if it is that's a > build time error. I haven't seen a good solution here. Ideally we'd just define the functions unconditionally and have IS_ENABLED() take care of letting the compiler drop them silently, but that doesn't build because of missing struct members. I won't object to either an 'extern' declaration or the 'BUILD_BUG_ON()' if you and others prefer that, both are better than BUG() here. I still think my suggestion would be a little simpler. Arnd