Commit graph

6834 commits

Author SHA1 Message Date
mlugg
38b373bf0b
cases: add compile error test for never-mutated local variable 2023-11-19 11:11:50 +00:00
mlugg
d82d327de2
test: update remaining code to fix 'var is never mutated' errors 2023-11-19 09:57:04 +00:00
mlugg
9c16b2370d
test: update behavior to silence 'var is never mutated' errors 2023-11-19 09:57:03 +00:00
mlugg
21fa187abc
test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
mlugg
2c1acb6180
test: update translate-c tests to match new discard format 2023-11-19 09:55:07 +00:00
dweiller
325e0f5f0e test: check compile errors when compilation has no errors 2023-11-19 00:12:43 +02:00
Curtis Tate Wilkinson
7b99189f19
Add struct declaration location to empty root struct field member error 2023-11-18 12:03:10 +00:00
David
673a1efa22
Sema: include sentinel in type of pointer-to-array ptr field
Resolves: #18007
2023-11-16 16:08:30 +00:00
Jakub Konka
b173088089
Merge pull request #18015 from ziglang/elf-tests
More ELF tests
2023-11-16 16:11:24 +01:00
David
941090d94f
Move duplicate field detection for struct init expressions into AstGen
Partially addresses #17916.
2023-11-16 14:38:16 +00:00
Jakub Konka
85c0485fd9 elf: test -r mode does not create unneeded .eh_frame section 2023-11-16 10:54:39 +01:00
Jakub Konka
f6bf3353b1 elf: test -r mode with archive on the linker line 2023-11-16 10:51:21 +01:00
Krzysztof Wolicki
acf9de376d
Sema: Add error for non-power of 2 field alignment when reifying Unions, Structs, Pointers 2023-11-16 10:19:54 +02:00
kcbanner
53500a5768 sema: fixup underflows during struct / ptr array init when using -fstrip 2023-11-12 18:22:57 -05:00
Andrew Kelley
70d8baaec1 Revert "Sema: fix comparison with undefined"
This reverts commit 547481c31c.

There is a comment that did not get addressed with this patch, and the
required test cases are not added.

Reopens #17798.
2023-11-12 14:33:17 -07:00
Bogdan Romanyuk
547481c31c
Sema: fix comparison with undefined 2023-11-12 11:03:23 +02:00
kcbanner
3fc6a2f113 sema: pass sema through if available for the array_type case in bitSizeAdvanced 2023-11-11 13:11:51 +00:00
Jacob Young
89cac88e91 behavior: add testing for LLVM SROA bugs 2023-11-10 18:04:09 -05:00
Jakub Konka
9ad03b628f
Merge pull request #17955 from ziglang/issue-17951
macho: handle special section/segment boundary symbols
2023-11-10 18:36:06 +01:00
Bogdan Romanyuk
ec934c6d32 disallow calling @trap at comptime 2023-11-10 18:39:42 +02:00
Jakub Konka
17177727c0 test/link: refactor common bits between ELF and MachO tests 2023-11-10 13:50:33 +01:00
Jakub Konka
7566a8fbd8 test/link: spawn ELF and MachO tests from the same root test/link/link.zig 2023-11-10 13:44:43 +01:00
Jakub Konka
c550eb3e8a
Merge pull request #17933 from ziglang/elf-r-mode
elf: the dreaded `-r` mode
2023-11-10 07:57:52 +01:00
mlugg
3f10b3ee1e Sema: do not allow comptime-only pointer fields in packed structs 2023-11-10 06:51:48 +00:00
Jakub Konka
73fd4ed54b test/link/elf: make .eh_frame relocatable test also verify COMDATs we emit 2023-11-09 23:22:47 +01:00
Jakub Konka
50f48022f0 test/link/elf: fix .eh_frame test 2023-11-09 14:51:00 +01:00
Jakub Konka
f607126614 test/link/elf: verify we can output a valid relocatable with .eh_frame section 2023-11-09 11:49:04 +01:00
mlugg
997eaf6d87 Sema: do not force resolution of struct field inits when calling function pointer field
b3462b7 caused a regression in a third-party project, since it forced
resolution of field initializers for any field call 'foo.bar()', despite
this only being necessary when 'bar' is a comptime field.

