public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Qing Zhao <qing.zhao@oracle.com>
To: Joseph Myers <josmyers@redhat.com>
Cc: "richard.guenther@gmail.com" <richard.guenther@gmail.com>,
	Siddhesh Poyarekar <siddhesh@gotplt.org>,
	"uecker@tugraz.at" <uecker@tugraz.at>,
	Kees Cook <keescook@chromium.org>,
	"isanbard@gmail.com" <isanbard@gmail.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v7 1/5] Provide counted_by attribute to flexible array member field (PR108896)
Date: Wed, 27 Mar 2024 20:40:13 +0000	[thread overview]
Message-ID: <A0BB756D-68DB-4FA7-8391-2F3F66D7F6F1@oracle.com> (raw)
In-Reply-To: <988fa8f9-8bc6-cd26-3c69-7fc26d86c43a@redhat.com>



> On Mar 26, 2024, at 13:20, Joseph Myers <josmyers@redhat.com> wrote:
> 
> On Tue, 26 Mar 2024, Qing Zhao wrote:
> 
>>> What happens when there are multiple counted_by attributes on the same 
>>> field?  As far as I can see, all but one end up being ignored (by the code 
>>> that actually uses the attribute).
>> 
>> In general, is there any rule for handling multiple same attributes in 
>> GCC? i.e, from left to right, the last one wins? Or something else? I’d 
>> like to following the consistent rule with other places in GCC.
> 
> Sometimes, they are meaningful and all can be respected.  (An example is 
> the format_arg attribute, where ngettext legitimately has two such 
> attributes.)
> 
> When not meaningful, an error is appropriate.  For example, with section 
> attributes you can get
> 
>        error ("section of %q+D conflicts with previous declaration",
>               *node);
> 
> if different sections are named.  I think that's a suitable model for the 
> new attribute here: allow duplicates if they name the same field, but give 
> errors if they name different fields, just as with the section attribute.
> 
> Once you give an error for multiple attributes naming different fields, 
> which one wins is just a question of error recovery; the specific choice 
> doesn't matter much, as long as you don't get an ICE in later processing.

Agreed and fixed as suggested.

Thanks.

Qing
> 
> -- 
> Joseph S. Myers
> josmyers@redhat.com


  reply	other threads:[~2024-03-27 20:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 13:15 [PATCH v7 0/5] New attribute "counted_by" to annotate bounds for C99 FAM(PR108896) Qing Zhao
2024-03-20 13:15 ` [PATCH v7 1/5] Provide counted_by attribute to flexible array member field (PR108896) Qing Zhao
2024-03-25 20:44   ` Joseph Myers
2024-03-26 15:11     ` Qing Zhao
2024-03-26 15:21       ` Joseph Myers
2024-03-26 16:01         ` Qing Zhao
2024-03-26 17:20       ` Joseph Myers
2024-03-27 20:40         ` Qing Zhao [this message]
2024-03-20 13:15 ` [PATCH v7 2/5] Convert references with "counted_by" attributes to/from .ACCESS_WITH_SIZE Qing Zhao
2024-03-25 20:48   ` Joseph Myers
2024-03-26 15:13     ` Qing Zhao
2024-03-20 13:15 ` [PATCH v7 3/5] Use the .ACCESS_WITH_SIZE in builtin object size Qing Zhao
2024-03-25 20:50   ` Joseph Myers
2024-03-26 15:14     ` Qing Zhao
2024-03-20 13:15 ` [PATCH v7 4/5] Use the .ACCESS_WITH_SIZE in bound sanitizer Qing Zhao
2024-03-20 13:15 ` [PATCH v7 5/5] Add the 6th argument to .ACCESS_WITH_SIZE Qing Zhao
2024-03-20 19:07 ` [PATCH v7 0/5] New attribute "counted_by" to annotate bounds for C99 FAM(PR108896) Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A0BB756D-68DB-4FA7-8391-2F3F66D7F6F1@oracle.com \
    --to=qing.zhao@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=isanbard@gmail.com \
    --cc=josmyers@redhat.com \
    --cc=keescook@chromium.org \
    --cc=richard.guenther@gmail.com \
    --cc=siddhesh@gotplt.org \
    --cc=uecker@tugraz.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).