9740 Commits

Author SHA1 Message Date
Linus Groh
8588964972 Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
Andrew Kelley
eccd06f5d0
Merge pull request #21370 from ziglang/fuzz
rework fuzzing API to accept a function pointer parameter
2024-09-11 23:41:51 -07:00
Andrew Kelley
e3f58bd551 add runs per second to fuzzing ui
closes #21025
2024-09-11 19:53:29 -07:00
Andrew Kelley
4fba7336a9
Merge pull request #21269 from alexrp/soft-float
Fix soft float support, split musl triples by float ABI, and enable CI
2024-09-11 17:41:55 -07:00
Andrew Kelley
2d005827b8 make lowest stack an internal libfuzzer detail
This value is useful to help determine run uniqueness in the face of
recursion, however it is not valuable to expose to the fuzzing UI.
2024-09-11 13:41:29 -07:00
Andrew Kelley
0cdccff519 fuzzer: move web files into separate directory 2024-09-11 13:41:29 -07:00
Andrew Kelley
892ce7ef52 rework fuzzing API
The previous API used `std.testing.fuzzInput(.{})` however that has the
problem that users call it multiple times incorrectly, and there might
be work happening to obtain the corpus which should not be included in
coverage analysis, and which must not slow down iteration speed.

This commit restructures it so that the main loop lives in libfuzzer and
directly calls the "test one" function.

In this commit I was a little too aggressive because I made the test
runner export `fuzzer_one` for this purpose. This was motivated by
performance, but it causes "exported symbol collision: fuzzer_one" to
occur when more than one fuzz test is provided.

There are three ways to solve this:

1. libfuzzer needs to be passed a function pointer instead. Possible
   performance downside.

2. build runner needs to build a different process per fuzz test.
   Potentially wasteful and unclear how to isolate them.

3. test runner needs to perform a relocation at runtime to point the
   function call to the relevant unit test. Portability issues and
   dubious performance gains.
2024-09-11 13:41:29 -07:00
Andrew Kelley
b81782366b
Merge pull request #21367 from RetroDev256/faster-tokenizer
Update the zig tokenizer to use labeled switch statements
2024-09-10 19:59:43 -07:00
David Rubin
421fbd939c
thread: don't leak the thread in spawnManager (#21379) 2024-09-11 01:04:59 +00:00
Eric Petersen
36b89101df tokenizer: use labeled switch statements 2024-09-10 16:09:37 -07:00
Jacob Young
6aa6d088d9 Dwarf: implement and test hash maps 2024-09-10 13:06:08 -04:00
Jacob Young
e048e78886 Dwarf: implement and test multi array list 2024-09-10 12:27:57 -04:00
Ian Johnson
9007534551 std.zig.tokenizer: simplify line-based tokens
Closes #21358
Closes #21360

This commit modifies the `multiline_string_literal_line`, `doc_comment`,
and `container_doc_comment` tokens to no longer include the line ending
as part of the token. This makes it easier to handle line endings (which
may be LF, CRLF, or in edge cases possibly nonexistent) consistently.

In the two issues linked above, Autodoc was already assuming this for
doc comments, and yielding incorrect results when handling files with
CRLF line endings (both in Markdown parsing and source rendering).

