Veikka Tuominen
cfc19eace7
stage2 cbe: errors
2021-03-08 00:33:07 +02:00
Veikka Tuominen
c22f010fdd
stage2 cbe: regular optional types
2021-03-08 00:33:07 +02:00
Veikka Tuominen
ca20d0ea26
stage2 cbe: pointer like optionals
2021-03-08 00:32:52 +02:00
jacob gw
5d215cc76b
stage2 Elf linker: fill in bswapAllFields
...
I moved it to std.elf since it could be used there and added test
2021-03-07 23:18:26 +02:00
Jonathan Knezek
0447a2c041
Implement fmtDuration using Formatter ( #8137 )
...
* Implement fmtDuration using Formatter
Deprecate Duration, duration
* fmtDuration: Fixed ns remainder
* fmtDuration: Fixed visibility; removed [Dd]uration
2021-03-07 15:00:15 +02:00
LemonBoy
72664df491
std: Deprecate the B and Bi format specifiers
...
Following #8007 and #8137 let's get rid of the last weird format.
2021-03-07 14:58:45 +02:00
LemonBoy
e47b754b28
std: Prevent null pointer deref in mem.len{,Z}
...
Closes #8140
2021-03-07 14:58:45 +02:00
Evan Haas
6d69a29d75
translate-c: Support compound assignment of pointer and signed int
...
This handles `ptr += idx` and `ptr -= idx` when `idx` is a
signed integer expression.
2021-03-07 14:54:04 +02:00
Evan Haas
874c63f89c
translate-c: translate align attribute for block scoped variables
2021-03-07 14:53:33 +02:00
Josh Wolfe
a7c0234eee
docgen --skip-code-tests
2021-03-07 14:52:52 +02:00
Vincent Rischmann
272ae0ca0d
fix parsing of assignment with 'inline for' and 'inline while'
2021-03-06 17:39:54 -08:00
Andrew Kelley
34cb5934dd
Merge pull request #7910 from Vexu/stage2-async
...
Stage2: astgen async stuff, implement var args functions
2021-03-06 13:35:48 -08:00
Veikka Tuominen
8c6e7fb2c7
stage2: implement var args
2021-03-06 15:55:29 +02:00
Veikka Tuominen
17e6e09285
stage2: astgen async
2021-03-06 15:01:25 +02:00
Meghan
9f722f43ac
std/special: init-exe,lib make import(std) its own decl ( #8160 )
...
std/special: init-exe,lib make import(std) its own decl
2021-03-05 19:13:05 -08:00
Isaac Freund
ef3adbdb36
zig fmt: fix lastToken() for container_decl_arg
2021-03-05 21:33:27 +01:00
Veikka Tuominen
9cd038d73a
std: fix memory leak in MultiArrayList
2021-03-05 10:52:40 -08:00
Evan Haas
291edafa1b
translate-c: enable pointer arithmetic with signed integer operand
...
Given a pointer operand `ptr` and a signed integer operand `idx`
`ptr + idx` and `idx + ptr` -> ptr + @bitCast(usize, @intCast(isize, idx))
`ptr - idx` -> ptr - @bitCast(usize, @intCast(isize, idx))
Thanks @LemonBoy for pointing out that we can take advantage of wraparound
to dramatically simplify the code.
2021-03-05 14:16:40 +02:00
cryptocode
02737d535a
Reject bare +/- input when parsing floats
2021-03-05 13:11:20 +01:00
Andrew Kelley
434fce2146
zig fmt: recovery: missing while rbrace
...
Previously, this test case resulted in zig fmt entering an endless loop.
2021-03-04 20:54:09 -07:00
Andrew Kelley
041212a41c
zig cc: fix handling of -MM flag
...
Clang docs say:
> Like -MMD, but also implies -E and writes to stdout by default.
Previously, Zig handled this option by forwarding it directly to Clang,
and disabling depfiles. However this did not adhere to Clang's documented
behavior of these flags.
Now, in addition to being forwarded directly to Clang, `-MM` also
sets c_out_mode = .preprocessor, just like `-E`.
Another issue I noticed is that Zig did not recognize the aliases for
-MG, -MM, or -MMD. The aliases are now recognized.
2021-03-04 18:14:00 -07:00
Andrew Kelley
98b24aa47f
stage2: support environment variables for verbose options
...
The presence of ZIG_VERBOSE_LINK now enables --verbose-link.
The presence of ZIG_VERBOSE_CC now enables --verbose-cc.
These are useful when debugging usage of `zig cc` which does not have
CLI flags for these options, since they are not valid C compiler flags.
2021-03-04 17:37:53 -07:00
Andrew Kelley
ffb2568a9f
Merge pull request #7763 from kivikakk/zig-elf-parse
...
std.elf: expose parsing decoupled from std.fs.File
2021-03-04 11:56:31 -08:00
daurnimator
34ca6b7b44
std: add io.Writer.writeStruct
...
We have readStruct, add writeStruct for symmetry
2021-03-03 22:45:45 +01:00
Andrew Kelley
fcd25065ef
stage2: fix merge conflict with previous commit
...
The compiler failed to build from source; this fixes it.
2021-03-03 13:18:13 -07:00
jacob gw
2ebeb0dbf3
stage2: remove error number from error set map
...
This saves memory since it is already stored in module
as well as allowing for better threading.
Part 2 of what is outlined in #8079 .
2021-03-03 11:49:54 -08:00
Veikka Tuominen
904f774563
translate-c: fix c tokenizer giving invalid tokens
2021-03-03 11:33:14 -08:00
Josh Wolfe
7fbe9e7d60
update docs and grammar to allow CRLF line endings ( #8063 )
2021-03-03 14:30:46 -05:00
Andrew Kelley
5bd9a64516
Merge pull request #7778 from g-w1/stage2-merge-errors
...
stage2: error set merging with tests
2021-03-02 23:19:22 -08:00
Andrew Kelley
3995783207
astgen: fix crash looking for wrong token in error sets
...
Fixes a regression from #7920 .
2021-03-03 00:17:36 -07:00
Veikka Tuominen
ad3f7e0cf0
fix small inconsistency
2021-03-02 23:53:10 -07:00
g-w1
8b100792eb
stage2: error set merging with tests
...
I had to come up with creative tests because we don't have error set type equality yet.
2021-03-02 23:53:05 -07:00
Andrew Kelley
4b57fb5f23
Merge pull request #7741 from FireFox317/optionals-llvm
...
stage2: add support for optionals in the LLVM backend
2021-03-02 21:03:50 -08:00
Andrew Kelley
713f113822
stage2: improve orelse implementation
...
* Now it supports being an lvalue (see additional lines in the test
case).
* Properly handles a pointer result location (see additional lines in
the test case that assign the result of the orelse to a variable
rather than a const).
* Properly sets the result location type when possible, so that type
inference of an `orelse` operand expression knows its result type.
2021-03-02 21:59:23 -07:00
Timon Kruiper
6aa1ea9c59
stage2: fixup some formatting errors ({x} -> {s})
...
These were missed in cd7c870bd81391dd97c5c75eb3910382ba7280a1
2021-03-02 19:02:55 -07:00
Timon Kruiper
ed6757ece6
stage2: add a test for for loops in LLVM backend
2021-03-02 19:02:55 -07:00
Timon Kruiper
d4ec0279d3
stage2: add support for optionals in the LLVM backend
...
We can now codegen optionals! This includes the following instructions:
- is_null
- is_null_ptr
- is_non_null
- is_non_null_ptr
- optional_payload
- optional_payload_ptr
- br_void
Also includes a test for optionals.
2021-03-02 19:02:55 -07:00
Isaac Freund
3ad9cb8b47
zig fmt: allow and trim whitespace around zig fmt: (off|on)
...
Currently `// zig fmt: off` does not work as there are two spaces
after the `//` instead of one. This can cause confusion, so allow
arbitrary whitespace before the `zig fmt: (off|on)` in the comment but
trim this whitespace to the canonical single space in the output.
2021-03-03 01:06:09 +01:00
Andrew Kelley
84f3b3dff2
re-enable behavior tests: translate-c macros
...
These were temporarily disabled in
dd973fb365dbbe11ce5beac8b4889bfab3fddc4d and we forgot re-enable
them until now.
2021-03-02 16:32:52 -07:00
Vincent Rischmann
3dd8396a55
os/linux: fix IO_Uring.timeout
...
According to the io_uring PDF (https://kernel.dk/io_uring.pdf ) the
timeout struct must be 64 bits on both 32 and 64 bit architectures.
2021-03-02 14:13:11 +02:00
Andrew Kelley
f296c95599
Merge pull request #8120 from joachimschmidt557/stage2-arm
...
stage2 ARM: implement basic integer multiplication
2021-03-01 19:11:37 -08:00
Andrew Kelley
f9c9b92175
Merge pull request #7946 from koachan/sparc64-framefixes
...
SPARCv9: Handle various stack frame related quirks.
2021-03-01 19:10:36 -08:00
Andrew Kelley
a20169a610
zig fmt the std lib
2021-03-01 20:04:28 -07:00
Martin Wickham
7613e51a57
Add some bit set variants
2021-03-01 18:52:15 -08:00
daurnimator
1f861ecc95
Bring back ZIG_SKIP_INSTALL_LIB_FILES
2021-03-01 16:23:10 -08:00
Isaac Freund
7b5b7bda87
parser: fix infinite loop on missing comma in param list
2021-03-01 16:09:57 -08:00
joachimschmidt557
278bd60732
stage2 ARM: Add tests for basic integer multiplication
2021-03-02 00:34:41 +01:00
LemonBoy
cd7c870bd8
std: Deprecate 'x'/'X'/'e'/'E' special cases for u8 slices
...
Let's follow the road paved by the removal of 'z'/'Z', the Formatter
pattern is nice enough to let us remove the remaining four special cases
and declare u8 slices free from any special casing!
2021-03-01 15:33:10 -08:00
joachimschmidt557
345ac53836
stage2 ARM: Implement basic integer multiplication
2021-03-02 00:14:56 +01:00
LemonBoy
bee7db77fe
std: Replace lastIndexOf with lastIndexOfScalar
...
This may work around the miscompilation in LLVM 12.
2021-03-01 11:08:16 -08:00