26354 Commits

Author SHA1 Message Date
Xavier Bouchoux
69d6f2e1b8 build.zig: add support for using "zig c++" as the bootstrap c++ compiler
The build was previously failing with `error: unknown command: -print-file-name=libstdc++.a`
because the command invocation was
`zig -print-file-name=libstdc++.a`
instead of
`zig c++ -print-file-name=libstdc++.a`

note: .cxx_compiler_arg1 = "" instead of undefined to avoid breaking existing setups without requiring to run cmake again.
2023-10-16 23:07:04 +02:00
Xavier Bouchoux
0afead5651 glibc patch: add backwards compatibility for strtol-family functions
following suit from b40943e253c079ec3de1b149dd2ef0ccc3da38a4,
add a version guard in addition to the ISOC2X check.
2023-10-16 22:43:28 +02:00
Jakub Konka
78f2ae7f29
Merge pull request #17531 from moosichu/fix/frameworks
Fix some frameworks not linking macos
2023-10-16 20:45:04 +02:00
joadnacer
7b9165b375 std.mem: Improve writeIntSlice performance 2023-10-16 08:49:05 -04:00
Veikka Tuominen
14efbf5ed1 Sema: fix missing check for tuple default initializers
Closes #17525
2023-10-16 14:00:18 +03:00
Veikka Tuominen
78855bd218 make distinct error limit configurable
Closes #786
2023-10-16 04:08:45 -04:00
Jacob Young
fbd90e487b Build: fix some issues with ConfigHeader step
* include path was using bad default for dependency lazy paths
 * unhashed config options caused changes to not trigger a rebuild
2023-10-16 03:50:47 -04:00
Andrew Kelley
ca690ffa22
Merge pull request #17448 from squeek502/win32-manifest
Add preliminary support for Windows `.manifest` files
2023-10-15 19:47:27 -07:00
Bogdan Romanyuk
ebde525cce
Sema: fix @extern error on function pointer 2023-10-16 01:30:39 +00:00
Robin Voetter
fd6b3db342
Merge pull request #17293 from Snektron/spirv-aaaa
spirv: more instructions
2023-10-16 02:04:09 +02:00
Ryan Liptak
b51147889f Add warning if .xml file is used, since it's likely intended to be a Windows manifest file
Example:

> zig build-exe test.zig test.xml
warning: embedded manifest files must have the extension '.manifest'
error: unrecognized file extension of parameter 'test.xml'
2023-10-15 13:33:16 -07:00
Ryan Liptak
5f15acc463 Add preliminary support for Windows .manifest files
An embedded manifest file is really just XML data embedded as a RT_MANIFEST resource (ID = 24). Typically, the Windows-only 'Manifest Tool' (`mt.exe`) is used to embed manifest files, and `mt.exe` also seems to perform some transformation of the manifest data before embedding, but in testing it doesn't seem like the transformations are necessary to get the intended result.

So, to handle embedding manifest files, Zig now takes the following approach:

- Generate a .rc file with the contents `1 24 "path-to-manifest.manifest"`
- Compile that generated .rc file into a .res file
- Link the .res file into the final binary

This effectively achieves the same thing as `mt.exe` minus the validation/transformations of the XML data that it performs.

How this is used:

On the command line:
```
zig build-exe main.zig main.manifest
```
(on the command line, specifying a .manifest file when the target object format is not COFF is an error)

or in build.zig:

```
const exe = b.addExecutable(.{
    .name = "manifest-test",
    .root_source_file = .{ .path = "main.zig" },
    .target = target,
    .optimize = optimize,
    .win32_manifest = .{ .path = "main.manifest" },
});
```
(in build.zig, the manifest file is ignored if the target object format is not COFF)

Note: Currently, only one manifest file can be specified per compilation. This is because the ID of the manifest resource is currently always 1. Specifying multiple manifests could be supported if a way for the user to specify an ID for each manifest is added (manifest IDs must be a u16).

Closes #17406

options
2023-10-15 13:33:16 -07:00
Johan Jansson
a1e0b9979a std.heap.ArenaAllocator: fix doc comment typo
Fixes #17537
2023-10-15 21:20:48 +03:00
Robin Voetter
8c153221b9
wasm: disable division test
Seems that bit integers are not properly supported
2023-10-15 20:08:19 +02:00
Robin Voetter
faad97edff
spirv: update failing / passing tests
Some tests are now failing due to debug info changes, some tests
now pass due to improved compiler functionality.
2023-10-15 20:08:18 +02:00
Tom Read Cutting
023d1ac6bf Add search for extension-less libraries (MachO)
accessLibPath now has a `noextension` block to search for extension-less
libraries.
2023-10-15 17:11:44 +01:00
Robin Voetter
0552e504d0
spirv: work around OpSource parsing issue in llvm-spirv
The Khronos SPIRV-LLVM translator does not parse OpSource correctly. This
was causing tests to fail and other mysterious issues.

