FS2_Open
Open source remastering of the Freespace 2 engine
msvc.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 #include <sal.h>
21 
22 #define SCP_FORMAT_STRING _Printf_format_string_
23 #define SCP_FORMAT_STRING_ARGS(x,y)
24 
25 #define __attribute__(x)
26 #define __UNUSED
27 #define __ALIGNED(x) __declspec(align(x))
28 
29 #ifdef NO_RESTRICT_USE
30 # define RESTRICT
31 #elif _MSC_VER >= 1400
32 # define RESTRICT __restrict
33 #else
34 # define RESTRICT
35 #endif
36 
37 #define ASSUME(x)
38 
39 #if defined(NDEBUG)
40 # if _MSC_VER >= 1400 /* MSVC 2005 or newer */
41 # define Assertion(expr, msg, ...) do { ASSUME(expr); } while (0)
42 # else
43 # define Assertion(expr, msg) do {} while (0)
44 # endif
45 #else
46  /*
47  * NOTE: Assertion() can only use its proper functionality in compilers
48  * that support variadic macros.
49  */
50 # if _MSC_VER >= 1400 /* MSVC 2005 or newer */
51 # define Assertion(expr, msg, ...) \
52  do { \
53  if (!(expr)) { \
54  WinAssert(#expr, __FILE__, __LINE__, msg, __VA_ARGS__); \
55  } \
56  } while (0)
57 # else /* Older MSVC compilers */
58 # define Assertion(expr, msg) \
59  do { \
60  if (!(expr)) { \
61  WinAssert(#expr, __FILE__, __LINE__); \
62  } while (0)
63 # endif
64 #endif
65 
66 /* C++11 Standard Detection */
67 #if !defined(HAVE_CXX11)
68  /* Use the Visual Studio version to detect C++11 support */
69 # if _MSC_VER >= 1600
70 # define HAVE_CXX11
71 # endif
72 #endif
73 
74 #define PTRDIFF_T_ARG "%Iu"
75 #define SIZE_T_ARG "%Id"
76 
77 /* The 'noexcept' keyword is not defined in versions before VS 2015. */
78 #if _MSC_VER < 1900
79 # define NOEXCEPT
80 #else
81 # define NOEXCEPT noexcept
82 #endif
83 
84 #define likely(x)
85 #define unlikely(x)