On 24 May 2023 16:09:21 CEST, Qing Zhao <qing.z...@oracle.com> wrote: >Bernhard, > >Thanks a lot for your comments. > >> On May 19, 2023, at 7:11 PM, Bernhard Reutner-Fischer >> <rep.dot....@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. >
So ANY_TRAILING_FLEXARRAY or TYPE_CONTAINS_FLEXARRAY, TYPE_INCLUDES_FLEXARRAY or something like that would be more clear, i don't know. I'd probably use the first, but that's enough bike shedding for me now. Let's see what others think. thanks, >Hope this is clear. >thanks. > >Qing >> >>> >>> /* In an IDENTIFIER_NODE, this means that assemble_name was called with >>> this string as an argument. */ >> >