Skip to content

Replace unreachable with error return for non-standard Windows targets#24289

Merged
alexrp merged 1 commit into
ziglang:masterfrom
squeek502:unsupported-windows-targets
Jun 29, 2025
Merged

Replace unreachable with error return for non-standard Windows targets#24289
alexrp merged 1 commit into
ziglang:masterfrom
squeek502:unsupported-windows-targets

Conversation

@squeek502
Copy link
Copy Markdown
Member

@squeek502 squeek502 commented Jun 29, 2025

This new error (error.UnsupportedCoffArchitecture) mirrors the error returned from the Elf struct (error.UnsupportedElfArchitecture):

else => return error.UnsupportedElfArchitecture,

Before:

$ zig build-exe -target riscv64-windows-gnu main.zig
thread 543087 panic: reached unreachable code

After:

$ zig build-exe -target riscv64-windows-gnu main.zig
error: unable to create compilation: UnsupportedCoffArchitecture

Closes #24287

This new error mirrors the error returned from the Elf struct (error.UnsupportedElfArchitecture):

https://github.com/ziglang/zig/blob/0adcfd60f4fcfd01c74a6477cbcef187ce06f533/src/link/Lld.zig#L112

Before:

```
$ zig build-exe -target riscv64-windows-gnu main.zig
thread 543087 panic: reached unreachable code
```

After:

```
$ zig build-exe -target riscv64-windows-gnu main.zig
error: unable to create compilation: UnsupportedCoffArchitecture
```

Closes ziglang#24287
@alexrp alexrp enabled auto-merge (rebase) June 29, 2025 01:36
@alexrp alexrp merged commit d3363b7 into ziglang:master Jun 29, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Attempting to use certain windows targets hits unreachable

2 participants