]> git.ipfire.org Git - thirdparty/gcc.git/commit
Introduce IR bit TYPE_INCLUDES_FLEXARRAY for the GCC extension
authorQing Zhao <qing.zhao@oracle.com>
Thu, 29 Jun 2023 17:07:08 +0000 (17:07 +0000)
committerQing Zhao <qing.zhao@oracle.com>
Thu, 29 Jun 2023 17:13:09 +0000 (17:13 +0000)
commit3967da96556163d78cbeafe342c16b820aa85799
treefb68c4f2731df7d84d6b05e1a826f6a5d09d2654
parent6a1cf0d0d9cbf79f30aa5d76bca19615f12ea57f
Introduce IR bit TYPE_INCLUDES_FLEXARRAY for the GCC extension

on a structure with a C99 flexible array member being nested in
another structure

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.
This patch is to introduce the IR bit TYPE_INCLUDES_FLEXARRAY (reuse the
existing IR bit TYPE_NO_NAMED_ARGS_SATDARG_P), set it correctly in C FE,
stream it correctly in Middle-end, and print it during IR dumping.

gcc/c/ChangeLog:

* c-decl.cc (finish_struct): Set TYPE_INCLUDES_FLEXARRAY for
struct/union type.

gcc/lto/ChangeLog:

* lto-common.cc (compare_tree_sccs_1): Compare bit
TYPE_NO_NAMED_ARGS_STDARG_P or TYPE_INCLUDES_FLEXARRAY properly
for its corresponding type.

gcc/ChangeLog:

* print-tree.cc (print_node): Print new bit type_include_flexarray.
* tree-core.h (struct tree_type_common): Use bit no_named_args_stdarg_p
as type_include_flexarray for RECORD_TYPE or UNION_TYPE.
* tree-streamer-in.cc (unpack_ts_type_common_value_fields): Stream
in bit no_named_args_stdarg_p properly for its corresponding type.
* tree-streamer-out.cc (pack_ts_type_common_value_fields): Stream
out bit no_named_args_stdarg_p properly for its corresponding type.
* tree.h (TYPE_INCLUDES_FLEXARRAY): New macro TYPE_INCLUDES_FLEXARRAY.
gcc/c/c-decl.cc
gcc/lto/lto-common.cc
gcc/print-tree.cc
gcc/tree-core.h
gcc/tree-streamer-in.cc
gcc/tree-streamer-out.cc
gcc/tree.h