19490 Commits

Author SHA1 Message Date
Jakub Konka
20ea44ef10 macho: fix memory leak and refactor Target usage 2022-07-25 22:46:43 -07:00
r00ster
cff5d9c805
std.mem: add first method to SplitIterator and SplitBackwardsIterator 2022-07-25 22:04:30 +03:00
Veikka Tuominen
2f34d06d01 Sema: analyzeInlineCallArg needs a block for the arg and the param 2022-07-25 22:04:08 +03:00
VÖRÖSKŐI András
370793a36b PriorityDequeue: use compareFn in update() method 2022-07-25 18:12:32 +03:00
Luuk de Gram
9a3dacc00e
Merge pull request #12188 from Luukdegram/llvm-wasm-c-abi
stage2: llvm - Implement C ABI when targetting wasm32
2022-07-25 16:12:36 +02:00
Ryan Liptak
75e5b38410
std.fs: End iteration on Linux/WASI during Iterator.next when hitting ENOENT
`getdents` on Linux can return `ENOENT` if the directory referred to by the fd is deleted during iteration. Returning null when this happens makes sense because:

- `ENOENT` is specific to the Linux implementation of `getdents`
- On other platforms like FreeBSD, `getdents` returns `0` in this scenario, which is functionally equivalent to the `.NOENT => return null` handling on Linux
- In all the usage sites of `Iterator.next` throughout the standard library, translating `ENOENT` returned from `next` as null was the best way to handle it, so the use-case for handling the exact `ENOENT` scenario specifically may not exist to a relevant extent

Previously, ENOENT being returned would trigger `os.unexpectedErrno`.

Closes #12211
2022-07-25 16:14:25 +03:00
r00ster
8f3ab96b0e
std.testing: make the caret indicator line more helpful 2022-07-25 15:51:22 +03:00
Andrew Kelley
0d120fcb89
Merge pull request #12225 from ziglang/ci-stage3-standalone
CI stage3 test coverage for test-standalone and test-cli
2022-07-25 00:46:56 -07:00
Luuk de Gram
a7417f7839
wasm: Enable C-ABI tests for self-hosted compiler 2022-07-25 06:34:00 +02:00
Luuk de Gram
6b4d4c70fd
wasm: Only allow lowering C-ABI compatible types 2022-07-25 06:34:00 +02:00
Luuk de Gram
200b2e4ee1
llvm: correctly lower c-abi for Wasm target
When lowering the return type for Wasm if the calling convention is `C`,
it now correctly lower it according to what clang does as specified in:
https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md

This makes use of the same logic as the Wasm backend, ensuring the
generated code does not diverge in function signatures.

When passing arguments accross the C-ABI for the Wasm target,
we want slightly different behavior than x86_64.
For instance: a struct with multiple fields must always be passed
by reference, even if its ABI size fits in a single integer.
However, we do pass larger integers such as 128bit by value,
which LLVM will correctly lower to use double arguments instead.
2022-07-25 06:34:00 +02:00
Luuk de Gram
bf28a47cf2
wasm: pass correct abi-size for scalar values
When returning an aggregate type that contains a scalar value (nested),
its abi-size is passed by bits, rather than bytes to `buildOpcode`.
2022-07-25 06:33:56 +02:00
Luuk de Gram
7c13bdb1c9
Merge pull request #12059 from Luukdegram/linker-tests-run-step
Implement EmulatableRunStep for linker tests
2022-07-25 06:33:01 +02:00
Andrew Kelley
546c75ca46 LLVM: notice the soft_float CPU feature
when deciding whether to lower to x86_fp80 instructions, or softfloat
instructions.

Closes #10847
Closes #12090
2022-07-24 17:10:08 -07:00
Andrew Kelley
93ae386f56 stage2: don't skip liveness or codegen if -femit-asm is supplied
Fixes Godbolt's CLI usage of Zig.
2022-07-24 15:02:05 -07:00
Andrew Kelley
be294e3744 CI stage3 test coverage for test-standalone 2022-07-24 15:02:05 -07:00
Ryan Liptak
4624c81899 std.fs: Fix Walker closing the initial directory when not fully iterated
This is a fix for a regression caused by 61c5d8f8f1

Closes #12209
2022-07-24 12:00:14 -07:00
Andrew Kelley
934573fc5d Revert "std.fmt: require specifier for unwrapping ?T and E!T."
This reverts commit 7cbd586ace46a8e8cebab660ebca3cfc049305d9.

This is causing a fail to build from source:

```
./lib/std/fmt.zig:492:17: error: cannot format optional without a specifier (i.e. {?} or {any})
                @compileError("cannot format optional without a specifier (i.e. {?} or {any})");
                ^
./src/link/MachO/Atom.zig:544:26: note: called from here
                log.debug("  RELA({s}) @ {x} => %{d} in object({d})", .{
                         ^
```

