FS2_Open
Open source remastering of the Freespace 2 engine
gcc.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  * For GCC with autotools, see AX_CXX_COMPiLE_STDCXX_11 macro in the
53  * file "configure.ac". This sets HAVE_CXX11 & -std=c++0x or -std=c++11
54  * as appropriate.
55  *
56  * TODO: Is anything else required here?
57  */
58 #endif
59 
60 #define SIZE_T_ARG "%zu"
61 #define PTRDIFF_T_ARG "%zd"
62 
63 #define NOEXCEPT noexcept
64 
65 #define likely(x) __builtin_expect((long) !!(x), 1L)
66 #define unlikely(x) __builtin_expect((long) !!(x), 0L)