STLdoc
STLdocumentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sourceannotations.h
Go to the documentation of this file.
1 /***
2 *SourceAnnotations.h - Source Annotation definitions
3 *
4 * Copyright (c) Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 * Defines internal structures used by the Source Code analysis engine.
8 *
9 ****/
10 
11 #if _MSC_VER >= 1400
12 
13 #pragma once
14 
15 #ifndef _M_CEE_SAFE
16 
17 #if !defined (_W64)
18 #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
19 #define _W64 __w64
20 #else /* !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 */
21 #define _W64
22 #endif /* !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 */
23 #endif /* !defined (_W64) */
24 
25 #ifndef _SIZE_T_DEFINED
26 #ifdef _WIN64
27 typedef unsigned __int64 size_t;
28 #else /* _WIN64 */
29 typedef _W64 unsigned int size_t;
30 #endif /* _WIN64 */
31 #define _SIZE_T_DEFINED
32 #endif /* _SIZE_T_DEFINED */
33 
34 #ifndef _WCHAR_T_DEFINED
35 typedef unsigned short wchar_t;
36 #define _WCHAR_T_DEFINED
37 #endif /* _WCHAR_T_DEFINED */
38 
39 
40 #pragma push_macro( "SA" )
41 #pragma push_macro( "REPEATABLE" )
42 
43 #ifdef __cplusplus
44 #define SA( id ) id
45 #define REPEATABLE [repeatable]
46 #else /* __cplusplus */
47 #define SA( id ) SA_##id
48 #define REPEATABLE
49 #endif /* __cplusplus */
50 
51 #ifdef __cplusplus
52 namespace vc_attributes
53 {
54 #endif /* __cplusplus */
55 
56 enum SA( YesNoMaybe )
57 {
58  // Choose values that we can detect as invalid if they are or'd together
59  SA( No ) = 0x0fff0001,
60  SA( Maybe ) = 0x0fff0010,
61  SA( Yes ) = 0x0fff0100
62 };
63 
64 typedef enum SA( YesNoMaybe ) SA( YesNoMaybe );
65 
66 enum SA( AccessType )
67 {
68  SA( NoAccess ) = 0,
69  SA( Read ) = 1,
70  SA( Write ) = 2,
71  SA( ReadWrite ) = 3
72 };
73 
74 typedef enum SA( AccessType ) SA( AccessType );
75 
76 #ifndef SAL_NO_ATTRIBUTE_DECLARATIONS
77 
78 REPEATABLE
79 [source_annotation_attribute( SA( All ) )]
80 struct PreAttribute
81 {
82 #ifdef __cplusplus
83  PreAttribute();
84 #endif /* __cplusplus */
85 
86  unsigned int Deref;
87  SA( YesNoMaybe ) Valid;
88  SA( YesNoMaybe ) Null;
89  SA( YesNoMaybe ) Tainted;
90  SA( AccessType ) Access;
91  unsigned int Notref;
92  size_t ValidElementsConst;
93  size_t ValidBytesConst;
94  const wchar_t* ValidElements;
95  const wchar_t* ValidBytes;
96  const wchar_t* ValidElementsLength;
97  const wchar_t* ValidBytesLength;
98  size_t WritableElementsConst;
99  size_t WritableBytesConst;
100  const wchar_t* WritableElements;
101  const wchar_t* WritableBytes;
102  const wchar_t* WritableElementsLength;
103  const wchar_t* WritableBytesLength;
104  size_t ElementSizeConst;
105  const wchar_t* ElementSize;
106  SA( YesNoMaybe ) NullTerminated;
107  const wchar_t* Condition;
108 };
109 
110 REPEATABLE
111 [source_annotation_attribute( SA( All ) )]
112 struct PostAttribute
113 {
114 #ifdef __cplusplus
115  PostAttribute();
116 #endif /* __cplusplus */
117 
118  unsigned int Deref;
119  SA( YesNoMaybe ) Valid;
120  SA( YesNoMaybe ) Null;
121  SA( YesNoMaybe ) Tainted;
122  SA( AccessType ) Access;
123  unsigned int Notref;
124  size_t ValidElementsConst;
125  size_t ValidBytesConst;
126  const wchar_t* ValidElements;
127  const wchar_t* ValidBytes;
128  const wchar_t* ValidElementsLength;
129  const wchar_t* ValidBytesLength;
130  size_t WritableElementsConst;
131  size_t WritableBytesConst;
132  const wchar_t* WritableElements;
133  const wchar_t* WritableBytes;
134  const wchar_t* WritableElementsLength;
135  const wchar_t* WritableBytesLength;
136  size_t ElementSizeConst;
137  const wchar_t* ElementSize;
138  SA( YesNoMaybe ) NullTerminated;
139  SA( YesNoMaybe ) MustCheck;
140  const wchar_t* Condition;
141 };
142 
143 [source_annotation_attribute( SA( All ) )]
144 struct FormatStringAttribute
145 {
146 #ifdef __cplusplus
147  FormatStringAttribute();
148 #endif /* __cplusplus */
149 
150  const wchar_t* Style;
151  const wchar_t* UnformattedAlternative;
152 };
153 
154 REPEATABLE
155 [source_annotation_attribute( SA( All ) )]
156 struct InvalidCheckAttribute
157 {
158 #ifdef __cplusplus
159  InvalidCheckAttribute();
160 #endif /* __cplusplus */
161 
162  long Value;
163 };
164 
165 [source_annotation_attribute( SA( All ) )]
166 struct SuccessAttribute
167 {
168 #ifdef __cplusplus
169  SuccessAttribute();
170 #endif /* __cplusplus */
171 
172  const wchar_t* Condition;
173 };
174 
175 REPEATABLE
176 [source_annotation_attribute( SA( All ) )]
177 struct PreBoundAttribute
178 {
179 #ifdef __cplusplus
180  PreBoundAttribute();
181 #endif /* __cplusplus */
182  unsigned int Deref;
183 };
184 
185 REPEATABLE
186 [source_annotation_attribute( SA( All ) )]
187 struct PostBoundAttribute
188 {
189 #ifdef __cplusplus
190  PostBoundAttribute();
191 #endif /* __cplusplus */
192  unsigned int Deref;
193 };
194 
195 REPEATABLE
196 [source_annotation_attribute( SA( All ) )]
197 struct PreRangeAttribute
198 {
199 #ifdef __cplusplus
200  PreRangeAttribute();
201 #endif /* __cplusplus */
202  unsigned int Deref;
203  const char* MinVal;
204  const char* MaxVal;
205 };
206 
207 REPEATABLE
208 [source_annotation_attribute( SA( All ) )]
209 struct PostRangeAttribute
210 {
211 #ifdef __cplusplus
212  PostRangeAttribute();
213 #endif /* __cplusplus */
214  unsigned int Deref;
215  const char* MinVal;
216  const char* MaxVal;
217 };
218 
219 REPEATABLE
220 [source_annotation_attribute( SA( All ) )]
221 struct DerefAttribute
222 {
223 #ifdef __cplusplus
224  DerefAttribute();
225 #endif /* __cplusplus */
226  int unused;
227 };
228 
229 REPEATABLE
230 [source_annotation_attribute( SA( All ) )]
231 struct NotrefAttribute
232 {
233 #ifdef __cplusplus
234  NotrefAttribute();
235 #endif /* __cplusplus */
236  int unused;
237 };
238 
239 REPEATABLE
240 [source_annotation_attribute( SA( All ) )]
241 struct AnnotesAttribute
242 {
243 #ifdef __cplusplus
244  AnnotesAttribute();
245 #endif /* __cplusplus */
246  wchar_t *Name;
247  wchar_t *p1;
248  wchar_t *p2;
249  wchar_t *p3;
250  wchar_t *p4;
251  wchar_t *p5;
252  wchar_t *p6;
253  wchar_t *p7;
254  wchar_t *p8;
255  wchar_t *p9;
256 };
257 
258 [source_annotation_attribute( SA( All ) )]
259 REPEATABLE
260 struct AtAttribute
261 {
262 #ifdef __cplusplus
263  AtAttribute();
264 #endif /* __cplusplus */
265  wchar_t *p1;
266 };
267 
268 [source_annotation_attribute( SA( All ) )]
269 REPEATABLE
270 struct AtBufferAttribute
271 {
272 #ifdef __cplusplus
273  AtBufferAttribute();
274 #endif /* __cplusplus */
275  wchar_t *p1;
276  wchar_t *p2;
277  wchar_t *p3;
278 };
279 
280 [source_annotation_attribute( SA( All ) )]
281 REPEATABLE
282 struct WhenAttribute
283 {
284 #ifdef __cplusplus
285  WhenAttribute();
286 #endif /* __cplusplus */
287  wchar_t *p1;
288 };
289 
290 [source_annotation_attribute( SA( All ) )]
291 REPEATABLE
292 struct TypefixAttribute
293 {
294 #ifdef __cplusplus
295  TypefixAttribute();
296 #endif /* __cplusplus */
297  wchar_t *p1;
298 };
299 
300 [source_annotation_attribute( SA( All ) )]
301 REPEATABLE
302 struct ContextAttribute
303 {
304 #ifdef __cplusplus
305  ContextAttribute();
306 #endif /* __cplusplus */
307  wchar_t *p1;
308 };
309 
310 [source_annotation_attribute( SA( All ) )]
311 REPEATABLE
312 struct ExceptAttribute
313 {
314 #ifdef __cplusplus
315  ExceptAttribute();
316 #endif /* __cplusplus */
317  int unused;
318 };
319 
320 [source_annotation_attribute( SA( All ) )]
321 REPEATABLE
322 struct PreOpAttribute
323 {
324 #ifdef __cplusplus
325  PreOpAttribute();
326 #endif /* __cplusplus */
327  int unused;
328 };
329 
330 [source_annotation_attribute( SA( All ) )]
331 REPEATABLE
332 struct PostOpAttribute
333 {
334 #ifdef __cplusplus
335  PostOpAttribute();
336 #endif /* __cplusplus */
337  int unused;
338 };
339 
340 [source_annotation_attribute( SA( All ) )]
341 REPEATABLE
342 struct BeginAttribute
343 {
344 #ifdef __cplusplus
345  BeginAttribute();
346 #endif /* __cplusplus */
347  int unused;
348 };
349 
350 [source_annotation_attribute( SA( All ) )]
351 REPEATABLE
352 struct EndAttribute
353 {
354 #ifdef __cplusplus
355  EndAttribute();
356 #endif /* __cplusplus */
357  int unused;
358 };
359 
360 #endif /* SAL_NO_ATTRIBUTE_DECLARATIONS */
361 
362 #ifdef __cplusplus
363 }; // namespace vc_attributes
364 #endif /* __cplusplus */
365 
366 #pragma pop_macro( "REPEATABLE" )
367 #pragma pop_macro( "SA" )
368 
369 #ifdef __cplusplus
370 
371 #define SA_All All
372 #define SA_Class Class
373 #define SA_Constructor Constructor
374 #define SA_Delegate Delegate
375 #define SA_Enum Enum
376 #define SA_Event Event
377 #define SA_Field Field
378 #define SA_GenericParameter GenericParameter
379 #define SA_Interface Interface
380 #define SA_Method Method
381 #define SA_Module Module
382 #define SA_Parameter Parameter
383 #define SA_Property Property
384 #define SA_ReturnValue ReturnValue
385 #define SA_Struct Struct
386 #define SA_Typedef Typedef
387 
388 typedef ::vc_attributes::YesNoMaybe SA_YesNoMaybe;
389 const ::vc_attributes::YesNoMaybe SA_Yes = ::vc_attributes::Yes;
390 const ::vc_attributes::YesNoMaybe SA_No = ::vc_attributes::No;
391 const ::vc_attributes::YesNoMaybe SA_Maybe = ::vc_attributes::Maybe;
392 
393 typedef ::vc_attributes::AccessType SA_AccessType;
394 const ::vc_attributes::AccessType SA_NoAccess = ::vc_attributes::NoAccess;
395 const ::vc_attributes::AccessType SA_Read = ::vc_attributes::Read;
396 const ::vc_attributes::AccessType SA_Write = ::vc_attributes::Write;
397 const ::vc_attributes::AccessType SA_ReadWrite = ::vc_attributes::ReadWrite;
398 
399 #ifndef SAL_NO_ATTRIBUTE_DECLARATIONS
400 typedef ::vc_attributes::PreAttribute SA_Pre;
401 typedef ::vc_attributes::PostAttribute SA_Post;
402 typedef ::vc_attributes::FormatStringAttribute SA_FormatString;
403 typedef ::vc_attributes::InvalidCheckAttribute SA_InvalidCheck; /*???*/
404 typedef ::vc_attributes::SuccessAttribute SA_Success;
405 typedef ::vc_attributes::PreBoundAttribute SA_PreBound;
406 typedef ::vc_attributes::PostBoundAttribute SA_PostBound;
407 typedef ::vc_attributes::PreRangeAttribute SA_PreRange;
408 typedef ::vc_attributes::PostRangeAttribute SA_PostRange;
409 
410 typedef ::vc_attributes::DerefAttribute SAL_deref;
411 typedef ::vc_attributes::NotrefAttribute SAL_notref;
412 typedef ::vc_attributes::PreOpAttribute SAL_pre;
413 typedef ::vc_attributes::PostOpAttribute SAL_post;
414 typedef ::vc_attributes::ExceptAttribute SAL_except;
415 
416 typedef ::vc_attributes::AtAttribute SAL_at;
417 typedef ::vc_attributes::AtBufferAttribute SAL_at_buffer;
418 typedef ::vc_attributes::WhenAttribute SAL_when;
419 typedef ::vc_attributes::BeginAttribute SAL_begin;
420 typedef ::vc_attributes::EndAttribute SAL_end;
421 typedef ::vc_attributes::TypefixAttribute SAL_typefix;
422 typedef ::vc_attributes::AnnotesAttribute SAL_annotes;
423 typedef ::vc_attributes::ContextAttribute SAL_context;
424 
425 #endif /* SAL_NO_ATTRIBUTE_DECLARATIONS */
426 
427 #else /* __cplusplus */
428 
429 typedef struct PreAttribute SA_Pre;
430 typedef struct PreAttribute PreAttribute;
431 typedef struct PostAttribute SA_Post;
432 typedef struct PostAttribute PostAttribute;
433 typedef struct FormatStringAttribute SA_FormatString;
434 typedef struct InvalidCheckAttribute SA_InvalidCheck; /*???*/
435 typedef struct SuccessAttribute SA_Success;
436 typedef struct PreBoundAttribute SA_PreBound;
437 typedef struct PostBoundAttribute SA_PostBound;
438 typedef struct PreRangeAttribute SA_PreRange;
439 typedef struct PostRangeAttribute SA_PostRange;
440 
441 typedef struct DerefAttribute SAL_deref;
442 typedef struct NotrefAttribute SAL_notref;
443 typedef struct PreOpAttribute SAL_pre;
444 typedef struct PostOpAttribute SAL_post;
445 typedef struct ExceptAttribute SAL_except;
446 
447 typedef struct AtAttribute SAL_at;
448 typedef struct AtBufferAttribute SAL_at_buffer;
449 typedef struct WhenAttribute SAL_when;
450 typedef struct BeginAttribute SAL_begin;
451 typedef struct EndAttribute SAL_end;
452 typedef struct TypefixAttribute SAL_typefix;
453 typedef struct AnnotesAttribute SAL_annotes;
454 typedef struct ContextAttribute SAL_context;
455 
456 #endif /* __cplusplus */
457 
458 #endif /* _M_CEE_SAFE */
459 
460 #ifdef _MANAGED
461 
462 #ifdef CODE_ANALYSIS
463 #define SA_SUPPRESS_MESSAGE( category, id, ... ) [::System::Diagnostics::CodeAnalysis::SuppressMessage( category, id, __VA_ARGS__ )]
464 #define CA_SUPPRESS_MESSAGE( ... ) [System::Diagnostics::CodeAnalysis::SuppressMessage( __VA_ARGS__ )]
465 #define CA_GLOBAL_SUPPRESS_MESSAGE( ... ) [assembly:System::Diagnostics::CodeAnalysis::SuppressMessage( __VA_ARGS__ )]
466 #else /* CODE_ANALYSIS */
467 #define SA_SUPPRESS_MESSAGE( category, id, ... )
468 #define CA_SUPPRESS_MESSAGE( ... )
469 #define CA_GLOBAL_SUPPRESS_MESSAGE( ... )
470 #endif /* CODE_ANALYSIS */
471 
472 #endif /* _MANAGED */
473 
474 #endif /* _MSC_VER >= 1400 */
475 
_W64 unsigned int size_t
Definition: crtdefs.h:496
virtual property T Value
Definition: vccorlib.h:1414
unsigned short wchar_t
Definition: crtdefs.h:536
#define _W64
Definition: crtdefs.h:100