Make compatible_types a public function
diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c
index e03817f..8712e73 100644
--- a/gcc/jit/libgccjit.c
+++ b/gcc/jit/libgccjit.c
@@ -356,9 +356,9 @@
gcc::jit::recording::type::accepts_writes_from virtual function on
LTYPE. */
-static bool
-compatible_types (gcc::jit::recording::type *ltype,
- gcc::jit::recording::type *rtype)
+bool
+gcc_jit_compatible_types (gcc_jit_type *ltype,
+ gcc_jit_type *rtype)
{
return ltype->accepts_writes_from (rtype);
}
@@ -1461,8 +1461,8 @@
global->get_debug_string ());
RETURN_IF_FAIL_PRINTF5 (
- compatible_types (global->get_type (),
- value->get_type ()),
+ gcc_jit_compatible_types ((gcc_jit_type*) global->get_type (),
+ (gcc_jit_type*) value->get_type ()),
NULL, NULL,
"mismatching types for global \"%s\":"
" assignment to global %s (type: %s) from %s (type: %s)",
@@ -1736,8 +1736,8 @@
gcc::jit::recording::type *field_type
= struct_type->get_fields ()->get_field (i)->get_type ();
RETURN_NULL_IF_FAIL_PRINTF4 (
- compatible_types (field_type,
- fields[i]->get_type ()),
+ gcc_jit_compatible_types ((gcc_jit_type*) field_type,
+ (gcc_jit_type*) fields[i]->get_type ()),
ctxt, loc,
"mismatching type for field[%zi] (expected type: %s): %s (type: %s)",
i,
@@ -1794,8 +1794,8 @@
RETURN_NULL_IF_FAIL_PRINTF1 (
elements[i], ctxt, loc, "NULL elements[%zi]", i);
RETURN_NULL_IF_FAIL_PRINTF4 (
- compatible_types (element_type,
- elements[i]->get_type ()),
+ gcc_jit_compatible_types ((gcc_jit_type*) element_type,
+ (gcc_jit_type*) elements[i]->get_type ()),
ctxt, loc,
"mismatching type for array[%zi] (expected type: %s): %s (type: %s)",
i,
@@ -1878,7 +1878,7 @@
RETURN_NULL_IF_FAIL (a, ctxt, loc, "NULL a");
RETURN_NULL_IF_FAIL (b, ctxt, loc, "NULL b");
RETURN_NULL_IF_FAIL_PRINTF4 (
- compatible_types (a->get_type (), b->get_type ()),
+ gcc_jit_compatible_types ((gcc_jit_type*) a->get_type (), (gcc_jit_type*) b->get_type ()),
ctxt, loc,
"mismatching types for binary op:"
" a: %s (type: %s) b: %s (type: %s)",
@@ -1987,8 +1987,8 @@
param->get_type ()->get_debug_string ());
RETURN_NULL_IF_FAIL_PRINTF6 (
- compatible_types (param->get_type (),
- arg->get_type ()),
+ gcc_jit_compatible_types ((gcc_jit_type*) param->get_type (),
+ (gcc_jit_type*) arg->get_type ()),
ctxt, loc,
"mismatching types for argument %d of function \"%s\":"
" assignment to param %s (type: %s) from %s (type: %s)",
@@ -2076,8 +2076,8 @@
param_type->get_debug_string ());
RETURN_NULL_IF_FAIL_PRINTF6 (
- compatible_types (param_type,
- arg->get_type ()),
+ gcc_jit_compatible_types ((gcc_jit_type*) param_type,
+ (gcc_jit_type*) arg->get_type ()),
ctxt, loc,
"mismatching types for argument %d of fn_ptr: %s:"
" assignment to param %d (type: %s) from %s (type: %s)",
@@ -2528,8 +2528,8 @@
RETURN_IF_FAIL (lvalue, ctxt, loc, "NULL lvalue");
RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue");
RETURN_IF_FAIL_PRINTF4 (
- compatible_types (lvalue->get_type (),
- rvalue->get_type ()),
+ gcc_jit_compatible_types ((gcc_jit_type*) lvalue->get_type (),
+ (gcc_jit_type*) rvalue->get_type ()),
ctxt, loc,
"mismatching types:"
" assignment to %s (type: %s) from %s (type: %s)",
@@ -2574,8 +2574,8 @@
op);
RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue");
RETURN_IF_FAIL_PRINTF4 (
- compatible_types (lvalue->get_type (),
- rvalue->get_type ()),
+ gcc_jit_compatible_types ((gcc_jit_type*) lvalue->get_type (),
+ (gcc_jit_type*) rvalue->get_type ()),
ctxt, loc,
"mismatching types:"
" assignment to %s (type: %s) involving %s (type: %s)",
@@ -2731,9 +2731,9 @@
gcc::jit::recording::function *func = block->get_function ();
RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue");
RETURN_IF_FAIL_PRINTF4 (
- compatible_types (
- func->get_return_type (),
- rvalue->get_type ()),
+ gcc_jit_compatible_types (
+ (gcc_jit_type*) func->get_return_type (),
+ (gcc_jit_type*) rvalue->get_type ()),
ctxt, loc,
"mismatching types:"
" return of %s (type: %s) in function %s (return type: %s)",
@@ -3731,8 +3731,8 @@
RETURN_NULL_IF_FAIL_PRINTF1 (
elements[i], ctxt, loc, "NULL elements[%zi]", i);
RETURN_NULL_IF_FAIL_PRINTF4 (
- compatible_types (element_type,
- elements[i]->get_type ()),
+ gcc_jit_compatible_types ((gcc_jit_type*) element_type,
+ (gcc_jit_type*) elements[i]->get_type ()),
ctxt, loc,
"mismatching type for element[%zi] (expected type: %s): %s (type: %s)",
i,
diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h
index 8c737f1..732ca58 100644
--- a/gcc/jit/libgccjit.h
+++ b/gcc/jit/libgccjit.h
@@ -616,6 +616,11 @@
extern ssize_t
gcc_jit_type_get_size (gcc_jit_type *type);
+/* Given types LTYPE and RTYPE, return true if they are compatible. */
+extern bool
+gcc_jit_compatible_types (gcc_jit_type *ltype,
+ gcc_jit_type *rtype);
+
/* Given type "T", get type "T[N]" (for a constant N). */
extern gcc_jit_type *
gcc_jit_context_new_array_type (gcc_jit_context *ctxt,
diff --git a/gcc/jit/libgccjit.map b/gcc/jit/libgccjit.map
index 53b4246..abe6ea0 100644
--- a/gcc/jit/libgccjit.map
+++ b/gcc/jit/libgccjit.map
@@ -256,4 +256,5 @@
LIBGCCJIT_ABI_22 {
global:
gcc_jit_type_get_size;
+ gcc_jit_compatible_types;
} LIBGCCJIT_ABI_21;