summaryrefslogtreecommitdiffhomepage
path: root/include/psxtypes/compiler/__nt_compiler_msvc.h
blob: 78aa71d82ad16b54fa3ae51599fa55d1284c9a63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef _PSXTYPES_NT_COMPILER_MSVC_H_
#define _PSXTYPES_NT_COMPILER_MSVC_H_

/* sigh */
#pragma warning ( disable : 4204 ) /* non-constant aggregate initializer    */
#pragma warning ( disable : 4054 ) /* cast funtion ptr to data ptr         */
#pragma warning ( disable : 4055 ) /* cast data ptr to funtion ptr        */
#pragma warning ( disable : 4127 ) /* constant expression comparisons    */
#pragma warning ( disable : 4152 ) /* cast a function pointer to void   */
#pragma warning ( disable : 4200 ) /* adjust to the 21st century       */
#pragma warning ( disable : 4201 ) /* nameless struct member          */
#pragma warning ( disable : 4702 ) /* unreachable code               */
#pragma warning ( disable : 4706 ) /* assignment within conditional */
#pragma warning ( disable : 4820 ) /* struct member padding        */

/* compiler identification */
#define __COMPILER__			__MSVC__
#define __COMPILER_DEPENDENT_SUFFIX__	__msvc


/* NTVER: the bare minimum */
#ifndef NTVER
	#define NTVER 0x0500
#elif (NTVER < 0x0500)
	#error __^@^__: NTVER: minimum supported NT version is 0x0500.
#endif


/* x86 processor model */
#ifdef _M_IX86

#if (_M_IX86 == 900)
	#define __X86_MODEL 	986
#elif (_M_IX86 == 800)
	#define __X86_MODEL 	886
#elif (_M_IX86 == 700)
	#define __X86_MODEL 	786
#elif (_M_IX86 == 600)
	#define __X86_MODEL 	686
#elif (_M_IX86 == 500)
	#define __X86_MODEL 	586
#elif (_M_IX86 == 400)
	#define __X86_MODEL 	486
#elif (_M_IX86 == 300)
	#define __X86_MODEL 	386
#endif

#endif

/* x86_64 processor model */
#if defined(_M_AMD64)
	#define __amd64 1
	#define __X86_64_MODEL 	__amd64
#endif


/* va_list */
#define __CUSTOM_OR_BUILTIN_va_list__  char *


/* compiler keywords */
#define __in
#define __out
#define __in_opt
#define __out_opt
#define __in_out
#define __in_out_opt
#define __reserved
#define __optional
#define __simplified
#define __caller_allocated
#define __caller_initialized
#define __null_placeholder		(0x0)


/* __SIZEOF_POINTER__ */
#if defined(__NT32)
	#define __SIZEOF_POINTER__	4
#elif defined(__NT64)
	#define __SIZEOF_POINTER__	8
#endif


/* compiler attributes */
#define __inline__			__inline
#define __volatile__			volatile
#define __attr_aligned__(x)		__declspec(align(x))
#define __attr_ptr_size_aligned__	__attr_aligned__(__SIZEOF_POINTER__)
#define __attr_packed__
#define __attr_export__			__declspec(dllexport)
#define __attr_import__			__declspec(dllimport)
#define __attr_naked__			__declspec(naked)
#define __attr_weak__

#ifdef __PE_VISIBILITY__
#define __attr_hidden__ 		__attribute__((visibility("hidden")))
#define __attr_public__ 		__attribute__((visibility("default")))
#define __attr_protected__ 		__attribute__((visibility("protected")))
#else
#define __attr_hidden__
#define __attr_public__
#define __attr_protected__
#endif


/* named section support */
#define __attr_section__(s)
#define __attr_section_decl__(s)	__declspec(allocate(s))
#define __SECTION_PRAGMA_REQUIRED__


/* compiler-dependent assertions */
#define __assert_aligned_size(s,a)	typedef char __assert##s [1-((sizeof(s) % a))]
#define __assert_struct_size(s1,s2)     typedef char __assert##s1##s2 [1 + sizeof(s2) -sizeof(s1)]


/* calling conventions */
#undef __stdcall
#undef APIENTRY
#undef CALLBACK
#undef NTAPI
#undef WINAPI

#define __stdcall 	_stdcall
#define APIENTRY	__stdcall
#define CALLBACK	__stdcall
#define NTAPI		__stdcall
#define WINAPI		__stdcall

#endif /* _PSXTYPES_NT_COMPILER_MSVC_H_ */