Commit Graph

5175 Commits

Author SHA1 Message Date
Jacob Young
6d1292552e cbe: implement function alignment 2022-12-03 08:40:08 -05:00
Jacob Young
ec3116f573 cbe: fix zero-bit struct field pointer 2022-12-03 08:40:08 -05:00
Jacob Young
7fb6eb3d14 cbe: implement multiple exports of a symbols 2022-12-03 08:21:03 -05:00
Jacob Young
81c271cc62 cbe: don't emit extern decls that are already exported 2022-12-03 08:21:03 -05:00
Andrew Kelley
610d604f5b
Merge pull request #13748 from jacobly0/c-unaligned
cbe: use memcpy for underaligned loads and stores
2022-12-03 02:18:07 -05:00
Andrew Kelley
fdbb0fb7b9
Merge pull request #13744 from Vexu/stage2-fixes
Improve error messages, fix dependency loops
2022-12-03 00:42:11 -05:00
Jacob Young
e1216077f0 cbe: add support for constraint modifiers specified after a colon
This translates `%[name:mod]` to `%mod[name]` for C.
2022-12-02 22:21:24 -05:00
Jacob Young
fdedd62365 cbe: use memcpy for underaligned loads and stores 2022-12-02 22:21:24 -05:00
Andrew Kelley
29e8e67a7e CBE: use bool, true, false, instead of zig_ prefixes
In general the C backend should lower to human-maintainable C code
whenever possible. Directly using C types that one would use when
writing C code is one part of the strategy.

The concern with including stdint.h is C89 compatibility. Well, we can
just check the C std lib version before deciding to include that header.
2022-12-02 16:12:49 -07:00
Veikka Tuominen
b500e0eb17 Sema: add "parameter type declared here" note to type coercion 2022-12-03 00:48:04 +02:00
Veikka Tuominen
74285a4ed7 add test for error message improved by self-hosted
Closes #5099
2022-12-03 00:48:04 +02:00
Veikka Tuominen
f20e449fd6 Sema: improve error for mismatched type in implicit return
Closes #2653
2022-12-03 00:48:03 +02:00
Veikka Tuominen
e2509ddbe6 AstGen: add error for invalid string comparisons
These operations are allowed because the string literals are just
pointers but they produce unexpected results. These errors prevent
beginners from shooting themselves in the foot while still allowing
advanced users to circumvent them if they desire to do so.

