aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/tree-ssa-uninit.c5
-rw-r--r--gcc/tree.c10
-rw-r--r--gcc/tree.h1
3 files changed, 7 insertions, 9 deletions
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index c94831b..516a7bd 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -404,10 +404,7 @@ maybe_warn_operand (ao_ref &ref, gimple *stmt, tree lhs, tree rhs,
tree rhstype = TREE_TYPE (rhs);
if (POINTER_TYPE_P (rhstype))
rhstype = TREE_TYPE (rhstype);
- if (TYPE_EMPTY_P (rhstype)
- || (RECORD_OR_UNION_TYPE_P (rhstype)
- && (!first_field (rhstype)
- || default_is_empty_record (rhstype))))
+ if (is_empty_type (rhstype))
return NULL_TREE;
bool warned = false;
diff --git a/gcc/tree.c b/gcc/tree.c
index 1ad4ad5..0fe9097 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -15136,22 +15136,22 @@ get_nonnull_args (const_tree fntype)
/* Returns true if TYPE is a type where it and all of its subobjects
(recursively) are of structure, union, or array type. */
-static bool
-default_is_empty_type (tree type)
+bool
+is_empty_type (const_tree type)
{
if (RECORD_OR_UNION_TYPE_P (type))
{
for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL
&& !DECL_PADDING_P (field)
- && !default_is_empty_type (TREE_TYPE (field)))
+ && !is_empty_type (TREE_TYPE (field)))
return false;
return true;
}
else if (TREE_CODE (type) == ARRAY_TYPE)
return (integer_minus_onep (array_type_nelts (type))
|| TYPE_DOMAIN (type) == NULL_TREE
- || default_is_empty_type (TREE_TYPE (type)));
+ || is_empty_type (TREE_TYPE (type)));
return false;
}
@@ -15170,7 +15170,7 @@ default_is_empty_record (const_tree type)
if (TREE_ADDRESSABLE (type))
return false;
- return default_is_empty_type (TYPE_MAIN_VARIANT (type));
+ return is_empty_type (TYPE_MAIN_VARIANT (type));
}
/* Determine whether TYPE is a structure with a flexible array member,
diff --git a/gcc/tree.h b/gcc/tree.h
index 9a713cd..5c0e3cc 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -6233,6 +6233,7 @@ extern void gt_pch_nx (tree &);
extern void gt_pch_nx (tree &, gt_pointer_operator, void *);
extern bool nonnull_arg_p (const_tree);
+extern bool is_empty_type (const_tree);
extern bool default_is_empty_record (const_tree);
extern bool flexible_array_type_p (const_tree);
extern HOST_WIDE_INT arg_int_size_in_bytes (const_tree);