From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BE133858C60; Thu, 16 Feb 2023 13:14:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BE133858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676553253; bh=Um8L5pLeDaGFQWsjEJaRLP++PSvngxy3s9nHAx1KMr0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xSsqXTyrmA6cxw99VlQro7T0mZ8LsU/IgM8Jqh4TCn+dlDq9DspDreTnvhTEkEVJX qYWzC6zuf4k1rYP3BDHtYPI7P2W1cKZBdI5GknmSvZziCrjTpNhxKhkC/IcSQYfqRL Fa9/EQwFwRG7G+f5SayMXZ499zztgEUX/qRiJy4k= From: "aaron at aaronballman dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108796] Can't intermix C2x and GNU style attributes Date: Thu, 16 Feb 2023 13:14:12 +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: 13.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: aaron at aaronballman dot com 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108796 Aaron Ballman changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aaron at aaronballman dot = com --- Comment #7 from Aaron Ballman --- (In reply to joseph@codesourcery.com from comment #6) > The logic is that GNU attributes are declaration specifiers (and can mix= =20 > anywhere with other declaration specifiers), but standard attributes=20 > aren't declaration specifiers; rather, they come in specified positions=20 > relative to declaration specifiers (the semantics before and after the=20 > declaration specifiers are different), and in the middle isn't such a=20 > position. How does that square with: ``` struct __attribute__((packed)) S { ... }; void func(int *ip) __attribute__((nonnull(1))); ``` where the GNU attribute is not written where a declaration specifier is allowed? FWIW, the Clang rationale for our behavior is that users don't really distinguish between spelling an attribute with `[[]]` or spelling it with `__attribute__` -- it's an attribute either way. We couldn't find a reason = why it made sense to force users to determine arbitrary parse ordering rules for conceptually "identical" constructs. While not compatible with GCC's approa= ch, a correct usage in GCC is expected to also be a correct usage in Clang.=