From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C1F0F3858D1E; Wed, 10 Aug 2022 11:57:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1F0F3858D1E From: "matz at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/106571] Implement -Wsection diag Date: Wed, 10 Aug 2022 11:57:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: matz at gcc dot gnu.org X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2022 11:57:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106571 Michael Matz changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matz at gcc dot gnu.org --- Comment #4 from Michael Matz --- To elaborate: normally you don't need to know which section a variable will= be placed into when generating code to access it. (In fact you don't even nee= d to know if it's defined in the same linking component at all) So, for declarations the section is immaterial, and checking for a mismatch between decl and def doesn't seem appropriate. In the general case. This = is not the general case, the per-cpu sections of the kernel have special semantics, and I agree with Andrew that checking would be better implemented with something orthogonal to the section attribute itself. Boris: what does DECLARE_PER_CPU() expand into? Are there other attributes that could be usefully checked for mismatch between decl and def?=