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 shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 7A1C3C433EF for ; Sun, 20 Feb 2022 09:09:29 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nLiDQ-0001V0-Vc; Sun, 20 Feb 2022 04:09:12 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nLiDO-0001Ug-RB for kernelnewbies@kernelnewbies.org; Sun, 20 Feb 2022 04:09:11 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 63B575C02D0; Sun, 20 Feb 2022 04:09:08 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 20 Feb 2022 04:09:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; bh=wckOHCPsqIgld4dRm7gLiFYmimYUhf427ZdXnO zik+0=; b=j6CIutcpUKfet+CfFN+kklcm39C1/EzxviVHvo6vmCMnAVtp0PmZyi 9M+kEyjSqYzp9vR5/JT5v0VE/FxPBVQDjdFjMp9km5+inxPY6tKIUhShxZBzB3oq 07EfhGhP9hYOWnf5P0O3dA5JA6aPCweoFywmYFz/FV1+k6EhbQ2Ci2LQHzYdfc+o HtqqWCwM7u90rs0cDJwH+85ctfZD9Yc/Xqj3ifh9cJLjSzdVZdD0FaFnrJuHVGwc 2Yr1K+XJ3K3ZW5GfiTdz5SysTyf/r9b+yhsNo/cC3ITug+NZQsWG8euN+9pIHHdZ 1GB8zHZyIYfjF1DTaKOsVcC4qcbpYZrA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=wckOHCPsqIgld4dRm 7gLiFYmimYUhf427ZdXnOzik+0=; b=B11Rxq6F5eMn0xTL5hdYg6jAl5Kw2S6E/ jIT22NLSHzLDzNLbmeTcUbDVH0qYMqiOFVTtD7cw+AozYb/+GuT7jKLiM7Et9PNJ tvleOXCbEZBcU6hoMHM+CabGR/n8lRVBjDo4d6S/8nvZsjbkppNfwpSKqaGYiMzq iirs5Hxw5XeJaQHOYtUWYkfe1OyZk+X3HtLYCo3eJtt51K6tBgGp0VTi9l6P83c7 Qo/2Z4UgJSYebecSM49f9zC14cogrzIG6t52AD4RNv2+DwNSDtwyOKMKDEyVf3iQ CNlmc7KYOUyEDUUiVnQv1xT3f7ewQ1xp2qQ4TfydKy6fajR/AER7Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrkeeggddtudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjsehttdertd dttddvnecuhfhrohhmpefirhgvghcumffjuceoghhrvghgsehkrhhorghhrdgtohhmqeen ucggtffrrghtthgvrhhnpedtieeikedvieejjeevueeuleeglefffeeufedviefgkeeggf evjeffiefgkefhueenucffohhmrghinheplhhivhgvghhrvghprdgtohhmpdgsohhothhl ihhnrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepghhrvghgsehkrhhorghhrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 20 Feb 2022 04:09:07 -0500 (EST) Date: Sun, 20 Feb 2022 10:09:05 +0100 From: Greg KH To: Song Zhi Subject: Re: Why doesn't the GCC give any warning to these unused variables in the Linux kernel? Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Cc: "kernelnewbies@kernelnewbies.org" X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Sun, Feb 20, 2022 at 07:39:13AM +0000, Song Zhi wrote: > Normally, the compiler warns if a variable is declared but is never referenced. In the Linux kernel source code, some unused functions and variables are marked __atrribute__((unused)). > > > ==> https://livegrep.com/search/linux?q=__attribute__((unused)) > > > GCC, on the other hand, does not provide any warnings for these unused and unmarked variables like the integer flags in kernel/sched/idle.c#427 . > > > Why? Because we do not enable that build warning as it is mostly useless for kernel code due to how different apis work inside the kernel. Try enabling it yourself and see all of the noise that happens. greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies