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
momumi
47f7e66580
add more test cases for invalid number literals
2020-03-15 23:42:29 +10:00
momumi
925f710852
make parsing 0.0_e1 an error
2020-03-15 13:05:24 +10:00
momumi
7aac21c6f5
allow _ separators in number literals (stage 1)
...
* Underscores `_` may be placed between two digits in a int/float literal
* Consecutive underscores are not allowed
* Fixed parsing bug in exponents of hexadecimal float literals.
Exponents should always be base 10, but hex characters would be parsed
inside the exponent and everything after them would be ignored. eg:
`0x1.0p1ab1` would be parsed as `0x1.0p1`.
2020-03-15 12:38:35 +10:00
Andrew Kelley
75bda408cd
update stack traces test expectations
2020-03-13 17:50:29 -04:00
Andrew Kelley
656ba530d8
Merge remote-tracking branch 'origin/master' into llvm10
2020-03-13 15:17:53 -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
Andrew Kelley
9e60c89601
Revert "Translate C: Group generated casts"
...
This reverts commit 895672b3f96aab1f5bad3446f5186a047f29412c.
2020-03-08 03:53:06 -04:00
Andrew Kelley
8b80cb3072
Revert "translate-c remove redundant grouping, fix nested loops without blocks."
...
This reverts commit abe7305e169be2047d65f96e6525d3828684f058.
2020-03-08 03:52:52 -04:00
Andrew Kelley
96c07674fc
Merge remote-tracking branch 'origin/master' into llvm10
2020-03-07 12:18:41 -05:00
Vexu
abe7305e16
translate-c remove redundant grouping, fix nested loops without blocks.
2020-03-07 12:14:44 -05:00
Lachlan Easton
895672b3f9
Translate C: Group generated casts
...
Translate C: Put an alignCast in c style pointer casts to allow opaque types to cast properly in C macros
Translate C: add test case for aligning opaque types in pointer casts
Translate C: Fix @typeId -> @typeInfo
Add test case to run_translated_c for casting from pointer to opaque type
2020-03-07 03:26:42 -05:00
daurnimator
8f627593eb
Use in_stream.readAllAlloc where sensible
2020-03-06 18:49:12 -05: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