See https://github.com/ziglang/zig/pull/17692#issuecomment-1802096734.
2023-11-08 23:47:10 -07:00
Jakub Konka
9bcb432a0e elf: test emitting relocatable 2023-11-08 18:41:09 +01:00
mlugg
4504e03a18 Sema: fix source location for untyped array init with result type
Resolves: #17923
2023-11-08 06:56:52 +00:00
dweiller
81219586bc sema: allow slicing [*]T without end 2023-11-07 17:01:32 +02:00
Matthew Lugg
b3462b7cec
Merge pull request #17692 from kcbanner/struct_field_init_pass
sema: analyze struct field bodies in a second pass, to allow them to use the layout of the struct itself
2023-11-07 07:44:32 +00:00
mlugg
d78eda34c5 Sema: emit @intCast safety check correctly for vectors
This code was previously tripping an assertion by not making this value
used in the safety check a vector.
2023-11-07 06:42:15 +00:00
mlugg
9b394a200a Sema: allow destructuring vectors
This was intended to work when destructuring was first implemented, and
was just unintentionally missed out.
2023-11-07 06:11:01 +00:00
Jakub Konka
bf0387b6bb
Merge pull request #17873 from ziglang/elf-archive
elf: implement archiving input object files
2023-11-07 03:22:14 +01:00
kcbanner
f10499be0a
sema: analyze field init bodies in a second pass
This change allows struct field inits to use layout information
of their own struct without causing a circular dependency.

`semaStructFields` caches the ranges of the init bodies in the `StructType`
trailing data. The init bodies are then resolved by `resolveStructFieldInits`,
which is called before the inits are actually required.

Within the init bodies, the struct decl's instruction is repurposed to refer
to the field type itself. This is to allow us to easily rebuild the inst_map
mapping required for the init body instructions to refer to the field type.

Thanks to @mlugg for the guidance on this one!
2023-11-07 00:49:35 +00:00
Andrew Kelley
234693bcbb tests: skip native CPU std tests on Windows
See tracking issue #17902
2023-11-06 16:03:04 -07:00
Jakub Konka
261db02018 CheckObject: support parsing and dumping archive symtab for ELF 2023-11-06 21:18:26 +01:00
Jacob Young
9ced27dace x86_64: fix passing register-sized payload as non-reigster-sized union
Closes #17885
2023-11-06 14:11:31 -05:00
Bogdan Romanyuk
62e67a2b56
Sema: emit error when pointer to extern function is called 2023-11-06 15:26:28 +00:00
Jakub Konka
6490e2ed82 test/link/elf: improve test linking with static lib 2023-11-06 14:47:01 +01:00
kcbanner
50e2fb8fd0 cbe: fixup __asm style exports, re-enable 12680 on macos now that alias isn't used 2023-11-05 23:36:11 -05:00
Andrew Kelley
1b0b46a8a9
Merge pull request #17871 from jacobly0/x86_64
x86_64: get a compiler compiled with the x86_64 backend passing x86_64 backend tests
2023-11-05 18:45:21 -05:00
Andrew Kelley
702b809ea3
Merge pull request #17815 from Luukdegram/wasm-no-entry
wasm-linker: implement `-fno-entry` and correctly pass `--shared` and `--pie` when given
2023-11-05 18:44:12 -05:00
Jacob Young
0ea7189c23 behavior: enable test passing with x86_64 backend 2023-11-05 11:54:29 -05:00
Jakub Konka
205f8214d8 test/link/elf: enable our ELF archiver 2023-11-05 13:42:26 +01:00
Bogdan Romanyuk
e9a6197a8e
Sema: fix error notes with wrong extern type 2023-11-05 12:36:06 +02:00
Jakub Konka
f24ceec35a
Merge pull request #17844 from ziglang/elf-object
elf: handle emitting relocatables and static libraries - humble beginnings
2023-11-04 20:58:15 +01:00
Jakub Konka
ee66137269 elf: add link smoke tests covering emitting obj and static lib 2023-11-04 09:13:34 +01:00
Jakub Konka
b8c8565e93 elf: implement --gc-sections for non-LLVM Zig source 2023-11-04 09:08:27 +01:00