Closes #8290
2022-12-03 00:09:23 +02:00
Veikka Tuominen
0e38cc16d5 Sema: fix comparisons between lazy and runtime values
Closes #12498
2022-12-03 00:09:23 +02:00
Veikka Tuominen
7f9e841f74 Sema: do not forcibly canonicalize unresolved pointer element type
Closes #13308
2022-12-03 00:09:23 +02:00
Veikka Tuominen
59dad43de2 Sema: add error for failed assumption about struct having runtime bits 2022-12-02 18:46:59 +02:00
Veikka Tuominen
86e6acb37b AstGen: improve error message for missing parameter name
Closes #13393
2022-12-02 15:39:40 +02:00
Andrew Kelley
665eba93c1 CBE: eliminate zig_void
C void is perfectly fine.
2022-12-02 00:46:27 -05:00
Andrew Kelley
4071b22454
Merge pull request #13715 from Vexu/cbe
cbe bug fixes and improvements
2022-12-01 17:38:11 -05:00
Veikka Tuominen
6ded2d2adb cbe: disable failing behavior test on aarch64 2022-12-01 12:18:10 +02:00
Veikka Tuominen
d0edaabf9d Value: fix elemValueAdvanced for optional payloads
Closes #13707
2022-12-01 11:49:06 +02:00
Andrew Kelley
a943422672
Merge pull request #13717 from GethDW/option-fix
std.build.Builder: fix for Allocator changes
2022-11-30 19:43:51 -05:00
Andrew Kelley
b1793c2b52 add test coverage for zig build CLI and options API 2022-11-30 13:22:43 -07:00
Luuk de Gram
090deae41d
wasm: enable behavior tests for packed structs 2022-11-30 21:01:09 +01:00
Veikka Tuominen
11ec7109c3 cbe: do not memcpy identical integer types when bitcasting 2022-11-30 17:11:06 +02:00
Veikka Tuominen
15cc83e27a cbe: reduce amount of temporary locals 2022-11-30 17:11:06 +02:00
Veikka Tuominen
f4afeb3ffd AstGen: fix incorrect handling of source cursor with shift builtins
Closes #13714
2022-11-30 17:11:06 +02:00
Veikka Tuominen
2dcac348e5 cbe: implement packed unions 2022-11-30 15:14:33 +02:00
Veikka Tuominen
1a1a5702ab cbe: correctly handle pointers to zero bit error union payloads 2022-11-30 15:14:33 +02:00
Veikka Tuominen
4def9c4a9b cbe: operand of address of operator must be an lvalue 2022-11-30 15:14:33 +02:00
Veikka Tuominen
6310186d52 cbe: cast pointer switch target to int 2022-11-30 15:14:33 +02:00
Veikka Tuominen
8af5648015 Sema: make inferred allocs always mutable
Const allocs don't make any sense, make_ptr_const handles making
the pointers not mutable.
2022-11-30 15:14:33 +02:00
Veikka Tuominen
63ae7899ae cbe: ensure test and tagName function names are unique 2022-11-30 15:14:33 +02:00
Andrew Kelley
ceb0a632cf std.mem.Allocator: allow shrink to fail
closes #13535
2022-11-29 23:30:38 -07:00
Andrew Kelley
deda6b5146 LLVM: fix canElideLoad behavior with loops
closes #13546
2022-11-30 00:20:49 -05:00
Veikka Tuominen
b2b1d421c3 Sema: add missing failWithBadMemberAccess to zirExport
The assumption that AstGen would error only holds when exporting
a identifier not a namespace member.
2022-11-29 21:44:08 +02:00
Veikka Tuominen
4b0ef6a409 Sema: make non-existent field error point to field name
Closes #13698
2022-11-29 21:44:08 +02:00
Veikka Tuominen
6f5a438946 AstGen: unstack block scope when creating opaque type
Closes #13697
2022-11-29 21:44:08 +02:00
Veikka Tuominen
ed73429926 Sema: explain why parameter must be declared comptime
Closes #13692
2022-11-29 21:44:08 +02:00
Veikka Tuominen
17ff002bc0 Sema: improve safety panic for access of inactive union field 2022-11-29 21:44:08 +02:00
Veikka Tuominen
6337c04244 Sema: improve panic for slice start index being greater than end index
Closes #13689
2022-11-29 15:47:02 +02:00
Veikka Tuominen
6f9c7e33b9 llvm: implement union_init for packed unions
Closes #13664
2022-11-29 15:47:02 +02:00
Jakub Konka
1829b6eab8
Merge pull request #13625 from kcbanner/windows_disable_symlink_tests
Skip linker tests requiring symlinks on Windows
2022-11-29 02:57:37 +01:00
Jakub Konka
033aa1d761 aarch64-windows: skip failing standalone tests 2022-11-28 19:45:53 -05:00
Jakub Konka
870872dd63 aarch64-windows: skip failing floatop behavior test 2022-11-28 18:10:51 -05:00
Jakub Konka
07bf4de6a9 aarch64-windows: skip failing align behavior test 2022-11-28 18:10:51 -05:00
kcbanner
ea84eda904 'fmt' 2022-11-26 17:16:56 -05:00
Veikka Tuominen
304e828088
Merge pull request #13637 from Vexu/stage2-fixes
Stage2 bug fixes
2022-11-26 22:03:49 +02:00
kcbanner
57bc61ab26 test-link: add -Denable-symlinks-windows to opt-in to using symlinks
Adds a way for standalone tests to declare they need symlinks, and these
tests won't be run on windows unless -Denable-symlinks-windows is set
2022-11-26 14:26:26 -05:00
Veikka Tuominen
71937f75d8 Sema: correctly detect union target in zirSwitchBlock
Closes #13655
2022-11-26 18:05:27 +02:00