Applying the same simplification for multiline string literals also
brings `zig fmt` into conformance with
https://github.com/ziglang/zig-spec/issues/38 regarding formatting of
multiline strings with CRLF line endings: the spec says that `zig fmt`
should remove the CR from such line endings, but this was not previously
the case.
2024-09-10 13:34:33 +03:00
Alex Rønne Petersen
26119bd98d
test: Skip some floating point tests that fail on arm-linux-(gnu,musl)eabi.
https://github.com/ziglang/zig/issues/21234
2024-09-10 08:53:30 +02:00
Alex Rønne Petersen
65d36be4a8
std.zig.system: Work around llvm/llvm-project#105978 by disabling vfp2.
https://github.com/llvm/llvm-project/issues/105978
2024-09-10 08:53:30 +02:00
xdBronch
d6d09f4ea7 add error for discarding if/while pointer capture 2024-09-10 01:45:48 +03:00
Des-Nerger
6b1f509422 std.zig.render: replace magic number 4 with indent_delta. 2024-09-10 01:27:49 +03:00
Linus Groh
54b668f8a3 std.fmt: Update casing of a few functions to match naming style guide 2024-09-08 11:30:20 -07:00
Alex Rønne Petersen
af04404b49 std: Fix assembler comment syntax for sparc. 2024-09-07 13:16:22 -07:00
pfg
c97db8e497
Support stringifying non-exhaustive enum to json (#21228) 2024-09-07 11:06:41 -04:00
Andrew Kelley
5f3d9e0b7a
Merge pull request #21261 from alexrp/riscv32
More `riscv32-linux` port work
2024-09-06 17:43:10 -07:00
Alex Rønne Petersen
af370a69cd
std.Target: Make Abi.floatAbi() more accurate.
Also rename Target.getFloatAbi() to floatAbi().
2024-09-06 20:11:47 +02:00
Alex Rønne Petersen
17f54e8274
std.zig.target: Split powerpc-linux-musl triple into powerpc-linux-musleabi(hf). 2024-09-06 20:11:47 +02:00
Alex Rønne Petersen
c1a70acc91
std.zig.target: Split mips(el)-linux-musl triples into mips(el)-linux-musleabi(hf).
Closes #21184.
2024-09-06 20:11:47 +02:00
Alex Rønne Petersen
a0205fff98
std.DynLib: Prefer std.fs.File.stat() over posix.fstat().
This is necessary for riscv32-linux.
2024-09-06 20:03:15 +02:00
Alex Rønne Petersen
65a6e9eee5
std.posix: Skip a couple of tests that use fstat()/fstatat() on riscv32. 2024-09-06 20:03:15 +02:00
Alex Rønne Petersen
f35015575e
std.time: Use clock_nanosleep() to implement sleep() on Linux.
This fixes the function for riscv32 where the old nanosleep() is not available.
clock_nanosleep() has been available since Linux 2.6 and glibc 2.1 anyway.
2024-09-06 20:03:12 +02:00
Alex Rønne Petersen
8043197995
std.os.linux: Add clock_nanosleep() syscall wrapper. 2024-09-06 20:03:00 +02:00
Andrew Kelley
f29bdd6746
Merge pull request #21263 from alexrp/thumb-fixes
Some fixes for `thumb-linux-*` support
2024-09-06 10:55:45 -07:00
Ian Johnson
3543f28320 std.math.big.int: fix shiftRight sign handling
Closes #21311

The sign of the result `r` needs to be initialized before the correction
`r.addScalar(r.toConst(), -1)`, or the intended end result could be off
by 2 (depending on the original sign of `r`).
2024-09-06 10:36:12 -07:00
Andrew Kelley
3929cac154
Merge pull request #21257 from mlugg/computed-goto-3
compiler: implement labeled switch/continue
2024-09-04 18:31:28 -07:00
Arwalk
f87dd43c12
stdlib : base64 encode to writer (#20961) 2024-09-04 08:10:12 +00:00
Alex Rønne Petersen
e5ee9c1e43 std.elf: Bring the EM enum up to date.
Based on:

* `include/elf/common.h` in binutils
* `include/uapi/linux/elf-em.h` in Linux
* https://www.sco.com/developers/gabi/latest/ch4.eheader.html

I opted to use the tag naming of binutils because it seems to be by far the most
complete and authoritative source at this point in time.
2024-09-03 17:44:01 -07:00
Michael Dusan
7a4d69983a AstGen: update @errorCast to maybe eval to err
Consequently, `AstGen.ret()` now passes the error code to
`.defer_error_code`. Previously, the error union value was passed.

closes #20371
2024-09-03 22:56:23 +01:00
Alex Rønne Petersen
9bcb0e938c
std.crypto.ml_kem: Reduce test iteration counts from 100 to 10. (#21285)
Closes #21255.
2024-09-02 23:20:48 +00:00
fdfdjfk3
a670f55195
std.fmt.fmtIntSize*: document when precision is ignored 2024-09-02 14:21:59 +03:00
Jeremy Hertel
13da34955c std.hash_map: fix error message in getAutoHashFn 2024-09-02 12:09:10 +03:00
Matthew Lugg
6d2945f1fe
Merge pull request #21264 from mlugg/decl-literals
compiler: implement decl literals
2024-09-02 00:44:11 +01:00
Jeremy Hertel
227fb4875f std.math: rename make_f80 to F80.toFloat and break_f80 to F80.fromFloat 2024-09-02 00:10:22 +03:00
mlugg
2b9af9e825
AstGen: error on unused switch label 2024-09-01 18:31:01 +01:00
mlugg
b7a55cd6c3
AstGen: allow breaking from labeled switch
Also, don't use the special switch lowering for errors if the switch
is labeled; this isn't currently supported. Related: #20627.
2024-09-01 18:31:01 +01:00
mlugg
3b52e5a221
std.zig.render: fix switch rendering 2024-09-01 18:30:31 +01:00
mlugg
0cc8435a83
std.zig: resolve syntactic ambiguity
The parse of `fn foo(a: switch (...) { ... })` was previously handled
incorrectly; `a` was treated as both the parameter name and a label.

The same issue exists for `for` and `while` expressions -- they should
be fixed too, and the grammar amended appropriately. This commit does
not do this: it only aims to avoid introducing regressions from labeled
switch syntax.
2024-09-01 18:30:31 +01:00
mlugg
5e12ca9fe3
compiler: implement labeled switch/continue 2024-09-01 18:30:31 +01:00
mlugg
0b9fccf508
std: deprecate some incorrect default initializations
In favour of newly-added decls, which can be used via decl literals.
2024-09-01 17:34:07 +01:00
mlugg
6e3e23a941
compiler: implement decl literals
Resolves: #9938
2024-09-01 17:34:07 +01:00
mlugg
9e683f0f35
compiler: provide result type to operand of try
This is mainly useful in conjunction with Decl Literals (#9938).

Resolves: #19777
2024-09-01 17:34:07 +01:00
Nico Elbers
cad65307b7 std: make debug.dumpStackPointerAddr compile
Very simply add the format specifier to the print statement.
Since debug.print is hard coded I couldn't come up with a reasonalble
way to add a test, and since this function is simple enough I doubt it's
useful.

fixes one part of #21094
2024-09-01 00:45:31 -07:00
Jeremy Hertel
52fc046907 std.c: fix pthread_mutex_t size for x86_64-linux-gnu 2024-09-01 00:44:09 -07:00
Hila Friedman
a76e98e7d5 remove length assertion from mprotect 2024-08-31 20:59:47 -07:00