Commit Graph

3793 Commits

Author SHA1 Message Date
Vexu
71d776c3be add note to disabled tests, improve comptime cmpxchg 2020-03-12 22:42:01 +02:00
Vexu
6dde769279 Simplify stores, use sext for signed ints 2020-03-12 22:02:58 +02:00
Vexu
710b05b153 support @atomicRmw at comptime 2020-03-12 16:46:16 +02:00
Vexu
9262f065f5 Move abi size checking to codegen 2020-03-11 16:48:18 +02:00
Vexu
ec906a9771 fix codegen, update docs 2020-03-11 13:55:52 +02:00
Vexu
1f66435a6b support cmpxchg at comptime 2020-03-11 12:02:05 +02:00
Vexu
64e60d8ae2 special case atomic operations on zero bit types 2020-03-11 10:29:15 +02:00
Vexu
21809c3300 support non power of two integers in atomic ops 2020-03-11 09:24:53 +02:00
Vexu
ee5b00a8b9 use atomic bools in std lib 2020-03-10 22:54:47 +02:00
Vexu
8dc188ebe0 support atomic operations with bools 2020-03-10 22:33:32 +02:00
Andrew Kelley
675f01f176 Merge pull request #4590 from xackus/fix-4587
fix failed assert on generic fn opaque return type
2020-03-09 22:10:57 -04:00
LemonBoy
1f44b29724 ir: Fix codegen of ?*T types where T is zero-sized
* Fix codegen for optional types that decay to a pointer, the type
  behaves as a boolean
* Fix comptime evaluation of zero-sized arrays, always initialize the
  internal array elements

Closes #4673
2020-03-09 22:08:56 -04:00
Andrew Kelley
638d5c3aca Merge pull request #4700 from Vexu/noasync
Implement new noasync syntax
2020-03-09 18:36:01 -04:00
xackus
e7cc456421 better error messages and more tests 2020-03-09 22:33:18 +01:00
Andrew Kelley
7db6da7cb8 lazy_cmp_zero only resolves type is zero bits for alignof 2020-03-09 14:24:04 -04:00
LemonBoy
14bbb82832 ir: Fix lazy comparison between @alignOf and zero
Closes #4527
2020-03-09 14:05:38 -04:00
Vexu
3fd2cd4367 add LemonBoy's test 2020-03-09 18:43:09 +02:00
Vexu
03c1431f9c disallow resume and suspend in noasync scopes 2020-03-09 15:51:51 +02:00
Vexu
3618256c97 implement noasync scopes 2020-03-09 12:33:24 +02:00
Vexu
6f8d732599 update parsers to new noasync syntax 2020-03-09 12:23:30 +02:00
LemonBoy
e2fd289a33 ir: Create usize result_loc for array subscript expr
Allow the subscript expression to infer the resulting type.

Closes #4169
2020-03-08 18:52:44 -04:00
LemonBoy
06d0dac0fb ir: Prevent crash in compiler error
Anonymous containers have no struct_field->type AstNode set, let's
always use the field node itself to make the error messages consistent.

Closes #4691
2020-03-08 18:12:50 -04:00
xackus
7782c76bee fix failed assert on generic fn opaque return type 2020-03-08 18:05:45 +01:00
Andrew Kelley
f90fe1f8f2 Merge pull request #4687 from daurnimator/fix-typo
Fix grammar from "C pointers cannot point opaque types"
2020-03-08 12:44:56 -04:00
Vexu
692a974c3e translate-c reject structs with VLAs 2020-03-08 12:11:37 +02:00
daurnimator
c8050a931c Strip trailing whitespace from src/ir.cpp 2020-03-08 19:18:25 +11:00
daurnimator
b85bb152bf Fix grammar in error message 2020-03-08 19:18:06 +11:00
Andrew Kelley
fa46bcb368 stage1: make get_optional_type more robust
Now it will emit a compile error rather than crashing when the child
type has not been resolved properly.

Introduces `get_optional_type2` which should be used generally inside
ir.cpp.

Fix some std lib compile errors noticed by the provided test case.

Thanks @LemonBoy for the test case. Closes #4377.

