From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7B835385770C; Tue, 11 Jul 2023 09:10:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B835385770C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689066613; bh=nD3Ol+kPo+VNAJV5dQ2ua4zKhV+pfOgSj6P6EesCOjE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=x5Z9S4jKtRUpH4rjxc/HVGM3+I2eAig9IVAwvuK/o1aTE2d7qvkWSIAtDz3V82tVg YMVmicAOKTtByPIWwI1ciO3zTEhTXYOrAGjR+Na9vMBPJ/1ifKUmPCkFun1XvdfEmk zkLWMZvYab7Ruw3fYqOf0Q1PYd5F/38Kf3BNk5Jg= From: "fw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/110617] RFE: Add a diagnostic-only variant of nonnull attribute Date: Tue, 11 Jul 2023 09:10:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: fw at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110617 --- Comment #9 from Florian Weimer --- (In reply to Xi Ruoyao from comment #6) > (In reply to Richard Biener from comment #5) > > I think a -f... option to disable the code generation effects would make > > more sense than adding another attribute kind. >=20 > Then maybe we'd just add a -D_GLIBC_NONNULL=3D{0,1} (?) into Glibc cdefs.h > instead. Anyway I'm already too frustrated about this so I'll not contin= ue > working on nonnull within Glibc headers. If you don't like this just clo= se > it as WONTFIX. For those who are not following libc-alpha, glibc already disables __nonnull during its build, so it should be totally fine to use __nonnull in installed headers to improve diagnostics. We have this in include/sys/cdefs.h (which augments ): /* The compiler will optimize based on the knowledge the parameter is not NULL. This will omit tests. A robust implementation cannot allow this so when compiling glibc itself we ignore this attribute. */ # undef __nonnull # define __nonnull(params) We'd like the diagnostics for building glibc itself, and a new -f option wo= uld help with that.=