From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9946AC4345F for ; Mon, 15 Apr 2024 02:20:45 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=Wfh3cBf0; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4VHrVz6jbBz3dXh for ; Mon, 15 Apr 2024 12:20:43 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=Wfh3cBf0; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4VHrV852hFz2xck for ; Mon, 15 Apr 2024 12:20:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1713147597; bh=8o4K5dRyl8sIUjU0EgivmjJC3lGXyfUukYQCR3Ov8pA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Wfh3cBf0QS/1UiJCGd9wNTsg4Z3JgU/S53A7sXuE66QjWbiVD9T5UErj+qdU+566N hjbiVLnV+ds0WJ+Ev+xRCLWWsYkNs/ydYleOUGiOgEvXor3j+0XD5ZTGMx7r9XyYx5 jn2svY0f1Sry8eWSJqE0BMCHAzNMPGqqW0t7XdRo/lDxhdZw7wJ9e8/OC/PSiEPyk7 59A2AycixIle915lKXR/ZEVvbbDPyQIwTiMKuZDpZGbvMmBz2pFKC82F8PzOQcpTbi j7+dgyBZn3vKLSDfhQN2vQw0ZU/QKf2x+gGzusuyAGdNvKz8OxQs5aM4xz/lfB0l96 UWGlHWQT/t0iQ== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4VHrV23GDlz4wcr; Mon, 15 Apr 2024 12:19:53 +1000 (AEST) From: Michael Ellerman To: Arnd Bergmann , Adrian Hunter , Christophe Leroy Subject: Re: [PATCH] bug: Fix no-return-statement warning with !CONFIG_BUG In-Reply-To: References: <20240410153212.127477-1-adrian.hunter@intel.com> <87be83da-6102-483d-b1dc-a77eecc9f780@app.fastmail.com> <4d429a10-eb45-4262-8e74-69af810ef1ac@intel.com> Date: Mon, 15 Apr 2024 12:19:50 +1000 Message-ID: <875xwjcqpl.fsf@mail.lhotse> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" "Arnd Bergmann" writes: > On Thu, Apr 11, 2024, at 11:27, Adrian Hunter wrote: >> On 11/04/24 11:22, Christophe Leroy wrote: >>> Le 11/04/2024 =C3=A0 10:12, Christophe Leroy a =C3=A9crit=C2=A0: >>>> >>>> Looking at the report, I think the correct fix should be to use=20 >>>> BUILD_BUG() instead of BUG() >>>=20 >>> I confirm the error goes away with the following change to next-2024041= 1=20 >>> on powerpc tinyconfig with gcc 13.2 >>>=20 >>> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c >>> index 4e18db1819f8..3d5ac0cdd721 100644 >>> --- a/kernel/time/timekeeping.c >>> +++ b/kernel/time/timekeeping.c >>> @@ -282,7 +282,7 @@ static inline void timekeeping_check_update(struct= =20 >>> timekeeper *tk, u64 offset) >>> } >>> static inline u64 timekeeping_debug_get_ns(const struct tk_read_base = *tkr) >>> { >>> - BUG(); >>> + BUILD_BUG(); >>> } >>> #endif >>>=20 >> >> 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. 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. cheers