| ... | ... | @@ -191,25 +191,27 @@ const bad_main_ret = "expected return type of main to be 'void', '!void', 'noret |
| 191 | 191 | // and we want fewer call frames in stack traces. |
| 192 | 192 | inline fn initEventLoopAndCallMain() u8 { |
| 193 | 193 | if (std.event.Loop.instance) |loop| { |
| 194 | | loop.init() catch |err| { |
| 195 | | std.debug.warn("error: {}\n", @errorName(err)); |
| 196 | | if (@errorReturnTrace()) |trace| { |
| 197 | | std.debug.dumpStackTrace(trace.*); |
| 198 | | } |
| 199 | | return 1; |
| 200 | | }; |
| 201 | | defer loop.deinit(); |
| 202 | | |
| 203 | | var result: u8 = undefined; |
| 204 | | var frame: @Frame(callMain) = undefined; |
| 205 | | _ = @asyncCall(&frame, &result, callMain); |
| 206 | | loop.run(); |
| 207 | | return result; |
| 208 | | } else { |
| 209 | | // This is marked inline because for some reason LLVM in release mode fails to inline it, |
| 210 | | // and we want fewer call frames in stack traces. |
| 211 | | return @inlineCall(callMain); |
| 194 | if (!@hasDecl(root, "event_loop")) { |
| 195 | loop.init() catch |err| { |
| 196 | std.debug.warn("error: {}\n", @errorName(err)); |
| 197 | if (@errorReturnTrace()) |trace| { |
| 198 | std.debug.dumpStackTrace(trace.*); |
| 199 | } |
| 200 | return 1; |
| 201 | }; |
| 202 | defer loop.deinit(); |
| 203 | |
| 204 | var result: u8 = undefined; |
| 205 | var frame: @Frame(callMain) = undefined; |
| 206 | _ = @asyncCall(&frame, &result, callMain); |
| 207 | loop.run(); |
| 208 | return result; |
| 209 | } |
| 212 | 210 | } |
| 211 | |
| 212 | // This is marked inline because for some reason LLVM in release mode fails to inline it, |
| 213 | // and we want fewer call frames in stack traces. |
| 214 | return @inlineCall(callMain); |
| 213 | 215 | } |
| 214 | 216 | |
| 215 | 217 | // This is not marked inline because it is called with @asyncCall when |