sal.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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. #ifndef SAL_HXX
  7. #define SAL_HXX
  8. #include <concurrencysal.h>
  9. #ifdef __GNUC__
  10. # define __inner_checkReturn __attribute__((warn_unused_result))
  11. #elif defined(_MSC_VER)
  12. # define __inner_checkReturn __declspec("SAL_checkReturn")
  13. #else
  14. # define __inner_checkReturn
  15. #endif
  16. #define __checkReturn __inner_checkReturn
  17. /* Input parameters */
  18. #define _In_
  19. #define _In_opt_
  20. #define _In_z_
  21. #define _In_opt_z_
  22. #define _In_reads_(s)
  23. #define _In_reads_opt_(s)
  24. #define _In_reads_bytes_(s)
  25. #define _In_reads_bytes_opt_(s)
  26. #define _In_reads_z_(s)
  27. #define _In_reads_opt_z_(s)
  28. #define _In_reads_or_z_(s)
  29. #define _In_reads_or_z_opt_(s)
  30. #define _In_reads_to_ptr_(p)
  31. #define _In_reads_to_ptr_opt_(p)
  32. #define _In_reads_to_ptr_z_(p)
  33. #define _In_reads_to_ptr_opt_z_(p)
  34. #define _In_count_(s)
  35. #define _In_opt_count_(s)
  36. #define _In_bytecount_(s)
  37. #define _In_opt_bytecount_(s)
  38. #define _In_count_c_(s)
  39. #define _In_opt_count_c_(s)
  40. #define _In_bytecount_c_(s)
  41. #define _In_opt_bytecount_c_(s)
  42. #define _In_z_count_(s)
  43. #define _In_opt_z_count_(s)
  44. #define _In_z_bytecount_(s)
  45. #define _In_opt_z_bytecount_(s)
  46. #define _In_z_count_c_(s)
  47. #define _In_opt_z_count_c_(s)
  48. #define _In_z_bytecount_c_(s)
  49. #define _In_opt_z_bytecount_c_(s)
  50. #define _In_ptrdiff_count_(s)
  51. #define _In_opt_ptrdiff_count_(s)
  52. #define _In_count_x_(s)
  53. #define _In_opt_count_x_(s)
  54. #define _In_bytecount_x_(s)
  55. #define _In_opt_bytecount_x_(s)
  56. /* Output parameters */
  57. #define _Out_
  58. #define _Out_opt_
  59. #define _Out_writes_(s)
  60. #define _Out_writes_opt_(s)
  61. #define _Out_writes_bytes_(s)
  62. #define _Out_writes_bytes_opt_(s)
  63. #define _Out_writes_z_(s)
  64. #define _Out_writes_opt_z_(s)
  65. #define _Out_writes_to_(s, c)
  66. #define _Out_writes_to_opt_(s, c)
  67. #define _Out_writes_all_(s)
  68. #define _Out_writes_all_opt_(s)
  69. #define _Out_writes_bytes_to_(s, c)
  70. #define _Out_writes_bytes_to_opt_(s, c)
  71. #define _Out_writes_bytes_all_(s)
  72. #define _Out_writes_bytes_all_opt_(s)
  73. #define _Out_writes_to_ptr_(p)
  74. #define _Out_writes_to_ptr_opt_(p)
  75. #define _Out_writes_to_ptr_z_(p)
  76. #define _Out_writes_to_ptr_opt_z_(p)
  77. #define _Out_cap_(s)
  78. #define _Out_opt_cap_(s)
  79. #define _Out_bytecap_(s)
  80. #define _Out_opt_bytecap_(s)
  81. #define _Out_cap_c_(s)
  82. #define _Out_opt_cap_c_(s)
  83. #define _Out_bytecap_c_(s)
  84. #define _Out_opt_bytecap_c_(s)
  85. #define _Out_cap_m_(m, s)
  86. #define _Out_opt_cap_m_(m, s)
  87. #define _Out_z_cap_m_(m, s)
  88. #define _Out_opt_z_cap_m_(m, s)
  89. #define _Out_ptrdiff_cap_(s)
  90. #define _Out_opt_ptrdiff_cap_(s)
  91. #define _Out_cap_x_(s)
  92. #define _Out_opt_cap_x_(s)
  93. #define _Out_bytecap_x_(s)
  94. #define _Out_opt_bytecap_x_(s)
  95. #define _Out_z_cap_(s)
  96. #define _Out_opt_z_cap_(s)
  97. #define _Out_z_bytecap_(s)
  98. #define _Out_opt_z_bytecap_(s)
  99. #define _Out_z_cap_c_(s)
  100. #define _Out_opt_z_cap_c_(s)
  101. #define _Out_z_bytecap_c_(s)
  102. #define _Out_opt_z_bytecap_c_(s)
  103. #define _Out_z_cap_x_(s)
  104. #define _Out_opt_z_cap_x_(s)
  105. #define _Out_z_bytecap_x_(s)
  106. #define _Out_opt_z_bytecap_x_(s)
  107. #define _Out_cap_post_count_(a, o)
  108. #define _Out_opt_cap_post_count_(a, o)
  109. #define _Out_bytecap_post_bytecount_(a, o)
  110. #define _Out_opt_bytecap_post_bytecount_(a, o)
  111. #define _Out_z_cap_post_count_(a, o)
  112. #define _Out_opt_z_cap_post_count_(a, o)
  113. #define _Out_z_bytecap_post_bytecount_(a, o)
  114. #define _Out_opt_z_bytecap_post_bytecount_(a, o)
  115. #define _Out_capcount_(c)
  116. #define _Out_opt_capcount_(c)
  117. #define _Out_bytecapcount_(c)
  118. #define _Out_opt_bytecapcount_(c)
  119. #define _Out_capcount_x_(c)
  120. #define _Out_opt_capcount_x_(c)
  121. #define _Out_bytecapcount_x_(c)
  122. #define _Out_opt_bytecapcount_x_(c)
  123. #define _Out_z_capcount_(c)
  124. #define _Out_opt_z_capcount_(c)
  125. #define _Out_z_bytecapcount_(c)
  126. #define _Out_opt_z_bytecapcount_(c)
  127. /* Inout parameters */
  128. #define _Inout_
  129. #define _Inout_opt_
  130. #define _Inout_z_
  131. #define _Inout_opt_z_
  132. #define _Inout_updates_(s)
  133. #define _Inout_updates_opt_(s)
  134. #define _Inout_updates_z_(s)
  135. #define _Inout_updates_opt_z_(s)
  136. #define _Inout_updates_to_(s, c)
  137. #define _Inout_updates_to_opt_(s, c)
  138. #define _Inout_updates_all_(s)
  139. #define _Inout_updates_all_opt_(s)
  140. #define _Inout_updates_bytes_(s)
  141. #define _Inout_updates_bytes_opt_(s)
  142. #define _Inout_updates_bytes_to_(s, c)
  143. #define _Inout_updates_bytes_to_opt_(s, c)
  144. #define _Inout_updates_bytes_all_(s)
  145. #define _Inout_updates_bytes_all_opt_(s)
  146. #define _Inout_count_(s)
  147. #define _Inout_opt_count_(s)
  148. #define _Inout_bytecount_(s)
  149. #define _Inout_opt_bytecount_(s)
  150. #define _Inout_count_c_(s)
  151. #define _Inout_opt_count_c_(s)
  152. #define _Inout_bytecount_c_(s)
  153. #define _Inout_opt_bytecount_c_(s)
  154. #define _Inout_z_count_(s)
  155. #define _Inout_opt_z_count_(s)
  156. #define _Inout_z_bytecount_(s)
  157. #define _Inout_opt_z_bytecount_(s)
  158. #define _Inout_z_count_c_(s)
  159. #define _Inout_opt_z_count_c_(s)
  160. #define _Inout_z_bytecount_c_(s)
  161. #define _Inout_opt_z_bytecount_c_(s)
  162. #define _Inout_ptrdiff_count_(s)
  163. #define _Inout_opt_ptrdiff_count_(s)
  164. #define _Inout_count_x_(s)
  165. #define _Inout_opt_count_x_(s)
  166. #define _Inout_bytecount_x_(s)
  167. #define _Inout_opt_bytecount_x_(s)
  168. #define _Inout_cap_(s)
  169. #define _Inout_opt_cap_(s)
  170. #define _Inout_bytecap_(s)
  171. #define _Inout_opt_bytecap_(s)
  172. #define _Inout_cap_c_(s)
  173. #define _Inout_opt_cap_c_(s)
  174. #define _Inout_bytecap_c_(s)
  175. #define _Inout_opt_bytecap_c_(s)
  176. #define _Inout_cap_x_(s)
  177. #define _Inout_opt_cap_x_(s)
  178. #define _Inout_bytecap_x_(s)
  179. #define _Inout_opt_bytecap_x_(s)
  180. #define _Inout_z_cap_(s)
  181. #define _Inout_opt_z_cap_(s)
  182. #define _Inout_z_bytecap_(s)
  183. #define _Inout_opt_z_bytecap_(s)
  184. #define _Inout_z_cap_c_(s)
  185. #define _Inout_opt_z_cap_c_(s)
  186. #define _Inout_z_bytecap_c_(s)
  187. #define _Inout_opt_z_bytecap_c_(s)
  188. #define _Inout_z_cap_x_(s)
  189. #define _Inout_opt_z_cap_x_(s)
  190. #define _Inout_z_bytecap_x_(s)
  191. #define _Inout_opt_z_bytecap_x_(s)
  192. /* Pointer to pointer parameters */
  193. #define _Outptr_
  194. #define _Outptr_result_maybenull_
  195. #define _Outptr_opt_
  196. #define _Outptr_opt_result_maybenull_
  197. #define _Outptr_result_z_
  198. #define _Outptr_opt_result_z_
  199. #define _Outptr_result_maybenull_z_
  200. #define _Outptr_opt_result_maybenull_z_
  201. #define _Outptr_result_nullonfailure_
  202. #define _Outptr_opt_result_nullonfailure_
  203. #define _COM_Outptr_
  204. #define _COM_Outptr_result_maybenull_
  205. #define _COM_Outptr_opt_
  206. #define _COM_Outptr_opt_result_maybenull_
  207. #define _Outptr_result_buffer_(s)
  208. #define _Outptr_opt_result_buffer_(s)
  209. #define _Outptr_result_buffer_to_(s, c)
  210. #define _Outptr_opt_result_buffer_to_(s, c)
  211. #define _Outptr_result_buffer_all_(s)
  212. #define _Outptr_opt_result_buffer_all_(s)
  213. #define _Outptr_result_buffer_maybenull_(s)
  214. #define _Outptr_opt_result_buffer_maybenull_(s)
  215. #define _Outptr_result_buffer_to_maybenull_(s, c)
  216. #define _Outptr_opt_result_buffer_to_maybenull_(s, c)
  217. #define _Outptr_result_buffer_all_maybenull_(s)
  218. #define _Outptr_opt_result_buffer_all_maybenull_(s)
  219. #define _Outptr_result_bytebuffer_(s)
  220. #define _Outptr_opt_result_bytebuffer_(s)
  221. #define _Outptr_result_bytebuffer_to_(s, c)
  222. #define _Outptr_opt_result_bytebuffer_to_(s, c)
  223. #define _Outptr_result_bytebuffer_all_(s)
  224. #define _Outptr_opt_result_bytebuffer_all_(s)
  225. #define _Outptr_result_bytebuffer_maybenull_(s)
  226. #define _Outptr_opt_result_bytebuffer_maybenull_(s)
  227. #define _Outptr_result_bytebuffer_to_maybenull_(s, c)
  228. #define _Outptr_opt_result_bytebuffer_to_maybenull_(s, c)
  229. #define _Outptr_result_bytebuffer_all_maybenull_(s)
  230. #define _Outptr_opt_result_bytebuffer_all_maybenull_(s)
  231. /* Output reference parameters */
  232. #define _Outref_
  233. #define _Outref_result_maybenull_
  234. #define _Outref_result_buffer_(s)
  235. #define _Outref_result_bytebuffer_(s)
  236. #define _Outref_result_buffer_to_(s, c)
  237. #define _Outref_result_bytebuffer_to_(s, c)
  238. #define _Outref_result_buffer_all_(s)
  239. #define _Outref_result_bytebuffer_all_(s)
  240. #define _Outref_result_buffer_maybenull_(s)
  241. #define _Outref_result_bytebuffer_maybenull_(s)
  242. #define _Outref_result_buffer_to_maybenull_(s, c)
  243. #define _Outref_result_bytebuffer_to_maybenull_(s, c)
  244. #define _Outref_result_buffer_all_maybenull_(s)
  245. #define _Outref_result_bytebuffer_all_maybenull_(s)
  246. #define _Outref_result_nullonfailure_
  247. #define _Result_nullonfailure_
  248. #define _Result_zeroonfailure_
  249. /* Return values */
  250. #define _Ret_z_
  251. #define _Ret_maybenull_z_
  252. #define _Ret_notnull_
  253. #define _Ret_maybenull_
  254. #define _Ret_null_
  255. #define _Ret_valid_
  256. #define _Ret_writes_(s)
  257. #define _Ret_writes_z_(s)
  258. #define _Ret_writes_bytes_(s)
  259. #define _Ret_writes_maybenull_(s)
  260. #define _Ret_writes_maybenull_z_(s)
  261. #define _Ret_writes_bytes_maybenull_(s)
  262. #define _Ret_writes_to_(s, c)
  263. #define _Ret_writes_bytes_to_(s, c)
  264. #define _Ret_writes_to_maybenull_(s, c)
  265. #define _Ret_writes_bytes_to_maybenull_(s, c)
  266. #define _Points_to_data_
  267. #define _Literal_
  268. #define _Notliteral_
  269. #define _Deref_ret_range_(l,u)
  270. #define _Unchanged_(e)
  271. /* Optional pointer parameters */
  272. #define __in_opt
  273. #define __out_opt
  274. #define __inout_opt
  275. /* Other common annotations */
  276. #define _In_range_(low, hi)
  277. #define _Out_range_(low, hi)
  278. #define _Ret_range_(low, hi)
  279. #define _Deref_in_range_(low, hi)
  280. #define _Deref_out_range_(low, hi)
  281. #define _Deref_inout_range_(low, hi)
  282. #define _Struct_size_bytes_(size)
  283. #define _Deref_out_
  284. #define _Deref_out_opt_
  285. #define _Deref_opt_out_
  286. #define _Deref_opt_out_opt_
  287. /* Function annotations */
  288. #define _Called_from_function_class_(name)
  289. #define _Check_return_ __checkReturn
  290. #define _Function_class_(name)
  291. #define _Raises_SEH_exception_
  292. #define _Maybe_raises_SEH_exception_
  293. #define _Must_inspect_result_
  294. #define _Use_decl_annotations_
  295. /* Success/failure annotations */
  296. #define _Always_(anno_list)
  297. #define _On_failure_(anno_list)
  298. #define _Return_type_success_(expr)
  299. #define _Success_(expr)
  300. #define _Reserved_
  301. #define _Const_
  302. /* Buffer properties */
  303. #define _Readable_bytes_(s)
  304. #define _Readable_elements_(s)
  305. #define _Writable_bytes_(s)
  306. #define _Writable_elements_(s)
  307. #define _Null_terminated_
  308. #define _NullNull_terminated_
  309. /* Field properties */
  310. #define _Field_size_(s)
  311. #define _Field_size_full_(s)
  312. #define _Field_size_full_opt_(s)
  313. #define _Field_size_opt_(s)
  314. #define _Field_size_part_(s, c)
  315. #define _Field_size_part_opt_(s, c)
  316. #define _Field_size_bytes_(size)
  317. #define _Field_size_bytes_full_(size)
  318. #define _Field_size_bytes_full_opt_(s)
  319. #define _Field_size_bytes_opt_(s)
  320. #define _Field_size_bytes_part_(s, c)
  321. #define _Field_size_bytes_part_opt_(s, c)
  322. #define _Field_z_
  323. #define _Field_range_(min, max)
  324. /* Structural annotations */
  325. #define _At_(e, a)
  326. #define _At_buffer_(e, i, c, a)
  327. #define _Group_(a)
  328. #define _When_(e, a)
  329. /* printf/scanf annotations */
  330. #define _Printf_format_string_
  331. #define _Scanf_format_string_
  332. #define _Scanf_s_format_string_
  333. #define _Format_string_impl_(kind,where)
  334. #define _Printf_format_string_params_(x)
  335. #define _Scanf_format_string_params_(x)
  336. #define _Scanf_s_format_string_params_(x)
  337. /* Analysis */
  338. #define _Analysis_mode_(x)
  339. #define _Analysis_assume_(expr)
  340. #define _Analysis_assume_nullterminated_(expr)
  341. #define _Post_
  342. #define _Post_equal_to_(expr)
  343. #define _Post_readable_byte_size_(s)
  344. #define _Post_readable_size_(s)
  345. #define _Post_satisfies_(c)
  346. #define _Post_writable_byte_size_(s)
  347. #define _Post_writable_size_(s)
  348. #define _Pre_equal_to_(expr)
  349. #define _Pre_notnull_
  350. #define _Pre_readable_byte_size_(s)
  351. #define _Pre_readable_size_(s)
  352. #define _Pre_satisfies_(c)
  353. #define _Pre_writable_byte_size_(s)
  354. #define _Pre_writable_size_(s)
  355. #define _Strict_type_match_
  356. /* FIXME: __in macro conflicts with argument names in libstdc++. For this reason,
  357. * we disable it for C++. This should be fixed in libstdc++ so we can uncomment
  358. * it in fixed version here. */
  359. #if !defined(__cplusplus) || !defined(__GNUC__)
  360. #define __in
  361. #define __out
  362. #endif
  363. #define __bcount(size)
  364. #define __ecount(size)
  365. #define __in_bcount(size)
  366. #define __in_bcount_nz(size)
  367. #define __in_bcount_z(size)
  368. #define __in_ecount(size)
  369. #define __in_ecount_nz(size)
  370. #define __in_ecount_z(size)
  371. #define __out_bcount(size)
  372. #define __out_bcount_nz(size)
  373. #define __out_bcount_z(size)
  374. #define __out_bcount_full(size)
  375. #define __out_bcount_full_z(size)
  376. #define __out_bcount_part(size, length)
  377. #define __out_bcount_part_z(size, length)
  378. #define __out_ecount(size)
  379. #define __out_ecount_nz(size)
  380. #define __out_ecount_z(size)
  381. #define __out_ecount_full(size)
  382. #define __out_ecount_full_z(size)
  383. #define __out_ecount_part(size, length)
  384. #define __out_ecount_part_z(size, length)
  385. #define __inout
  386. #define __inout_bcount(size)
  387. #define __inout_bcount_nz(size)
  388. #define __inout_bcount_z(size)
  389. #define __inout_bcount_full(size)
  390. #define __inout_bcount_part(size, length)
  391. #define __inout_ecount(size)
  392. #define __inout_ecount_nz(size)
  393. #define __inout_ecount_z(size)
  394. #define __inout_ecount_full(size)
  395. #define __inout_ecount_part(size, length)
  396. #define __deref
  397. #define __deref_opt_out
  398. #define __deref_opt_out_bcount(x)
  399. #define __deref_out
  400. #define __deref_out_ecount(size)
  401. #define __deref_out_opt
  402. #define __range(x,y)
  403. #endif