Skip to content

Commit c7e3dd4

Browse files
jaladreipsjsji
authored andcommitted
Make OCLUtil.h compatible with C++20 standard (#3149)
The std::memory_order enum gets changed in C++20: https://en.cppreference.com/w/cpp/atomic/memory_order This change makes OCLUtil.h includable by projects that use C++20. Original commit: KhronosGroup/SPIRV-LLVM-Translator@61303255b75bb23
1 parent ab8cc8b commit c7e3dd4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm-spirv/lib/SPIRV/OCLUtil.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,19 @@ enum OCLScopeKind {
9898
// To avoid any inconsistence here, constants are explicitly initialized with
9999
// the corresponding constants from 'std::memory_order' enum.
100100
enum OCLMemOrderKind {
101+
#if __cplusplus >= 202002L
102+
OCLMO_relaxed = std::memory_order_relaxed,
103+
OCLMO_acquire = std::memory_order_acquire,
104+
OCLMO_release = std::memory_order_release,
105+
OCLMO_acq_rel = std::memory_order_acq_rel,
106+
OCLMO_seq_cst = std::memory_order_seq_cst
107+
#else
101108
OCLMO_relaxed = std::memory_order::memory_order_relaxed,
102109
OCLMO_acquire = std::memory_order::memory_order_acquire,
103110
OCLMO_release = std::memory_order::memory_order_release,
104111
OCLMO_acq_rel = std::memory_order::memory_order_acq_rel,
105112
OCLMO_seq_cst = std::memory_order::memory_order_seq_cst
113+
#endif
106114
};
107115

108116
enum IntelFPGAMemoryAccessesVal {

0 commit comments

Comments
 (0)