There was only one use of COMPLETE_OR_UNBOUND_ARRAY_TYPE_P outside the frontends, in expr.c. This patch expands the macro there and moves the macro's definition to c-common.h.
It feels a bit odd that we still have decls with no layout at this late stage, but that's a separate issue... 2018-10-15 Richard Sandiford <richard.sandif...@arm.com> gcc/ * tree.h (COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): Move to c-common.h. * expr.c (expand_expr_real_1): Expand use of COMPLETE_OR_UNBOUND_ARRAY_TYPE_P here. gcc/c-family/ * c-common.h (COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro, moved from tree.h. Index: gcc/tree.h =================================================================== --- gcc/tree.h 2018-10-15 14:13:04.148469305 +0100 +++ gcc/tree.h 2018-10-15 14:13:08.520433065 +0100 @@ -602,10 +602,6 @@ #define COMPLETE_TYPE_P(NODE) (TYPE_SIZE /* Nonzero if this type is the (possibly qualified) void type. */ #define VOID_TYPE_P(NODE) (TREE_CODE (NODE) == VOID_TYPE) -/* Nonzero if this type is complete or is an array with unspecified bound. */ -#define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \ - (COMPLETE_TYPE_P (TREE_CODE (NODE) == ARRAY_TYPE ? TREE_TYPE (NODE) : (NODE))) - #define FUNC_OR_METHOD_TYPE_P(NODE) \ (TREE_CODE (NODE) == FUNCTION_TYPE || TREE_CODE (NODE) == METHOD_TYPE) Index: gcc/expr.c =================================================================== --- gcc/expr.c 2018-10-15 14:12:54.040553089 +0100 +++ gcc/expr.c 2018-10-15 14:13:08.520433065 +0100 @@ -9884,7 +9884,8 @@ expand_expr_real_1 (tree exp, rtx target /* If a static var's type was incomplete when the decl was written, but the type is complete now, lay out the decl now. */ if (DECL_SIZE (exp) == 0 - && COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (TREE_TYPE (exp)) + && DEFINITE_TYPE_P (TREE_CODE (type) == ARRAY_TYPE + ? TREE_TYPE (type) : type) && (TREE_STATIC (exp) || DECL_EXTERNAL (exp))) layout_decl (exp, 0); Index: gcc/c-family/c-common.h =================================================================== --- gcc/c-family/c-common.h 2018-10-15 14:13:04.148469305 +0100 +++ gcc/c-family/c-common.h 2018-10-15 14:13:08.516433099 +0100 @@ -746,6 +746,10 @@ #define C_TYPE_OBJECT_OR_INCOMPLETE_P(ty #define COMPLETE_OR_VOID_TYPE_P(NODE) \ (COMPLETE_TYPE_P (NODE) || VOID_TYPE_P (NODE)) +/* Nonzero if this type is complete or is an array with unspecified bound. */ +#define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \ + (COMPLETE_TYPE_P (TREE_CODE (NODE) == ARRAY_TYPE ? TREE_TYPE (NODE) : (NODE))) + struct visibility_flags { unsigned inpragma : 1; /* True when in #pragma GCC visibility. */