After building some larger codes using opaque types and some c++ codes
using opaque types it became clear I needed to go through and look for
places where opaque types and modes needed to be handled. A whole pile
of one-liners.
gcc/
* typeclass.h: Add opaque_type_class.
* builtins.c (type_to_class): Identify opaque type class.
* dwarf2out.c (is_base_type): Handle opaque types.
(gen_type_die_with_usage): Handle opaque types.
* expr.c (count_type_elements): Opaque types should
never have initializers.
* ipa-devirt.c (odr_types_equivalent_p): No type-specific handling
for opaque types is needed as it eventually checks the underlying
mode which is what is important.
* tree-streamer.c (record_common_node): Handle opaque types.
* tree.c (type_contains_placeholder_1): Handle opaque types.
(type_cache_hasher::equal): No additional comparison needed for
opaque types.
gcc/c-family
* c-pretty-print.c (c_pretty_printer::simple_type_specifier):
Treat opaque types like other types.
(c_pretty_printer::direct_abstract_declarator): Opaque types are
supported types.
gcc/c
* c-aux-info.c (gen_type): Support opaque types.
gcc/cp
* error.c (dump_type): Handle opaque types.
(dump_type_prefix): Handle opaque types.
(dump_type_suffix): Handle opaque types.
(dump_expr): Handle opaque types.
* pt.c (tsubst): Allow opaque types in templates.
(unify): Allow opaque types in templates.
* typeck.c (structural_comptypes): Handle comparison
of opaque types.
12 files changed:
case ARRAY_TYPE: return (TYPE_STRING_FLAG (type)
? string_type_class : array_type_class);
case LANG_TYPE: return lang_type_class;
+ case OPAQUE_TYPE: return opaque_type_class;
default: return no_type_class;
}
}
break;
case VOID_TYPE:
+ case OPAQUE_TYPE:
case BOOLEAN_TYPE:
case INTEGER_TYPE:
case REAL_TYPE:
case IDENTIFIER_NODE:
case VOID_TYPE:
+ case OPAQUE_TYPE:
case BOOLEAN_TYPE:
case INTEGER_TYPE:
case REAL_TYPE:
data_type = concat ("unsigned ", data_type, NULL);
break;
+ case OPAQUE_TYPE:
case REAL_TYPE:
data_type = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (t)));
break;
case INTEGER_TYPE:
case REAL_TYPE:
case VOID_TYPE:
+ case OPAQUE_TYPE:
case BOOLEAN_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
case UNION_TYPE:
case LANG_TYPE:
case VOID_TYPE:
+ case OPAQUE_TYPE:
case TYPENAME_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
case UNION_TYPE:
case LANG_TYPE:
case VOID_TYPE:
+ case OPAQUE_TYPE:
case TYPENAME_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
case ENUMERAL_TYPE:
case REAL_TYPE:
case VOID_TYPE:
+ case OPAQUE_TYPE:
case BOOLEAN_TYPE:
case INTEGER_TYPE:
case COMPLEX_TYPE:
case ERROR_MARK:
case IDENTIFIER_NODE:
case VOID_TYPE:
+ case OPAQUE_TYPE:
case REAL_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
case BOOLEAN_TYPE:
case ENUMERAL_TYPE:
case VOID_TYPE:
+ case OPAQUE_TYPE:
case NULLPTR_TYPE:
if (TREE_CODE (arg) != TREE_CODE (parm))
return unify_type_mismatch (explain_p, parm, arg);
/* All void and bool types are the same. */
break;
+ case OPAQUE_TYPE:
case INTEGER_TYPE:
case FIXED_POINT_TYPE:
case REAL_TYPE:
return 1;
case VOID_TYPE:
+ case OPAQUE_TYPE:
case ARRAY_TYPE:
case RECORD_TYPE:
case UNION_TYPE:
return;
case VOID_TYPE:
+ case OPAQUE_TYPE:
case INTEGER_TYPE:
case REAL_TYPE:
case FIXED_POINT_TYPE:
return 0;
case VOID_TYPE:
+ case OPAQUE_TYPE:
case METHOD_TYPE:
case FUNCTION_TYPE:
case LANG_TYPE:
break;
}
case VOID_TYPE:
+ case OPAQUE_TYPE:
case NULLPTR_TYPE:
break;
case TREE_LIST:
case VOID_CST:
case VOID_TYPE:
+ case OPAQUE_TYPE:
/* No recursive trees. */
break;
case ARRAY_TYPE:
switch (TREE_CODE (type))
{
case VOID_TYPE:
+ case OPAQUE_TYPE:
case COMPLEX_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
switch (TREE_CODE (a->type))
{
case VOID_TYPE:
+ case OPAQUE_TYPE:
case COMPLEX_TYPE:
case POINTER_TYPE:
case REFERENCE_TYPE:
function_type_class, method_type_class,
record_type_class, union_type_class,
array_type_class, string_type_class,
- lang_type_class
+ lang_type_class, opaque_type_class
};
#endif /* GCC_TYPECLASS_H */