Message ID | eea8eca0-6b5d-c5fa-e5bd-aa5409bd78c6@suse.cz |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 53B15385E037 for <patchwork@sourceware.org>; Wed, 5 Oct 2022 11:50:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 008463853556 for <gcc-patches@gcc.gnu.org>; Wed, 5 Oct 2022 11:49:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 008463853556 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 24AFD1F899 for <gcc-patches@gcc.gnu.org>; Wed, 5 Oct 2022 11:49:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1664970594; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xTiZN9Hmw93D2rz9DRrrxVmPZmmiTE5MTximsr/JU7w=; b=aaLevVc1sdSyohHluzRvfTKY8gWCp0WmGAva2Nwh1qJnZg6cj/kbopoyMAnc2HVaGLIXaY NIdoylHd3+8BEOqcz2vS55cr8GUwZ3uh1CBqHxKRDIYd4bs8chVxVGjoISsl1x6PTLx0p9 taAoX9w9FI5OKkow8qpee0SRsiVoZiQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1664970594; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xTiZN9Hmw93D2rz9DRrrxVmPZmmiTE5MTximsr/JU7w=; b=S80NT5h1cqpvRo4R4jyK38M7NYZag0r0FDaUjYf30VmYBtvB/B8mBA3CcB+ioy1fdQWBdV woGsT5DxPDxqLtDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0DD4A13345 for <gcc-patches@gcc.gnu.org>; Wed, 5 Oct 2022 11:49:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id lqQIAmJvPWPTWAAAMHmgww (envelope-from <mliska@suse.cz>) for <gcc-patches@gcc.gnu.org>; Wed, 05 Oct 2022 11:49:54 +0000 Message-ID: <eea8eca0-6b5d-c5fa-e5bd-aa5409bd78c6@suse.cz> Date: Wed, 5 Oct 2022 13:49:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 From: =?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz> Subject: [PATCH] c: support attribs starting with '_' To: gcc-patches@gcc.gnu.org References: <mvm5ygyh4nx.fsf@suse.de> Content-Language: en-US In-Reply-To: <mvm5ygyh4nx.fsf@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
c: support attribs starting with '_'
|
|
Commit Message
Martin Liška
Oct. 5, 2022, 11:49 a.m. UTC
PR c/107156 gcc/ChangeLog: * attribs.h (lookup_attribute_by_prefix): Support attributes starting with underscore (like _noreturn, or __Noreturn). --- gcc/attribs.h | 2 -- 1 file changed, 2 deletions(-)
Comments
On Wed, Oct 05, 2022 at 01:49:40PM +0200, Martin Liška wrote: > PR c/107156 > > gcc/ChangeLog: > > * attribs.h (lookup_attribute_by_prefix): Support attributes > starting with underscore (like _noreturn, or __Noreturn). There are no _noreturn or __Noreturn attributes, there is just _Noreturn. And, the assert is useful to catch that non-canonicalized attributes don't make it into the attribute lists. Now that we have the first attribute that starts with an underscore in canonicalized form (do we accept ___Noreturn__ attribute too, perhaps we shouldn't?), I'd say instead of removing the assert it should verify gcc_checking_assert (attr_len == 0 || p[0] != '_' || (ident_len > 1 && p[1] != '_')); ? > --- > gcc/attribs.h | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/gcc/attribs.h b/gcc/attribs.h > index b2836560fc2..706d35e63d8 100644 > --- a/gcc/attribs.h > +++ b/gcc/attribs.h > @@ -274,8 +274,6 @@ lookup_attribute_by_prefix (const char *attr_name, tree list) > } > > const char *p = IDENTIFIER_POINTER (name); > - gcc_checking_assert (attr_len == 0 || p[0] != '_'); > - > if (strncmp (attr_name, p, attr_len) == 0) > break; > > -- > 2.37.3 Jakub
On 10/5/22 14:01, Jakub Jelinek wrote: > On Wed, Oct 05, 2022 at 01:49:40PM +0200, Martin Liška wrote: >> PR c/107156 >> >> gcc/ChangeLog: >> >> * attribs.h (lookup_attribute_by_prefix): Support attributes >> starting with underscore (like _noreturn, or __Noreturn). > > There are no _noreturn or __Noreturn attributes, there is just > _Noreturn. > And, the assert is useful to catch that non-canonicalized attributes > don't make it into the attribute lists. > Now that we have the first attribute that starts with an underscore > in canonicalized form (do we accept ___Noreturn__ attribute too, perhaps > we shouldn't?), I'd say instead of removing the assert it should verify > gcc_checking_assert (attr_len == 0 || p[0] != '_' > || (ident_len > 1 && p[1] != '_')); Works for me, I'm going to install the following patch. Martin > ? >> --- >> gcc/attribs.h | 2 -- >> 1 file changed, 2 deletions(-) >> >> diff --git a/gcc/attribs.h b/gcc/attribs.h >> index b2836560fc2..706d35e63d8 100644 >> --- a/gcc/attribs.h >> +++ b/gcc/attribs.h >> @@ -274,8 +274,6 @@ lookup_attribute_by_prefix (const char *attr_name, tree list) >> } >> >> const char *p = IDENTIFIER_POINTER (name); >> - gcc_checking_assert (attr_len == 0 || p[0] != '_'); >> - >> if (strncmp (attr_name, p, attr_len) == 0) >> break; >> >> -- >> 2.37.3 > > Jakub >
diff --git a/gcc/attribs.h b/gcc/attribs.h index b2836560fc2..706d35e63d8 100644 --- a/gcc/attribs.h +++ b/gcc/attribs.h @@ -274,8 +274,6 @@ lookup_attribute_by_prefix (const char *attr_name, tree list) } const char *p = IDENTIFIER_POINTER (name); - gcc_checking_assert (attr_len == 0 || p[0] != '_'); - if (strncmp (attr_name, p, attr_len) == 0) break;