|
| 1 | + |
| 2 | +/* |
| 3 | + * Copyright (C) 2025 Intel Corporation. All rights reserved. |
| 4 | + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 5 | + */ |
| 6 | + |
| 7 | +/* |
| 8 | + * THIS FILE IS GENERATED AUTOMATICALLY, DO NOT EDIT! |
| 9 | + */ |
| 10 | +#ifndef AOT_EXPORT_CHECKED_H |
| 11 | +#define AOT_EXPORT_CHECKED_H |
| 12 | + |
| 13 | +#include <stdbool.h> |
| 14 | +#include <stdint.h> |
| 15 | +#include <stdlib.h> |
| 16 | + |
| 17 | +#include "aot_export.h" |
| 18 | + |
| 19 | +typedef struct { |
| 20 | + int error_code; // Error code (0 for success, non-zero for errors) |
| 21 | + union { |
| 22 | + uint32_t uint32_t_value; |
| 23 | + _Bool _Bool_value; |
| 24 | + aot_obj_data_t aot_obj_data_t_value; |
| 25 | + aot_comp_data_t aot_comp_data_t_value; |
| 26 | + aot_comp_context_t aot_comp_context_t_value; |
| 27 | + // Add other types as needed |
| 28 | + } value; |
| 29 | +} Result; |
| 30 | + |
| 31 | +static inline Result |
| 32 | +aot_call_stack_features_init_default_checked(void *features) |
| 33 | +{ |
| 34 | + Result res; |
| 35 | + // Check for null pointer parameter: features |
| 36 | + if (features == NULL) { |
| 37 | + res.error_code = -1; |
| 38 | + return res; |
| 39 | + } |
| 40 | + // Execute the original function |
| 41 | + aot_call_stack_features_init_default(features); |
| 42 | + // Assign return value and error code |
| 43 | + res.error_code = 0; |
| 44 | + return res; |
| 45 | +} |
| 46 | + |
| 47 | +static inline Result |
| 48 | +aot_create_comp_data_checked(void *wasm_module, void *target_arch, |
| 49 | + _Bool gc_enabled) |
| 50 | +{ |
| 51 | + Result res; |
| 52 | + // Check for null pointer parameter: wasm_module |
| 53 | + if (wasm_module == NULL) { |
| 54 | + res.error_code = -1; |
| 55 | + return res; |
| 56 | + } |
| 57 | + // Check for null pointer parameter: target_arch |
| 58 | + if (target_arch == NULL) { |
| 59 | + res.error_code = -1; |
| 60 | + return res; |
| 61 | + } |
| 62 | + // Execute the original function |
| 63 | + aot_comp_data_t original_result = |
| 64 | + aot_create_comp_data(wasm_module, target_arch, gc_enabled); |
| 65 | + // Assign return value and error code |
| 66 | + if (original_result != NULL) { |
| 67 | + res.error_code = 0; |
| 68 | + res.value.aot_comp_data_t_value = original_result; |
| 69 | + } |
| 70 | + else { |
| 71 | + res.error_code = -2; |
| 72 | + } |
| 73 | + return res; |
| 74 | +} |
| 75 | + |
| 76 | +static inline Result |
| 77 | +aot_destroy_comp_data_checked(aot_comp_data_t comp_data) |
| 78 | +{ |
| 79 | + Result res; |
| 80 | + // Execute the original function |
| 81 | + aot_destroy_comp_data(comp_data); |
| 82 | + // Assign return value and error code |
| 83 | + res.error_code = 0; |
| 84 | + return res; |
| 85 | +} |
| 86 | + |
| 87 | +static inline Result |
| 88 | +aot_compiler_init_checked(void) |
| 89 | +{ |
| 90 | + Result res; |
| 91 | + // Execute the original function |
| 92 | + _Bool original_result = aot_compiler_init(); |
| 93 | + // Assign return value and error code |
| 94 | + res.error_code = original_result ? 0 : -2; |
| 95 | + res.value._Bool_value = original_result; |
| 96 | + return res; |
| 97 | +} |
| 98 | + |
| 99 | +static inline Result |
| 100 | +aot_compiler_destroy_checked(void) |
| 101 | +{ |
| 102 | + Result res; |
| 103 | + // Execute the original function |
| 104 | + aot_compiler_destroy(); |
| 105 | + // Assign return value and error code |
| 106 | + res.error_code = 0; |
| 107 | + return res; |
| 108 | +} |
| 109 | + |
| 110 | +static inline Result |
| 111 | +aot_create_comp_context_checked(aot_comp_data_t comp_data, |
| 112 | + aot_comp_option_t option) |
| 113 | +{ |
| 114 | + Result res; |
| 115 | + // Execute the original function |
| 116 | + aot_comp_context_t original_result = |
| 117 | + aot_create_comp_context(comp_data, option); |
| 118 | + // Assign return value and error code |
| 119 | + if (original_result != NULL) { |
| 120 | + res.error_code = 0; |
| 121 | + res.value.aot_comp_context_t_value = original_result; |
| 122 | + } |
| 123 | + else { |
| 124 | + res.error_code = -2; |
| 125 | + } |
| 126 | + return res; |
| 127 | +} |
| 128 | + |
| 129 | +static inline Result |
| 130 | +aot_destroy_comp_context_checked(aot_comp_context_t comp_ctx) |
| 131 | +{ |
| 132 | + Result res; |
| 133 | + // Execute the original function |
| 134 | + aot_destroy_comp_context(comp_ctx); |
| 135 | + // Assign return value and error code |
| 136 | + res.error_code = 0; |
| 137 | + return res; |
| 138 | +} |
| 139 | + |
| 140 | +static inline Result |
| 141 | +aot_compile_wasm_checked(aot_comp_context_t comp_ctx) |
| 142 | +{ |
| 143 | + Result res; |
| 144 | + // Execute the original function |
| 145 | + _Bool original_result = aot_compile_wasm(comp_ctx); |
| 146 | + // Assign return value and error code |
| 147 | + res.error_code = original_result ? 0 : -2; |
| 148 | + res.value._Bool_value = original_result; |
| 149 | + return res; |
| 150 | +} |
| 151 | + |
| 152 | +static inline Result |
| 153 | +aot_obj_data_create_checked(aot_comp_context_t comp_ctx) |
| 154 | +{ |
| 155 | + Result res; |
| 156 | + // Execute the original function |
| 157 | + aot_obj_data_t original_result = aot_obj_data_create(comp_ctx); |
| 158 | + // Assign return value and error code |
| 159 | + if (original_result != NULL) { |
| 160 | + res.error_code = 0; |
| 161 | + res.value.aot_obj_data_t_value = original_result; |
| 162 | + } |
| 163 | + else { |
| 164 | + res.error_code = -2; |
| 165 | + } |
| 166 | + return res; |
| 167 | +} |
| 168 | + |
| 169 | +static inline Result |
| 170 | +aot_obj_data_destroy_checked(aot_obj_data_t obj_data) |
| 171 | +{ |
| 172 | + Result res; |
| 173 | + // Execute the original function |
| 174 | + aot_obj_data_destroy(obj_data); |
| 175 | + // Assign return value and error code |
| 176 | + res.error_code = 0; |
| 177 | + return res; |
| 178 | +} |
| 179 | + |
| 180 | +static inline Result |
| 181 | +aot_get_aot_file_size_checked(aot_comp_context_t comp_ctx, |
| 182 | + aot_comp_data_t comp_data, |
| 183 | + aot_obj_data_t obj_data) |
| 184 | +{ |
| 185 | + Result res; |
| 186 | + // Execute the original function |
| 187 | + uint32_t original_result = |
| 188 | + aot_get_aot_file_size(comp_ctx, comp_data, obj_data); |
| 189 | + // Assign return value and error code |
| 190 | + if (original_result == 0) { |
| 191 | + res.error_code = 0; |
| 192 | + res.value.uint32_t_value = original_result; |
| 193 | + } |
| 194 | + else { |
| 195 | + res.error_code = -2; |
| 196 | + } |
| 197 | + return res; |
| 198 | +} |
| 199 | + |
| 200 | +static inline Result |
| 201 | +aot_emit_aot_file_buf_checked(aot_comp_context_t comp_ctx, |
| 202 | + aot_comp_data_t comp_data, void *p_aot_file_size) |
| 203 | +{ |
| 204 | + Result res; |
| 205 | + // Check for null pointer parameter: p_aot_file_size |
| 206 | + if (p_aot_file_size == NULL) { |
| 207 | + res.error_code = -1; |
| 208 | + return res; |
| 209 | + } |
| 210 | + // Execute the original function |
| 211 | + aot_emit_aot_file_buf(comp_ctx, comp_data, p_aot_file_size); |
| 212 | + // Assign return value and error code |
| 213 | + res.error_code = 0; |
| 214 | + return res; |
| 215 | +} |
| 216 | + |
| 217 | +static inline Result |
| 218 | +aot_emit_aot_file_buf_ex_checked(aot_comp_context_t comp_ctx, |
| 219 | + aot_comp_data_t comp_data, |
| 220 | + aot_obj_data_t obj_data, void *aot_file_buf, |
| 221 | + uint32_t aot_file_size) |
| 222 | +{ |
| 223 | + Result res; |
| 224 | + // Check for null pointer parameter: aot_file_buf |
| 225 | + if (aot_file_buf == NULL) { |
| 226 | + res.error_code = -1; |
| 227 | + return res; |
| 228 | + } |
| 229 | + // Execute the original function |
| 230 | + _Bool original_result = aot_emit_aot_file_buf_ex( |
| 231 | + comp_ctx, comp_data, obj_data, aot_file_buf, aot_file_size); |
| 232 | + // Assign return value and error code |
| 233 | + res.error_code = original_result ? 0 : -2; |
| 234 | + res.value._Bool_value = original_result; |
| 235 | + return res; |
| 236 | +} |
| 237 | + |
| 238 | +static inline Result |
| 239 | +aot_emit_llvm_file_checked(aot_comp_context_t comp_ctx, void *file_name) |
| 240 | +{ |
| 241 | + Result res; |
| 242 | + // Check for null pointer parameter: file_name |
| 243 | + if (file_name == NULL) { |
| 244 | + res.error_code = -1; |
| 245 | + return res; |
| 246 | + } |
| 247 | + // Execute the original function |
| 248 | + _Bool original_result = aot_emit_llvm_file(comp_ctx, file_name); |
| 249 | + // Assign return value and error code |
| 250 | + res.error_code = original_result ? 0 : -2; |
| 251 | + res.value._Bool_value = original_result; |
| 252 | + return res; |
| 253 | +} |
| 254 | + |
| 255 | +static inline Result |
| 256 | +aot_emit_object_file_checked(aot_comp_context_t comp_ctx, void *file_name) |
| 257 | +{ |
| 258 | + Result res; |
| 259 | + // Check for null pointer parameter: file_name |
| 260 | + if (file_name == NULL) { |
| 261 | + res.error_code = -1; |
| 262 | + return res; |
| 263 | + } |
| 264 | + // Execute the original function |
| 265 | + _Bool original_result = aot_emit_object_file(comp_ctx, file_name); |
| 266 | + // Assign return value and error code |
| 267 | + res.error_code = original_result ? 0 : -2; |
| 268 | + res.value._Bool_value = original_result; |
| 269 | + return res; |
| 270 | +} |
| 271 | + |
| 272 | +static inline Result |
| 273 | +aot_emit_aot_file_checked(aot_comp_context_t comp_ctx, |
| 274 | + aot_comp_data_t comp_data, void *file_name) |
| 275 | +{ |
| 276 | + Result res; |
| 277 | + // Check for null pointer parameter: file_name |
| 278 | + if (file_name == NULL) { |
| 279 | + res.error_code = -1; |
| 280 | + return res; |
| 281 | + } |
| 282 | + // Execute the original function |
| 283 | + _Bool original_result = aot_emit_aot_file(comp_ctx, comp_data, file_name); |
| 284 | + // Assign return value and error code |
| 285 | + res.error_code = original_result ? 0 : -2; |
| 286 | + res.value._Bool_value = original_result; |
| 287 | + return res; |
| 288 | +} |
| 289 | + |
| 290 | +static inline Result |
| 291 | +aot_destroy_aot_file_checked(void *aot_file) |
| 292 | +{ |
| 293 | + Result res; |
| 294 | + // Check for null pointer parameter: aot_file |
| 295 | + if (aot_file == NULL) { |
| 296 | + res.error_code = -1; |
| 297 | + return res; |
| 298 | + } |
| 299 | + // Execute the original function |
| 300 | + aot_destroy_aot_file(aot_file); |
| 301 | + // Assign return value and error code |
| 302 | + res.error_code = 0; |
| 303 | + return res; |
| 304 | +} |
| 305 | + |
| 306 | +static inline Result |
| 307 | +aot_get_last_error_checked(void) |
| 308 | +{ |
| 309 | + Result res; |
| 310 | + // Execute the original function |
| 311 | + aot_get_last_error(); |
| 312 | + // Assign return value and error code |
| 313 | + res.error_code = 0; |
| 314 | + return res; |
| 315 | +} |
| 316 | + |
| 317 | +static inline Result |
| 318 | +aot_get_plt_table_size_checked(void) |
| 319 | +{ |
| 320 | + Result res; |
| 321 | + // Execute the original function |
| 322 | + uint32_t original_result = aot_get_plt_table_size(); |
| 323 | + // Assign return value and error code |
| 324 | + if (original_result == 0) { |
| 325 | + res.error_code = 0; |
| 326 | + res.value.uint32_t_value = original_result; |
| 327 | + } |
| 328 | + else { |
| 329 | + res.error_code = -2; |
| 330 | + } |
| 331 | + return res; |
| 332 | +} |
| 333 | + |
| 334 | +#endif // AOT_EXPORT_CHECKED_H |
0 commit comments