diff --git a/ompi/mpi/c/abi.py b/ompi/mpi/c/abi.py index efa6adc4a84..2de9bff681c 100755 --- a/ompi/mpi/c/abi.py +++ b/ompi/mpi/c/abi.py @@ -259,6 +259,10 @@ class ConvertOMPIToStandard: COMM = 'ompi_convert_comm_ompi_to_standard' +# Inline function attributes +INLINE_ATTRS = '__opal_attribute_always_inline__ static inline' + + def mpi_fn_name_from_base_fn_name(name): """Convert from a base name to the standard 'MPI_*' name.""" return f'MPI_{name.capitalize()}' @@ -318,7 +322,7 @@ def dump_lines(self, lines): self.dump(line) def generate_error_convert_fn(self): - self.dump(f'static inline int {ConvertFuncs.ERROR_CLASS}(int error_class)') + self.dump(f'{INLINE_ATTRS} int {ConvertFuncs.ERROR_CLASS}(int error_class)') self.dump('{') lines = [] lines.append('switch (error_class) {') @@ -333,7 +337,7 @@ def generate_error_convert_fn(self): def generic_convert(self, fn_name, param_name, type_, value_names): intern_type = self.mangle_name(type_) - self.dump(f'static inline {type_} {fn_name}({intern_type} {param_name})') + self.dump(f'{INLINE_ATTRS} {type_} {fn_name}({intern_type} {param_name})') self.dump('{') lines = [] for i, value_name in enumerate(value_names): @@ -350,7 +354,7 @@ def generic_convert(self, fn_name, param_name, type_, value_names): def generic_convert_reverse(self, fn_name, param_name, type_, value_names): intern_type = self.mangle_name(type_) - self.dump(f'static inline {intern_type} {fn_name}({type_} {param_name})') + self.dump(f'{INLINE_ATTRS} {intern_type} {fn_name}({type_} {param_name})') self.dump('{') lines = [] for i, value_name in enumerate(value_names): @@ -388,7 +392,7 @@ def generate_win_convert_fn(self): def generate_pointer_convert_fn(self, type_, fn_name, constants): abi_type = self.mangle_name(type_) - self.dump(f'static inline void {fn_name}({abi_type} *ptr)') + self.dump(f'{INLINE_ATTRS} void {fn_name}({abi_type} *ptr)') self.dump('{') lines = [] for i, ompi_name in enumerate(constants): @@ -411,7 +415,7 @@ def generate_file_convert_fn(self): def generate_status_convert_fn(self): type_ = 'MPI_Status' abi_type = self.mangle_name(type_) - self.dump(f'static inline void {ConvertFuncs.STATUS}({abi_type} *out, {type_} *inp)') + self.dump(f'{INLINE_ATTRS} void {ConvertFuncs.STATUS}({abi_type} *out, {type_} *inp)') self.dump('{') self.dump(' out->MPI_SOURCE = inp->MPI_SOURCE;') self.dump(' out->MPI_TAG = inp->MPI_TAG;') @@ -1182,7 +1186,7 @@ def standard_abi(base_name, template): internal_name = f'ompi_abi_{template.prototype.name}' internal_sig = template.prototype.signature('ompi', internal_name, count_type='MPI_Count') - print('static inline', internal_sig) + print(INLINE_ATTRS, internal_sig) template.print_body(func_name=base_name) def generate_function(prototype, fn_name, internal_fn, count_type='int'):