|
|
|
1 |
|
#if _MSC_VER >= 1400 |
2 |
|
|
3 |
|
#pragma once |
4 |
|
|
5 |
|
#ifndef _M_CEE_SAFE // Source annotation attributes don't work with /clr:safe |
6 |
|
|
7 |
|
#if !defined(_W64) |
8 |
|
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 |
9 |
|
#define _W64 __w64 |
10 |
|
#else |
11 |
|
#define _W64 |
12 |
|
#endif |
13 |
|
#endif |
14 |
|
|
15 |
|
#ifndef _SIZE_T_DEFINED |
16 |
|
#ifdef _WIN64 |
17 |
|
typedef unsigned __int64 size_t; |
18 |
|
#else |
19 |
|
typedef _W64 unsigned int size_t; |
20 |
|
#endif |
21 |
|
#define _SIZE_T_DEFINED |
22 |
|
#endif |
23 |
|
|
24 |
|
#ifndef _WCHAR_T_DEFINED |
25 |
|
typedef unsigned short wchar_t; |
26 |
|
#define _WCHAR_T_DEFINED |
27 |
|
#endif |
28 |
|
|
29 |
|
|
30 |
|
#pragma push_macro( "SA" ) |
31 |
|
#pragma push_macro( "REPEATABLE" ) |
32 |
|
|
33 |
|
#ifdef __cplusplus |
34 |
|
#define SA( id ) id |
35 |
|
#define REPEATABLE [repeatable] |
36 |
|
#else // !__cplusplus |
37 |
|
#define SA( id ) SA_##id |
38 |
|
#define REPEATABLE |
39 |
|
#endif // !__cplusplus |
40 |
|
|
41 |
|
#ifdef __cplusplus |
42 |
|
namespace vc_attributes |
43 |
|
{ |
44 |
|
#endif // __cplusplus |
45 |
|
|
46 |
|
enum SA( YesNoMaybe ) |
47 |
|
{ |
48 |
|
// Choose values that we can detect as invalid if they are or'd together |
49 |
|
SA( No ) = 0x0fff0001, |
50 |
|
SA( Maybe ) = 0x0fff0010, |
51 |
|
SA( Yes ) = 0x0fff0100 |
52 |
|
}; |
53 |
|
|
54 |
|
typedef enum SA( YesNoMaybe ) SA( YesNoMaybe ); |
55 |
|
|
56 |
|
enum SA( AccessType ) |
57 |
|
{ |
58 |
|
SA( NoAccess ) = 0, |
59 |
|
SA( Read ) = 1, |
60 |
|
SA( Write ) = 2, |
61 |
|
SA( ReadWrite ) = 3 |
62 |
|
}; |
63 |
|
|
64 |
|
typedef enum SA( AccessType ) SA( AccessType ); |
65 |
|
|
66 |
|
#ifndef SAL_NO_ATTRIBUTE_DECLARATIONS |
67 |
|
|
68 |
|
REPEATABLE |
69 |
|
[source_annotation_attribute( SA( Parameter ) )] |
70 |
|
struct PreAttribute |
71 |
|
{ |
72 |
|
#ifdef __cplusplus |
73 |
|
PreAttribute(); |
74 |
|
#endif |
75 |
|
|
76 |
|
unsigned int Deref; |
77 |
|
SA( YesNoMaybe ) Valid; |
78 |
|
SA( YesNoMaybe ) Null; |
79 |
|
SA( YesNoMaybe ) Tainted; |
80 |
|
SA( AccessType ) Access; |
81 |
|
size_t ValidElementsConst; |
82 |
|
size_t ValidBytesConst; |
83 |
|
const wchar_t* ValidElements; |
84 |
|
const wchar_t* ValidBytes; |
85 |
|
const wchar_t* ValidElementsLength; |
86 |
|
const wchar_t* ValidBytesLength; |
87 |
|
size_t WritableElementsConst; |
88 |
|
size_t WritableBytesConst; |
89 |
|
const wchar_t* WritableElements; |
90 |
|
const wchar_t* WritableBytes; |
91 |
|
const wchar_t* WritableElementsLength; |
92 |
|
const wchar_t* WritableBytesLength; |
93 |
|
size_t ElementSizeConst; |
94 |
|
const wchar_t* ElementSize; |
95 |
|
SA( YesNoMaybe ) NullTerminated; |
96 |
|
const wchar_t* Condition; |
97 |
|
}; |
98 |
|
|
99 |
|
REPEATABLE |
100 |
|
[source_annotation_attribute( SA( Parameter )|SA( ReturnValue ) )] |
101 |
|
struct PostAttribute |
102 |
|
{ |
103 |
|
#ifdef __cplusplus |
104 |
|
PostAttribute(); |
105 |
|
#endif |
106 |
|
|
107 |
|
unsigned int Deref; |
108 |
|
SA( YesNoMaybe ) Valid; |
109 |
|
SA( YesNoMaybe ) Null; |
110 |
|
SA( YesNoMaybe ) Tainted; |
111 |
|
SA( AccessType ) Access; |
112 |
|
size_t ValidElementsConst; |
113 |
|
size_t ValidBytesConst; |
114 |
|
const wchar_t* ValidElements; |
115 |
|
const wchar_t* ValidBytes; |
116 |
|
const wchar_t* ValidElementsLength; |
117 |
|
const wchar_t* ValidBytesLength; |
118 |
|
size_t WritableElementsConst; |
119 |
|
size_t WritableBytesConst; |
120 |
|
const wchar_t* WritableElements; |
121 |
|
const wchar_t* WritableBytes; |
122 |
|
const wchar_t* WritableElementsLength; |
123 |
|
const wchar_t* WritableBytesLength; |
124 |
|
size_t ElementSizeConst; |
125 |
|
const wchar_t* ElementSize; |
126 |
|
SA( YesNoMaybe ) NullTerminated; |
127 |
|
SA( YesNoMaybe ) MustCheck; |
128 |
|
const wchar_t* Condition; |
129 |
|
}; |
130 |
|
|
131 |
|
[source_annotation_attribute( SA( Parameter ) )] |
132 |
|
struct FormatStringAttribute |
133 |
|
{ |
134 |
|
#ifdef __cplusplus |
135 |
|
FormatStringAttribute(); |
136 |
|
#endif |
137 |
|
|
138 |
|
const wchar_t* Style; |
139 |
|
const wchar_t* UnformattedAlternative; |
140 |
|
}; |
141 |
|
|
142 |
|
REPEATABLE |
143 |
|
[source_annotation_attribute( SA( ReturnValue ) )] |
144 |
|
struct InvalidCheckAttribute |
145 |
|
{ |
146 |
|
#ifdef __cplusplus |
147 |
|
InvalidCheckAttribute(); |
148 |
|
#endif |
149 |
|
|
150 |
|
long Value; |
151 |
|
}; |
152 |
|
|
153 |
|
[source_annotation_attribute( SA( Method ) )] |
154 |
|
struct SuccessAttribute |
155 |
|
{ |
156 |
|
#ifdef __cplusplus |
157 |
|
SuccessAttribute(); |
158 |
|
#endif |
159 |
|
|
160 |
|
const wchar_t* Condition; |
161 |
|
}; |
162 |
|
|
163 |
|
REPEATABLE |
174 |
|
[source_annotation_attribute( SA( Parameter )|SA( ReturnValue ) )] |
175 |
|
struct PostBoundAttribute |
176 |
|
{ |
177 |
|
#ifdef __cplusplus |
178 |
|
PostBoundAttribute(); |
179 |
|
#endif |
180 |
|
unsigned int Deref; |
181 |
|
}; |
182 |
|
|
183 |
|
REPEATABLE |
184 |
|
[source_annotation_attribute( SA( Parameter ) )] |
185 |
|
struct PreRangeAttribute |
186 |
|
{ |
187 |
|
#ifdef __cplusplus |
188 |
|
PreRangeAttribute(); |
189 |
|
#endif |
190 |
|
unsigned int Deref; |
191 |
|
const char* MinVal; |
192 |
|
const char* MaxVal; |
193 |
|
}; |
194 |
|
|
195 |
|
REPEATABLE |
196 |
|
[source_annotation_attribute( SA( Parameter )|SA( ReturnValue ) )] |
197 |
|
struct PostRangeAttribute |
198 |
|
{ |
199 |
|
#ifdef __cplusplus |
200 |
|
PostRangeAttribute(); |
201 |
|
#endif |
202 |
|
unsigned int Deref; |
203 |
|
const char* MinVal; |
204 |
|
const char* MaxVal; |
205 |
|
}; |
206 |
|
|
207 |
|
#endif // !SAL_NO_ATTRIBUTE_DECLARATIONS |
208 |
|
|
209 |
|
#ifdef __cplusplus |
210 |
|
}; // namespace vc_attributes |
211 |
|
#endif // __cplusplus |
212 |
|
|
213 |
|
#pragma pop_macro( "REPEATABLE" ) |
214 |
|
#pragma pop_macro( "SA" ) |
215 |
|
|
216 |
|
#ifdef __cplusplus |
217 |
|
|
218 |
|
#define SA_All All |
219 |
|
#define SA_Class Class |
220 |
|
#define SA_Constructor Constructor |
221 |
|
#define SA_Delegate Delegate |
222 |
|
#define SA_Enum Enum |
223 |
|
#define SA_Event Event |
224 |
|
#define SA_Field Field |
225 |
|
#define SA_GenericParameter GenericParameter |
226 |
|
#define SA_Interface Interface |
227 |
|
#define SA_Method Method |
228 |
|
#define SA_Module Module |
229 |
|
#define SA_Parameter Parameter |
230 |
|
#define SA_Property Property |
231 |
|
#define SA_ReturnValue ReturnValue |
232 |
|
#define SA_Struct Struct |
233 |
|
|
234 |
|
typedef ::vc_attributes::YesNoMaybe SA_YesNoMaybe; |
235 |
|
const ::vc_attributes::YesNoMaybe SA_Yes = ::vc_attributes::Yes; |
236 |
|
const ::vc_attributes::YesNoMaybe SA_No = ::vc_attributes::No; |
237 |
|
const ::vc_attributes::YesNoMaybe SA_Maybe = ::vc_attributes::Maybe; |
238 |
|
|
239 |
|
typedef ::vc_attributes::AccessType SA_AccessType; |
240 |
|
const ::vc_attributes::AccessType SA_NoAccess = ::vc_attributes::NoAccess; |
241 |
|
const ::vc_attributes::AccessType SA_Read = ::vc_attributes::Read; |
242 |
|
const ::vc_attributes::AccessType SA_Write = ::vc_attributes::Write; |
243 |
|
const ::vc_attributes::AccessType SA_ReadWrite = ::vc_attributes::ReadWrite; |
244 |
|
|
245 |
|
#ifndef SAL_NO_ATTRIBUTE_DECLARATIONS |
246 |
|
typedef ::vc_attributes::PreAttribute SA_Pre; |
247 |
|
typedef ::vc_attributes::PostAttribute SA_Post; |
248 |
|
typedef ::vc_attributes::FormatStringAttribute SA_FormatString; |
249 |
|
typedef ::vc_attributes::InvalidCheckAttribute SA_InvalidCheck; /*???*/ |
250 |
|
typedef ::vc_attributes::SuccessAttribute SA_Success; |
251 |
|
typedef ::vc_attributes::PreBoundAttribute SA_PreBound; |
252 |
|
typedef ::vc_attributes::PostBoundAttribute SA_PostBound; |
253 |
|
typedef ::vc_attributes::PreRangeAttribute SA_PreRange; |
254 |
|
typedef ::vc_attributes::PostRangeAttribute SA_PostRange; |
255 |
|
#endif //!SAL_NO_ATTRIBUTE_DECLARATIONS |
256 |
|
|
257 |
|
#else // !__cplusplus |
258 |
|
|
259 |
|
typedef struct PreAttribute SA_Pre; |
260 |
|
typedef struct PreAttribute PreAttribute; |
261 |
|
typedef struct PostAttribute SA_Post; |
262 |
|
typedef struct PostAttribute PostAttribute; |
263 |
|
typedef struct FormatStringAttribute SA_FormatString; |
264 |
|
typedef struct InvalidCheckAttribute SA_InvalidCheck; /*???*/ |
265 |
|
typedef struct SuccessAttribute SA_Success; |
266 |
|
typedef struct PreBoundAttribute SA_PreBound; |
267 |
|
typedef struct PostBoundAttribute SA_PostBound; |
268 |
|
typedef struct PreRangeAttribute SA_PreRange; |
269 |
|
typedef struct PostRangeAttribute SA_PostRange; |
270 |
|
|
271 |
|
#endif // __cplusplus |
272 |
|
|
273 |
|
#endif // !_M_CEE_SAFE |
274 |
|
|
275 |
|
#ifdef _MANAGED |
276 |
|
|
277 |
|
#ifdef CODE_ANALYSIS |
278 |
|
#define SA_SUPPRESS_MESSAGE( category, id, ... ) [::System::Diagnostics::CodeAnalysis::SuppressMessage( category, id, __VA_ARGS__ )] |
279 |
|
#define CA_SUPPRESS_MESSAGE( ... ) [System::Diagnostics::CodeAnalysis::SuppressMessage( __VA_ARGS__ )] |
280 |
|
#define CA_GLOBAL_SUPPRESS_MESSAGE( ... ) [assembly:System::Diagnostics::CodeAnalysis::SuppressMessage( __VA_ARGS__ )] |
281 |
|
#else // !CODE_ANALYSIS |
282 |
|
#define SA_SUPPRESS_MESSAGE( category, id, ... ) |
283 |
|
#define CA_SUPPRESS_MESSAGE( ... ) |
284 |
|
#define CA_GLOBAL_SUPPRESS_MESSAGE( ... ) |
285 |
|
#endif // !CODE_ANALYSIS |
286 |
|
|
287 |
|
#endif // _MANAGED |
288 |
|
|
289 |
|
// Windows SDK Update Vista Beta2 (June 2006): __analysis_assume defined by specstrings.h |
290 |
|
#ifdef _PREFAST_ |
291 |
|
// #define __analysis_assume(expr) __assume(expr) |
292 |
|
#else // !_PREFAST_ |
293 |
|
// #define __analysis_assume(expr) |
294 |
|
#endif // _PREFAST_ |
295 |
|
|
296 |
|
|
297 |
|
#endif // _MSC_VER >= 1400 |
298 |
|
|
299 |
|
|
|
|
|