b32 generate_foreign_info : 1;
b32 no_std : 1;
b32 no_stale_code : 1;
+ b32 show_all_errors : 1;
b32 generate_tag_file : 1;
b32 generate_symbol_info_file : 1;
// If there are no given arguments to a structure literal, it is treated as a 'zero-value',
// and can be used to create a completely zeroed value of any type.
if (bh_arr_length(sl->args.values) == 0 && bh_arr_length(sl->args.named_values) == 0) {
- if (sl->type->kind == Type_Kind_Basic &&
- sl->type->Basic.kind == Basic_Kind_Void) {
- ERROR(sl->token->pos, "Cannot produce a zero-value for 'void' type.");
- }
-
AstZeroValue *zv = make_zero_value(context.ast_alloc, sl->token, sl->type);
bh_arr_push(sl->args.values, (AstTyped *) zv);
} else {
onyx_errors_enable();
- YIELD(ic->expected_type_expr->token->pos, "Waiting on expected type expression to be resolved.");
+ YIELD_ERROR(ic->expected_type_expr->token->pos, "Waiting on expected type expression to be resolved.");
}
}
OnyxErrorRank last_rank = errors.errors[0].rank;
bh_arr_each(OnyxError, err, errors.errors) {
- if (last_rank != err->rank) break;
+ if (!context.options->show_all_errors && last_rank != err->rank) break;
if (err->pos.filename) {
bh_file_contents file_contents = { 0 };
"Developer options:\n"
"\t--no-colors Disables colors in the error message.\n"
"\t--no-file-contents Disables '#file_contents' for security.\n"
+ "\t--show-all-errors Print all errors (can result in many consequencial errors from a single error)"
"\t--print-function-mappings Prints a mapping from WASM function index to source location.\n"
"\t--print-static-if-results Prints the conditional result of each #if statement. Useful for debugging.\n"
"\n";
.use_multi_threading = 0,
.no_std = 0,
.no_stale_code = 0,
+ .show_all_errors = 0,
.runtime = Runtime_Onyx,
else if (!strcmp(argv[i], "--no-stale-code")) {
options.no_stale_code = 1;
}
+ else if (!strcmp(argv[i], "--show-all-errors")) {
+ options.show_all_errors = 1;
+ }
else if (!strcmp(argv[i], "-I")) {
bh_arr_push(options.included_folders, argv[++i]);
}
WID(NULL, WI_I32_CONST, mod->null_proc_func_idx);
} else {
+ if (type == &basic_types[Basic_Kind_Void]) {
+ return;
+ }
+
WasmType wt = onyx_type_to_wasm_type(type);
if (wt == WASM_TYPE_VOID) {
onyx_report_error(where->pos, Error_Critical, "Cannot produce a zero-value for this type.");
}
case .Basic {
- bytes, err := io.read_bytes(r, .{ target, info.size });
+ err := io.read_fill_buffer(r, .{ target, info.size });
assert(err == .None, "Deserialize expected to be able to read all the bytes.");
}
read_u32 :: macro (r: &io.Reader) -> u32 {
dest: u32;
- io.read_bytes(r, str.{~~&dest, 4});
+ io.read_fill_buffer(r, str.{~~&dest, 4});
return dest;
}
}
read_byte :: read_byte;
unread_byte :: unread_byte;
read_bytes :: read_bytes;
+ read_fill_buffer :: read_fill_buffer;
read_string :: read_string;
read_i32 :: read_i32;
read_i64 :: read_i64;
buf := memory.make_slice(u8, bytes, allocator);
bytes_read, err := read_bytes(reader, buf);
return buf[0 .. bytes_read];
-};
+}
+
+read_fill_buffer :: (use reader: &Reader, bytes: [] u8) -> Error {
+ n := bytes.count;
+ if n == 0 {
+ if reader_get_buffered(reader) > 0 do return .None;
+ return reader_consume_error(reader);
+ }
+
+ write_index := 0;
+ while n > 0 && !reader_empty(reader) {
+ reader_read_next_chunk(reader);
+
+ to_write := math.min(n, end);
+ memory.copy(bytes.data + write_index, buffer.data, to_write);
+ n -= to_write;
+ write_index += to_write;
+ start += to_write;
+ }
+
+ last_byte = cast(i32) bytes[write_index - 1];
+ return (.None) if !reader_empty(reader) else .EOF;
+}
read_i32 :: (use reader: &Reader) -> i32 {
n: i32 = 0;
//
// Prints to standard error, if available.
eprintf :: (format: str, va: ..any) -> str {
- flush :: (_, to_output) => {
- runtime.platform.__output_error(to_output);
- return true;
- }
-
buffer: [1024] u8;
- runtime.platform.__output_error(conv.format_va(buffer, format, va, .{null, flush}));
+ runtime.platform.__output_error(
+ conv.format_va(buffer, format, va, .{
+ null,
+ (ctx: rawptr, to_output: str) -> bool {
+ runtime.platform.__output_error(to_output);
+ return true;
+ }
+ })
+ );
}
}
sem_post(&thread->wait_semaphore);
}
+static void resume_thread_slow(debug_thread_state_t *thread) {
+ sem_post(&thread->wait_semaphore);
+}
+
static u32 get_stack_frame_instruction_pointer(debug_state_t *debug, debug_thread_state_t *thread, ovm_stack_frame_t *frame) {
ovm_func_t *func = frame->func;
if (granularity == 2) {
ON_THREAD(thread_id) {
(*thread)->run_count = 1;
- resume_thread(*thread);
+ resume_thread_slow(*thread);
}
}