Commit graph

7930 commits

Author SHA1 Message Date
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
Eric Joldasov
a6c8ee5231 compiler: rename "@XToY" to "@YFromX", zig fmt: rewrite them
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:24 -07:00
Andrew Kelley
e6e8cacab9 std.mem.order: use for loop syntax
Not only does it look nicer, it's a performance enhancement for debug
builds since the safety checks are eliminated.
2023-06-19 12:07:32 -07:00
Josh Wolfe
32cb9462ff
std: Support user-provided jsonParse method. Unify json.Parser and json.parse* (#15705) 2023-06-19 11:21:37 -04:00
Jan Philipp Hafer
539e0b0469 compiler_rt: fixup exports of PPC routines
PPC targets can also use the functionality-equivalent standard routine, so
unconditionally export the standard routine.

Fixup of #16054 merged in f043071cdf.
2023-06-18 15:27:47 -07:00
Andrew Kelley
28862dd30c
Merge pull request #16080 from squeek502/windows-vt
windows: detect ANSI support in more terminals
2023-06-18 13:36:59 -07:00
Andrew Kelley
3ef91233ca
Merge pull request #15867 from devnexen/haiku_malloc_usable_size
std.c: haiku also supports malloc_usable_size to benefit zig's heap
2023-06-18 12:44:08 -07:00
r00ster91
2839e35d1c std.math.isPowerOfTwo: add tests and doc comment and improve assert
The assert is changed from `int != 0` to `int > 0` because negative
integers always return `false`.
Python's `math.log2` does the same and errors for 0 or negative integers.
2023-06-18 10:42:03 -07:00
David CARLIER
54ea0bbcdd std.c: exposing timer api 2023-06-18 08:09:42 -07:00
Krzysztof Wolicki
e9da87866c autodoc: Fix rendering of function arguments named _ 2023-06-18 14:41:49 +00:00
Loris Cro
216ef10dc4
Merge branch 'master' into autodoc-searchkey 2023-06-18 09:06:40 +02:00
Ryan Liptak
5439f36c97 Remove unnecessary isatty call from supportsAnsiEscapeCodes
isatty on Windows is implemented as a isCygwinPty call and a GetConsoleMode call, so calling isatty just duplicates the function calls we already need to do in supportsAnsiEscapeCodes.
2023-06-17 23:36:10 -07:00
Christofer Nolander
59a12cd293 windows: detect ANSI support in more terminals 2023-06-17 23:30:17 -07:00
Mizuochi Keita
729a051e9e std.http: Fix segfault while redirecting
Make to avoid releasing request's connection twice.
Change the `Request.connection` field optional. This field is null while the connection is released.

Fixes #15965
2023-06-17 21:58:33 -07:00
Andrew Kelley
e3736baddb
Merge pull request #15501 from matu3ba/win_rmwithposix
std.windows: use posix semantics to delete files, if available
2023-06-17 14:21:15 -07:00
Andrew Kelley
8d0a8c2859
Merge pull request #15265 from tiehuis/optimize-udivmod
optimize udivmod
2023-06-17 14:19:07 -07:00
Xavier Bouchoux
67b3e07260 zlib: naming convention
Adress review comments from https://github.com/ziglang/zig/pull/13977
by using the same naming convention as zstd.

And by using `finish()` instead of `close()` for the finalisation of the compressed stream.
rationale:
  - it is not the same as how close() is usually used, since it must be called to flush and write the final bytes. And as such it may fail.
  - it is not the same `flush` in the deflate code, which allows to keep writting more bytes later, and doesn't write the final checksum.
  - it is the same name as used in the original zlib library (Z_FINISH)

Also, use a packed struct for the header, which seems a better fit.
2023-06-17 14:08:05 -07:00
dantecatalfamo
8b92354396 std: add zlib stream writer 2023-06-17 14:07:45 -07:00
r00ster91
6e84f46990 std: replace builtin.Version with SemanticVersion 2023-06-17 13:17:34 -07:00
Andrew Kelley
96acc204b2
Merge pull request #16052 from mikdusan/bsd-getdents
fix bad return types for BSDs getdents and debitrot openbsd
2023-06-17 13:01:52 -07:00
Motiejus Jakštys
d41111d7ef mem: rename align*Generic to mem.align*
Anecdote 1: The generic version is way more popular than the non-generic
one in Zig codebase:

     git grep -w alignForward | wc -l
    56
     git grep -w alignForwardGeneric | wc -l
    149

     git grep -w alignBackward | wc -l
    6
     git grep -w alignBackwardGeneric | wc -l
    15

Anecdote 2: In my project (turbonss) that does much arithmetic and
alignment I exclusively use the Generic functions.

Anecdote 3: we used only the Generic versions in the Macho Man's linker
workshop.
2023-06-17 12:49:13 -07:00
Marc Tiehuis
5baa05664e wyhash: support comptime usage
Closes #16070.
2023-06-17 12:06:40 -07:00
Evin Yulo
6f766fbf00 privatize std.mem.writePackedInt{Big, Little}
These are unnecessary since writePackedInt accepts an endian parameter.
2023-06-17 06:35:30 -07:00
Jan Philipp Hafer
f043071cdf compiler_rt: add missing PPC routines
Adds conditional exports
- __fixkfti
- __fixunskfti
- __floattikf
- __negkf2
- __mulkc3
- __divkc3
- __powikf2
and adjusts tools/gen_stubs.zig.

From https://gcc.gnu.org/onlinedocs/gcc/Floating-Types.html:
"When long double transitions to __float128 on PowerPC in the future,
__ibm128 will remain for use in conversions between the two types."

Hence `__extendkftf2` and `__trunctfkf2` for conversion are superfluous
and only using f128 for `kf` routines is justified.

Closes #16057.
2023-06-16 23:37:50 -07:00
Gregory Mullen
abfa215882 add additional errno (INTR) to tcset,getpgrp calls
Missed this originally because I was only able to trigger it when
SA_RESTART was missing from the sigaction handlers. I'm unconvinced this
is actually a sane way for stdlib to behave (see #15664). But this does
duplicate the existing behavior throughout os.zig which IMO should be
prioritized here.
2023-06-16 22:02:36 -07:00
Andrew Kelley
78c8cb4225
Merge pull request #16003 from g-w1/plan9-lazy-syms
Plan9: lots of fixes
2023-06-16 21:57:33 -07:00
Marc Tiehuis
59a6f482e2 disable udivmod asm divq on windows 2023-06-17 13:50:05 +12:00
Marc Tiehuis
947dd36341 optimize udivmod
See https://reviews.llvm.org/D81809 for upstream description.

In summary this is ~10x improvement for small divisors and similar
performance for equal divisors.

Closes #13523.
2023-06-17 13:50:04 +12:00
Veikka Tuominen
0f5aff3441 zig build: add option to only print failed steps
The motivating case for this is that currently when a test fails
the CI log will include ~5k lines of listing steps that succeeded.
2023-06-16 15:17:59 -07:00
r00ster91
2593156068 migration: std.math.{min, min3, max, max3} -> @min & @max 2023-06-16 13:44:09 -07:00
Jacob G-W
4dac9f54dd plan9: flesh out stdlib enough to allow not using simplified start logic 2023-06-16 08:34:30 -04:00
Andrew Kelley
5d9e8f27d0
Merge pull request #16053 from ziglang/update-linux-headers
update linux kernel headers to 6.3.8
2023-06-15 23:58:05 -07:00
Isaac Freund
a2f54fce53 std.Build.Step.Run: add stdin to cache manifest 2023-06-16 05:35:30 +00:00
Andrew Kelley
6bd93ef4eb update linux kernel headers to 6.3.8 2023-06-15 12:04:36 -07:00
Michael Dusan
4054d00144
dragonfly: fix std.c.getdents
- fix getdents return type usize → c_int
2023-06-15 14:48:20 -04:00
Michael Dusan
40fc71bf71
openbsd: fix std.c.getdents and debitrot
- fix getdents return type usize → c_int
- special-case process.zig to use sysctl instead of sysctlbyname
- use struct/field pattern for sysctl HW_* constants
2023-06-15 14:48:20 -04:00
Michael Dusan
64ddba955a
freebsd: fix std.c.getdents
- fix getdents return type usize → isize
- usize ultimately forced errors to .SUCCESS in std.c.getError

New behavior in freebsd 13.2 is to return ENOENT if the directory being
iterated is deleted during iteration. We now detect this and treat it
consistent with iteration ending.
2023-06-15 14:48:19 -04:00
Dumitru Stavila
1253d591be target.zig adds ps4 and ps5 type sizes. 2023-06-15 11:23:04 -07:00
Eric Joldasov
610b02c432 std.atomic.Atomic: update tests to new for-loop syntax, re-enable test with isel
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-14 18:25:56 -07:00
Marcos O
ff835cce10
windows.sendto fix (#15831) 2023-06-14 16:24:16 +00:00
Andrew Kelley
38fc826a5a
Merge pull request #15957 from BratishkaErik/deprecated-
std.*: remove stuff that was deprecated in older versions
2023-06-13 14:53:41 -07:00
Niles Salter
700ea694b2
Fix pdqSort+heapSort for ranges besides 0..len (#15982) 2023-06-13 16:55:58 -04:00
Evin Yulo
129afba460 publicize std.rand.ziggurat 2023-06-13 11:29:28 -07:00
Lee Cannon
21c258acac allow run step to skip foreign binary execution if executor fails 2023-06-13 11:27:45 -07:00
Frank Denis
cc708b4a88
crypto.pcurves: don't assume that points with X=0 are at infinity (#16017)
There's also a valid point with X=0 on each curves.

Fixes #16015
2023-06-13 18:20:24 +00:00
Evin Yulo
137b115681 os.connect: mark ECONNABORTED as unreachable
closes #13677
2023-06-13 11:16:09 -07:00
Jan200101
d7b73af8f6 Never implicitly add rpaths for each lib dir, add NixOS libdir to rpath 2023-06-13 11:11:10 -07:00
Zapolsky Anton
c76ce25a61
Remove CheckObjectStep.runAndCompare (#15973)
Closes #14969
2023-06-13 14:09:24 -04:00
Evin Yulo
854f26ad8a fix typo in std.Uri 2023-06-13 10:58:11 -07:00
bfredl
4f914c8414 bpf: expose "syscall" program type and F_SLEEPABLE flag 2023-06-13 10:57:51 -07:00