@@ -259,6 +259,10 @@ class ConvertOMPIToStandard:
259
259
COMM = 'ompi_convert_comm_ompi_to_standard'
260
260
261
261
262
+ # Inline function attributes
263
+ INLINE_ATTRS = '__opal_attribute_always_inline__ static inline'
264
+
265
+
262
266
def mpi_fn_name_from_base_fn_name (name ):
263
267
"""Convert from a base name to the standard 'MPI_*' name."""
264
268
return f'MPI_{ name .capitalize ()} '
@@ -318,7 +322,7 @@ def dump_lines(self, lines):
318
322
self .dump (line )
319
323
320
324
def generate_error_convert_fn (self ):
321
- self .dump (f'static inline int { ConvertFuncs .ERROR_CLASS } (int error_class)' )
325
+ self .dump (f'{ INLINE_ATTRS } int { ConvertFuncs .ERROR_CLASS } (int error_class)' )
322
326
self .dump ('{' )
323
327
lines = []
324
328
lines .append ('switch (error_class) {' )
@@ -333,7 +337,7 @@ def generate_error_convert_fn(self):
333
337
334
338
def generic_convert (self , fn_name , param_name , type_ , value_names ):
335
339
intern_type = self .mangle_name (type_ )
336
- self .dump (f'static inline { type_ } { fn_name } ({ intern_type } { param_name } )' )
340
+ self .dump (f'{ INLINE_ATTRS } { type_ } { fn_name } ({ intern_type } { param_name } )' )
337
341
self .dump ('{' )
338
342
lines = []
339
343
for i , value_name in enumerate (value_names ):
@@ -350,7 +354,7 @@ def generic_convert(self, fn_name, param_name, type_, value_names):
350
354
351
355
def generic_convert_reverse (self , fn_name , param_name , type_ , value_names ):
352
356
intern_type = self .mangle_name (type_ )
353
- self .dump (f'static inline { intern_type } { fn_name } ({ type_ } { param_name } )' )
357
+ self .dump (f'{ INLINE_ATTRS } { intern_type } { fn_name } ({ type_ } { param_name } )' )
354
358
self .dump ('{' )
355
359
lines = []
356
360
for i , value_name in enumerate (value_names ):
@@ -388,7 +392,7 @@ def generate_win_convert_fn(self):
388
392
389
393
def generate_pointer_convert_fn (self , type_ , fn_name , constants ):
390
394
abi_type = self .mangle_name (type_ )
391
- self .dump (f'static inline void { fn_name } ({ abi_type } *ptr)' )
395
+ self .dump (f'{ INLINE_ATTRS } void { fn_name } ({ abi_type } *ptr)' )
392
396
self .dump ('{' )
393
397
lines = []
394
398
for i , ompi_name in enumerate (constants ):
@@ -411,7 +415,7 @@ def generate_file_convert_fn(self):
411
415
def generate_status_convert_fn (self ):
412
416
type_ = 'MPI_Status'
413
417
abi_type = self .mangle_name (type_ )
414
- self .dump (f'static inline void { ConvertFuncs .STATUS } ({ abi_type } *out, { type_ } *inp)' )
418
+ self .dump (f'{ INLINE_ATTRS } void { ConvertFuncs .STATUS } ({ abi_type } *out, { type_ } *inp)' )
415
419
self .dump ('{' )
416
420
self .dump (' out->MPI_SOURCE = inp->MPI_SOURCE;' )
417
421
self .dump (' out->MPI_TAG = inp->MPI_TAG;' )
@@ -1182,7 +1186,7 @@ def standard_abi(base_name, template):
1182
1186
internal_name = f'ompi_abi_{ template .prototype .name } '
1183
1187
internal_sig = template .prototype .signature ('ompi' , internal_name ,
1184
1188
count_type = 'MPI_Count' )
1185
- print ('static inline' , internal_sig )
1189
+ print (INLINE_ATTRS , internal_sig )
1186
1190
template .print_body (func_name = base_name )
1187
1191
1188
1192
def generate_function (prototype , fn_name , internal_fn , count_type = 'int' ):
0 commit comments