Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2087211rdb; Sun, 3 Dec 2023 01:50:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaJHbBRhKfeezRNNhlr3VaHAhj1Mnenm+seOOH7HF/2pnK7L1DaOxUS/FVB+ps0zeW42Dy X-Received: by 2002:a05:6870:ac26:b0:1fb:75a:77ac with SMTP id kw38-20020a056870ac2600b001fb075a77acmr2757686oab.93.1701597008306; Sun, 03 Dec 2023 01:50:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701597008; cv=none; d=google.com; s=arc-20160816; b=M1+YHH98UGA0B+LdGAgBIaTSZAQrC8EAOEl+QRDII2eJVLIi6GPhbQrfefTpcfyOIa vwhyb4R8wb4Ux6dsJCXmxyGpr/EyW42Gr4I81PGux44pCGYnk5uc9HDQRzrejqKQtknW fhnHeozFzxsrNXzhRGwNh/V7QJ0GT19+ZNvsD+XpNtRRwyIvCLMOAbXBwd03t1cBnMZG tbIlkVAQWNN6V8hdEmwo7VSd0re+EglqUu6W4fpgtk4RNMNluXGvCMOXYl/KY81+xrPd qIg5lYHJjwNRFrqYTDtzfV/X3++IL2+a0h1dJIo0RKFiVJ+uDL6pb47p7WiX5yVpARjM HzOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=favE9t77tApv9tYsd3Aeb3yyJJ+m3IS6kMOTpruxKfs=; fh=PFwXawrH1uMeasvl/p3z1jdQgSTgo4FZ0xmHmWTcQfM=; b=WsjN2nRTtPTNoHeEZlbUdTb28OVJrGKHMD6yBSIUkxf/Oek3rNYEtnCCfcdQKWGY+y ZRLcfBMTy7eS65GqBckBhJKvBiZ+Yu7K54eXCv+cx8o2gUm0FqJGuQ3fSSY2uqspBHkj VCGOM5rLczXKf9tp+TCKGYtObefvoWYe1SdBc72yO+Y0sWr/s+LDOLayqv9wsfDuRFoY N74N5nsU7WPcCKGXlHM5dVQF1jDCAqybZVcgx8e1nM+cDgYR5iCoRN81h1y0IXUVA24e ONCJIjqN7H1jbqJ2bJRsXT61RwZl2xH4T6v19Ndr+CQqZ5i2S8f4saDYfg6G0ThFPOH5 V3+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=krGY099a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x68-20020a636347000000b00577f87e6210si18912pgb.332.2023.12.03.01.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 01:50:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=krGY099a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 380C18095037; Sun, 3 Dec 2023 01:50:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232858AbjLCJtw (ORCPT + 99 others); Sun, 3 Dec 2023 04:49:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231638AbjLCJtv (ORCPT ); Sun, 3 Dec 2023 04:49:51 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4530CED for ; Sun, 3 Dec 2023 01:49:57 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D41B7C433CC; Sun, 3 Dec 2023 09:49:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701596996; bh=rmsWponTX5RKX19qzp5R0zCYaOiow+z0DQeDMbnv4hs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=krGY099aw4XVTLnHqechM+QYTTiVpi77Y5Sg9sl2m20KUWYFikFGob/yeUNdPDMvv mgL2T/dyKctjBYe85UnYisBy0M2w6RF8eyks00H1v2cEq/PNLT2vbw4Mj2fKyWo8N/ JwwI/sZKc1f1xcAziikHBfx/kdu/y1JwYg4bi5F4gj+/3oRg8/alQrKu+nAZeHVaF2 PWnaplfhFxxhvlxy9pk0fAS+zw1DaDb0noGL+ok4nxxUhYPT+K9cpVzhxLcW9SX+h5 KsDXXZiroAkKy0hAhm3AZiQiFiUDB1nqv+UAPqgtImF0L2OdDi9TqeSSTXZMlM2nTW JNVr0n4xoXzPg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] modpost: inform compilers that fatal() never returns Date: Sun, 3 Dec 2023 18:49:32 +0900 Message-Id: <20231203094934.1908270-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231203094934.1908270-1-masahiroy@kernel.org> References: <20231203094934.1908270-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 03 Dec 2023 01:50:07 -0800 (PST) The function fatal() never returns because modpost_log() calls exit(1) when LOG_FATAL is passed. Inform compilers of this fact so that unreachable code flow can be identified at compile time. Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor --- Changes in v2: - Use noreturn attribute together with alias scripts/mod/modpost.c | 3 +++ scripts/mod/modpost.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index ca0a90158f85..c13bc9095df3 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -90,6 +90,9 @@ void modpost_log(enum loglevel loglevel, const char *fmt, ...) error_occurred = true; } +void __attribute__((alias("modpost_log"))) +modpost_log_noret(enum loglevel loglevel, const char *fmt, ...); + static inline bool strends(const char *str, const char *postfix) { if (strlen(str) < strlen(postfix)) diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 9fe974dc1a52..835cababf1b0 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -200,6 +200,9 @@ enum loglevel { void __attribute__((format(printf, 2, 3))) modpost_log(enum loglevel loglevel, const char *fmt, ...); +void __attribute__((format(printf, 2, 3), noreturn)) +modpost_log_noret(enum loglevel loglevel, const char *fmt, ...); + /* * warn - show the given message, then let modpost continue running, still * allowing modpost to exit successfully. This should be used when @@ -215,4 +218,4 @@ modpost_log(enum loglevel loglevel, const char *fmt, ...); */ #define warn(fmt, args...) modpost_log(LOG_WARN, fmt, ##args) #define error(fmt, args...) modpost_log(LOG_ERROR, fmt, ##args) -#define fatal(fmt, args...) modpost_log(LOG_FATAL, fmt, ##args) +#define fatal(fmt, args...) modpost_log_noret(LOG_FATAL, fmt, ##args) -- 2.40.1