-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathmacro_utils.h
34 lines (27 loc) · 1.17 KB
/
macro_utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*******************************************************************************
//
// SYCL 2020 Conformance Test Suite
//
// Copyright (c) 2021 The Khronos Group Inc.
//
*******************************************************************************/
#ifndef __SYCLCTS_TESTS_COMMON_MACRO_UTILS_H
#define __SYCLCTS_TESTS_COMMON_MACRO_UTILS_H
#define INTERNAL_CTS_CAT(a, b) _INTERNAL_CTS_CAT(a, b)
#define _INTERNAL_CTS_CAT(a, b) a##b
#define INTERNAL_CTS_IF(c) INTERNAL_CTS_CAT(_INTERNAL_CTS_IF_, c)
#define _INTERNAL_CTS_IF_0(t, f) f
#define _INTERNAL_CTS_IF_1(t, f) t
#define INTERNAL_CTS_NOT(x) \
INTERNAL_CTS_CHECK(INTERNAL_CTS_CAT(_INTERNAL_CTS_NOT_, x))
#define _INTERNAL_CTS_NOT_0 INTERNAL_CTS_PROBE()
#define INTERNAL_CTS_BOOL(x) INTERNAL_CTS_NOT(INTERNAL_CTS_NOT(x))
#define INTERNAL_CTS_CHECK(...) _INTERNAL_CTS_CHECK(__VA_ARGS__, 0)
#define _INTERNAL_CTS_CHECK(_, v, ...) v
#define INTERNAL_CTS_PROBE() ~, 1
#define INTERNAL_CTS_FIRST(a, ...) a
#define INTERNAL_CTS_HAS_ARGS(...) \
INTERNAL_CTS_BOOL( \
INTERNAL_CTS_FIRST(_INTERNAL_CTS_END_OF_ARGS_ __VA_ARGS__)())
#define _INTERNAL_CTS_END_OF_ARGS_() 0
#endif // __SYCLCTS_TESTS_COMMON_MACRO_UTILS_H