2967 Commits

Author SHA1 Message Date
LemonBoy
d526b0ffb0 std: Disable _only_ the flaky part of the ResetEvent test
The remaining part is working just fine as it's not time-dependent.
2020-11-19 15:46:20 -07:00
Andrew Kelley
647c6e0d09 tfw you can't even disable a test without getting the logic wrong 2020-11-19 13:28:54 -07:00
Veikka Tuominen
cf819b95fe
Merge pull request #6829 from tadeokondrak/error-unsupported-callconv
stage1: Compile error instead of falling back to C for unsupported cc
2020-11-19 19:03:08 +02:00
Tadeo Kondrak
25ec2dbc1e Add builtin.Signedness, use it instead of is_signed 2020-11-19 18:59:21 +02:00
Tadeo Kondrak
c002a5026a
Update code to not use unsupported calling conventions for target 2020-11-19 14:01:07 +02:00
Andrew Kelley
13cccdd92c add std.heap.raw_c_allocator
This API does what `std.heap.c_allocator` previously did. See the new
doc comments for more details.
2020-11-18 22:09:34 -07:00
Andrew Kelley
02a4e5a4bf
Merge pull request #6385 from LemonBoy/callocator
std: Make C allocator respect the required alignment
2020-11-18 20:16:57 -08:00
breakin
6d3c176c12 Change seed for Murmur2_64 from u32 to u64 2020-11-18 17:05:38 -08:00
Veikka Tuominen
2418c8206a
Merge pull request #7154 from daurnimator/std.atomic
std.atomic.{Int,Bool}
2020-11-18 21:48:17 +02:00
Jakub Konka
663e112773 std: add chdir smoke test 2020-11-18 15:37:44 +01:00
Lee Cannon
64feae3ac3 Move utf8->utf16 up one level into os.zig 2020-11-18 15:37:44 +01:00
Lee Cannon
dbbe709dc7 use else in err switch 2020-11-18 15:37:44 +01:00
Lee Cannon
32c998e03c Switch to RtlSetCurrentDirectory_U 2020-11-18 15:37:44 +01:00
Lee Cannon
80b1e82b1b Implement chdir and chdirZ for Windows 2020-11-18 15:37:44 +01:00
Veikka Tuominen
a6470088c6
Merge pull request #6434 from daurnimator/fifo.pump
std: add LinearFifo(...).pump(src_reader, dest_writer)
2020-11-18 16:35:13 +02:00
Veikka Tuominen
ee1d21bbef
Merge pull request #6649 from Rocknest/verparse
make Version.parse less strict
2020-11-18 16:06:52 +02:00
daurnimator
767dd772c0
std: add std.atomic.Bool 2020-11-19 00:58:13 +11:00
daurnimator
d89d6374be
std: add tests for std.atomic.Int 2020-11-19 00:57:54 +11:00
daurnimator
8fa29bc0a2
std: fix missing operation argument to @atomicRmw 2020-11-19 00:57:35 +11:00
daurnimator
eb4d93ece3
std: some more docs for std.atomic.Int 2020-11-19 00:44:38 +11:00
daurnimator
513e8161dd
std: mark std.atomic.Int as extern so it can be used in public ABIs 2020-11-19 00:41:43 +11:00
daurnimator
c492ef97fd std: expose all atomic operations from std.atomic.Int 2020-11-18 15:36:40 +02:00
Vexu
da84ef2a9c
make help in commands more consistent
Closes #7101

