Commit Graph

3895 Commits

Author SHA1 Message Date
Andrew Kelley
c420eb60ad
Merge pull request #8590 from lithdew/master
x,  x/os/Socket: initial work on new Socket abstraction
2021-04-25 19:15:15 -04:00
Andrew Kelley
2fc6b347ec
Merge pull request #8616 from LemonBoy/fn-align
Function pointer alignment
2021-04-25 19:12:06 -04:00
Andrew Kelley
6f61594692
Merge pull request #8496 from xackus/isError
std.meta: add isError
2021-04-25 13:27:44 -04:00
LemonBoy
5a94794b73 std: Fix thread creation with field-less context type
Closes #8524
2021-04-25 13:21:15 -04:00
LemonBoy
19cec0db1e std: Make met.alignment work on more types
Make it return the correct value for function types and optional
pointers.
2021-04-25 16:49:21 +02:00
lithdew
98706c9686 x: fmt source code 2021-04-25 21:15:02 +09:00
lithdew
b435d7fa60 x, x/os/Socket: initial work on new Socket abstraction
Kick-start initial work on new cross-platform abstraction for
sockets. Adds a test for read timeouts and a test for creating
a non-blocking socket pair on Linux.

The new Socket abstraction is barebones and is made to support both
blocking and non-blocking abstractions, alongside different socket
protocols and domains.

Support for platform-dependant socket options that handles unsupported
platforms gracefully via. comptime checks is provided for the new Socket
abstraction.

This also marks the first out of many commits for introducing breaking
changes to the standard library in a separate `x` folder, which was
pre-approved by @andrewrk.

The intent for the new `x` package is to introduce new async, event loop,
networking, and operating system abstractions that would require breaking
the standard library significantly. By having the `x` package, code in the
standard library and compiler may then slowly be refactored to use the `x`
package. Once modules in the `x` package are stabilized, they can be moved
out of the `x` package, and a global 'grep' can be done to update import
paths that resolve to the stabilized module in the `x` package.
2021-04-25 21:15:02 +09:00
Matt Knight
8530b6b724 fix import path 2021-04-24 13:35:55 -04:00
Frank Denis
7a793a9b9d ed25519: use double-base multiplication for signature verification
This makes single signature verification about 60% faster.

Also check that R is not the identity point.
2021-04-24 13:35:36 -04:00
LemonBoy
eabf378a56 zig fmt: Automagically fix block-less suspend exprs 2021-04-24 15:37:55 +02:00
LemonBoy
0aede1a8fc stage1: Require a block after suspend
Closes #8603
2021-04-24 10:25:43 +02:00
Andrew Kelley
a279f18bce
Merge pull request #8599 from LemonBoy/unsigned-neg
stage1: Allow wrapping negation on unsigned ints at comptime
2021-04-23 16:59:01 -04:00
Hadron67
e86a1df9f2 std.atomic: load should take const pointer to Self 2021-04-23 22:39:49 +02:00
LemonBoy
9ac5f98200 std: Remove unneeded workaround
Now that -% works on unsigned integers at comptime this (clever) hack is
not not needed anymore.
2021-04-23 19:19:44 +02:00
LemonBoy
c5cc6b7082 compiler-rt: Export __extendhftf2 and __trunctfhf2
Even though LLVM12 doesn't make use of those intrinsics at the moment
let's export them anyway.
2021-04-21 19:02:13 +02:00
LemonBoy
e0d7cfce5f compiler-rt: Don't re-define PPC builtins in test mode
Prevent linking errors when `zig test`-ing the compiler_rt module for
powerpc-linux triples.
2021-04-21 19:00:57 +02:00
LemonBoy
e4f9a3041a std: Use stat definition with 32bit *time fields
We're not ready for Y38K yet.
2021-04-21 16:31:30 +02:00
LemonBoy
d82eb8dd40 std: Split syscall parameters for PowerPC targets 2021-04-21 16:31:29 +02:00
Jakub Konka
c8753aceef macho: fix typos in consts defs 2021-04-21 06:49:34 +02:00
Michael Dusan
0c6dfa6f0c target: drop ppc32 and prefer ppc
- original PR #7949 (incorrectly) patched a generated-file and changes
  have subsequently been lost/overwritten