These are resolved by only generating a single OpSource instruction for now,
which does not have the source file locations also.

See https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/2188
2023-10-15 17:07:39 +02:00
Ali Chraghi
45a1945dc4
spirv: simple binary and comparison vector operations 2023-10-15 14:00:33 +02:00
Robin Voetter
9c20449cc5
wasm: lower min/max for floats to compiler_rt
The min and max builtins in Zig have some intricate behavior
related to floats, that is not replicated with the min and max
wasm instructions or using simple select operations. By lowering
these instructions to compiler_rt, handling around NaNs is done
correctly.

See also https://github.com/WebAssembly/design/issues/214
2023-10-15 14:00:32 +02:00
Ali Chraghi
2fe16e072a
spirv: emit vectors as arrays 2023-10-15 14:00:32 +02:00
Robin Voetter
245c084726
add Snektron to CODEOWNERS for SPIR-V 2023-10-15 14:00:31 +02:00
Robin Voetter
f4064d98e2
spirv: optional comparison 2023-10-15 14:00:31 +02:00
Robin Voetter
10b8171466
spirv: handle errors in switch 2023-10-15 14:00:30 +02:00
Robin Voetter
3ca1f88898
std.testing: disable expectEqualSlices printing for spirv 2023-10-15 14:00:26 +02:00
Robin Voetter
e2e4e1f8b4
spirv: intcast, trunc for strange ints 2023-10-15 14:00:10 +02:00
Robin Voetter
b1499df1b8
spirv: sign-extension for strange integers 2023-10-15 14:00:09 +02:00
Robin Voetter
dc44baf763
std.testing: allow print() at comptime
This allows functions like expectEqual to be performed at comptime. If
an error is detected, the result is logged via a compile error.
2023-10-15 14:00:08 +02:00
Robin Voetter
839a93a101
intern pool: fix float equality
We need to perform bitwise equality here, otherwise we get
two different entries for nan values.
2023-10-15 14:00:08 +02:00
Robin Voetter
4f279078c8
spirv: air min/max 2023-10-15 14:00:07 +02:00
Robin Voetter
f858bf1616
spirv: air bitcast for non-numeric non-pointer types 2023-10-15 14:00:07 +02:00
Robin Voetter
0af16a58a0
spirv: fix air is_null optional slice field type 2023-10-15 14:00:06 +02:00
Robin Voetter
d0e7a3596b
spirv: allow generation of *i0 2023-10-15 14:00:06 +02:00
Robin Voetter
2d52fc762d
spirv: handle zero-sized arrays 2023-10-15 14:00:05 +02:00
Ali Chraghi
d8b591766a
spirv: fpext and fptrunc instructions 2023-10-15 14:00:04 +02:00
Robin Voetter
d2692af8e2
spirv: override function return type to void if it has no runtime bits 2023-10-15 14:00:04 +02:00
Robin Voetter
ae3efab226
spirv: generate *void as pointer to opaque 2023-10-15 14:00:03 +02:00
Robin Voetter
fe51ff9fc1
spirv: make air is_null not emit OpPtr(Not)Equal 2023-10-15 14:00:03 +02:00
Robin Voetter
15cf1315bb
spirv: fix incorrect repr of some optional operations 2023-10-15 14:00:01 +02:00
Robin Voetter
0a3e566f57
spirv: make bitcasts between the same spirv type a no-op 2023-10-15 14:00:01 +02:00
Robin Voetter
c6c5fb40de
spirv: fix float unequality 2023-10-15 14:00:00 +02:00
Robin Voetter
4a6a024a4b
spirv: properly skip comptime function parameters 2023-10-15 14:00:00 +02:00
Robin Voetter
89b1dafa78
spirv: aggregate_init for structs 2023-10-15 13:59:55 +02:00
Robin Voetter
28dda3bf89
spirv: put linkery bits in Object
This structure is used to group information that needs to
persist between decls in codegen.
2023-10-15 13:59:26 +02:00
Robin Voetter
31ad2d72a7
spirv: use CacheString for source_file_names instead of []const u8 2023-10-15 13:59:26 +02:00
Robin Voetter
a3d77bdba9
spirv: get rid of SpvModule arena 2023-10-15 13:59:25 +02:00
Robin Voetter
ab701c3d37
spirv: anon decl refs 2023-10-15 13:59:24 +02:00
Robin Voetter
08ea9a9ff6
spirv: cast result of .elem pointers to right type if needed 2023-10-15 13:59:23 +02:00
Robin Voetter
a7c3d5e4ec
spirv: constant elem ptr fix 2023-10-15 13:59:22 +02:00
Robin Voetter
4ea361f6dc
spirv: lower pointers to zero-bit types as undef 2023-10-15 13:59:22 +02:00
Robin Voetter
4e22f811e7
spirv: opaque types 2023-10-15 13:59:20 +02:00