mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-11-27 10:00:59 +00:00
Use sorted lists to maintain consistency between CI and local.
This commit is contained in:
parent
94dce59c7a
commit
096461cbaf
|
|
@ -268,12 +268,14 @@ def generate_checked_headers(header_paths):
|
|||
for node in ast.ext
|
||||
if isinstance(node, c_ast.Decl) and isinstance(node.type, c_ast.FuncDecl)
|
||||
]
|
||||
functions = sorted(functions, key=lambda f: f.name)
|
||||
|
||||
return_types = {
|
||||
" ".join(func.type.type.type.names)
|
||||
for func in functions
|
||||
if isinstance(func.type.type, c_ast.TypeDecl)
|
||||
}
|
||||
return_types = sorted(return_types)
|
||||
|
||||
result_struct = generate_result_struct(return_types)
|
||||
write_checked_header(output_path, result_struct, functions, typedefs)
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@
|
|||
typedef struct {
|
||||
int error_code; // Error code (0 for success, non-zero for errors)
|
||||
union {
|
||||
uint32_t uint32_t_value;
|
||||
_Bool _Bool_value;
|
||||
aot_obj_data_t aot_obj_data_t_value;
|
||||
aot_comp_data_t aot_comp_data_t_value;
|
||||
aot_comp_context_t aot_comp_context_t_value;
|
||||
aot_comp_data_t aot_comp_data_t_value;
|
||||
aot_obj_data_t aot_obj_data_t_value;
|
||||
uint32_t uint32_t_value;
|
||||
// Add other types as needed
|
||||
} value;
|
||||
} Result;
|
||||
|
|
@ -44,6 +44,60 @@ aot_call_stack_features_init_default_checked(void *features)
|
|||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_compile_wasm_checked(aot_comp_context_t comp_ctx)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
_Bool original_result = aot_compile_wasm(comp_ctx);
|
||||
// Assign return value and error code
|
||||
res.error_code = original_result ? 0 : -2;
|
||||
res.value._Bool_value = original_result;
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_compiler_destroy_checked(void)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
aot_compiler_destroy();
|
||||
// Assign return value and error code
|
||||
res.error_code = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_compiler_init_checked(void)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
_Bool original_result = aot_compiler_init();
|
||||
// Assign return value and error code
|
||||
res.error_code = original_result ? 0 : -2;
|
||||
res.value._Bool_value = original_result;
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_create_comp_context_checked(aot_comp_data_t comp_data,
|
||||
aot_comp_option_t option)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
aot_comp_context_t original_result =
|
||||
aot_create_comp_context(comp_data, option);
|
||||
// Assign return value and error code
|
||||
if (original_result != NULL) {
|
||||
res.error_code = 0;
|
||||
res.value.aot_comp_context_t_value = original_result;
|
||||
}
|
||||
else {
|
||||
res.error_code = -2;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_create_comp_data_checked(void *wasm_module, void *target_arch,
|
||||
_Bool gc_enabled)
|
||||
|
|
@ -74,58 +128,21 @@ aot_create_comp_data_checked(void *wasm_module, void *target_arch,
|
|||
}
|
||||
|
||||
static inline Result
|
||||
aot_destroy_comp_data_checked(aot_comp_data_t comp_data)
|
||||
aot_destroy_aot_file_checked(void *aot_file)
|
||||
{
|
||||
Result res;
|
||||
// Check for null pointer parameter: aot_file
|
||||
if (aot_file == NULL) {
|
||||
res.error_code = -1;
|
||||
return res;
|
||||
}
|
||||
// Execute the original function
|
||||
aot_destroy_comp_data(comp_data);
|
||||
aot_destroy_aot_file(aot_file);
|
||||
// Assign return value and error code
|
||||
res.error_code = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_compiler_init_checked(void)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
_Bool original_result = aot_compiler_init();
|
||||
// Assign return value and error code
|
||||
res.error_code = original_result ? 0 : -2;
|
||||
res.value._Bool_value = original_result;
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_compiler_destroy_checked(void)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
aot_compiler_destroy();
|
||||
// Assign return value and error code
|
||||
res.error_code = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_create_comp_context_checked(aot_comp_data_t comp_data,
|
||||
aot_comp_option_t option)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
aot_comp_context_t original_result =
|
||||
aot_create_comp_context(comp_data, option);
|
||||
// Assign return value and error code
|
||||
if (original_result != NULL) {
|
||||
res.error_code = 0;
|
||||
res.value.aot_comp_context_t_value = original_result;
|
||||
}
|
||||
else {
|
||||
res.error_code = -2;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_destroy_comp_context_checked(aot_comp_context_t comp_ctx)
|
||||
{
|
||||
|
|
@ -138,62 +155,31 @@ aot_destroy_comp_context_checked(aot_comp_context_t comp_ctx)
|
|||
}
|
||||
|
||||
static inline Result
|
||||
aot_compile_wasm_checked(aot_comp_context_t comp_ctx)
|
||||
aot_destroy_comp_data_checked(aot_comp_data_t comp_data)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
_Bool original_result = aot_compile_wasm(comp_ctx);
|
||||
// Assign return value and error code
|
||||
res.error_code = original_result ? 0 : -2;
|
||||
res.value._Bool_value = original_result;
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_obj_data_create_checked(aot_comp_context_t comp_ctx)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
aot_obj_data_t original_result = aot_obj_data_create(comp_ctx);
|
||||
// Assign return value and error code
|
||||
if (original_result != NULL) {
|
||||
res.error_code = 0;
|
||||
res.value.aot_obj_data_t_value = original_result;
|
||||
}
|
||||
else {
|
||||
res.error_code = -2;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_obj_data_destroy_checked(aot_obj_data_t obj_data)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
aot_obj_data_destroy(obj_data);
|
||||
aot_destroy_comp_data(comp_data);
|
||||
// Assign return value and error code
|
||||
res.error_code = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_get_aot_file_size_checked(aot_comp_context_t comp_ctx,
|
||||
aot_comp_data_t comp_data,
|
||||
aot_obj_data_t obj_data)
|
||||
aot_emit_aot_file_checked(aot_comp_context_t comp_ctx,
|
||||
aot_comp_data_t comp_data, void *file_name)
|
||||
{
|
||||
Result res;
|
||||
// Check for null pointer parameter: file_name
|
||||
if (file_name == NULL) {
|
||||
res.error_code = -1;
|
||||
return res;
|
||||
}
|
||||
// Execute the original function
|
||||
uint32_t original_result =
|
||||
aot_get_aot_file_size(comp_ctx, comp_data, obj_data);
|
||||
_Bool original_result = aot_emit_aot_file(comp_ctx, comp_data, file_name);
|
||||
// Assign return value and error code
|
||||
if (original_result == 0) {
|
||||
res.error_code = 0;
|
||||
res.value.uint32_t_value = original_result;
|
||||
}
|
||||
else {
|
||||
res.error_code = -2;
|
||||
}
|
||||
res.error_code = original_result ? 0 : -2;
|
||||
res.value._Bool_value = original_result;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -270,36 +256,22 @@ aot_emit_object_file_checked(aot_comp_context_t comp_ctx, void *file_name)
|
|||
}
|
||||
|
||||
static inline Result
|
||||
aot_emit_aot_file_checked(aot_comp_context_t comp_ctx,
|
||||
aot_comp_data_t comp_data, void *file_name)
|
||||
aot_get_aot_file_size_checked(aot_comp_context_t comp_ctx,
|
||||
aot_comp_data_t comp_data,
|
||||
aot_obj_data_t obj_data)
|
||||
{
|
||||
Result res;
|
||||
// Check for null pointer parameter: file_name
|
||||
if (file_name == NULL) {
|
||||
res.error_code = -1;
|
||||
return res;
|
||||
}
|
||||
// Execute the original function
|
||||
_Bool original_result = aot_emit_aot_file(comp_ctx, comp_data, file_name);
|
||||
uint32_t original_result =
|
||||
aot_get_aot_file_size(comp_ctx, comp_data, obj_data);
|
||||
// Assign return value and error code
|
||||
res.error_code = original_result ? 0 : -2;
|
||||
res.value._Bool_value = original_result;
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_destroy_aot_file_checked(void *aot_file)
|
||||
{
|
||||
Result res;
|
||||
// Check for null pointer parameter: aot_file
|
||||
if (aot_file == NULL) {
|
||||
res.error_code = -1;
|
||||
return res;
|
||||
if (original_result == 0) {
|
||||
res.error_code = 0;
|
||||
res.value.uint32_t_value = original_result;
|
||||
}
|
||||
else {
|
||||
res.error_code = -2;
|
||||
}
|
||||
// Execute the original function
|
||||
aot_destroy_aot_file(aot_file);
|
||||
// Assign return value and error code
|
||||
res.error_code = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -331,4 +303,32 @@ aot_get_plt_table_size_checked(void)
|
|||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_obj_data_create_checked(aot_comp_context_t comp_ctx)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
aot_obj_data_t original_result = aot_obj_data_create(comp_ctx);
|
||||
// Assign return value and error code
|
||||
if (original_result != NULL) {
|
||||
res.error_code = 0;
|
||||
res.value.aot_obj_data_t_value = original_result;
|
||||
}
|
||||
else {
|
||||
res.error_code = -2;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline Result
|
||||
aot_obj_data_destroy_checked(aot_obj_data_t obj_data)
|
||||
{
|
||||
Result res;
|
||||
// Execute the original function
|
||||
aot_obj_data_destroy(obj_data);
|
||||
// Assign return value and error code
|
||||
res.error_code = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif // AOT_EXPORT_CHECKED_H
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user