From 69720717c143a9dc77d4c52dd5e2f19858425fa8 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 17 Jul 2018 08:10:04 +0000 Subject: [Ada] Type mismatch warning for imported C++ class 2018-07-17 Eric Botcazou gcc/ada/ * gcc-interface/ada-tree.h (TYPE_RETURN_BY_DIRECT_REF_P): Define for METHOD_TYPE too. (TYPE_RETURN_UNCONSTRAINED_P): Likewise. (TYPE_CI_CO_LIST): Likewise. * gcc-interface/gigi.h (is_cplusplus_method): Delete. (fntype_same_flags_p): Adjust comment. * gcc-interface/decl.c (Has_Thiscall_Convention): Delete. (gnat_to_gnu_entity) : Do not set the "thiscall" attribute directly. (is_cplusplus_method): Make static and adjust head comment. (gnat_to_gnu_param): Return a pointer for the "this" parameter of C++ constructors. (gnat_to_gnu_subprog_type): Turn imported C++ constructors into their callable form. Generate a METHOD_TYPE node for imported C++ methods. Set param_list at the very end of the processing. (substitute_in_type) : New case. * gcc-interface/misc.c (gnat_print_type) : Likewise. (gnat_type_hash_eq): Accept METHOD_TYPE. * gcc-interface/trans.c (Identifier_to_gnu): Deal with METHOD_TYPE. (Attribute_to_gnu): Likewise. (Call_to_gnu): Likewise. (process_freeze_entity): Likewise. * gcc-interface/utils.c (create_subprog_decl): Adjust head comment. (fntype_same_flags_p): Likewise. From-SVN: r262792 --- gcc/ada/gcc-interface/misc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/ada/gcc-interface/misc.c') diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index f74dd5e..05bbf2e 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -473,6 +473,7 @@ gnat_print_type (FILE *file, tree node, int indent) switch (TREE_CODE (node)) { case FUNCTION_TYPE: + case METHOD_TYPE: print_node (file, "ci/co list", TYPE_CI_CO_LIST (node), indent + 4); break; @@ -684,12 +685,12 @@ gnat_get_fixed_point_type_info (const_tree type, /* Return true if types T1 and T2 are identical for type hashing purposes. Called only after doing all language independent checks. At present, - this function is only called when both types are FUNCTION_TYPE. */ + this is only called when both types are FUNCTION_TYPE or METHOD_TYPE. */ static bool gnat_type_hash_eq (const_tree t1, const_tree t2) { - gcc_assert (TREE_CODE (t1) == FUNCTION_TYPE); + gcc_assert (FUNC_OR_METHOD_TYPE_P (t1) && TREE_CODE (t1) == TREE_CODE (t2)); return fntype_same_flags_p (t1, TYPE_CI_CO_LIST (t2), TYPE_RETURN_UNCONSTRAINED_P (t2), TYPE_RETURN_BY_DIRECT_REF_P (t2), -- cgit v1.1