public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Qing Zhao <qing.zhao@oracle.com>
To: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Qing Zhao via Gcc-patches <gcc-patches@gcc.gnu.org>,
	"joseph@codesourcery.com" <joseph@codesourcery.com>,
	"richard.guenther@gmail.com" <richard.guenther@gmail.com>,
	"jakub@redhat.com" <jakub@redhat.com>,
	"keescook@chromium.org" <keescook@chromium.org>,
	"siddhesh@gotplt.org" <siddhesh@gotplt.org>,
	"uecker@tugraz.at" <uecker@tugraz.at>
Subject: Re: [V7][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]
Date: Wed, 24 May 2023 14:09:21 +0000	[thread overview]
Message-ID: <F2A1E1F0-3B20-479E-8708-335E44C1CB30@oracle.com> (raw)
In-Reply-To: <20230520011133.1d813add@nbbrfq.loc>

Bernhard,

Thanks a lot for your comments.

> On May 19, 2023, at 7:11 PM, Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:
> 
> On Fri, 19 May 2023 20:49:47 +0000
> Qing Zhao via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
>> GCC extension accepts the case when a struct with a flexible array member
>> is embedded into another struct or union (possibly recursively).
> 
> Do you mean TYPE_TRAILING_FLEXARRAY()?

The following might be more accurate description:

GCC extension accepts the case when a struct with a flexible array member
 is embedded into another struct or union (possibly recursively) as the last field.



> 
>> diff --git a/gcc/tree.h b/gcc/tree.h
>> index 0b72663e6a1..237644e788e 100644
>> --- a/gcc/tree.h
>> +++ b/gcc/tree.h
>> @@ -786,7 +786,12 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
>>    (...) prototype, where arguments can be accessed with va_start and
>>    va_arg), as opposed to an unprototyped function.  */
>> #define TYPE_NO_NAMED_ARGS_STDARG_P(NODE) \
>> -  (TYPE_CHECK (NODE)->type_common.no_named_args_stdarg_p)
>> +  (FUNC_OR_METHOD_CHECK (NODE)->type_common.no_named_args_stdarg_p)
>> +
>> +/* True if this RECORD_TYPE or UNION_TYPE includes a flexible array member
>> +   at the last field recursively.  */
>> +#define TYPE_INCLUDE_FLEXARRAY(NODE) \
>> +  (RECORD_OR_UNION_CHECK (NODE)->type_common.no_named_args_stdarg_p)
> 
> Until i read the description above i read TYPE_INCLUDE_FLEXARRAY as an
> option to include or not include something. The description hints more
> at TYPE_INCLUDES_FLEXARRAY (with an S) to be a type which has at least
> one member which has a trailing flexible array or which itself has a
> trailing flexible array.

Yes, TYPE_INCLUDES_FLEXARRAY (maybe with a S is a better name) means the structure/union TYPE includes a flexible array member or includes a struct with a flexible array member as the last field.

Hope this is clear.
thanks.

Qing
> 
>> 
>> /* In an IDENTIFIER_NODE, this means that assemble_name was called with
>>    this string as an argument.  */
> 


  reply	other threads:[~2023-05-24 14:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19 20:49 [V7][PATCH 0/2]Accept and Handle the case when a structure including a FAM nested in another structure Qing Zhao
2023-05-19 20:49 ` [V7][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832] Qing Zhao
2023-05-19 23:11   ` Bernhard Reutner-Fischer
2023-05-24 14:09     ` Qing Zhao [this message]
2023-05-25  5:41       ` Bernhard Reutner-Fischer
2023-05-25 15:21         ` Qing Zhao
2023-05-19 20:49 ` [V7][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650] Qing Zhao
2023-05-19 21:12   ` Joseph Myers
2023-05-24 13:05     ` Qing Zhao
2023-05-24 16:57     ` Qing Zhao

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=F2A1E1F0-3B20-479E-8708-335E44C1CB30@oracle.com \
    --to=qing.zhao@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=keescook@chromium.org \
    --cc=rep.dot.nop@gmail.com \
    --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).