- fix #7947 in a different way: drop `ppc32` because `ppc` already exists
2021-04-20 16:19:59 -04:00
Frank Denis
10f2d62789
std/crypto: use finer-grained error sets in function signatures (#8558)
std/crypto: use finer-grained error sets in function signatures

Returning the `crypto.Error` error set for all crypto operations
was very convenient to ensure that errors were used consistently,
and to avoid having multiple error names for the same thing.

The flipside is that callers were forced to always handle all
possible errors, even those that could never be returned by a
function.

This PR makes all functions return union sets of the actual errors
they can return.

The error sets themselves are all limited to a single error.

Larger sets are useful for platform-specific APIs, but we don't have
any of these in `std/crypto`, and I couldn't find any meaningful way
to build larger sets.
2021-04-20 19:57:27 +02:00
Andrew Kelley
1e06a74348
Merge pull request #8542 from LemonBoy/floating-point-is-hard-my-dude
Floating point is hard my dude
2021-04-20 13:28:03 -04:00
LemonBoy
a5a3ad5e10 c: Minor cleanup
* Remove superfluous "test_" prefix in test names
* Use aliased isNan everywhere
2021-04-20 15:44:54 +02:00
LemonBoy
a4e2539b09 c: Implement fmax and fmaxf 2021-04-20 15:44:21 +02:00
LemonBoy
fcfe25710b c: Implement fmin and fminf 2021-04-20 15:43:46 +02:00
LemonBoy
c7c77fb1b0 c: Add tests for generic_fmod implementation 2021-04-20 15:43:01 +02:00
Hubert Jasudowicz
d605f02756 std: Add process_vm_readv/writev wrappers 2021-04-19 16:12:28 +02:00
Isaac Freund
4081e0a475 zig fmt: bypass auto indentation for // zig fmt: on
Currently an indented `// zig fmt: on` will be indented an additional
time on every run of zig fmt.
2021-04-17 20:10:20 -04:00
Isaac Freund
8e6865c8ee std/build: fix linker_allow_shlib_undefined
The relevant flags were renamed in 01a1365 but updating std.build
was overlooked.
2021-04-17 15:17:54 +02:00
Hubert Jasudowicz
5134fb72ef std: Add pidfd wrappers 2021-04-17 01:13:16 +02:00
daurnimator
99e7ba24b1 Add LibExeObjStep.linker_allow_shlib_undefined field to set --allow-shlib-undefined 2021-04-16 22:51:51 +02:00
Andrew Kelley
140d9df99b
Merge pull request #8506 from LemonBoy/test-c-file
build: Test the c.zig file too
2021-04-16 13:03:52 -04:00
Manuel Floruß
2cd49d20e8 Fix std.os.windows.user32.messageBoxW
Arguments to `selectSymbol` were passed in the wrong order.
2021-04-16 13:01:25 -04:00
Mahdi Khanalizadeh
d1a41feddc linux: fix number of arguments for tgkill syscall 2021-04-16 17:09:15 +02:00
Evan Haas
d4d21dd46d translate-c: better handling of int -> enum casts
In std.meta.cast when casting to an enum type from an integer type, first
do a C-style cast from the source value to the tag type of the enum.
This ensures that we don't get an error due to the source value not being
representable by the enum.

In transCCast() use std.meta.cast instead of directly emitting the cast
operation since the enum's underlying type may not be known at translation
time due to an MSVC bug, see https://github.com/ziglang/zig/issues/8003

Fixes #6011
2021-04-15 22:46:22 -04:00
LemonBoy
bd4421befe compiler-rt: Don't pass f16 around as arguments
Fixes some failures on AArch64.
f16 was a mistake.
2021-04-15 21:52:08 +02:00
LemonBoy
5bc1dc59e6 compiler-rt: Implement __trunctfhf2 2021-04-15 18:23:09 +02:00
LemonBoy
b29677dd12 compiler-rt: Implement __extendhftf2 2021-04-15 18:21:58 +02:00
LemonBoy
8e0b2f0e52 compiler-rt: Fix typo in implementation of fp truncation ops
The problem went unnoticed for years, yay.
2021-04-15 18:14:25 +02:00
Andrew Kelley
a38042e3ac ci: windows: proper flags to zig build 2021-04-15 02:02:36 -07:00
Andrew Kelley
04b8354702 freebsd: disable failing test
See #8538
2021-04-15 00:59:40 -07:00
lithdew
81adcd533e os/posix: handle ECONNRESET for write/writev 2021-04-14 16:40:06 -07:00
Andrew Kelley
5a3ea9bece Merge remote-tracking branch 'origin/llvm12'
Happy LLVM 12 Release Day.

Please note that the llvm 12 tag does not include the latest commit in
the release/12.x branch, which is in fact a bug fix for a regression
that is causing a failure in Zig's test suite.

Zig master branch is tracking release/12.x, and will be enabling the
test that is fixed by that commit.
2021-04-14 14:41:57 -07:00
LemonBoy
2ebd6bd706 std: Fix sqrt for u0/u1 input types 2021-04-14 17:53:27 +02:00
LemonBoy
ebf97627fd build: Test the c.zig file too
* Add some more tests for the sqrt/sqrtf implementations.
  The idea is to cross-check the software impl with the HW one whenever
  possible.
* Fix a broken test, oops.
2021-04-14 17:53:26 +02:00
Michael Dusan
28ae498254 dwarf: fix LineNumberProgram check
- on first iteration populate `prev_` fields and do nothing else

closes #8421
2021-04-12 17:18:56 -04:00
Andrew Kelley
c4c7cb252a
Merge pull request #8502 from xackus/std-docs
std docs: @This() in generic types
2021-04-12 11:37:00 -07:00
Michael Dusan
0fa1a2cb73
Revert "dwarf: fix LineNumberProgram check"
- needed/needs to go through review process

This reverts commit 746f65f8b3.
2021-04-12 06:55:12 -04:00
Michael Dusan
746f65f8b3
dwarf: fix LineNumberProgram check
- tolerate out-of-order DW_AT_ranges

closes #8421
2021-04-12 06:12:00 -04:00
xackus
ab991cab84 std docs: @This() in generic types 2021-04-12 09:31:45 +02:00