FS2_Open
Open source remastering of the Freespace 2 engine
clang.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8 
20 #define SCP_FORMAT_STRING
21 #define SCP_FORMAT_STRING_ARGS(x,y) __attribute__((format(printf, x, y)))
22 
23 #define __UNUSED __attribute__((__unused__))
24 #define __ALIGNED(x) __attribute__((__aligned__(x)))
25 
26 #ifdef NO_RESTRICT_USE
27 # define RESTRICT
28 #else
29 # define RESTRICT restrict
30 #endif
31 
32 #define ASSUME(x)
33 
34 #if defined(NDEBUG)
35 # define Assertion(expr, msg, ...) do { } while (0)
36 #else
37 /*
38  * NOTE: Assertion() can only use its proper functionality in compilers
39  * that support variadic macros.
40  */
41 # define Assertion(expr, msg, ...) \
42  do { \
43  if (!(expr)) { \
44  WinAssert(#expr, __FILE__, __LINE__, msg, ##__VA_ARGS__); \
45  } \
46  } while (0)
47 #endif
48 
49 /* C++11 Standard Detection */
50 #if !defined(HAVE_CXX11)
51  /*
52  * Clang does not seem to have a feature check for 'is_trivial'.
53  * Assume it will be covered by one of the following checks ...
54  * http://clang.llvm.org/docs/LanguageExtensions.html#feature_check
55  */
56 # if __has_feature(cxx_static_assert) && __has_feature(cxx_auto_type)
57 # define HAVE_CXX11
58 # endif
59 #endif
60 
61 #define SIZE_T_ARG "%zu"
62 #define PTRDIFF_T_ARG "%zd"
63 
64 #define NOEXCEPT noexcept
65 
66 #define likely(x) __builtin_expect((long) !!(x), 1L)
67 #define unlikely(x) __builtin_expect((long) !!(x), 0L)