Commit Graph

11160 Commits (3c7a49c4947b748c04e314dc89f2ce56562da29c)

Author SHA1 Message Date
Travis 3c7a49c494 add missing case for TokenizeStateSawDotStar at eof 2020-10-29 12:03:45 -05:00
Travis 069aee1495 don't allow a token starting with an asterisk directly following .* 2020-10-29 12:03:45 -05:00
LemonBoy b3314a8be6 stage1: Fix small bug in pointer type analysis
A flag meant to catch recursively-defined types was never reset, leading
the compiler to generate wrong answers when asked for its
type/alignment.

Closes #6850
2020-10-29 15:41:45 +02:00
Veikka Tuominen 85dd5746bd
Merge pull request #6678 from s-ol/doc-type-aware
generated docs improvements: add vector, fntype, anytype type-printing; bool, function value-printing
2020-10-29 15:19:02 +02:00
LemonBoy fe6cc0c3ba std: Better handling of type values in expectEqual 2020-10-29 15:13:44 +02:00
Andrew Kelley 81f5e1e667 ci: freebsd: skip non-native tests to save time 2020-10-28 22:59:23 -07:00
Andrew Kelley fd3da3348c ci: macos: rebuild zig1.o with stage1
see #6830 for details.
2020-10-28 16:31:59 -07:00
s-ol 6e96352b90 docs: link to functions in getValueText and getCallHtml 2020-10-29 00:10:22 +01:00
LemonBoy 7bc9531698 stage1: Correctly generated optional constant values
Closes #6799
2020-10-28 21:56:28 +02:00
Frank Denis 0adc144f88 std/crypto: adjust aesni parallelism to CPU models
Intel keeps changing the latency & throughput of the aes* and clmul
instructions every time they release a new model.

Adjust `optimal_parallel_blocks` accordingly, keeping 8 as a safe
default for unknown data.
2020-10-28 21:44:00 +02:00
Frank Denis ea45897fcc PascalCase *box names, remove unneeded comptime & parenthesis
Also rename (salsa20|chacha20)Internal() to a better name.

And sort reexported crypto.* names
2020-10-28 21:43:15 +02:00
LemonBoy 6d2f103bfb stage1: Fix crash in comptime struct value copy
Comptime fields are never materialized in the ZigValue so pay attention
when iterating over the fields array.

Fixes #6800
2020-10-28 21:13:32 +02:00
Jakub Konka 1a171a143a
Merge pull request #6842 from kubkon/aarch64-macos-fix
std: Apple Silicon: no fstat$INODE64 symbol found
2020-10-28 11:38:46 +01:00
Jakub Konka 4f50958407 Clean up exporting of symbols on Darwin 2020-10-28 10:36:19 +01:00
Jakub Konka bda9a159aa Apple Silicon: no fstat$INODE64 symbol found
It seems that Apple has finally got rid of the 32bit versions of
`fstat` and `fstatat`, and instead, only 64bit versions are available
on BigSur and Apple Silicon.