Fixes #4374.
2020-03-06 18:30:30 -05:00
Andrew Kelley
3dc8cb12e8 ir: remove pointless and misleading code in @embedFile 2020-03-06 15:55:18 -05:00
Michael Dusan
428677ea36 stage1: fix regression
- regression was introduced by 371c21aa70
2020-03-05 20:45:01 -05:00
Andrew Kelley
01c722c21c Revert "Allow constant struct val to reallocate its fields when resolving an inferred struct field with a comptime value."
This reverts commit debcc79d56.

This caused a regression when building self-hosted
2020-03-05 17:19:01 -05:00
Alexandros Naskos
debcc79d56 Allow constant struct val to reallocate its fields when resolving an inferred struct field with a comptime value. 2020-03-05 15:48:03 -05:00
Andrew Kelley
c0242f2310 update mingw-w64 source files to v7.0.0 2020-03-05 15:41:28 -05:00
Michael Dusan
371c21aa70 stage1: housekeeping
- use consistent allocator in `realloc_const_vals_ptrs()`
- unexport `create_fn_raw()`
2020-03-05 12:17:47 -05:00
Andrew Kelley
3e3d464884 @TypeOf avoids heap allocation for only 1 parameter 2020-03-04 17:43:23 -05:00
LemonBoy
2e3e8d0c74 ir: Adapt ir_print for the new @TypeOf format 2020-03-04 17:21:10 -05:00
LemonBoy
0c310f0fbf ir: Implement @TypeOf with multiple arguments
Closes #439
2020-03-04 17:21:10 -05:00
Andrew Kelley
24fc69acad Merge pull request #4573 from alexnask/tuple_concat
Allow concatenation of tuples that contain a mix of runtime and comptime values
2020-03-04 17:09:43 -05:00
Andrew Kelley
f247a90541 get_codegen_ptr_type returns possible error
And fix most of the fallout. This also makes optional pointers not
require resolving zero bits, because the comptime value struct layout no
longer depends on whether the type has zero bits.

Thanks to @LemonBoy for the behavior test case

Closes #4357
Closes #4359
2020-03-04 17:04:59 -05:00
Timon Kruiper
e095475d92 Fix docs generation
Commit edb210905d caused the docs generation
to fail, because all the type information in pass1 was already freed in
`zig_llvm_emit_output`.
2020-03-04 09:59:21 -05:00
Alexandros Naskos
b838122cc0 Merge branch 'master' of https://github.com/ziglang/zig into tuple_concat 2020-03-02 00:55:19 +02:00
Alexandros Naskos
78e4daaa03 Removed unused variable 2020-03-02 00:54:57 +02:00
Andrew Kelley
b99c6d56da stage1: fix compilation on 32-bit arm 2020-03-01 03:27:09 -05:00
Andrew Kelley
7617610400 Merge pull request #4550 from ziglang/os-version-ranges
introduce operating system version ranges as part of the target; self-host native dynamic linker detection and native glibc version detection
2020-02-29 01:57:06 -05:00
Alexandros Naskos
1b41f2d77e C pointer slices are no longer allowzero (#4462)
* Slices from C pointers are no longer allowzero but instead insert a runtime assertion.

* Added a test, fixed code for cases with non-allowzero C pointers

* Create new type when flipping allow_zero, sometimes we get a cached value back from adjust_ptr_len.

* Added comments, changed panic message

* Added runtime safety test.
2020-02-29 01:36:42 -05:00
Andrew Kelley
3cba603eae fix crash when building docgen 2020-02-29 01:05:11 -05:00
Andrew Kelley
a5a53a182a fix typo from other commit
d2535c003c
2020-02-28 16:06:06 -05:00
Andrew Kelley
bee4007ec9 fix crash with multiple comptime fn calls and...
...default initialized array to undefined

closes #4578
2020-02-28 15:49:19 -05:00
Andrew Kelley
578dc16910 fix compiler crash when comptime parsing targets 2020-02-28 15:41:30 -05:00
Andrew Kelley
500dde32d5 dynamic_linker becomes a field of std.zig.CrossTarget 2020-02-28 14:51:56 -05:00