Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp1229692rwl; Thu, 10 Aug 2023 08:12:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEICAyyU73F5cnP9iBTNfJALeRTNqBToret6gLKs2Y2RDibiYDAL/khDyoBELDdLD1Sj7aV X-Received: by 2002:a17:902:9890:b0:1bc:6266:d0e4 with SMTP id s16-20020a170902989000b001bc6266d0e4mr1848090plp.69.1691680364553; Thu, 10 Aug 2023 08:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691680364; cv=none; d=google.com; s=arc-20160816; b=G20nFgOzrEXoOzawyjG/sn/lijPt15YoGjSox0UJrpA0BsJEo2et2ywONMDyYRomuo CVRRFvOzLyqYFIt279H940S2zOuBTX3qWzP5vunZFq8m9DHTioU59Evef2anshoyFjJG EmaXOOtIWaq5imEAqXOAIHav4LJCExQ7jAQsMiapv78Def1KYJ4m+/8M2uDBTa1AQf2i UG7HjzGEJlN3nzoHLduoJr2f7Ct12wEGyA//73Cra17N4ff8pgA0/HECmFbnD5hjySor j/WXQ0w7ep14eSaLMG3vRyBCaErArEvjq1HUU1xP1hcpfIdt5WOFYMcf2QfwWdTUH1Ug 5lbg== 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=Jg00WGPiOC+5hFiCAWAlM3hkUb9NuNsUhwTkHNNzsLE=; fh=Xve+om5ZPKBYDHEodHnCAcrNCE0usvrntcsVvc52q/Q=; b=BkXCs0vySnQ0Hb9+Z7Xd7CS3lxylnCLwv/kOEzCZIs7Y0EuOMvwna9csuz3fLKqegH Djdtt1bxFtpJXWd4lnUr5OFw1/sm9eUBCuNnDNEE3hQdyY85GcrLwdMwEmK11MYL9o1k GRyD0hucj0xaSNwDENruPst++79gjV1PK0yQbxgwcS6oQGR4igz0tn2+kb/K50sut3rc ZTqdTlg/2fFWrxDdq3q9BH1YdsU+t2weKO8kcyb2OUUP977fZE8ZqIIkqa6lWmv19KqF QOiuDZLiUTMUkeV2qGrGfIJttg54RkfNf5Bxk9yh44bPa+tspptPS9blrMknoz7Mhofw r7cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DxT8ZQR6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r11-20020a1709028bcb00b001b9c3498526si1517429plo.433.2023.08.10.08.12.18; Thu, 10 Aug 2023 08:12:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DxT8ZQR6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234442AbjHJOX4 (ORCPT + 99 others); Thu, 10 Aug 2023 10:23:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234457AbjHJOXm (ORCPT ); Thu, 10 Aug 2023 10:23:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47DDA2724; Thu, 10 Aug 2023 07:23:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CD0AF65DD3; Thu, 10 Aug 2023 14:23:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89935C433C8; Thu, 10 Aug 2023 14:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691677420; bh=v595bHoeyNn6tQTZFJfqAWz27K2FECm/q0MGvugZTZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DxT8ZQR60KYnGL1DSAXEZb3e1nnFuS8GiPW51vMID+/XwWUWUbg5irPFhH22d+v5I 5P6keUTpqVVa6BuazI5kKmsRIVW+YoGuU3R9tfmzBlVq7RuFqDjkHpl7L0HQENHSjZ dqogsDVC0AgR5QsqljD6o0S64dhRp9SzJO1TgwJz/WNdMfM02VHc3Wk8sCW2QGYrei u9bZmviAMmcQHlvPrvCws57z2H9HKs18wiTjUFMI9BUI22xd24e9YF8GmzbclD2/hS YPszKWmjRf+wEWSq8Xr00+3rsFkOfBHam8jOtbyM9s2NLNhUkREwhzS78LuHQUgb3R 40Lce0N0wPBkA== From: Arnd Bergmann To: Andrew Morton , linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Richard Henderson , Ivan Kokshaysky , Matt Turner , Huacai Chen , WANG Xuerui , "David S. Miller" , Al Viro , "Steven Rostedt (Google)" , Qing Zhang , Donglin Peng , Qi Hu , linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, sparclinux@vger.kernel.org Subject: [PATCH 15/17] arch: fix asm-offsets.c building with -Wmissing-prototypes Date: Thu, 10 Aug 2023 16:19:33 +0200 Message-Id: <20230810141947.1236730-16-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230810141947.1236730-1-arnd@kernel.org> References: <20230810141947.1236730-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Arnd Bergmann When -Wmissing-prototypes is enabled, the some asm-offsets.c files fail to build, even when this warning is disabled in the Makefile for normal files: arch/sparc/kernel/asm-offsets.c:22:5: error: no previous prototype for 'sparc32_foo' [-Werror=missing-prototypes] arch/sparc/kernel/asm-offsets.c:48:5: error: no previous prototype for 'foo' [-Werror=missing-prototypes] Address this by making use of the same trick we have on other architectures, renaming the unused global function to main(), which has an implicit prototype. On loongarch, there are many functions in this file, so the trick does not work, adding explicit declarations works around it in a slightly more ugly way but is the best I could come up with here. Signed-off-by: Arnd Bergmann --- arch/alpha/kernel/asm-offsets.c | 2 +- arch/ia64/kernel/asm-offsets.c | 2 +- arch/loongarch/kernel/asm-offsets.c | 12 ++++++++++++ arch/sparc/kernel/asm-offsets.c | 13 ++----------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/arch/alpha/kernel/asm-offsets.c b/arch/alpha/kernel/asm-offsets.c index b121294bee266..b87487e70488d 100644 --- a/arch/alpha/kernel/asm-offsets.c +++ b/arch/alpha/kernel/asm-offsets.c @@ -12,7 +12,7 @@ #include #include -void foo(void) +int main(void) { DEFINE(TI_TASK, offsetof(struct thread_info, task)); DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c index be3b90fef2e92..62b9aaf10b3c0 100644 --- a/arch/ia64/kernel/asm-offsets.c +++ b/arch/ia64/kernel/asm-offsets.c @@ -20,7 +20,7 @@ #include "../kernel/sigframe.h" #include "../kernel/fsyscall_gtod_data.h" -void foo(void) +int main(void) { DEFINE(IA64_TASK_SIZE, sizeof (struct task_struct)); DEFINE(IA64_THREAD_INFO_SIZE, sizeof (struct thread_info)); diff --git a/arch/loongarch/kernel/asm-offsets.c b/arch/loongarch/kernel/asm-offsets.c index 8da0726777edb..735115f8341c9 100644 --- a/arch/loongarch/kernel/asm-offsets.c +++ b/arch/loongarch/kernel/asm-offsets.c @@ -14,6 +14,7 @@ #include #include +void output_ptreg_defines(void); void output_ptreg_defines(void) { COMMENT("LoongArch pt_regs offsets."); @@ -61,6 +62,7 @@ void output_ptreg_defines(void) BLANK(); } +void output_task_defines(void); void output_task_defines(void) { COMMENT("LoongArch task_struct offsets."); @@ -76,6 +78,7 @@ void output_task_defines(void) BLANK(); } +void output_thread_info_defines(void); void output_thread_info_defines(void) { COMMENT("LoongArch thread_info offsets."); @@ -92,6 +95,7 @@ void output_thread_info_defines(void) BLANK(); } +void output_thread_defines(void); void output_thread_defines(void) { COMMENT("LoongArch specific thread_struct offsets."); @@ -128,6 +132,7 @@ void output_thread_defines(void) BLANK(); } +void output_thread_fpu_defines(void); void output_thread_fpu_defines(void) { OFFSET(THREAD_FPR0, loongarch_fpu, fpr[0]); @@ -169,6 +174,7 @@ void output_thread_fpu_defines(void) BLANK(); } +void output_thread_lbt_defines(void); void output_thread_lbt_defines(void) { OFFSET(THREAD_SCR0, loongarch_lbt, scr0); @@ -179,6 +185,7 @@ void output_thread_lbt_defines(void) BLANK(); } +void output_mm_defines(void); void output_mm_defines(void) { COMMENT("Size of struct page"); @@ -211,6 +218,7 @@ void output_mm_defines(void) BLANK(); } +void output_sc_defines(void); void output_sc_defines(void) { COMMENT("Linux sigcontext offsets."); @@ -219,6 +227,7 @@ void output_sc_defines(void) BLANK(); } +void output_signal_defines(void); void output_signal_defines(void) { COMMENT("Linux signal numbers."); @@ -257,6 +266,7 @@ void output_signal_defines(void) } #ifdef CONFIG_SMP +void output_smpboot_defines(void); void output_smpboot_defines(void) { COMMENT("Linux smp cpu boot offsets."); @@ -267,6 +277,7 @@ void output_smpboot_defines(void) #endif #ifdef CONFIG_HIBERNATION +void output_pbe_defines(void); void output_pbe_defines(void) { COMMENT("Linux struct pbe offsets."); @@ -279,6 +290,7 @@ void output_pbe_defines(void) #endif #ifdef CONFIG_FUNCTION_GRAPH_TRACER +void output_fgraph_ret_regs_defines(void); void output_fgraph_ret_regs_defines(void) { COMMENT("LoongArch fgraph_ret_regs offsets."); diff --git a/arch/sparc/kernel/asm-offsets.c b/arch/sparc/kernel/asm-offsets.c index 5784f2df489a4..4c8c9a6df2aa5 100644 --- a/arch/sparc/kernel/asm-offsets.c +++ b/arch/sparc/kernel/asm-offsets.c @@ -18,16 +18,12 @@ #include -#ifdef CONFIG_SPARC32 -int sparc32_foo(void) +int main(void) { +#ifdef CONFIG_SPARC32 DEFINE(AOFF_thread_fork_kpsr, offsetof(struct thread_struct, fork_kpsr)); - return 0; -} #else -int sparc64_foo(void) -{ #ifdef CONFIG_HIBERNATION BLANK(); OFFSET(SC_REG_FP, saved_context, fp); @@ -41,12 +37,7 @@ int sparc64_foo(void) OFFSET(SC_REG_G5, saved_context, g5); OFFSET(SC_REG_G6, saved_context, g6); #endif - return 0; -} #endif - -int foo(void) -{ BLANK(); DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread)); BLANK(); -- 2.39.2