Andrew Kelley
e9fc58eab7
LLVM: handle extern function name collisions
...
Zig allows multiple extern functions with the same name, and the
backends have to handle this possibility.
For LLVM, we keep a sparse map of collisions, and then resolve them in
flushModule(). This introduces some technical debt that will have to be
resolved when adding incremental compilation support to the LLVM
backend.
2022-06-07 00:47:10 -04:00
Jakub Konka
d9b0c984aa
Merge pull request #11794 from ziglang/elf-macho-alignment
...
elf+macho: use explicit alignment on Decl if specified
2022-06-07 01:03:15 +02:00
Andrew Kelley
367e2b2fe4
Merge pull request #11800 from Vexu/stage2
...
`zig2 build test-std` progress
2022-06-06 16:12:31 -04:00
Veikka Tuominen
84000aa820
Sema: fix inline call of func using ret_ptr with comptime only type
2022-06-06 13:11:50 -07:00
Veikka Tuominen
8fa88c88c2
AstGen: fix coercion scope type when stores are eliminated
2022-06-06 13:11:50 -07:00
Veikka Tuominen
cb5d2b691a
Sema: validate equality on store to comptime field
2022-06-06 13:11:50 -07:00
Veikka Tuominen
a040ccb42f
Sema: fix coerce result ptr outside of functions
2022-06-06 13:11:50 -07:00
Andrew Kelley
41bf81dc32
Revert "Treat blocks with "return" as "noreturn""
...
This reverts commit 135b91aecd9be1f6f5806b667e07e383dd481198.
"endsWithBreak()" is not a meaningful question to ask and should not be
used this way. A simple example that defeats this logic is:
```zig
export fn entry() void {
outer: {
{
break :outer;
}
return;
}
}
```
2022-06-06 11:31:54 -07:00
BratishkaErik
1bdc2b777b
tools: fix update-linux-headers.zig and process_headers.zig
...
Signed-off-by: BratishkaErik <bratishkaerik@getgoogleoff.me>
2022-06-06 15:53:53 +02:00
Gregory Anders
135b91aecd
Treat blocks with "return" as "noreturn"
...
Block statements that end with "break" should not be considered
"noreturn" for the enclosing scope, but other "noreturn" instructions
(return, panic, compile error, etc.) should be. This differentiation
necessitates handling "break" differently from the other "noreturn"
instructions when inside a block statement.
2022-06-06 13:13:52 +03:00
Jakub Konka
95966f6fd7
elf+macho: use explicit alignment on decl is specified
2022-06-05 16:46:50 +02:00
Jakub Konka
33826a6a2e
x64: disable misbehaving behavior tests
2022-06-05 10:36:54 +02:00
Jakub Konka
1b5dd4e148
Merge pull request #11790 from joachimschmidt557/stage2-arm
...
stage2 ARM: implement basic switch expressions
2022-06-05 09:10:12 +02:00
joachimschmidt557
d5ee451177
stage2 ARM: introduce support for basic switch expressions
2022-06-04 19:58:34 +02:00
Veikka Tuominen
50a6b0f3ac
Sema: fix function type callconv inference
2022-06-04 11:33:18 +03:00
Veikka Tuominen
2b93546b39
Sema: fix initialization of array with comptime only elem type
2022-06-03 20:21:20 +03:00
Andrew Kelley
288e89b606
Sema: fix compiler crash with comptime arithmetic involving @ptrToInt
2022-06-01 16:45:28 -07:00
Andrew Kelley
a4cdb49a58
Merge pull request #11763 from Vexu/stage2-alloc-const
...
Stage2: detect when initializer of const variable is comptime known
2022-06-01 18:59:13 -04:00
Andrew Kelley
b82cccc9e9
Sema: fix alignment of element ptr result type
2022-06-01 15:43:21 -07:00
Veikka Tuominen
94624893d8
disable failing test
2022-06-01 13:06:31 +03:00
Veikka Tuominen
9431100736
Sema: apply previous changes to validateUnionInit
2022-06-01 13:01:39 +03:00
Veikka Tuominen
36df79cd37
stage2: ignore generic return type when hashing function type
...
Generic parameter types are already ignored.
2022-05-31 16:43:58 +03:00
Veikka Tuominen
febc7d3cd6
Sema: take dbg_stmt into account in zirResolveInferredAlloc
2022-05-31 16:22:00 +03:00
Andrew Kelley
c3ef4ac15f
Merge pull request #11752 from ziglang/zir-fancy-fns
...
stage2: add missing data to ZIR encoding of functions
2022-05-30 21:18:10 -04:00
Andrew Kelley
c84f5a5f91
Merge pull request #11749 from Vexu/stage2
...
Stage2: improve AstGen for array init expressions
2022-05-30 17:35:18 -04:00
Andrew Kelley
bd89a73d52
Sema: implement functions generic across callconv() or align()
2022-05-30 14:16:28 -07:00
Veikka Tuominen
0e8307789a
AstGen: add tuple aware elem_type_index
2022-05-29 13:19:03 +03:00
Veikka Tuominen
c7b778992e
AstGen: improve generated Zir for array init exprs
2022-05-29 13:19:03 +03:00
Veikka Tuominen
0274e2f1fd
translate-c: check variable types being demoted to opaque
2022-05-29 12:07:29 +03:00
TwoClocks
36b4658752
translate-c: check record fields for opaque demotions
2022-05-29 12:06:37 +03:00
Veikka Tuominen
ee651c3cd3
Revert "reserve correct space for bitfields"
...
This reverts commit 22cb6938891c73d64b749a2516c8eaf79aa25b03.
2022-05-29 12:04:50 +03:00
TwoClocks
22cb693889
reserve correct space for bitfields
2022-05-28 17:31:26 +03:00
joachimschmidt557
ddd5b57045
stage2 AArch64: complete genTypedValue
2022-05-27 16:43:11 -04:00
Andrew Kelley
4994ac18e4
Merge pull request #11733 from Vexu/stage2
...
more misc stage2 fixes
2022-05-27 16:20:49 -04:00
Veikka Tuominen
989c0f55e8
stage2: add test for fixed issue
2022-05-27 10:29:24 +03:00
Veikka Tuominen
8bf3e1f8d0
AstGen: preserve inferred ptr result loc for breaks
2022-05-27 10:29:24 +03:00
Veikka Tuominen
e08cdad53b
Sema: add error for runtime indexing comptime array
2022-05-27 10:29:15 +03:00
Andrew Kelley
83a2c41cd5
fix alignment behavior test case
...
As demonstrated by this new test case, stage1's functionality is
incorrect since it does not handle slicing from len..len correctly.
stage2 already has the correct behavior here.
2022-05-26 21:58:19 -07:00
Andrew Kelley
4751356d7f
clean up some behavior tests
...
* improve names
* properly categorize a couple of bug cases
* mark one as already passing
2022-05-26 21:58:19 -07:00
Jakub Konka
5ce9c878cf
apply Vexu's suggestion to use failing_allocator for now
2022-05-26 16:55:31 +02:00
Jakub Konka
d1e4600675
test: correctly track identical error msgs in handled errors list
...
Prior to this change, for an example compiler error test case with
multiple identical errors messages such as
```
:1:2: error: foo
:1:2: error: foo
```
the test harness would never increment the error index thus only
marking the very first error message as handled yielding a false
positive.
Additionally, while here, regress `dereference_anyopaque` test case
as not passing on `wasm32-wasi` target.
2022-05-26 16:23:56 +02:00
Veikka Tuominen
92c4e4f2c2
Sema: zirArrayType does need source location
2022-05-26 13:26:55 +03:00
Andrew Kelley
83f69af971
stage2: implement runtime array multiplication
...
Additionally:
* Sema: fix array cat/mul not setting the sentinel value
- This required an LLVM backend enhancement to the handling of the
AIR instruction aggregate_init that likely needs to be
propagated to the other backends.
* Sema: report integer overflow of array concatenation in a proper
compile error instead of crashing.
* Sema: fix not using proper pointer address space for array cat/mul
2022-05-25 22:33:48 -07:00
Andrew Kelley
b82081e709
Sema: implement array concatenation with runtime operands
2022-05-25 22:33:48 -07:00
Andrew Kelley
ab88165326
Sema: generic function instantiations inherit branch quota
2022-05-25 23:32:52 -04:00
Veikka Tuominen
f409d925ad
Sema: check for generic poison in resolveInst
2022-05-25 23:11:13 +03:00
Veikka Tuominen
eba66f4a58
Sema: handle block.is_typeof in more places
2022-05-25 19:57:44 +03:00
Veikka Tuominen
d214b6bdf0
stage2: packed struct fields do not have a byte offset
2022-05-25 19:57:38 +03:00
Veikka Tuominen
b0e8bf15f5
Sema: add error for dereferencing comptime value at runtime
2022-05-25 17:39:55 +03:00
Andrew Kelley
71e2a56e3e
mark some more behavior tests as passing
2022-05-25 00:12:56 -07:00