Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1253457lqj; Mon, 3 Jun 2024 15:36:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWunZARMJ6knNYNV+bF3a1wlw5h19c1fXMKlwfwenTovtciykGN2j5Jh40jnvZkyQG6cz0rfVQad2di+1XOU4tUUg7HWeRMVCjHlws2gQ== X-Google-Smtp-Source: AGHT+IHYf8M6axTjRz/DKP3/cbvAMdB5Mam9ClfozT6eZmU4HP65EcwTpaXZTgOa1SKFIw8tYjUa X-Received: by 2002:a17:906:3411:b0:a68:f6c7:fed5 with SMTP id a640c23a62f3a-a68f6c7ffffmr286292566b.34.1717454181078; Mon, 03 Jun 2024 15:36:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717454181; cv=pass; d=google.com; s=arc-20160816; b=JvchdW6t6KoNmYXkvjZTWY8oEB/JGA5g7tgY3ed826GV0Dy9ksMip+vRCj1dFDIzd4 1rPgmoi+NNAp95V/Y9I1G+Fy7HPkU+YT3EGLGDT9xCcZHMrI/iposGKce31EepDcsgxH 73wdTABYBnMQ9vPuCn/isw5lb3gkIfdqVtwmGzGWur69WeV4APh0Czl18F4S99mPSd1y /9shfH0sSDkr4dgGRQhAylTIYIYY6ep8+KQmH654J1n1j8ZF0bbe0BqRaDg+YxAjzIki uoFP2CAL/sSs0lUWbLnDuhUbDWtziRcJA41aeLFKH0D2GaCAK/i1BcFYQBSWvBZPOaf9 nQww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QZXNG+3Yo8nM7Kf7+xNvpOTmmkWl/EhyOs9imc3+QQY=; fh=LEPCqmnIJ3iy1e1TUYipGW1dZiJhfd3225fj6w/Mnv4=; b=m0ZReJlT5gUeplSw2HIrM8VWHcslybSq3WaW+/+NuRUcg3nF+nq6o+RZOu1NXqc9E6 tET/+RDDRXoFmFoZLGMKMnYgIIrYbEHOsw342RjtE3VXF0328fw8TaxjITEYhO/C5/ro Lm8k/aeMuOOo9qk0RkEXY/ar/X/4qJfvcyIWSgeilT4XYYra45OvUztj2KKXfnO5qzDK z5cA0kOPhhHOlZfmKAvD0o5eOWVWRSTDqR8FtVXg6+XKHyEZuifNHbPBPIPYT0b7VSP/ QuW40S0oKK3WPH+nehqgRIXmdfa2VWx5PqRPboTtRr/dCje9rQJR2itvjkvC9SLnW/0a GmCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EG1flP+i; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-199765-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199765-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a690695f70dsi143769766b.284.2024.06.03.15.36.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 15:36:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199765-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EG1flP+i; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-199765-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199765-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9EE231F24068 for ; Mon, 3 Jun 2024 22:36:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66BBE13CA8E; Mon, 3 Jun 2024 22:36:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EG1flP+i" 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 88D8957333; Mon, 3 Jun 2024 22:36:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717454172; cv=none; b=upjrUhR82IhvP9ddvqWgeg/SSnXcHNdSsFpOLQj0xnFxX1HAqYCy4xQNLmlp6IbMG1lN50GrUjfSH/ZBIFwzkG/UiwQQz9Q66gQknaghaoqQM3cf/XIVutwHoy0PXzOcW4ZukXEZ8cca8pa0vm39etX4mq2uHB+vkWLkYOcnyTg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717454172; c=relaxed/simple; bh=6UM2Nce1Tbntl44YOC4QXxHzVvN1clyiYgBnLClREvQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ejXeteRWQkZNaZoItHzLbIDnpgBA98Q6RjXP6z41rlj8PKGqzNjLuIlL0IhwRaMxOFXNZ50bZdrqQY0WbfwGm7wfK+ldATpip7QZwZvKTsgodjums6vX8m6cYkfLD6KK9zYrfvt81feFS0LpQG13l5k+1tMHyF91hcPK7ooErcU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EG1flP+i; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20013C2BD10; Mon, 3 Jun 2024 22:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717454172; bh=6UM2Nce1Tbntl44YOC4QXxHzVvN1clyiYgBnLClREvQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EG1flP+ilEsMuPF/rVS9CNrlnDAdQ3gLzR79WeL3zWSWfzI1Mm0aUaYpx/uOoS/v5 mEC8ysuzei6MS4XXuc36FhEgMB8m3Me94ABpFPlh3BMBm6Zi70V1+fwpeVPMCt7XX1 jNC/dQ82UfHY0V+vvuYeK/hJ/u9/Y/V3cfudZw1EikhjhzDMMen48uUHhCgm8zjt9C VG5hH2NS69N23nUZzm0+oz63u5EIQgS83nA0VY6/Y75Bs5RvcC1BA68K8NBUyhBLey 7nqhVy/Q16VgpmjJpe/I4ujf2Ik16fcRJMY9umvkljdwbeT+yhaelvKE456MCly87e NyO9mjkXlrIRg== Date: Mon, 3 Jun 2024 15:36:09 -0700 From: Nathan Chancellor To: John Hubbard Cc: Shuah Khan , Muhammad Usama Anjum , Beau Belgrave , Steven Rostedt , Mark Brown , Naresh Kamboju , Nick Desaulniers , Justin Stitt , Bill Wendling , sunliming , Masami Hiramatsu , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev Subject: Re: [PATCH v2 2/2] selftests/lib.mk: silence some clang warnings that gcc already ignores Message-ID: <20240603223609.GC1802995@thelio-3990X> References: <20240531183751.100541-1-jhubbard@nvidia.com> <20240531183751.100541-3-jhubbard@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240531183751.100541-3-jhubbard@nvidia.com> On Fri, May 31, 2024 at 11:37:51AM -0700, John Hubbard wrote: > gcc defaults to silence (off) for the following warnings, but clang > defaults to the opposite. The warnings are not useful for the kernel > itself, which is why they have remained disabled in gcc for the main > kernel build. And it is only due to including kernel data structures in > the selftests, that we get the warnings from clang. > > -Waddress-of-packed-member > -Wgnu-variable-sized-type-not-at-end > > In other words, the warnings are not unique to the selftests: there is > nothing that the selftests' code does that triggers these warnings, > other than the act of including the kernel's data structures. Therefore, > silence them for the clang builds as well. > > This eliminates warnings for the net/ and user_events/ kselftest > subsystems, in these files: > > ./net/af_unix/scm_rights.c > ./net/timestamping.c > ./net/ipsec.c > ./user_events/perf_test.c > > Cc: Nathan Chancellor > Signed-off-by: John Hubbard This seems reasonable to me. Acked-by: Nathan Chancellor > --- > tools/testing/selftests/lib.mk | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk > index 2902787b89b2..c179c02281e9 100644 > --- a/tools/testing/selftests/lib.mk > +++ b/tools/testing/selftests/lib.mk > @@ -50,6 +50,14 @@ else > CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) > endif # CROSS_COMPILE > > +# gcc defaults to silence (off) for the following warnings, but clang defaults > +# to the opposite. The warnings are not useful for the kernel itself, which is > +# why they have remained disabled in gcc for the main kernel build. And it is > +# only due to including kernel data structures in the selftests, that we get the > +# warnings from clang. Therefore, disable the warnings for clang builds. > +CFLAGS += -Wno-address-of-packed-member > +CFLAGS += -Wno-gnu-variable-sized-type-not-at-end > + > CC := $(CLANG) $(CLANG_FLAGS) -fintegrated-as > else > CC := $(CROSS_COMPILE)gcc > -- > 2.45.1 > >