Turi Create  4.0
sys_util.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 
7 #ifndef TURI_SYS_UTIL_H_
8 #define TURI_SYS_UTIL_H_
9 
10 #if defined(_MSC_VER)
11  #define TURI_BUILTIN_UNREACHABLE()
12  #define TURI_ATTRIBUTE_UNUSED
13  #define TURI_ATTRIBUTE_UNUSED_NDEBUG
14 #elif defined(__GNUC__)
15  #define TURI_BUILTIN_UNREACHABLE() __builtin_unreachable()
16  #define TURI_ATTRIBUTE_UNUSED __attribute__((unused))
17  #ifdef NDEBUG
18  #define TURI_ATTRIBUTE_UNUSED_NDEBUG TURI_ATTRIBUTE_UNUSED
19  #else
20  #define TURI_ATTRIBUTE_UNUSED_NDEBUG
21  #endif
22 #elif defined(__clang__)
23  #define TURI_BUILTIN_UNREACHABLE() __builtin_unreachable()
24  #define TURI_ATTRIBUTE_UNUSED __attribute__((unused))
25  #ifdef NDEBUG
26  #define TURI_ATTRIBUTE_UNUSED_NDEBUG TURI_ATTRIBUTE_UNUSED
27  #else
28  #define TURI_ATTRIBUTE_UNUSED_NDEBUG
29  #endif
30 #else
31  #error Unrecognized compiler platform.
32 #endif // Platform
33 
34 #endif