203 Commits

Author SHA1 Message Date
Tadeo Kondrak
8d5636ebe4
Rename noasync to nosuspend in self-hosted, add rewriter 2020-05-05 05:17:33 -06:00
Robin Voetter
32e5248820 Remove old-style @typeOf compatibility 2020-04-20 22:38:29 -04:00
Lachlan Easton
0122f2cff6 Translate C: Redo Add comment containing c source location for failed decls. 2020-04-14 22:13:43 +10:00
Andrew Kelley
9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
Michael Raymond
de9933761c std.zig.render: fix newlines before DocComments 2020-03-29 22:41:39 -04:00
LemonBoy
128e70ff3a ir: Allow errdefer with payload
Closes #1265
2020-03-21 09:54:49 +01:00
LemonBoy
11a4ce42c1
zig fmt: Respect trailing commas in error set declarations
The logic is not perfect as it doesn't take into account the presence of
doc comments, but it's an improvement over the status quo.
2020-03-18 11:15:22 -04:00
Vexu
5e5dee829d
remove .Cancel correct merge err set parsing 2020-03-15 01:02:33 +02:00
Andrew Kelley
18f1fef142
update standard library to new I/O streams API 2020-03-10 18:44:30 -04:00
Andrew Kelley
ba0e3be5cf
(breaking) rework stream abstractions
The main goal here is to make the function pointers comptime, so that we
don't have to do the crazy stuff with async function frames.

Since InStream, OutStream, and SeekableStream are already generic
across error sets, it's not really worse to make them generic across the
vtable as well.

See #764 for the open issue acknowledging that using generics for these
abstractions is a design flaw.

See #130 for the efforts to make these abstractions non-generic.

This commit also changes the OutStream API so that `write` returns
number of bytes written, and `writeAll` is the one that loops until the
whole buffer is written.
2020-03-10 15:32:32 -04:00
Vexu
6f8d732599
update parsers to new noasync syntax 2020-03-09 12:23:30 +02: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
Vexu
45da72c5b6
remove usages of @typeId, @memberCount, @memberName and @memberType 2020-02-24 23:09:01 +02:00
LemonBoy
95a71e29f8
zig fmt: Fix callconv rewriting for extern + string
Closes #4473
2020-02-18 18:18:15 -05:00
Andrew Kelley
cb3a818699
zig fmt: support noasync await 2020-02-16 01:44:52 -05:00
LemonBoy
1658becb62 fmt: Fix one more edge case in container formatting 2020-02-03 16:03:48 -05:00
LemonBoy
e548195fd5 fmt: Use left brace position instead of the right one
Fix a typo and add a test case.
2020-02-01 15:28:23 +01:00
LemonBoy
f34abbf260 fmt: Handle declarations in line with the opening brace 2020-02-01 14:43:31 +01:00
LemonBoy
8309ee8752 fmt: Respect trailing comma for field declarations
Closes #4349
2020-02-01 11:28:21 +01:00
LemonBoy
dee7804a81 fmt: Fix logic to find the argument list closing )
Closes #4341
2020-01-31 18:25:58 -05:00
xackus
5880eb3a75 stage2 parser: document undefined and clean up 2020-01-10 22:48:51 +01:00
Andrew Kelley
5951b79af4
remove stdcallcc, extern, nakedcc from stage1; zig fmt rewrites 2020-01-06 15:23:05 -05:00
Andrew Kelley
0a9daeb37e
Merge branch 'cc-work' of https://github.com/LemonBoy/zig into LemonBoy-cc-work 2020-01-06 14:07:56 -05:00
LemonBoy
e6485282d3 Better logic for last-param rendering 2020-01-03 11:49:42 +01:00
LemonBoy
7b375a1c4a Revert "Revert "Trailing comma is respected for builtin calls""
This reverts commit f83411b0b1b857c7f8679e3b90d2093ba60621d4.
2020-01-03 10:17:40 +01:00
Andrew Kelley
f83411b0b1
Revert "Trailing comma is respected for builtin calls"
This reverts commit afd029091854358e6e88cfc4cbb524022f4ec136.

This caused test failures.
2020-01-02 21:53:25 -05:00
LemonBoy
afd0290918 Trailing comma is respected for builtin calls 2020-01-02 16:43:39 -05:00
LemonBoy
0ec64d4c0c Integrate callconv into translate-c-2 2020-01-02 18:53:21 +01:00
LemonBoy
563d9ebfe5 Implement the callconv() annotation 2020-01-02 18:53:16 +01:00
Vexu
f5e7d2d00c
translate-c fix bugs
Thanks @daurnimator
2019-12-29 14:01:59 +02:00
Andrew Kelley
28dbdba37e
Merge pull request #3935 from Vexu/translate-c-2
Translate-c-2 the rest
2019-12-22 16:12:56 -05:00
Andrew Kelley
290dc5d95b
zig fmt support for slice sentinel syntax 2019-12-21 14:03:36 -05:00
Vexu
62bfff5e87
translate-c-2 fix expression grouping bugs 2019-12-18 13:32:19 +02:00
Vexu
e57e3602e7
translate-c-2 implement enums 2019-12-14 23:24:47 +02:00
Vexu
4dae70e702
translate-c-2 container aliases 2019-12-14 13:40:33 +02:00
Vexu
e4ca1f441b
translate-c-2 record type 2019-12-14 02:00:01 +02:00
Robin Voetter
4b4fbe3887
Replace @typeOf with @TypeOf in all zig source
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
Robin Voetter
20a3011def
Add typeOf/TypeOf substition in zig fmt 2019-12-10 11:09:29 -05:00
Andrew Kelley
8b2622cdd5
std.fmt.format: tuple parameter instead of var args 2019-12-08 22:53:51 -05:00
Andrew Kelley
64d700bfa6
zig fmt: support comptime fields 2019-12-08 12:26:20 -05:00
Vexu
d40ad92668
use enum literals in render.zig 2019-12-05 14:50:51 +02:00
Vexu
10cc8cad86
fix zig fmt of c pointers 2019-12-05 14:50:46 +02:00
Andrew Kelley
8a4c2d3b07
zig fmt fixes for sentinel-terminated pointers
closes #3771
2019-11-25 13:53:06 -05:00
Andrew Kelley
00878a15d7
zig fmt: support sentinel-terminated pointer syntax 2019-11-23 22:21:25 -05:00
Andrew Kelley
21f344b3b9
add null terminated pointers and arrays to self-hosted
as well as `@typeInfo` and `@Type`
2019-11-21 20:43:41 -05:00
Vexu
b92f42d1f4
implemented container doc comments in stage 2 2019-11-14 16:25:06 +02:00
Andrew Kelley
d4e6a6d5e2
zig fmt: support anon struct and anon list init syntax 2019-11-11 13:12:45 -05:00
Andrew Kelley
ae0a219d1f
stop accepting deprecated use keyword
closes #2591
2019-11-11 13:02:39 -05:00
Andrew Kelley
e0db54e89d
update the codebase to use @as 2019-11-08 15:57:24 -05:00
Brendan Hansknecht
c1e8fdf812 add token for parsing pointer dereference 2019-11-06 14:03:21 -05:00