1 | /******************************************************************************* |
2 | * Copyright 2016-2022 Intel Corporation |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | *******************************************************************************/ |
16 | |
17 | #ifndef COMMON_Z_MAGIC_HPP |
18 | #define COMMON_Z_MAGIC_HPP |
19 | |
20 | #define for_ for |
21 | |
22 | #define CHAIn2(a, b) a b |
23 | #define CHAIN2(a, b) CHAIn2(a, b) |
24 | |
25 | #define CONCAt2(a, b) a##b |
26 | #define CONCAT2(a, b) CONCAt2(a, b) |
27 | |
28 | #define STRINGIFy(s) #s |
29 | #define STRINGIFY(s) STRINGIFy(s) |
30 | |
31 | #ifdef _MSC_VER |
32 | #define PRAGMA_MACRo(x) __pragma(x) |
33 | #define PRAGMA_MACRO(x) PRAGMA_MACRo(x) |
34 | #else |
35 | #define PRAGMA_MACRo(x) _Pragma(#x) |
36 | #define PRAGMA_MACRO(x) PRAGMA_MACRo(x) |
37 | #endif |
38 | |
39 | #define UNUSED(x) ((void)x) |
40 | #define MAYBE_UNUSED(x) UNUSED(x) |
41 | |
42 | #if defined(_WIN32) && !defined(__GNUC__) |
43 | #define __PRETTY_FUNCTION__ __FUNCSIG__ |
44 | #endif |
45 | |
46 | #define Z_NOT_0 1 |
47 | #define Z_NOT_1 0 |
48 | #define Z_NOT(cond) CONCAT2(Z_NOT_, cond) |
49 | |
50 | #define Z_DO_IF_0(...) |
51 | #define Z_DO_IF_1(...) __VA_ARGS__ |
52 | #define Z_CONDITIONAL_DO(cond, ...) CONCAT2(Z_DO_IF_, cond)(__VA_ARGS__) |
53 | |
54 | #endif |
55 | |
56 | // vim: et ts=4 sw=4 cindent cino+=l0,\:4,N-s |
57 | |