Skip to content

Commit 66c57e2

Browse files
committed
[SYCL][ESIMD] Fix multistatement macro support
Looks like the semicolon could possibly lead to the code breakage in the following case: if (expression) __esimd_move_test_proxy(other); else statement; Signed-off-by: Kochetkov, Yuriy <[email protected]>
1 parent 4c5d5b2 commit 66c57e2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sycl/include/sycl/ext/intel/experimental/esimd/detail/test_proxy.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@
3636
// constructors and move operators.
3737
// Still the user-defined constructors or move operators should explicitly state
3838
// what to do with each of class atributes, so a proper wrapper required
39+
//
40+
// We are using a simple do-while trick to make sure no code breakage could
41+
// possibly occur in case macro becomes multistatement (PRE10-C in SEI CERT C)
3942
#define __esimd_move_test_proxy(other) \
4043
do { \
4144
M_testProxy = std::move(other.M_testProxy); \
42-
} while (false);
45+
} while (false)
4346

4447
__SYCL_INLINE_NAMESPACE(cl) {
4548
namespace sycl {

0 commit comments

Comments
 (0)