Skip to content

Commit 0f5f94d

Browse files
committed
fix: strip struct member access from OMP_DECLARE create list for OpenMP declare target compatibility
1 parent c97c5be commit 0f5f94d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/common/include/omp_macros.fpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,15 @@
231231

232232
#:def OMP_DECLARE(copyin=None, copyinReadOnly=None, create=None, link=None, extraOmpArgs=None)
233233
#:set copyin_val = OMP_TO_STR(copyin).strip('\n') + OMP_TO_STR(copyinReadOnly).strip('\n')
234-
#:set create_val = GEN_CLAUSE('(', create)
234+
#:if create is not None
235+
#:set _re = re.compile(',(?![^(]*\\))')
236+
#:set _elems = [x.strip() for x in re.sub(_re, ';', create).strip('[]').split(';')]
237+
#:set _bases = list(dict.fromkeys([x.split('%')[0].strip() for x in _elems]))
238+
#:set _create_omp = '[' + ', '.join(_bases) + ']'
239+
#:else
240+
#:set _create_omp = None
241+
#:endif
242+
#:set create_val = GEN_CLAUSE('(', _create_omp)
235243
#:set link_val = GEN_LINK_STR(link)
236244
#:set extraOmpArgs_val = GEN_EXTRA_ARGS_STR(extraOmpArgs)
237245
#:set clause_val = copyin_val.strip('\n') + &

0 commit comments

Comments
 (0)