The tweak in this commit is required to make Zig stage1 compile on
BigSur + aarch64.
2020-10-27 22:47:53 +01:00
Andrew Kelley e1ca6946be rename ZigClangFloatingLiteral_getValueAsApproximateDouble 2020-10-27 14:16:43 -07:00
Žiga Željko 7c2bde1f07 std/crypto: API cleanup 2020-10-26 19:19:34 -04:00
Andrew Kelley e2caf57527 Merge branch 'frmdstryr-import-empty-file' 2020-10-26 16:07:46 -07:00
Andrew Kelley 435c8ad703 non-hacky workaround for the empty file bug
See #3328
2020-10-26 16:06:14 -07:00
Andrew Kelley c1ae9f40c7 stage1: support "native" as the OS string in -target
This should help for bootstrapping purposes, intending to fix the macOS
CI.
2020-10-26 15:48:48 -07:00
frmdstryr 1ce0994897 Fix @import of empty file 2020-10-26 13:29:32 -07:00
Andrew Kelley e83334274f add regression test for already fixed bug
closes #6781
2020-10-26 13:18:44 -07:00
data-man 194e29adfc Format null type in std.fmt 2020-10-26 15:40:48 -04:00
Andrew Kelley a0f4606f32 ci: still build zig even though we are using (older) zig cc 2020-10-26 10:50:43 -07:00
Yanis Zafirópulos c6747e1063 Copy editing :) 2020-10-26 18:39:34 +01:00
Frank Denis 74a1175d9d std/*: add missing MIT license headers 2020-10-26 17:41:29 +01:00
mlarouche e3fed3c814 Temp Fix for deadlock in C compilation, found and tested on Windows 2020-10-25 21:33:46 -04:00
johnLate 0a619c68a6 fix type mismatch in std.net.StreamServer
Parameter in std.os.listen is u31.

Fixes ziglang#6775
2020-10-25 21:18:24 -04:00
dec05eba c0fa5963ee Make lastIndexOf use the same cut-off between BMH as indexOf
Also update test to use a string longer than 52 characters
to test both BMH and linear path.
2020-10-25 21:17:22 -04:00
Frank Denis 72064eba23 std/crypto: vectorize BLAKE3
Gives a ~40% speedup on x86_64.

However, the generic code remains faster on aarch64.

This is still processing only one block at a time for now.

I'm pretty confident that processing more blocks per round
will eventually give a substantial performance improvement on
all platforms with vector units.
2020-10-25 21:13:14 -04:00
Frank Denis 1b4ab749cf std/crypto: add the bcrypt password hashing function
The bcrypt function intentionally requires quite a lot of CPU cycles
to complete.

In addition to that, not having its full state constantly in the
CPU L1 cache causes a massive performance drop.

These properties slow down brute-force attacks against low-entropy
inputs (typically passwords), and GPU-based attacks get little
to no advantages over CPUs.
2020-10-25 21:11:40 -04:00
Sébastien Marie 2a0a11aa66 openbsd: make dl_phdr_info cross arches
introduce Addr and Half definition to std.elf, and use them for dl_phdr_info
2020-10-25 20:46:28 -04:00
Andrew Kelley 0088efc4b2
Merge pull request #6809 from jedisct1/salsa
std/crypto: add (X)Salsa20 and NaCl boxes
2020-10-25 20:34:35 -04:00
Andrew Kelley bbd1e122d4 ci: skip compile error tests on freebsd to save time 2020-10-25 17:29:10 -07:00
Frank Denis 0c7a99b38d Move ed25519 key pairs to a KeyPair structure 2020-10-25 21:55:05 +01:00
Frank Denis 28fb97f188 Add (X)Salsa20 and NaCl boxes
The NaCl constructions are available in pretty much all programming
languages, making them a solid choice for applications that require
interoperability.

Go includes them in the standard library, JavaScript has the popular
tweetnacl.js module, and reimplementations and ports of TweetNaCl
have been made everywhere.

Zig has almost everything that NaCl has at this point, the main
missing component being the Salsa20 cipher, on top on which NaCl's
secretboxes, boxes, and sealedboxes can be implemented.

So, here they are!

And clean the X25519 API up a little bit by the way.
2020-10-25 18:04:12 +01:00
Vincent Rischmann 59af275680 test runner: use the correct number in leak report 2020-10-25 11:28:36 +02:00
Sébastien Marie 3115d2f2cd readd original code from #6638. realpathZ() is expected to take a [*:0]const u8 2020-10-25 10:02:10 +01:00
Jakub Konka 872bc787b5 cc: fix regression on macOS after adding libc headers
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-24 17:32:50 +02:00
Frank Denis 91a1c20e74 Fix a typo (s/multple/multiple/) 2020-10-24 07:57:34 +02:00
s-ol 300b617140 generated docs: add FnFrame type support
See #3404
2020-10-23 15:44:32 +02:00
Timon Kruiper 4b48fccadd When checking a cache hit, make sure to handle a (re)moved source file
When a file cannot be found in the cache, it is not a hit.

Closes #6729
2020-10-23 01:01:37 -04:00
Andrew Kelley 3af9025a1d
Merge pull request #6719 from jedisct1/ed25519-batch
std/crypto/25519: add support for batch Ed25519 signature verification
2020-10-23 00:58:53 -04:00
Andrew Kelley 392e6da8a3 update stack trace test case 2020-10-22 21:57:30 -07:00
Andrew Kelley 59c26c79e8 Merge branch 'BarabasGitHub-improve-windows-networking' 2020-10-22 17:45:31 -07:00
Andrew Kelley 569f7ce49e Merge branch 'improve-windows-networking'
of https://github.com/BarabasGitHub/zig into
BarabasGitHub-improve-windows-networking

Conflicts:
 lib/std/os.zig

This commit resolves conflicts with the changes to std.os which removed
the EAGAIN error handling interactions with the event loop. The solution
to the conflict was to apply EAGAIN => return error.WouldBlock into the
improved windows networking branch.
2020-10-22 16:59:15 -07:00
DixiE 79ec08fe2f Fix Compiler Error When Using wWinMain Entry-Point
The fix for #6715 introduced a new compiler error when attempting to use
wWinMain as the application entry-point.

The Windows API often relies on implicit casts between signed and
unsigned variables. In this case, wWinMain returns an INT despite the
fact this value is intended to feed into ExitProcess, which expects a
UINT, so I've restored the bitcast from #5613.
2020-10-22 19:50:06 -04:00
Paul Espinosa ddd39b994b Use std.testing.expect in language reference samples
In this commit, the code samples in the language reference have been changed to
use `std.testing.expect` rather than `std.debug.assert` when they are
written in `test` code. This will teach Zig learners best practices when
they write their own test code.

Not all uses of `std.debug.assert` have been replaced. There are examples where
using `assert` fits the context of the sample.

Using `std.debug.assert` in test code can lead to errors if running tests in
ReleaseFast mode. In ReleaseFast mode, the `unreachable` in `assert` is
undefined behavior. It is possible that `assert` always causes `zig test` to
pass thus possibly leading to incorrect test code outcomes. The goal is to
prevent incorrect code from passing test cases.

Closes #5836
2020-10-22 15:54:57 -07:00
chwayne 1e13e8e817
Make argsAlloc/ArgIterator return zero-sentinel strings (#6720) 2020-10-22 17:52:48 -04:00
xackus 2ee79f149b std: reference more declarations in std.build 2020-10-22 17:44:23 -04:00