From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6D3857A for ; Mon, 14 Feb 2022 15:53:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6A84C340E9; Mon, 14 Feb 2022 15:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644853989; bh=jLvxgQZxaKOAqXhYrM5X1Wu5kLbIgCnhJeKHmC+J/hU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lQKVAu2uhc9aOAP+y7UGrprRWpt3DynGUNCiscNmjhGuzfwwkwi5m1z+ikunfTgp0 A+MtOkmrXFBm+xAdXxuaxv8uXfbzijCAeWyw6P5Enw9ypt94YI6uZDKoyXPp+o+N7q s4SIz0xvqbqJP5vqTHLjUnV43SmLu+NDzZ9eQqiE6U/s8dMTZ1SmDDyaBciqkQl/t2 STkV0H43IJluM5xai44liuwSe/z+RLXM7K8xORHhyrbhCfk4cvOYVp+czWFU0mpE0U TZsFtVQRzk8Kepfpzo9uZngSH2iylG1+3YliUMp5yigVnd/zYLL3me2Aotb0NXSoeJ 2p3i/kiMgKCKg== Date: Mon, 14 Feb 2022 08:53:04 -0700 From: Nathan Chancellor To: Steven Rostedt Cc: kernel test robot , chongjiapeng , llvm@lists.linux.dev, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org Subject: Re: kernel/trace/ftrace.c:7157:20: error: unused function 'ftrace_startup_enable' Message-ID: References: <202202132037.4aN017dU-lkp@intel.com> <20220214102000.1d3af66e@gandalf.local.home> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220214102000.1d3af66e@gandalf.local.home> Hi Steve, On Mon, Feb 14, 2022 at 10:20:00AM -0500, Steven Rostedt wrote: > On Sun, 13 Feb 2022 21:03:29 +0800 > kernel test robot wrote: > > > All errors (new ones prefixed by >>): > > > > >> kernel/trace/ftrace.c:7157:20: error: unused function 'ftrace_startup_enable' [-Werror,-Wunused-function] > > static inline void ftrace_startup_enable(int command) { } > > ^ > > 1 error generated. > > Strange. I always thought that static inline functions do not cause > warnings when not used? Especially, since they are often in headers when > things are turned off. Or is it because this is in a C file? With -Wunused-function, clang will warn about unused static inline functions within a .c file (but not .h), whereas GCC will not warn for either. The unused attribute was added to the definition of inline to make clang's behavior match GCC's. > Is this a new warning caused by a commit, or is it a new warning because > the compiler now complains about it? However, in commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build"), Masahiro made it so that the unused attribute does not get added at W=1 so that instances of unused static inline functions can be caught and eliminated (or put into use, if the function should have been used), hence this report. I will be honest, I don't know why the robot flagged 172f7ba9772c as the commit that introduced this warning but it seems legitimate if CONFIG_DYNAMIC_FTRACE is not enabled, since ftrace_startup_enable() is only ever used within an '#ifdef CONFIG_DYNAMIC_FTRACE' block so I guess the stub is unnecessary? Cheers, Nathan From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============6373621892763392496==" MIME-Version: 1.0 From: Nathan Chancellor To: kbuild-all@lists.01.org Subject: Re: kernel/trace/ftrace.c:7157:20: error: unused function 'ftrace_startup_enable' Date: Mon, 14 Feb 2022 08:53:04 -0700 Message-ID: In-Reply-To: <20220214102000.1d3af66e@gandalf.local.home> List-Id: --===============6373621892763392496== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Steve, On Mon, Feb 14, 2022 at 10:20:00AM -0500, Steven Rostedt wrote: > On Sun, 13 Feb 2022 21:03:29 +0800 > kernel test robot wrote: > = > > All errors (new ones prefixed by >>): > > = > > >> kernel/trace/ftrace.c:7157:20: error: unused function 'ftrace_startu= p_enable' [-Werror,-Wunused-function] = > > static inline void ftrace_startup_enable(int command) { } > > ^ > > 1 error generated. > = > Strange. I always thought that static inline functions do not cause > warnings when not used? Especially, since they are often in headers when > things are turned off. Or is it because this is in a C file? With -Wunused-function, clang will warn about unused static inline functions within a .c file (but not .h), whereas GCC will not warn for either. The unused attribute was added to the definition of inline to make clang's behavior match GCC's. > Is this a new warning caused by a commit, or is it a new warning because > the compiler now complains about it? However, in commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=3D1 build"), Masahiro made it so that the unused attribute does not get added at W=3D1 so that instances of unused static inline functions can be caught and eliminated (or put into use, if the function should have been used), hence this report. I will be honest, I don't know why the robot flagged 172f7ba9772c as the commit that introduced this warning but it seems legitimate if CONFIG_DYNAMIC_FTRACE is not enabled, since ftrace_startup_enable() is only ever used within an '#ifdef CONFIG_DYNAMIC_FTRACE' block so I guess the stub is unnecessary? Cheers, Nathan --===============6373621892763392496==--