Commit Graph

2275 Commits (a4eaeee72011a2f7866a18420812178991feaf8d)

Author SHA1 Message Date
LemonBoy 28dbc58837 Address review comments 2020-03-21 09:54:49 +01:00
LemonBoy 128e70ff3a ir: Allow errdefer with payload
Closes #1265
2020-03-21 09:54:49 +01:00
Andrew Kelley 3a2c490889 "generate .h files" feature is no longer supported in stage1 2020-03-20 18:33:36 -04:00
LemonBoy 541e763010 ir: Peer type resolution between ?[]T and *[N]T
Closes #4767
2020-03-20 12:23:05 -04:00
Andrew Kelley 160367e0dd
fix compile error for reading past end of pointer casted array 2020-03-19 17:23:53 -04:00
Andrew Kelley 8ddf9d84ff
add behavior tests for slicing with comptime indexes 2020-03-19 11:17:46 -04:00
Andrew Kelley f824658e13
slicing sentinel-terminated slice without end
now results in a sentinel-terminated slice.
2020-03-19 10:54:20 -04:00
Andrew Kelley 61266d2621
test & docs fixups to work with new semantics 2020-03-19 09:53:55 -04:00
Andrew Kelley b5dba702ff
fixes to std.meta
behavior tests are passing now
2020-03-19 09:53:55 -04:00
Andrew Kelley 2164b511cc
partial revert of an improvement this branch made
because it uncovered a result location bug, and I need to get this
branch merged before going into a result location rabbit hole.

also fix the result type of slicing when the indexes are runtime known
and the result should be sentinel terminated.
2020-03-19 09:53:55 -04:00
Andrew Kelley 2b4134459d
fix alignment when slicing with comptime start and end index 2020-03-19 09:53:54 -04:00
Andrew Kelley 0707be8de8
fixes in semantic analysis needed to support this feature 2020-03-19 09:53:54 -04:00
LemonBoy e3c92d0532 ir: More changes to sentinel-terminated const arrays
* Don't add an extra slot for the sentinel. Most of the code keeps using
  the constant value from the type descriptor, let's harmonize all the
  code dealing with sentinels.

* Properly write out sentinel values when reinterpreting pointers at
  comptime.

* Allow the reading of the 0th element in a `[0:S]T` type.
2020-03-19 09:53:30 -04:00
Andrew Kelley 46ffc798b6
fix swapped logic for Windows
Remove `std.fs.deleteTree`. Callers instead should use
`std.fs.cwd().deleteTree`.

Add `std.fs.deleteTreeAbsolute` for when the caller has an absolute
path.
2020-03-18 16:42:47 -04:00
LemonBoy 1479c28b49
ir: Correct ABI size calculation for arrays
Zero-length array with a sentinel may not have zero size.

Closes #4749
2020-03-18 11:10:45 -04:00
Andrew Kelley f51bec321b
Merge pull request #4707 from Vexu/small-atomics
Support atomic operations with bools and non power of two integers
2020-03-12 18:55:16 -04:00
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 ce19638cd4
disable test on mipsel 2020-03-12 17:31:10 +02:00
Vexu 02c491e42a
translate-c fix order of tokens 2020-03-12 17:14:01 +02:00
Vexu 710b05b153
support `@atomicRmw` at comptime 2020-03-12 16:46:16 +02:00
Vexu dda711ba0d
translate-c treat c bools as ints 2020-03-12 14:40:47 +02:00
Andrew Kelley 895f67cc6d
Merge pull request #4710 from ziglang/io-stream-iface
rework I/O stream abstractions
2020-03-11 18:54:52 -04:00
Andrew Kelley 571f3ed161 fix stray warn() in runtime safety test 2020-03-11 18:45:09 -04:00
Andrew Kelley 04626c176b
Merge remote-tracking branch 'origin/master' into io-stream-iface 2020-03-11 15:47:07 -04: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
Andrew Kelley 2bff0dda79
fix regressions found by test suite 2020-03-10 20:22:30 -04:00
LemonBoy 4ab13a359d ir: Fix shift code for u0 operands 2020-03-10 23:04:49 +01: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
LemonBoy 300fceac6e ir: Implement more safety checks for shl/shr
The checks are now valid on types whose size is not a power of two.

Closes #2096
2020-03-10 20:54:05 +01:00
Vexu cb4c488cbd
translate-c support struct field alignment 2020-03-10 15:57:57 +02:00
Vexu 4cace8f7c3
properly mangle shadowed primitive types 2020-03-10 15:52:54 +02:00
Vexu baec74645d
translate-c add daurnimator's pointer check to macro cast 2020-03-10 15:52:03 +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
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 3618256c97
implement noasync scopes 2020-03-09 12:33:24 +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
Vexu 5aa993cd61
translate-c fix nested loops without blocks. 2020-03-08 11:26:53 +02:00
daurnimator b85bb152bf
Fix grammar in error message 2020-03-08 19:18:06 +11:00