| ... | @@ -199,7 +199,8 @@ pub fn spawn(comptime startFn: anytype, context: SpawnContextType(@TypeOf(startF | ... | @@ -199,7 +199,8 @@ pub fn spawn(comptime startFn: anytype, context: SpawnContextType(@TypeOf(startF |
| 199 | inner: Context, | 199 | inner: Context, |
| 200 | }; | 200 | }; |
| 201 | fn threadMain(raw_arg: windows.LPVOID) callconv(.C) windows.DWORD { | 201 | fn threadMain(raw_arg: windows.LPVOID) callconv(.C) windows.DWORD { |
| 202 | const arg = if (@sizeOf(Context) == 0) {} else @ptrCast(*Context, @alignCast(@alignOf(Context), raw_arg)).*; | 202 | const arg = if (@sizeOf(Context) == 0) undefined // |
| | 203 | else @ptrCast(*Context, @alignCast(@alignOf(Context), raw_arg)).*; |
| 203 | | 204 | |
| 204 | switch (@typeInfo(@typeInfo(@TypeOf(startFn)).Fn.return_type.?)) { | 205 | switch (@typeInfo(@typeInfo(@TypeOf(startFn)).Fn.return_type.?)) { |
| 205 | .NoReturn => { | 206 | .NoReturn => { |
| ... | @@ -260,7 +261,8 @@ pub fn spawn(comptime startFn: anytype, context: SpawnContextType(@TypeOf(startF | ... | @@ -260,7 +261,8 @@ pub fn spawn(comptime startFn: anytype, context: SpawnContextType(@TypeOf(startF |
| 260 | | 261 | |
| 261 | const MainFuncs = struct { | 262 | const MainFuncs = struct { |
| 262 | fn linuxThreadMain(ctx_addr: usize) callconv(.C) u8 { | 263 | fn linuxThreadMain(ctx_addr: usize) callconv(.C) u8 { |
| 263 | const arg = if (@sizeOf(Context) == 0) {} else @intToPtr(*const Context, ctx_addr).*; | 264 | const arg = if (@sizeOf(Context) == 0) undefined // |
| | 265 | else @intToPtr(*Context, ctx_addr).*; |
| 264 | | 266 | |
| 265 | switch (@typeInfo(@typeInfo(@TypeOf(startFn)).Fn.return_type.?)) { | 267 | switch (@typeInfo(@typeInfo(@TypeOf(startFn)).Fn.return_type.?)) { |
| 266 | .NoReturn => { | 268 | .NoReturn => { |
| ... | @@ -292,7 +294,8 @@ pub fn spawn(comptime startFn: anytype, context: SpawnContextType(@TypeOf(startF | ... | @@ -292,7 +294,8 @@ pub fn spawn(comptime startFn: anytype, context: SpawnContextType(@TypeOf(startF |
| 292 | } | 294 | } |
| 293 | } | 295 | } |
| 294 | fn posixThreadMain(ctx: ?*c_void) callconv(.C) ?*c_void { | 296 | fn posixThreadMain(ctx: ?*c_void) callconv(.C) ?*c_void { |
| 295 | const arg = if (@sizeOf(Context) == 0) {} else @ptrCast(*Context, @alignCast(@alignOf(Context), ctx)).*; | 297 | const arg = if (@sizeOf(Context) == 0) undefined // |
| | 298 | else @ptrCast(*Context, @alignCast(@alignOf(Context), ctx)).*; |
| 296 | | 299 | |
| 297 | switch (@typeInfo(@typeInfo(@TypeOf(startFn)).Fn.return_type.?)) { | 300 | switch (@typeInfo(@typeInfo(@TypeOf(startFn)).Fn.return_type.?)) { |
| 298 | .NoReturn => { | 301 | .NoReturn => { |