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
Vexu
83d27f71ef
translate-c more macro ops
2020-03-06 17:34:37 -05:00
Vexu
eaccfffe56
translate-c: default initialize non-extern variables to undefined
2020-03-06 00:06:45 -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 debcc79d56a40f77b92e243b4e344fc9385bd405.
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
Vexu
ad27041de9
translate-c demote struct to opaque if unable to translate type
2020-03-05 10:55:32 -05:00
Vexu
e063854563
translate-c correct assumption about macros
2020-03-05 12:23:32 +02:00
Vexu
8088bdc6d5
translate-c macro comma operator
2020-03-05 11:22:50 +02: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
Andrew Kelley
3178807657
Merge remote-tracking branch 'origin/master' into llvm10
2020-03-04 15:35:46 -05:00
Andrew Kelley
55dfedff42
update cli test to new std.fs API
2020-03-03 15:58:14 -05:00
Andrew Kelley
66e6f5586e
enable f128 test on windows
2020-03-03 09:49:08 -05:00
Andrew Kelley
d1cb16aace
Merge remote-tracking branch 'origin/master' into llvm10
2020-03-03 09:44:13 -05:00
Andrew Kelley
c81345c8ae
breaking: std.os read/write functions + sendfile
...
* rework os.sendfile and add macosx support, and a fallback
implementation for any OS.
* fix sendto compile error
* std.os write functions support partial writes. closes #3443 .
* std.os pread / pwrite functions can now return `error.Unseekable`.
* std.fs.File read/write functions now have readAll/writeAll variants
which loop to complete operations even when partial reads/writes
happen.
* Audit std.os read/write functions with respect to Linux returning
EINVAL for lengths greater than 0x7fff0000.
* std.os read/write shim functions do not unnecessarily loop. Since
partial reads/writes are part of the API, the caller will be forced
to loop anyway, and so that would just be code bloat.
* Improve doc comments
* Add a non-trivial test for std.os.sendfile
* Fix std.os.pread on 32 bit Linux
* Add missing SYS_sendfile bit on aarch64
2020-03-03 02:25:26 -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
Andrew Kelley
ef3d761da5
breaking: std.mem.len no longer takes a type argument
...
also update fmt code to use std.mem.span.
2020-03-01 13:21:39 -05:00