From 9b3e1141d774cea8d365a9d8e00a9d02b82b49b4 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 9 Jan 2025 12:14:35 +0000 Subject: [PATCH] Transpile: Remove redundant interface generation for module functions --- .../transpile/fortran_iso_c_wrapper.py | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/loki/transformations/transpile/fortran_iso_c_wrapper.py b/loki/transformations/transpile/fortran_iso_c_wrapper.py index 819d919ba..e1ab7669b 100644 --- a/loki/transformations/transpile/fortran_iso_c_wrapper.py +++ b/loki/transformations/transpile/fortran_iso_c_wrapper.py @@ -457,28 +457,6 @@ def generate_iso_c_wrapper_module(module, use_c_ptr=False, language='c'): wrappers += [getter] wrapper_module.contains = ir.Section(body=(ir.Intrinsic('CONTAINS'), *wrappers)) - # Create function interface definitions for module functions - intfs = [] - for fct in module.subroutines: - if fct.is_function: - intf_fct = fct.clone(bind=f'{fct.name.lower()}') - intf_fct.body = ir.Section(body=()) - - intf_args = [] - for arg in intf_fct.arguments: - # Only scalar, intent(in) arguments are pass by value - # Pass by reference for array types - value = isinstance(arg, sym.Scalar) and arg.type.intent and arg.type.intent.lower() == 'in' - kind = iso_c_intrinsic_kind(arg.type, intf_fct, use_c_ptr=use_c_ptr) - ctype = SymbolAttributes(arg.type.dtype, value=value, kind=kind) - dimensions = arg.dimensions if isinstance(arg, sym.Array) else None - var = sym.Variable(name=arg.name, dimensions=dimensions, type=ctype, scope=intf_fct) - intf_args += (var,) - intf_fct.arguments = intf_args - sanitise_imports(intf_fct) - intfs.append(intf_fct) - spec.append(ir.Interface(body=(as_tuple(intfs),))) - # Remove any unused imports sanitise_imports(wrapper_module) return wrapper_module