| 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 |
/* Optional pointer parameters */ |
| 286 |
#define __in_opt |
| 287 |
#define __out_opt |
| 288 |
#define __inout_opt |
| 289 |
|
| 290 |
/* Other common annotations */ |
| 291 |
#define _In_range_(low, hi) |
| 292 |
#define _Out_range_(low, hi) |
| 293 |
#define _Ret_range_(low, hi) |
| 294 |
#define _Deref_in_range_(low, hi) |
| 295 |
#define _Deref_out_range_(low, hi) |
| 296 |
#define _Deref_inout_range_(low, hi) |
| 297 |
#define _Struct_size_bytes_(size) |
| 298 |
|
| 299 |
/* Function annotations */ |
| 300 |
#define _Called_from_function_class_(name) |
| 301 |
#define _Check_return_ __checkReturn |
| 302 |
#define _Function_class_(name) |
| 303 |
#define _Raises_SEH_exception_ |
| 304 |
#define _Maybe_raises_SEH_exception_ |
| 305 |
#define _Must_inspect_result_ |
| 306 |
#define _Use_decl_annotations_ |
| 307 |
|
| 308 |
/* Success/failure annotations */ |
| 309 |
#define _Always_(anno_list) |
| 310 |
#define _On_failure_(anno_list) |
| 311 |
#define _Return_type_success_(expr) |
| 312 |
#define _Success_(expr) |
| 313 |
|
| 314 |
#define _Reserved_ |
| 315 |
#define _Const_ |
| 316 |
|
| 317 |
/* Buffer properties */ |
| 318 |
#define _Readable_bytes_(s) |
| 319 |
#define _Readable_elements_(s) |
| 320 |
#define _Writable_bytes_(s) |
| 321 |
#define _Writable_elements_(s) |
| 322 |
#define _Null_terminated_ |
| 323 |
#define _NullNull_terminated_ |
| 324 |
|
| 325 |
/* Field properties */ |
| 326 |
#define _Field_size_(s) |
| 327 |
#define _Field_size_full_(s) |
| 328 |
#define _Field_size_full_opt_(s) |
| 329 |
#define _Field_size_opt_(s) |
| 330 |
#define _Field_size_part_(s, c) |
| 331 |
#define _Field_size_part_opt_(s, c) |
| 332 |
#define _Field_size_bytes_(size) |
| 333 |
#define _Field_size_bytes_full_(size) |
| 334 |
#define _Field_size_bytes_full_opt_(s) |
| 335 |
#define _Field_size_bytes_opt_(s) |
| 336 |
#define _Field_size_bytes_part_(s, c) |
| 337 |
#define _Field_size_bytes_part_opt_(s, c) |
| 338 |
#define _Field_z_ |
| 339 |
#define _Field_range_(min, max) |
| 340 |
|
| 341 |
/* Structural annotations */ |
| 342 |
#define _At_(e, a) |
| 343 |
#define _At_buffer_(e, i, c, a) |
| 344 |
#define _Group_(a) |
| 345 |
#define _When_(e, a) |
| 346 |
|
| 347 |
/* printf/scanf annotations */ |
| 348 |
#define _Printf_format_string_ |
| 349 |
#define _Scanf_format_string_ |
| 350 |
#define _Scanf_s_format_string_ |
| 351 |
#define _Format_string_impl_(kind,where) |
| 352 |
#define _Printf_format_string_params_(x) |
| 353 |
#define _Scanf_format_string_params_(x) |
| 354 |
#define _Scanf_s_format_string_params_(x) |
| 355 |
|
| 356 |
/* Analysis */ |
| 357 |
#define _Analysis_mode_(x) |
| 358 |
#define _Analysis_assume_(expr) |
| 359 |
#define _Analysis_assume_nullterminated_(expr) |
| 360 |
|
| 361 |
#define _Post_ |
| 362 |
#define _Post_equal_to_(expr) |
| 363 |
#define _Post_readable_byte_size_(s) |
| 364 |
#define _Post_readable_size_(s) |
| 365 |
#define _Post_satisfies_(c) |
| 366 |
#define _Post_writable_byte_size_(s) |
| 367 |
#define _Post_writable_size_(s) |
| 368 |
|
| 369 |
#define _Pre_equal_to_(expr) |
| 370 |
#define _Pre_notnull_ |
| 371 |
#define _Pre_readable_byte_size_(s) |
| 372 |
#define _Pre_readable_size_(s) |
| 373 |
#define _Pre_satisfies_(c) |
| 374 |
#define _Pre_writable_byte_size_(s) |
| 375 |
#define _Pre_writable_size_(s) |
| 376 |
|
| 377 |
#define _Strict_type_match_ |
| 378 |
|
| 379 |
/* FIXME: __in macro conflicts with argument names in libstdc++. For this reason, |
| 380 |
* we disable it for C++. This should be fixed in libstdc++ so we can uncomment |
| 381 |
* it in fixed version here. */ |
| 382 |
#if !defined(__cplusplus) || !defined(__GNUC__) |
| 383 |
#define __in |
| 384 |
#define __out |
| 385 |
#endif |
| 386 |
|
| 387 |
#define __bcount(size) |
| 388 |
#define __ecount(size) |
| 389 |
|
| 390 |
#define __in_bcount(size) |
| 391 |
#define __in_bcount_nz(size) |
| 392 |
#define __in_bcount_z(size) |
| 393 |
#define __in_ecount(size) |
| 394 |
#define __in_ecount_nz(size) |
| 395 |
#define __in_ecount_z(size) |
| 396 |
|
| 397 |
#define __out_bcount(size) |
| 398 |
#define __out_bcount_nz(size) |
| 399 |
#define __out_bcount_z(size) |
| 400 |
#define __out_bcount_full(size) |
| 401 |
#define __out_bcount_full_z(size) |
| 402 |
#define __out_bcount_part(size, length) |
| 403 |
#define __out_bcount_part_z(size, length) |
| 404 |
#define __out_ecount(size) |
| 405 |
#define __out_ecount_nz(size) |
| 406 |
#define __out_ecount_z(size) |
| 407 |
#define __out_ecount_full(size) |
| 408 |
#define __out_ecount_full_z(size) |
| 409 |
#define __out_ecount_part(size, length) |
| 410 |
#define __out_ecount_part_z(size, length) |
| 411 |
|
| 412 |
#define __inout |
| 413 |
#define __inout_bcount(size) |
| 414 |
#define __inout_bcount_nz(size) |
| 415 |
#define __inout_bcount_z(size) |
| 416 |
#define __inout_bcount_full(size) |
| 417 |
#define __inout_bcount_part(size, length) |
| 418 |
#define __inout_ecount(size) |
| 419 |
#define __inout_ecount_nz(size) |
| 420 |
#define __inout_ecount_z(size) |
| 421 |
#define __inout_ecount_full(size) |
| 422 |
#define __inout_ecount_part(size, length) |
| 423 |
|
| 424 |
#define __deref |
| 425 |
#define __deref_opt_out |
| 426 |
#define __deref_opt_out_bcount(x) |
| 427 |
#define __deref_out |
| 428 |
#define __deref_out_ecount(size) |
| 429 |
#define __deref_out_opt |
| 430 |
|
| 431 |
#define __range(x,y) |
| 432 |
|
| 433 |
#endif |
| 434 |
|