Co-authored-by: pfg <pfg@pfg.pw>
2020-11-18 13:58:27 +02:00
Alexandros Naskos
252924ae33 Added std.meta.fieldNames 2020-11-18 13:16:56 +02:00
Veikka Tuominen
6d5b76a75d
Merge pull request #7005 from jshholland/deprecate-span
Remove ArrayList.span
2020-11-18 13:14:48 +02:00
Veikka Tuominen
1e1a490600
Merge pull request #7084 from xackus/mem-volatile
std.mem: make sliceAsBytes, etc. respect volatile
2020-11-18 13:06:35 +02:00
xackus
27b73cc395 std: make meta.IntType a compile error
the function signature changed
also update langref
2020-11-18 12:57:49 +02:00
g-w1
a0226ab05b
std: openDirAbsolute and accessAbsolute (#7082)
* add more abosolutes

* added wrong files

* adding 2 tests and changing the function signatures because of lazy analysis not checking them

* fix a bug that got uncovered by lazy eval

* Add compile error when using WASI with openDirAbsolute and accessAbsolute

* typo
2020-11-18 08:42:35 +01:00
Andrew Kelley
238718b93a disable the flaky ResetEvent test
See #7009
2020-11-17 18:08:10 -07:00
Frank Denis
9c2b014ea8 std/crypto: use NAF for multi-scalar edwards25519 multiplication
Transforming scalars to non-adjacent form shrinks the number of
precomputations down to 8, while still processing 4 bits at a time.

However, real-world benchmarks show that the transform is only
really useful with large precomputation tables and for batch
signature verification. So, do it for batch verification only.
2020-11-17 17:07:32 -08:00
Frank Denis
0d9c474ecf std/crypto: implement the Hash-To-Curve standard for Edwards25519
https://github.com/cfrg/draft-irtf-cfrg-hash-to-curve

This is quite an important feature to have since many other standards
being worked on depend on this operation.

Brings a couple useful arithmetic operations on field elements by the way.

This PR also adds comments to the functions we expose in 25519/field
so that they can appear in the generated documentation.
2020-11-17 17:06:38 -08:00
Andrew Kelley
e6bfa377d1 std.crypto.isap: fix callsites of secureZero 2020-11-16 18:10:41 -07:00
Frank Denis
f9d209787b std/crypto: add ISAPv2 (ISAP-A-128a) AEAD
We currently have ciphers optimized for performance, for
compatibility, for size and for specific CPUs.

However we lack a class of ciphers that is becoming increasingly
important, as Zig is being used for embedded systems, but also as
hardware-level side channels keep being found on (Intel) CPUs.

Here is ISAPv2, a construction specifically designed for resilience
against leakage and fault attacks.

ISAPv2 is obviously not optimized for performance, but can be an
option for highly sensitive data, when the runtime environment cannot
be trusted.
2020-11-16 16:02:19 -08:00
Jonathan Marler
4df75645ce start.zig: call wWinMain with root's type
I have an alternative set of windows bindings I'm working on: https://github.com/marler8997/zig-os-windows.  So I'm declaring my wWinMain function with my own HINSTANCE type rather than the one from std.os.windows.  This change allows start to call wWinMain using any pointer type.
2020-11-16 16:01:18 -08:00
tgschultz
48d60834fd
Move leb128 and remove trivial *mem functions as discussed in #5588 (#6876)
* Move leb128 out of debug and remove trivial *mem functions as discussed in #5588

* Turns out one of the *Mem functions was used by MachO. Replaced with trivial use of FixedBufferStream.
2020-11-16 18:51:54 -05:00
heidezomp
9ea4ddae97 linuxWaitFd: make NetworkSubsystemFailed error unreachable
This error from os.poll is Windows-specific, so unreachable on Linux.
2020-11-16 14:03:19 -08:00
Andrew Kelley
ba967ae9a1
Merge pull request #7002 from jedisct1/timingSafeEqlMinimal
Add mem.timingSafeEql() for constant-time array comparison
2020-11-16 13:39:31 -08:00
Jakub Konka
cd4b54fd38 libstd: add more MachO consts and structs 2020-11-16 13:37:07 -08:00
LemonBoy
36c869dc14 std: Make windows.ReadFile allow short reads
Make it behave like the read() wrapper for unix systems.
Reading the whole buffer breaks some use-cases like buffered readers
over sockets.

Closes #7121
2020-11-16 13:35:06 -08:00
xackus
109a3ebcca std.mem: make args comptime, fix test names 2020-11-16 12:50:05 +01:00
xackus
92e45ee3a1 std.mem: make sliceAsBytes, etc. respect volatile 2020-11-14 13:59:29 +01:00
xackus
c814fdbfaf std.mem: improve doc comments 2020-11-14 13:59:29 +01:00
Andrew Kelley
bf03ae7acc std.fs.path.dirname: return null when input path is root
This intentionally diverges from the unix dirname command, as well as
Python and Node.js standard libraries, which all have this edge case
return the input path, unmodified. This is a footgun, and nobody should
have ever done it this way.

Even the man page contradicts the behavior. It says:
"strip last component from file name". Now consider, if you
remove the last item from an array of length 1, then you
have now an array of length 0. After you strip the last component, there
should be no components remaining. Clearly, returning the input parameter
unmodified in this case does not match the documented behavior. This is
my justification for taking a stand on this API design.

closes #6746
closes #6727
closes #6584
closes #6592
closes #6602
2020-11-13 17:36:49 -07:00
Sébastien Marie
ab4b34f75f openbsd: skip tests using Dir.realpath 2020-11-13 12:30:14 -05:00
Hubert Jasudowicz
bf73db71f5 std: Fix code model argument 2020-11-11 21:28:10 +02:00
Veikka Tuominen
93844a5ef9
Merge pull request #7061 from Vexu/std
std: fix HashMap.putAssumeCapacity
2020-11-11 18:50:34 +02:00
Vexu
ae6f3291c0
std: fix HashMap.clearRetainingCapacity 2020-11-11 14:05:43 +02:00
Vexu
f70160f89c
std: fix HashMap.putAssumeCapacity 2020-11-11 13:57:08 +02:00
Andrew Kelley
8b9195282e
Merge pull request #7044 from semarie/openbsd-simples
Simple sets of commits for OpenBSD support
2020-11-10 18:06:30 -05:00
Andrew Kelley
3110b21c4b std.Target: bump default version max for macos 2020-11-10 15:24:10 -07:00