I looked at the code to fix it but none of those args are optionals.
2022-07-24 11:50:10 -07:00
Lewis Gaul
a08b0fa706 Fix indexing in the test runner's log formatting 2022-07-24 12:08:02 +03:00
InKryption
7cbd586ace
std.fmt: require specifier for unwrapping ?T and E!T.
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-07-24 12:01:56 +03:00
Ali Chraghi
0b4a3ec950 std: compile error on invalid testing allocator usage 2022-07-24 11:57:00 +03:00
Meghan
dea437edfb
stage2: implement noinline fn 2022-07-24 11:56:33 +03:00
Andreas Reischuck
903bed931d report better error for package not found in stage2 2022-07-24 11:55:37 +03:00
Jonathan Marler
f598234ee8 std.json: expose encodeJsonString and encodeJsonStringChars
Expose 2 functions from std.json.  These functions take a slice of bytes
and forward them to a given writer as a JSON encoded string.

The use case I have for this is in a custom JsonStringWriter.  This writer
takes data and automatically encodes it as JSON string characters and
forwards it to an underlying writer.  I use this JsonStringWriter in
combination with std.fmt.format to go directly from a format string/arg
pair to JSON.  This way I don't have to format my string into a separate
buffer first and encode it afterwards, which avoids the need to create
a temporary buffer to hold the unencoded but formatted string.
2022-07-24 11:51:59 +03:00
Andrew Kelley
a2ab9e36fa
Merge pull request #12143 from Vexu/stage2-safety
Stage2 runtime safety progress
2022-07-23 20:09:24 -07:00
Andrew Kelley
9964324856 disable flaky behavior test
see #12208
2022-07-23 20:03:50 -07:00
Luuk de Gram
72c0cebe5c
test/link/macho: use EmulationStep for dead_strip 2022-07-23 17:27:47 +02:00
Vincent Rischmann
d99c32c2e1
io_uring: add new flags and opcodes 2022-07-23 17:21:17 +03:00
Veikka Tuominen
baf516218e Sema: don't add union field access safety check for single field unions 2022-07-23 15:40:12 +03:00
Veikka Tuominen
2436dd2c1b Sema: validate duplicate fields in anon structs 2022-07-23 15:40:12 +03:00
Veikka Tuominen
5b29275240 Sema: add some more 'declared here' notes 2022-07-23 15:40:12 +03:00
Veikka Tuominen
881c0cb20b Sema: add default value here note to invalid comptime field store error 2022-07-23 15:40:12 +03:00
Veikka Tuominen
15dddfd84d AstGen: make comptime fields in packed and extern structs compile errors 2022-07-23 15:40:12 +03:00
Veikka Tuominen
0ef4cc738b Sema: check for zero length slices in @alignCast safety 2022-07-23 15:40:12 +03:00
Veikka Tuominen
d75fa86d70 stage2: implement @setFloatMode 2022-07-23 15:40:12 +03:00
Veikka Tuominen
585c160c20 Sema: handle store to comptime field when ResultLoc == .none 2022-07-23 15:40:12 +03:00
Veikka Tuominen
9465906775 Sema: return .comptime_field_ptrs for tuples 2022-07-23 15:40:12 +03:00
Veikka Tuominen
cf87026e52 Sema: @alignCast safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
711b656773 Sema: @floatToInt safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
ff7ec4efb5 Sema: bad union field access safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
55fe34100f Sema: exact division safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
76d099950a Sema: cast negative to unsigned safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
0782586b15 Sema: divide by zero safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
9f10dfcb54 Sema: implement shr_exact runtime safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
4d20d6874c move passing safety tests to stage2 2022-07-23 15:40:11 +03:00
Veikka Tuominen
72c60acd5d Revert "std.mem.Allocator: add alignedCreate"
This reverts commit 5647a73fea7ecc9e1ee190362ef47f402eb95dff.
2022-07-23 15:30:12 +03:00
viri
b728e6aa00 stage1: don't lowercaseify lib names 2022-07-23 15:04:02 +03:00
Yujiri
6b9f609bd0 Fix #6944: referencing type info alignment causes error in unrelated function 2022-07-23 14:26:52 +03:00
devins2518
5647a73fea
std.mem.Allocator: add alignedCreate 2022-07-23 14:22:35 +03:00
InKryption
9555b84ab4 langref: clarify permitted @bitCast usage.
The current phrasing is vague; it is unclear whether it is demonstrating an example of the type of permitted behavior, from which the rule set must be extrapolated, or it is stating that this restriction only applies to the relationship between integers and bare structs.
2022-07-23 14:20:29 +03:00