aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2020-11-16 20:01:10 -0700
committerMartin Sebor <msebor@redhat.com>2020-11-16 20:01:10 -0700
commit3072125a40ccfc139a92d44fb3911a8a7186b025 (patch)
treef8d3b5964d6e4b7f39f1ec0f197cf23179297f23 /gcc/tree.c
parentb1ecb86569f63f897f6a95049c4ccf400bddeaad (diff)
downloadgcc-3072125a40ccfc139a92d44fb3911a8a7186b025.zip
gcc-3072125a40ccfc139a92d44fb3911a8a7186b025.tar.gz
gcc-3072125a40ccfc139a92d44fb3911a8a7186b025.tar.bz2
PR middle-end/97840 - Bogus -Wmaybe-uninitialized passing an empty object to a function
gcc/ChangeLog: * tree-ssa-uninit.c (maybe_warn_operand): Call is_empty_type. * tree.c (default_is_empty_type): Rename... (is_empty_type): ...to this. * tree.h (is_empty_type): Declare.
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c10
1 files changed, 5 insertions, 5 deletions
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,