Andrew Kelley
b4e344bcf8
Merge remote-tracking branch 'origin/master' into ast-memory-layout
...
Conflicts:
* lib/std/zig/ast.zig
* lib/std/zig/parse.zig
* lib/std/zig/parser_test.zig
* lib/std/zig/render.zig
* src/Module.zig
* src/zir.zig
I resolved some of the conflicts by reverting a small portion of
@tadeokondrak's stage2 logic here regarding `callconv(.Inline)`.
It will need to get reworked as part of this branch.
2021-02-11 23:45:40 -07:00
Andrew Kelley
3d0f4b9030
stage2: start reworking Module/astgen for memory layout changes
...
This commit does not reach any particular milestone, it is
work-in-progress towards getting things to build.
There's a `@panic("TODO")` in translate-c that should be removed when
working on translate-c stuff.
2021-02-11 23:29:55 -07:00
Veikka Tuominen
288e180598
snake_case render.Space
2021-02-12 02:14:07 +02:00
Veikka Tuominen
bb22490fcc
snake_case Node.Tag
2021-02-12 02:12:43 +02:00
Veikka Tuominen
e2289961c6
snake_case Token.Tag
2021-02-12 02:12:00 +02:00
Andrew Kelley
d3565ed6b4
Merge pull request #7749 from tadeokondrak/6429-callconv-inline
...
Replace inline fn with callconv(.Inline)
2021-02-11 16:01:58 -08:00
Isaac Freund
faa3fa65ac
zig fmt: implement line comments
2021-02-11 15:49:49 -08:00
Isaac Freund
b6448a533d
zig fmt: fix Tree.lastToken() for empty *Two nodes
2021-02-11 15:49:49 -08:00
Evan Haas
d98f09e4f6
translate-c: comma operator should introduce a new scope
...
This prevents inadvertent side-effects when an expression is not evaluated
due to boolean short-circuiting
Fixes #7989
2021-02-12 01:40:43 +02:00
Tadeo Kondrak
bb4f4c043e
test/cli.zig: Remove inline from panic function in testGodboltApi
...
Might add another line to stack traces there.
2021-02-10 20:22:20 -07:00
Tadeo Kondrak
bcc13597fc
translate_c: switch from inline fn to callconv(.Inline)
2021-02-10 20:22:19 -07:00
Tadeo Kondrak
7644e9a752
stage2: switch from inline fn to callconv(.Inline)
2021-02-10 20:22:18 -07:00
Tadeo Kondrak
1c15091bc8
stage1: switch from inline fn to callconv(.Inline)
2021-02-10 20:06:13 -07:00
Tadeo Kondrak
5dfe0e7e8f
Convert inline fn to callconv(.Inline) everywhere
2021-02-10 20:06:12 -07:00
Tadeo Kondrak
9c797fe3ac
std.zig: reformat inline fn to callconv(.Inline)
2021-02-10 20:06:11 -07:00
Jonathan Marler
61bcac108c
Add more mingw def files
...
I've added more of the ".def" files from mingw. The list is based on all the libraries referenced by the win32metadata project. (see https://github.com/marlersoft/zigwin32 ).
2021-02-10 13:38:16 -08:00
Isaac Freund
4c8caf3343
zig fmt: implement Tree.lastToken() for all nodes
2021-02-10 11:53:53 -08:00
Isaac Freund
515d4920e7
zig fmt: fix 0 element struct and array init
2021-02-10 11:53:53 -08:00
Isaac Freund
5df7fc36c6
zig fmt: implement Tree.lastToken() for struct init
2021-02-10 11:53:53 -08:00
Isaac Freund
928f6f48a6
zig fmt: implement Tree.lastToken() for array init
2021-02-10 11:53:53 -08:00
Isaac Freund
3110a73486
zig fmt: implement Tree.lastToken() for array types
2021-02-10 11:53:53 -08:00
Isaac Freund
8c4f3e5a31
zig fmt: fix render of pointers with ** tokens
2021-02-10 11:53:53 -08:00
Isaac Freund
a524e57090
zig fmt: support bodyless function decls
...
extern function declarations do not have a body, so allow setting
the rhs for FnDecl to 0 to indicate this is the case.
2021-02-10 11:53:53 -08:00
Isaac Freund
80b719d967
zig fmt: fix typo in firstToken() for pointer types
2021-02-10 11:53:53 -08:00
Isaac Freund
6dc2236054
musl: update to 1.2.2
2021-02-10 11:50:55 -08:00
Evan Haas
a2ec77041b
translate-c: call @boolToInt on return value when necessary
...
In C, if a function has return type `int` and the return expression
is a boolean expression, there is no implicit cast. Therefore the
translated Zig code needs to call @boolToInt() on the result.
Written with feedback from @Vexu
Fixes #6215
2021-02-10 20:23:27 +02:00
Jonathan Marler
1480c42806
require specifier for arrayish types
2021-02-09 22:25:52 -08:00
Andrew Kelley
58db3d2775
zig fmt: re-enable now-passing test cases
2021-02-09 23:07:29 -07:00
Andrew Kelley
fa5fcdd734
zig fmt: fix regression with many container members
2021-02-09 22:42:00 -07:00
Andrew Kelley
9d87e6aeb8
zig fmt: remove dead code
...
likely these will be resurrected to make array literal cases pass.
2021-02-09 22:29:01 -07:00
Andrew Kelley
36eee7bc6c
zig fmt: anytype, fn calls with one param, trailing commas
...
and extra newlines between top level declarations
2021-02-09 22:26:21 -07:00
Andrew Kelley
25bcf4eb99
zig fmt: grouped expressions
2021-02-09 21:17:43 -07:00
Andrew Kelley
7295d4b807
zig fmt: suspend blocks
2021-02-09 20:35:43 -07:00
Andrew Kelley
ebf04c56e1
zig fmt: usingnamespace
2021-02-09 20:17:47 -07:00
Andrew Kelley
39acc4c020
zig fmt: for loops
2021-02-09 20:08:40 -07:00
Andrew Kelley
1c79eea125
zig fmt: while loops
2021-02-09 17:23:57 -07:00
joachimschmidt557
6a5a6386c6
stage2 ARM: fix register allocation in genArmBinOp
...
Previously, this would reuse an operand even if reuseOperand returned
false for both operands.
genArmBinOpCode was also changed to be more Three-address code oriented
in the process.
2021-02-09 23:58:41 +01:00
joachimschmidt557
c2beaba85a
stage2 ARM: fix callee_preserved_regs
...
Previously, the registers included r0, r1, r2, r3 which are not
included in the callee saved registers according to the Procedure Call
Standard for the ARM Architecture.
2021-02-09 23:57:43 +01:00
Andrew Kelley
bcafc51e58
zig fmt: fn protos and anytype
2021-02-09 14:41:50 -07:00
Andrew Kelley
b1d8a0a5a6
zig fmt: asm expressions
2021-02-08 22:03:23 -07:00
Isaac Freund
d869133a9f
zig fmt: implement switches
2021-02-08 15:41:31 -08:00
Isaac Freund
837cd748a8
zig fmt: fix block lbrace indent
2021-02-08 15:41:31 -08:00
Isaac Freund
aaf13a2bb3
zig fmt: implement break
2021-02-08 15:41:31 -08:00
Evan Haas
221f1d898c
translate-c: Improve function pointer handling
...
Omit address-of operator if operand is a function.
Improve handling of function-call translation when using function pointers
Fixes #4124
2021-02-08 10:15:00 +02:00
Isaac Freund
57cec38e61
std/zig/ast: fix Tree.lastToken() for blocks
...
The fact that blocks may end in a semicolon but this semicolon is not
counted by recursive lastToken() evaluation on the sub expression causes
off-by-one errors for lastToken() on blocks currently.
To fix this, introduce BlockSemicolon and BlockTwoSemicolon following
the pattern used for trailing commas in e.g. builtin function arguments.
2021-02-07 14:51:37 -08:00
Isaac Freund
0e38362d24
zig fmt: split Slice and SliceSentinel
...
This saves 4 whole bytes in the common case where there is no sentinel.
2021-02-07 14:51:37 -08:00
Isaac Freund
1d71b19c0d
zig fmt: implement error set decls
2021-02-07 14:51:37 -08:00
Andrew Kelley
1adac0a55b
never pass -s to clang
...
We only use clang to produce object files; the idea of stripping is not
relevant here.
Fixes regression in previous commit.
2021-02-07 15:08:48 -07:00
Andrew Kelley
e197a03124
zig cc: recognize the -s flag to be "strip"
2021-02-07 14:51:27 -07:00
Isaac Freund
bb7b5ee2ac
zig fmt: implement catch and return
2021-02-07 12:04:32 -08:00