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 #ifdef __GNUC__ 11 # define __inner_checkReturn __attribute__((warn_unused_result)) 12 #elif defined(_MSC_VER) 13 # define __inner_checkReturn __declspec("SAL_checkReturn") 14 #else 15 # define __inner_checkReturn 16 #endif 17 18 #define __checkReturn __inner_checkReturn 19 20 /* Input parameters */ 21 #define _In_ 22 #define _In_opt_ 23 #define _In_z_ 24 #define _In_opt_z_ 25 #define _In_reads_(s) 26 #define _In_reads_opt_(s) 27 #define _In_reads_bytes_(s) 28 #define _In_reads_bytes_opt_(s) 29 #define _In_reads_z_(s) 30 #define _In_reads_opt_z_(s) 31 #define _In_reads_or_z_(s) 32 #define _In_reads_or_z_opt_(s) 33 #define _In_reads_to_ptr_(p) 34 #define _In_reads_to_ptr_opt_(p) 35 #define _In_reads_to_ptr_z_(p) 36 #define _In_reads_to_ptr_opt_z_(p) 37 38 /* Output parameters */ 39 #define _Out_ 40 #define _Out_opt_ 41 #define _Out_writes_(s) 42 #define _Out_writes_opt_(s) 43 #define _Out_writes_bytes_(s) 44 #define _Out_writes_bytes_opt_(s) 45 #define _Out_writes_z_(s) 46 #define _Out_writes_opt_z_(s) 47 #define _Out_writes_to_(s, c) 48 #define _Out_writes_to_opt_(s, c) 49 #define _Out_writes_all_(s) 50 #define _Out_writes_all_opt_(s) 51 #define _Out_writes_bytes_to_(s, c) 52 #define _Out_writes_bytes_to_opt_(s, c) 53 #define _Out_writes_bytes_all_(s) 54 #define _Out_writes_bytes_all_opt_(s) 55 #define _Out_writes_to_ptr_(p) 56 #define _Out_writes_to_ptr_opt_(p) 57 #define _Out_writes_to_ptr_z_(p) 58 #define _Out_writes_to_ptr_opt_z_(p) 59 60 /* Inout parameters */ 61 #define _Inout_ 62 #define _Inout_opt_ 63 #define _Inout_z_ 64 #define _Inout_opt_z_ 65 #define _Inout_updates_(s) 66 #define _Inout_updates_opt_(s) 67 #define _Inout_updates_z_(s) 68 #define _Inout_updates_opt_z_(s) 69 #define _Inout_updates_to_(s, c) 70 #define _Inout_updates_to_opt_(s, c) 71 #define _Inout_updates_all_(s) 72 #define _Inout_updates_all_opt_(s) 73 #define _Inout_updates_bytes_(s) 74 #define _Inout_updates_bytes_opt_(s) 75 #define _Inout_updates_bytes_to_(s, c) 76 #define _Inout_updates_bytes_to_opt_(s, c) 77 #define _Inout_updates_bytes_all_(s) 78 #define _Inout_updates_bytes_all_opt_(s) 79 80 /* Pointer to pointer parameters */ 81 #define _Outptr_ 82 #define _Outptr_result_maybenull_ 83 #define _Outptr_opt_ 84 #define _Outptr_opt_result_maybenull_ 85 #define _Outptr_result_z_ 86 #define _Outptr_opt_result_z_ 87 #define _Outptr_result_maybenull_z_ 88 #define _Outptr_opt_result_maybenull_z_ 89 #define _Outptr_result_nullonfailure_ 90 #define _Outptr_opt_result_nullonfailure_ 91 #define _COM_Outptr_ 92 #define _COM_Outptr_result_maybenull_ 93 #define _COM_Outptr_opt_ 94 #define _COM_Outptr_opt_result_maybenull_ 95 #define _Outptr_result_buffer_(s) 96 #define _Outptr_opt_result_buffer_(s) 97 #define _Outptr_result_buffer_to_(s, c) 98 #define _Outptr_opt_result_buffer_to_(s, c) 99 #define _Outptr_result_buffer_all_(s) 100 #define _Outptr_opt_result_buffer_all_(s) 101 #define _Outptr_result_buffer_maybenull_(s) 102 #define _Outptr_opt_result_buffer_maybenull_(s) 103 #define _Outptr_result_buffer_to_maybenull_(s, c) 104 #define _Outptr_opt_result_buffer_to_maybenull_(s, c) 105 #define _Outptr_result_buffer_all_maybenull_(s) 106 #define _Outptr_opt_result_buffer_all_maybenull_(s) 107 #define _Outptr_result_bytebuffer_(s) 108 #define _Outptr_opt_result_bytebuffer_(s) 109 #define _Outptr_result_bytebuffer_to_(s, c) 110 #define _Outptr_opt_result_bytebuffer_to_(s, c) 111 #define _Outptr_result_bytebuffer_all_(s) 112 #define _Outptr_opt_result_bytebuffer_all_(s) 113 #define _Outptr_result_bytebuffer_maybenull_(s) 114 #define _Outptr_opt_result_bytebuffer_maybenull_(s) 115 #define _Outptr_result_bytebuffer_to_maybenull_(s, c) 116 #define _Outptr_opt_result_bytebuffer_to_maybenull_(s, c) 117 #define _Outptr_result_bytebuffer_all_maybenull_(s) 118 #define _Outptr_opt_result_bytebuffer_all_maybenull_(s) 119 120 /* Output reference parameters */ 121 #define _Outref_ 122 #define _Outref_result_maybenull_ 123 #define _Outref_result_buffer_(s) 124 #define _Outref_result_bytebuffer_(s) 125 #define _Outref_result_buffer_to_(s, c) 126 #define _Outref_result_bytebuffer_to_(s, c) 127 #define _Outref_result_buffer_all_(s) 128 #define _Outref_result_bytebuffer_all_(s) 129 #define _Outref_result_buffer_maybenull_(s) 130 #define _Outref_result_bytebuffer_maybenull_(s) 131 #define _Outref_result_buffer_to_maybenull_(s, c) 132 #define _Outref_result_bytebuffer_to_maybenull_(s, c) 133 #define _Outref_result_buffer_all_maybenull_(s) 134 #define _Outref_result_bytebuffer_all_maybenull_(s) 135 #define _Outref_result_nullonfailure_ 136 #define _Result_nullonfailure_ 137 #define _Result_zeroonfailure_ 138 139 /* Return values */ 140 #define _Ret_z_ 141 #define _Ret_maybenull_z_ 142 #define _Ret_notnull_ 143 #define _Ret_maybenull_ 144 #define _Ret_null_ 145 #define _Ret_valid_ 146 #define _Ret_writes_(s) 147 #define _Ret_writes_z_(s) 148 #define _Ret_writes_bytes_(s) 149 #define _Ret_writes_maybenull_(s) 150 #define _Ret_writes_maybenull_z_(s) 151 #define _Ret_writes_bytes_maybenull_(s) 152 #define _Ret_writes_to_(s, c) 153 #define _Ret_writes_bytes_to_(s, c) 154 #define _Ret_writes_to_maybenull_(s, c) 155 #define _Ret_writes_bytes_to_maybenull_(s, c) 156 #define _Points_to_data_ 157 #define _Literal_ 158 #define _Notliteral_ 159 #define _Deref_ret_range_(l,u) 160 #define _Unchanged_(e) 161 #define _Pre_satisfies_(c) 162 #define _Post_satisfies_(c) 163 164 /* Optional pointer parameters */ 165 #define __in_opt 166 #define __out_opt 167 #define __inout_opt 168 169 /* Other common annotations */ 170 #define _In_range_(low, hi) 171 #define _Out_range_(low, hi) 172 #define _Ret_range_(low, hi) 173 #define _Deref_in_range_(low, hi) 174 #define _Deref_out_range_(low, hi) 175 #define _Deref_inout_range_(low, hi) 176 #define _Pre_equal_to_(expr) 177 #define _Post_equal_to_(expr) 178 #define _Struct_size_bytes_(size) 179 180 /* Function annotations */ 181 #define _Called_from_function_class_(name) 182 #define _Check_return_ __checkReturn 183 #define _Function_class_(name) 184 #define _Raises_SEH_exception_ 185 #define _Maybe_raises_SEH_exception_ 186 #define _Must_inspect_result_ 187 #define _Use_decl_annotations_ 188 189 /* Success/failure annotations */ 190 #define _Always_(anno_list) 191 #define _On_failure_(anno_list) 192 #define _Return_type_success_(expr) 193 #define _Success_(expr) 194 195 #define _Reserved_ 196 #define _Const_ 197 198 /* Buffer properties */ 199 #define _Readable_bytes_(s) 200 #define _Readable_elements_(s) 201 #define _Writable_bytes_(s) 202 #define _Writable_elements_(s) 203 #define _Null_terminated_ 204 #define _NullNull_terminated_ 205 #define _Pre_readable_size_(s) 206 #define _Pre_writable_size_(s) 207 #define _Pre_readable_byte_size_(s) 208 #define _Pre_writable_byte_size_(s) 209 #define _Post_readable_size_(s) 210 #define _Post_writable_size_(s) 211 #define _Post_readable_byte_size_(s) 212 #define _Post_writable_byte_size_(s) 213 214 /* Field properties */ 215 #define _Field_size_(s) 216 #define _Field_size_full_(s) 217 #define _Field_size_full_opt_(s) 218 #define _Field_size_opt_(s) 219 #define _Field_size_part_(s, c) 220 #define _Field_size_part_opt_(s, c) 221 #define _Field_size_bytes_(size) 222 #define _Field_size_bytes_full_(size) 223 #define _Field_size_bytes_full_opt_(s) 224 #define _Field_size_bytes_opt_(s) 225 #define _Field_size_bytes_part_(s, c) 226 #define _Field_size_bytes_part_opt_(s, c) 227 #define _Field_z_ 228 #define _Field_range_(min, max) 229 230 /* Structural annotations */ 231 #define _At_(e, a) 232 #define _At_buffer_(e, i, c, a) 233 #define _Group_(a) 234 #define _When_(e, a) 235 236 /* printf/scanf annotations */ 237 #define _Printf_format_string_ 238 #define _Scanf_format_string_ 239 #define _Scanf_s_format_string_ 240 #define _Format_string_impl_(kind,where) 241 #define _Printf_format_string_params_(x) 242 #define _Scanf_format_string_params_(x) 243 #define _Scanf_s_format_string_params_(x) 244 245 /* Analysis */ 246 #define _Analysis_assume_(expr) 247 #define _Analysis_assume_nullterminated_(expr) 248 249 /* FIXME: __in macro conflicts with argument names in libstdc++. For this reason, 250 * we disable it for C++. This should be fixed in libstdc++ so we can uncomment 251 * it in fixed version here. */ 252 #if !defined(__cplusplus) || !defined(__GNUC__) 253 #define __in 254 #define __out 255 #endif 256 257 #define __bcount(size) 258 #define __ecount(size) 259 260 #define __in_bcount(size) 261 #define __in_bcount_nz(size) 262 #define __in_bcount_z(size) 263 #define __in_ecount(size) 264 #define __in_ecount_nz(size) 265 #define __in_ecount_z(size) 266 267 #define __out_bcount(size) 268 #define __out_bcount_nz(size) 269 #define __out_bcount_z(size) 270 #define __out_bcount_full(size) 271 #define __out_bcount_full_z(size) 272 #define __out_bcount_part(size, length) 273 #define __out_bcount_part_z(size, length) 274 #define __out_ecount(size) 275 #define __out_ecount_nz(size) 276 #define __out_ecount_z(size) 277 #define __out_ecount_full(size) 278 #define __out_ecount_full_z(size) 279 #define __out_ecount_part(size, length) 280 #define __out_ecount_part_z(size, length) 281 282 #define __inout 283 #define __inout_bcount(size) 284 #define __inout_bcount_nz(size) 285 #define __inout_bcount_z(size) 286 #define __inout_bcount_full(size) 287 #define __inout_bcount_part(size, length) 288 #define __inout_ecount(size) 289 #define __inout_ecount_nz(size) 290 #define __inout_ecount_z(size) 291 #define __inout_ecount_full(size) 292 #define __inout_ecount_part(size, length) 293 294 #define __deref_out_ecount(size) 295 296 #endif 297 298