Andrew Kelley
61266d2621
test & docs fixups to work with new semantics
2020-03-19 09:53:55 -04:00
Andrew Kelley
571f3ed161
fix stray warn() in runtime safety test
2020-03-11 18:45:09 -04: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
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
xackus
7664c3bc11
remove @bytesToSlice, @sliceToBytes from tests, docs
2020-02-23 18:03:50 +01:00
Andrew Kelley
8d73703d52
fix safety for sentinel-slicing floats
2019-12-20 18:28:59 -05:00
Andrew Kelley
8918cb06fc
sentinel slicing improvements
...
* add runtime safety for slicing pointers, arrays, and slices.
* slicing without a sentinel value results in non-sentineled slice
* improved `std.debug.panic` handling of panic-during-panic
2019-12-20 18:28:59 -05:00
LemonBoy
19ddbd9e9e
Make sure the address is aligned for intToPtr ops
...
Closes #773
2019-12-15 14:41:05 -05:00
Andrew Kelley
b220be7a33
more test regression fixes
2019-11-29 23:04:19 -05:00
Andrew Kelley
e98e5dda52
implement safety for resuming non-suspended function
...
closes #3469
2019-10-22 23:43:27 -04:00
Andrew Kelley
7d303ae861
runtime safety for noasync function calls
...
See #3157
2019-09-06 13:08:44 -04:00
Andrew Kelley
4d8a6f6fea
fix compiler not checking alignment of function frames
...
closes #3086
2019-08-17 13:04:50 -04:00
Andrew Kelley
d813805f77
more debuggable safety for awaiting twice
2019-08-08 12:02:56 -04:00
Andrew Kelley
966c9ea63c
error return trace across suspend points
2019-08-06 18:47:09 -04:00
Andrew Kelley
87710a1cc2
implement `@asyncCall` which supports async function pointers
2019-08-03 16:17:42 -04:00
Andrew Kelley
e444e737b7
add runtime safety for resuming an awaiting function
2019-08-03 02:11:52 -04:00
Andrew Kelley
fcadeb50c0
fix multiple coroutines existing clobbering each other
2019-07-22 14:36:14 -04:00
Andrew Kelley
b735764898
different array literal syntax when inferring the size
...
old syntax: []i32{1, 2, 3}
new syntax: [_]i32{1, 2, 3}
closes #1797
2019-06-09 19:26:32 -04:00
Andrew Kelley
0099583bd3
C pointers support .? operator
...
see #1967
2019-05-08 17:39:00 -04:00
Andrew Kelley
5eaead6a56
implement allowzero pointer attribute
...
closes #1953
only needed for freestanding targets.
also adds safety for `@intToPtr` when the address is zero.
2019-03-25 12:55:45 -04:00
Andrew Kelley
64dddd7afe
add compile error for ignoring error
...
closes #772
2019-03-23 19:33:00 -04:00
Andrew Kelley
52bb71867d
implement vector negation
...
also fix vector behavior tests, they weren't actually testing
runtime vectors, but now they are.
See #903
2019-02-22 13:28:57 -05:00
Andrew Kelley
59de24817e
runtime safety check for casting null to pointer
...
see #1059
2019-02-14 01:09:33 -05:00
Andrew Kelley
373e21bb56
implement vector math safety with ext and trunc
2019-02-09 16:24:29 -05:00
Andrew Kelley
f330eebe4b
fix using the result of @intCast to u0
...
closes #1817
2019-02-07 16:02:45 -05:00
Andrew Kelley
56a8f2b018
fix @intCast not catching negative numbers to unsigned
2018-11-24 14:36:16 -05:00
Jimmi Holst Christensen
8139c5a516
New Zig formal grammar ( #1685 )
...
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-13 05:08:37 -08:00
Jimmi Holst Christensen
378d3e4403
Solve the return type ambiguity ( #1628 )
...
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
2018-10-15 09:51:15 -04:00
Andrew Kelley
bfcfaaf5bd
fix codegen for @intCast to u0
2018-09-17 20:33:42 -04:00
Andrew Kelley
35463526cc
add runtime safety for `@intToEnum`; add docs for runtime safety
...
See #367
2018-07-02 15:50:28 -04:00
Andrew Kelley
c7804277bf
`@floatToInt` now has safety-checked undefined behavior
...
when the integer part does not fit in the destination integer type
* Also fix incorrect safety triggered for integer casting an
`i32` to a `u7`. closes #1138
* adds compiler-rt function: `__floatuntidf`
2018-06-19 16:06:10 -04:00
Andrew Kelley
626b73e8be
remove error to/from int casting syntax; add `@errorToInt`/`@intToError`
...
See #1061
2018-06-18 18:48:29 -04:00
Andrew Kelley
3c12ba7180
update test cases
2018-06-17 04:32:57 -04:00
Andrew Kelley
019217d7a2
fix regressions
2018-06-01 00:17:31 -04:00
Andrew Kelley
fcbb7426fa
use * for pointer type instead of &
...
See #770
To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.
This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
2018-05-31 17:28:07 -04:00
Andrew Kelley
aa2995ee39
fix invalid codegen for error return traces across suspend points
...
See #821
Now the code works correctly, but error return traces are missing
the frames from coroutines.
2018-03-24 22:07:12 -04:00
Andrew Kelley
54c06bf715
error sets: runtime safety for int-to-err and err set cast
2018-02-08 21:54:44 -05:00
Andrew Kelley
76239f2089
error sets - update langref. all tests passing
2018-02-08 03:02:41 -05:00
Andrew Kelley
5f518dbeb9
*WIP* error sets converting std lib
2018-01-31 22:48:40 -05:00
Andrew Kelley
3671582c15
syntax: functions require return type. remove `->`
...
The purpose of this is:
* Only one way to do things
* Changing a function with void return type to return a possible
error becomes a 1 character change, subtly encouraging
people to use errors.
See #632
Here are some imperfect sed commands for performing this update:
remove arrow:
```
sed -i 's/\(\bfn\b.*\)-> /\1/g' $(find . -name "*.zig")
```
add void:
```
sed -i 's/\(\bfn\b.*\))\s*{/\1) void {/g' $(find ../ -name "*.zig")
```
Some cleanup may be necessary, but this should do the bulk of the work.
2018-01-25 04:10:11 -05:00
Andrew Kelley
e5bc5873d7
rename "debug safety" to "runtime safety"
...
closes #437
2018-01-25 01:46:12 -05:00