master
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6
7#ifndef SAL_HXX
8#define SAL_HXX
9
10#include <concurrencysal.h>
11
12#ifdef __GNUC__
13# define __inner_checkReturn __attribute__((warn_unused_result))
14#elif defined(_MSC_VER)
15# define __inner_checkReturn __declspec("SAL_checkReturn")
16#else
17# define __inner_checkReturn
18#endif
19
20#define __checkReturn __inner_checkReturn
21
22/* Input parameters */
23#define _In_
24#define _In_opt_
25#define _In_z_
26#define _In_opt_z_
27#define _In_reads_(s)
28#define _In_reads_opt_(s)
29#define _In_reads_bytes_(s)
30#define _In_reads_bytes_opt_(s)
31#define _In_reads_z_(s)
32#define _In_reads_opt_z_(s)
33#define _In_reads_or_z_(s)
34#define _In_reads_or_z_opt_(s)
35#define _In_reads_to_ptr_(p)
36#define _In_reads_to_ptr_opt_(p)
37#define _In_reads_to_ptr_z_(p)
38#define _In_reads_to_ptr_opt_z_(p)
39
40#define _In_count_(s)
41#define _In_opt_count_(s)
42#define _In_bytecount_(s)
43#define _In_opt_bytecount_(s)
44#define _In_count_c_(s)
45#define _In_opt_count_c_(s)
46#define _In_bytecount_c_(s)
47#define _In_opt_bytecount_c_(s)
48#define _In_z_count_(s)
49#define _In_opt_z_count_(s)
50#define _In_z_bytecount_(s)
51#define _In_opt_z_bytecount_(s)
52#define _In_z_count_c_(s)
53#define _In_opt_z_count_c_(s)
54#define _In_z_bytecount_c_(s)
55#define _In_opt_z_bytecount_c_(s)
56#define _In_ptrdiff_count_(s)
57#define _In_opt_ptrdiff_count_(s)
58#define _In_count_x_(s)
59#define _In_opt_count_x_(s)
60#define _In_bytecount_x_(s)
61#define _In_opt_bytecount_x_(s)
62
63/* Output parameters */
64#define _Out_
65#define _Out_opt_
66#define _Out_writes_(s)
67#define _Out_writes_opt_(s)
68#define _Out_writes_bytes_(s)
69#define _Out_writes_bytes_opt_(s)
70#define _Out_writes_z_(s)
71#define _Out_writes_opt_z_(s)
72#define _Out_writes_to_(s, c)
73#define _Out_writes_to_opt_(s, c)
74#define _Out_writes_all_(s)
75#define _Out_writes_all_opt_(s)
76#define _Out_writes_bytes_to_(s, c)
77#define _Out_writes_bytes_to_opt_(s, c)
78#define _Out_writes_bytes_all_(s)
79#define _Out_writes_bytes_all_opt_(s)
80#define _Out_writes_to_ptr_(p)
81#define _Out_writes_to_ptr_opt_(p)
82#define _Out_writes_to_ptr_z_(p)
83#define _Out_writes_to_ptr_opt_z_(p)
84
85#define _Out_cap_(s)
86#define _Out_opt_cap_(s)
87#define _Out_bytecap_(s)
88#define _Out_opt_bytecap_(s)
89#define _Out_cap_c_(s)
90#define _Out_opt_cap_c_(s)
91#define _Out_bytecap_c_(s)
92#define _Out_opt_bytecap_c_(s)
93#define _Out_cap_m_(m, s)
94#define _Out_opt_cap_m_(m, s)
95#define _Out_z_cap_m_(m, s)
96#define _Out_opt_z_cap_m_(m, s)
97#define _Out_ptrdiff_cap_(s)
98#define _Out_opt_ptrdiff_cap_(s)
99#define _Out_cap_x_(s)
100#define _Out_opt_cap_x_(s)
101#define _Out_bytecap_x_(s)
102#define _Out_opt_bytecap_x_(s)
103#define _Out_z_cap_(s)
104#define _Out_opt_z_cap_(s)
105#define _Out_z_bytecap_(s)
106#define _Out_opt_z_bytecap_(s)
107#define _Out_z_cap_c_(s)
108#define _Out_opt_z_cap_c_(s)
109#define _Out_z_bytecap_c_(s)
110#define _Out_opt_z_bytecap_c_(s)
111#define _Out_z_cap_x_(s)
112#define _Out_opt_z_cap_x_(s)
113#define _Out_z_bytecap_x_(s)
114#define _Out_opt_z_bytecap_x_(s)
115#define _Out_cap_post_count_(a, o)
116#define _Out_opt_cap_post_count_(a, o)
117#define _Out_bytecap_post_bytecount_(a, o)
118#define _Out_opt_bytecap_post_bytecount_(a, o)
119#define _Out_z_cap_post_count_(a, o)
120#define _Out_opt_z_cap_post_count_(a, o)
121#define _Out_z_bytecap_post_bytecount_(a, o)
122#define _Out_opt_z_bytecap_post_bytecount_(a, o)
123#define _Out_capcount_(c)
124#define _Out_opt_capcount_(c)
125#define _Out_bytecapcount_(c)
126#define _Out_opt_bytecapcount_(c)
127#define _Out_capcount_x_(c)
128#define _Out_opt_capcount_x_(c)
129#define _Out_bytecapcount_x_(c)
130#define _Out_opt_bytecapcount_x_(c)
131#define _Out_z_capcount_(c)
132#define _Out_opt_z_capcount_(c)
133#define _Out_z_bytecapcount_(c)
134#define _Out_opt_z_bytecapcount_(c)
135
136/* Inout parameters */
137#define _Inout_
138#define _Inout_opt_
139#define _Inout_z_
140#define _Inout_opt_z_
141#define _Inout_updates_(s)
142#define _Inout_updates_opt_(s)
143#define _Inout_updates_z_(s)
144#define _Inout_updates_opt_z_(s)
145#define _Inout_updates_to_(s, c)
146#define _Inout_updates_to_opt_(s, c)
147#define _Inout_updates_all_(s)
148#define _Inout_updates_all_opt_(s)
149#define _Inout_updates_bytes_(s)
150#define _Inout_updates_bytes_opt_(s)
151#define _Inout_updates_bytes_to_(s, c)
152#define _Inout_updates_bytes_to_opt_(s, c)
153#define _Inout_updates_bytes_all_(s)
154#define _Inout_updates_bytes_all_opt_(s)
155
156#define _Inout_count_(s)
157#define _Inout_opt_count_(s)
158#define _Inout_bytecount_(s)
159#define _Inout_opt_bytecount_(s)
160#define _Inout_count_c_(s)
161#define _Inout_opt_count_c_(s)
162#define _Inout_bytecount_c_(s)
163#define _Inout_opt_bytecount_c_(s)
164#define _Inout_z_count_(s)
165#define _Inout_opt_z_count_(s)
166#define _Inout_z_bytecount_(s)
167#define _Inout_opt_z_bytecount_(s)
168#define _Inout_z_count_c_(s)
169#define _Inout_opt_z_count_c_(s)
170#define _Inout_z_bytecount_c_(s)
171#define _Inout_opt_z_bytecount_c_(s)
172#define _Inout_ptrdiff_count_(s)
173#define _Inout_opt_ptrdiff_count_(s)
174#define _Inout_count_x_(s)
175#define _Inout_opt_count_x_(s)
176#define _Inout_bytecount_x_(s)
177#define _Inout_opt_bytecount_x_(s)
178#define _Inout_cap_(s)
179#define _Inout_opt_cap_(s)
180#define _Inout_bytecap_(s)
181#define _Inout_opt_bytecap_(s)
182#define _Inout_cap_c_(s)
183#define _Inout_opt_cap_c_(s)
184#define _Inout_bytecap_c_(s)
185#define _Inout_opt_bytecap_c_(s)
186#define _Inout_cap_x_(s)
187#define _Inout_opt_cap_x_(s)
188#define _Inout_bytecap_x_(s)
189#define _Inout_opt_bytecap_x_(s)
190#define _Inout_z_cap_(s)
191#define _Inout_opt_z_cap_(s)
192#define _Inout_z_bytecap_(s)
193#define _Inout_opt_z_bytecap_(s)
194#define _Inout_z_cap_c_(s)
195#define _Inout_opt_z_cap_c_(s)
196#define _Inout_z_bytecap_c_(s)
197#define _Inout_opt_z_bytecap_c_(s)
198#define _Inout_z_cap_x_(s)
199#define _Inout_opt_z_cap_x_(s)
200#define _Inout_z_bytecap_x_(s)
201#define _Inout_opt_z_bytecap_x_(s)
202
203/* Pointer to pointer parameters */
204#define _Outptr_
205#define _Outptr_result_maybenull_
206#define _Outptr_opt_
207#define _Outptr_opt_result_maybenull_
208#define _Outptr_result_z_
209#define _Outptr_opt_result_z_
210#define _Outptr_result_maybenull_z_
211#define _Outptr_opt_result_maybenull_z_
212#define _Outptr_result_nullonfailure_
213#define _Outptr_opt_result_nullonfailure_
214#define _COM_Outptr_
215#define _COM_Outptr_result_maybenull_
216#define _COM_Outptr_opt_
217#define _COM_Outptr_opt_result_maybenull_
218#define _Outptr_result_buffer_(s)
219#define _Outptr_opt_result_buffer_(s)
220#define _Outptr_result_buffer_to_(s, c)
221#define _Outptr_opt_result_buffer_to_(s, c)
222#define _Outptr_result_buffer_all_(s)
223#define _Outptr_opt_result_buffer_all_(s)
224#define _Outptr_result_buffer_maybenull_(s)
225#define _Outptr_opt_result_buffer_maybenull_(s)
226#define _Outptr_result_buffer_to_maybenull_(s, c)
227#define _Outptr_opt_result_buffer_to_maybenull_(s, c)
228#define _Outptr_result_buffer_all_maybenull_(s)
229#define _Outptr_opt_result_buffer_all_maybenull_(s)
230#define _Outptr_result_bytebuffer_(s)
231#define _Outptr_opt_result_bytebuffer_(s)
232#define _Outptr_result_bytebuffer_to_(s, c)
233#define _Outptr_opt_result_bytebuffer_to_(s, c)
234#define _Outptr_result_bytebuffer_all_(s)
235#define _Outptr_opt_result_bytebuffer_all_(s)
236#define _Outptr_result_bytebuffer_maybenull_(s)
237#define _Outptr_opt_result_bytebuffer_maybenull_(s)
238#define _Outptr_result_bytebuffer_to_maybenull_(s, c)
239#define _Outptr_opt_result_bytebuffer_to_maybenull_(s, c)
240#define _Outptr_result_bytebuffer_all_maybenull_(s)
241#define _Outptr_opt_result_bytebuffer_all_maybenull_(s)
242
243/* Output reference parameters */
244#define _Outref_
245#define _Outref_result_maybenull_
246#define _Outref_result_buffer_(s)
247#define _Outref_result_bytebuffer_(s)
248#define _Outref_result_buffer_to_(s, c)
249#define _Outref_result_bytebuffer_to_(s, c)
250#define _Outref_result_buffer_all_(s)
251#define _Outref_result_bytebuffer_all_(s)
252#define _Outref_result_buffer_maybenull_(s)
253#define _Outref_result_bytebuffer_maybenull_(s)
254#define _Outref_result_buffer_to_maybenull_(s, c)
255#define _Outref_result_bytebuffer_to_maybenull_(s, c)
256#define _Outref_result_buffer_all_maybenull_(s)
257#define _Outref_result_bytebuffer_all_maybenull_(s)
258#define _Outref_result_nullonfailure_
259#define _Result_nullonfailure_
260#define _Result_zeroonfailure_
261
262/* Return values */
263#define _Ret_z_
264#define _Ret_maybenull_z_
265#define _Ret_notnull_
266#define _Ret_maybenull_
267#define _Ret_null_
268#define _Ret_valid_
269#define _Ret_writes_(s)
270#define _Ret_writes_z_(s)
271#define _Ret_writes_bytes_(s)
272#define _Ret_writes_maybenull_(s)
273#define _Ret_writes_maybenull_z_(s)
274#define _Ret_writes_bytes_maybenull_(s)
275#define _Ret_writes_to_(s, c)
276#define _Ret_writes_bytes_to_(s, c)
277#define _Ret_writes_to_maybenull_(s, c)
278#define _Ret_writes_bytes_to_maybenull_(s, c)
279#define _Points_to_data_
280#define _Literal_
281#define _Notliteral_
282#define _Deref_ret_range_(l,u)
283#define _Unchanged_(e)
284
285#define _Ret_bytecap_(s)
286#define _Ret_bytecap_c_(s)
287#define _Ret_bytecap_x_(s)
288#define _Ret_bytecount_(s)
289#define _Ret_bytecount_c_(s)
290#define _Ret_bytecount_x_(s)
291#define _Ret_cap_(s)
292#define _Ret_cap_c_(s)
293#define _Ret_cap_x_(s)
294#define _Ret_count_(s)
295#define _Ret_count_c_(s)
296#define _Ret_count_x_(s)
297#define _Ret_opt_bytecap_(s)
298#define _Ret_opt_bytecap_c_(s)
299#define _Ret_opt_bytecap_x_(s)
300#define _Ret_opt_bytecount_(s)
301#define _Ret_opt_bytecount_c_(s)
302#define _Ret_opt_bytecount_x_(s)
303#define _Ret_opt_cap_(s)
304#define _Ret_opt_cap_c_(s)
305#define _Ret_opt_cap_x_(s)
306#define _Ret_opt_count_(s)
307#define _Ret_opt_count_c_(s)
308#define _Ret_opt_count_x_(s)
309#define _Ret_opt_valid_
310#define _Ret_opt_z_
311#define _Ret_opt_z_bytecap_(s)
312#define _Ret_opt_z_bytecount_(s)
313#define _Ret_opt_z_cap_(s)
314#define _Ret_opt_z_count_(s)
315#define _Ret_z_bytecap_(s)
316#define _Ret_z_bytecount_(s)
317#define _Ret_z_cap_(s)
318#define _Ret_z_count_(s)
319
320/* Optional pointer parameters */
321#define __in_opt
322#define __out_opt
323#define __inout_opt
324
325/* Other common annotations */
326#define _In_range_(low, hi)
327#define _Out_range_(low, hi)
328#define _Ret_range_(low, hi)
329#define _Deref_in_range_(low, hi)
330#define _Deref_out_range_(low, hi)
331#define _Deref_inout_range_(low, hi)
332#define _Struct_size_bytes_(size)
333#define _Deref_out_
334#define _Deref_out_opt_
335#define _Deref_opt_out_
336#define _Deref_opt_out_opt_
337
338/* Function annotations */
339#define _Called_from_function_class_(name)
340#define _Check_return_ __checkReturn
341#define _Function_class_(name)
342#define _Raises_SEH_exception_
343#define _Maybe_raises_SEH_exception_
344#define _Must_inspect_result_
345#define _Use_decl_annotations_
346
347/* Success/failure annotations */
348#define _Always_(anno_list)
349#define _On_failure_(anno_list)
350#define _Return_type_success_(expr)
351#define _Success_(expr)
352
353#define _Reserved_
354#define _Const_
355
356/* Buffer properties */
357#define _Readable_bytes_(s)
358#define _Readable_elements_(s)
359#define _Writable_bytes_(s)
360#define _Writable_elements_(s)
361#define _Null_terminated_
362#define _NullNull_terminated_
363
364/* Field properties */
365#define _Field_size_(s)
366#define _Field_size_full_(s)
367#define _Field_size_full_opt_(s)
368#define _Field_size_opt_(s)
369#define _Field_size_part_(s, c)
370#define _Field_size_part_opt_(s, c)
371#define _Field_size_bytes_(size)
372#define _Field_size_bytes_full_(size)
373#define _Field_size_bytes_full_opt_(s)
374#define _Field_size_bytes_opt_(s)
375#define _Field_size_bytes_part_(s, c)
376#define _Field_size_bytes_part_opt_(s, c)
377#define _Field_z_
378#define _Field_range_(min, max)
379
380/* Structural annotations */
381#define _At_(e, a)
382#define _At_buffer_(e, i, c, a)
383#define _Group_(a)
384#define _When_(e, a)
385
386/* printf/scanf annotations */
387#define _Printf_format_string_
388#define _Scanf_format_string_
389#define _Scanf_s_format_string_
390#define _Format_string_impl_(kind,where)
391#define _Printf_format_string_params_(x)
392#define _Scanf_format_string_params_(x)
393#define _Scanf_s_format_string_params_(x)
394
395/* Analysis */
396#define _Analysis_mode_(x)
397#define _Analysis_assume_(expr)
398#define _Analysis_assume_nullterminated_(expr)
399
400#define _Post_
401#define _Post_bytecap_(s)
402#define _Post_bytecount_(s)
403#define _Post_bytecount_c_(s)
404#define _Post_bytecount_x_(s)
405#define _Post_cap_(s)
406#define _Post_count_(s)
407#define _Post_count_c_(s)
408#define _Post_count_x_(s)
409#define _Post_defensive_
410#define _Post_equal_to_(expr)
411#define _Post_impl_
412#define _Post_invalid_
413#define _Post_maybenull_
414#define _Post_maybez_
415#define _Post_notnull_
416#define _Post_null_
417#define _Post_ptr_invalid_
418#define _Post_readable_byte_size_(s)
419#define _Post_readable_size_(s)
420#define _Post_satisfies_(c)
421#define _Post_satisfies_impl_(c)
422#define _Post_valid_
423#define _Post_valid_impl_
424#define _Post_writable_byte_size_(s)
425#define _Post_writable_size_(s)
426
427#define _Post_z_
428#define _Post_z_bytecount_(s)
429#define _Post_z_bytecount_c_(s)
430#define _Post_z_bytecount_x_(s)
431#define _Post_z_count_(s)
432#define _Post_z_count_c_(s)
433#define _Post_z_count_x_(s)
434#define _Prepost_z_
435
436#define _Null_
437#define _Notnull_
438#define _Maybenull_
439
440#define _Pre_
441#define _Pre_bytecap_(s)
442#define _Pre_bytecap_c_(s)
443#define _Pre_bytecap_x_(s)
444#define _Pre_bytecount_(s)
445#define _Pre_bytecount_c_(s)
446#define _Pre_bytecount_x_(s)
447#define _Pre_cap_(s)
448#define _Pre_cap_c_(s)
449#define _Pre_cap_c_one_
450#define _Pre_cap_for_(p)
451#define _Pre_cap_m_(m,s)
452#define _Pre_cap_x_(s)
453#define _Pre_count_(s)
454#define _Pre_count_c_(s)
455#define _Pre_count_x_(s)
456#define _Pre_defensive_
457#define _Pre_equal_to_(expr)
458#define _Pre_impl_
459#define _Pre_invalid_
460#define _Pre_maybenull_
461#define _Pre_notnull_
462#define _Pre_null_
463#define _Pre_opt_bytecap_(s)
464#define _Pre_opt_bytecap_c_(s)
465#define _Pre_opt_bytecap_x_(s)
466#define _Pre_opt_bytecount_(s)
467#define _Pre_opt_bytecount_c_(s)
468#define _Pre_opt_bytecount_x_(s)
469#define _Pre_opt_cap_(s)
470#define _Pre_opt_cap_c_(s)
471#define _Pre_opt_cap_c_one_
472#define _Pre_opt_cap_for_(p)
473#define _Pre_opt_cap_m_(m,s)
474#define _Pre_opt_cap_x_(s)
475#define _Pre_opt_count_(s)
476#define _Pre_opt_count_c_(s)
477#define _Pre_opt_count_x_(s)
478#define _Pre_opt_ptrdiff_cap_(p)
479#define _Pre_opt_ptrdiff_count_(p)
480#define _Pre_opt_valid_
481#define _Pre_opt_valid_bytecap_(s)
482#define _Pre_opt_valid_bytecap_c_(s)
483#define _Pre_opt_valid_bytecap_x_(s)
484#define _Pre_opt_valid_cap_(s)
485#define _Pre_opt_valid_cap_c_(s)
486#define _Pre_opt_valid_cap_x_(s)
487#define _Pre_opt_z_
488#define _Pre_opt_z_bytecap_(s)
489#define _Pre_opt_z_bytecap_c_(s)
490#define _Pre_opt_z_bytecap_x_(s)
491#define _Pre_opt_z_cap_(s)
492#define _Pre_opt_z_cap_c_(s)
493#define _Pre_opt_z_cap_x_(s)
494#define _Pre_ptrdiff_cap_(p)
495#define _Pre_ptrdiff_count_(p)
496#define _Pre_readable_byte_size_(s)
497#define _Pre_readable_size_(s)
498#define _Pre_readonly_
499#define _Pre_satisfies_(c)
500#define _Pre_satisfies_impl_(c)
501#define _Pre_unknown_
502#define _Pre_valid_
503#define _Pre_valid_bytecap_(s)
504#define _Pre_valid_bytecap_c_(s)
505#define _Pre_valid_bytecap_x_(s)
506#define _Pre_valid_cap_(s)
507#define _Pre_valid_cap_c_(s)
508#define _Pre_valid_cap_x_(s)
509#define _Pre_valid_impl_
510#define _Pre_writable_byte_size_(s)
511#define _Pre_writable_size_(s)
512#define _Pre_writeonly_
513#define _Pre_z_
514#define _Pre_z_bytecap_(s)
515#define _Pre_z_bytecap_c_(s)
516#define _Pre_z_bytecap_x_(s)
517#define _Pre_z_cap_(s)
518#define _Pre_z_cap_c_(s)
519#define _Pre_z_cap_x_(s)
520
521#define _Strict_type_match_
522
523/* FIXME: __in macro conflicts with argument names in libstdc++. For this reason,
524 * we disable it for C++. This should be fixed in libstdc++ so we can uncomment
525 * it in fixed version here. */
526#if !defined(__cplusplus) || !defined(__GNUC__)
527#define __in
528#define __out
529#endif
530
531#define __bcount(size)
532#define __ecount(size)
533
534#define __in_bcount(size)
535#define __in_bcount_nz(size)
536#define __in_bcount_z(size)
537#define __in_ecount(size)
538#define __in_ecount_nz(size)
539#define __in_ecount_z(size)
540
541#define __out_bcount(size)
542#define __out_bcount_nz(size)
543#define __out_bcount_z(size)
544#define __out_bcount_full(size)
545#define __out_bcount_full_z(size)
546#define __out_bcount_part(size, length)
547#define __out_bcount_part_z(size, length)
548#define __out_ecount(size)
549#define __out_ecount_nz(size)
550#define __out_ecount_z(size)
551#define __out_ecount_full(size)
552#define __out_ecount_full_z(size)
553#define __out_ecount_part(size, length)
554#define __out_ecount_part_z(size, length)
555
556#define __inout
557#define __inout_bcount(size)
558#define __inout_bcount_nz(size)
559#define __inout_bcount_z(size)
560#define __inout_bcount_full(size)
561#define __inout_bcount_part(size, length)
562#define __inout_ecount(size)
563#define __inout_ecount_nz(size)
564#define __inout_ecount_z(size)
565#define __inout_ecount_full(size)
566#define __inout_ecount_part(size, length)
567
568#define __deref
569#define __deref_opt_out
570#define __deref_opt_out_bcount(x)
571#define __deref_out
572#define __deref_out_ecount(size)
573#define __deref_out_opt
574
575#define __range(x,y)
576
577#endif
578