Commit Graph

315 Commits

Author SHA1 Message Date
Andrew Kelley
cd5f4de2a6
std: remove O_LARGEFILE from OS bits when the OS does not define it 2019-11-21 20:34:55 -05:00
Andrew Kelley
bf1cbebea1 improve std.fs.selfExePath and related functions on Windows 2019-11-21 18:51:12 -05:00
Andrew Kelley
cd37c1a377
add std.fs.Dir.openRead
This is progress towards file system APIs that encourage avoiding
Time Of Check, Time Of Use bugs.
2019-11-21 17:07:29 -05:00
Andrew Kelley
874b34a30f
self-hosted tokenizer handles \r in string literals 2019-11-20 21:03:17 -05:00
Andrew Kelley
ed619245e9
remove dead code shebang support from self-hosted tokenizer 2019-11-20 20:18:19 -05:00
Johan Bolmsjö
ad77e93415 std.testing.expectEqual: show differing pointer values
Show differing pointer values when comparing pointers instead of the
content they point to.

It's confusing for a test to say "expected S{.x = 1}, found S{.x = 1}"
as illustrated below when it was the pointers that differed.

There seems to be different rules for when a pointer is dereferenced by
the printing routine depending on its type. I don't fully grok this but
it's also illustrated below.

    const std = @import("std");

    const S = struct { x: u32 };

    // before: ...expected S{ .x = 1 }, found S{ .x = 1 }
    // after:  ...expected S@7ffcd20b7798, found S@7ffcd20b7790
    test "compare_ptr_to_struct" {
        var a = S{.x = 1};
        var b = S{.x = 1};
        std.testing.expectEqual(&a, &b);
    }

    // before: ...expected u32@7fff316ba31c, found u32@7fff316ba318
    // after:  ...expected u32@7ffecec622dc, found u32@7ffecec622d8
    test "compare_ptr_to_scalar" {
        var a: u32 = 1;
        var b: u32 = 1;
        std.testing.expectEqual(&a, &b);
    }
2019-11-19 06:22:34 +00:00
dbandstra
b3539b40a6 add std.math.tau constant (equivalent to 2 * pi) 2019-11-19 06:20:20 +00:00
frmdstryr
aa4e92f3b3 Make StreamServer return address of accecpted client 2019-11-19 01:06:04 +00:00
Andrew Kelley
4dd3f42972
Merge pull request #3695 from daurnimator/towards-afd
Windows definitions
2019-11-17 23:17:48 +00:00
Andrew Kelley
57b8614a5a
Merge pull request #3697 from Vexu/container-docs
Implement container level doc comments
2019-11-17 22:31:12 +00:00
Andrew Kelley
8e3370367b
Merge pull request #3705 from daurnimator/fix-std.valgrind
std: fix outdated valgrind module
2019-11-17 22:29:17 +00:00
Vexu
6cddf9d723 properly parse anon literal in array 2019-11-17 22:24:21 +00:00
daurnimator
d870a68e68
std: add a couple of tests to valgrind module 2019-11-17 14:16:09 +11:00
daurnimator
7d582d0a00
std: fix missing @ptrToInt in valgrind.memcheck 2019-11-17 14:14:57 +11:00
daurnimator
41c72bb54c
std: fix use of old syntax in std.valgrind.memcheck 2019-11-17 14:14:57 +11:00
daurnimator
cc76494c42
std: use enum literals in valgrind module 2019-11-17 14:14:57 +11:00
daurnimator
4a3bb557f1
std: fix outdated valgrind module 2019-11-17 14:14:57 +11:00
Vexu
977b613881
add container doc comments to generated docs 2019-11-15 15:17:59 +02:00
daurnimator
431eeb5e20
std: add pieces for WSAIoctl on windows 2019-11-15 10:31:52 +11:00
daurnimator
3b8afe31a0
std: add NtDeviceIoControlFile definition for windows 2019-11-15 10:31:51 +11:00
daurnimator
6469900e79
std: add WSAStartup and WSACleanup for windows 2019-11-15 10:31:47 +11:00
Vexu
b92f42d1f4
implemented container doc comments in stage 2 2019-11-14 16:25:06 +02:00
daurnimator
4cf535a01b
std: add WSASocketW for windows 2019-11-14 17:09:22 +11:00
daurnimator
d9d3268cc1
std: add DeviceIoControl and GetOverlappedResult for windows 2019-11-14 17:09:21 +11:00
daurnimator
f4c6cc3270
std: add winsock some definitions 2019-11-14 17:09:19 +11:00
daurnimator
a832b35c19
std: add windows socket constants
Taken from https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw
2019-11-14 17:09:17 +11:00
daurnimator
be86e41d97
std: add CTL_CODE function for windows 2019-11-14 17:09:16 +11:00
daurnimator
4830415071
std: add FILE_ANY_ constants for windows 2019-11-14 17:00:09 +11:00
daurnimator
0270545edb
std: add windows ioctl transfer types 2019-11-14 17:00:07 +11:00
daurnimator
ef6cec983c
std: add windows FILE_DEVICE_ defines 2019-11-14 17:00:05 +11:00
Andrew Kelley
0237e7a701 std.io.getStdOut and related fns no longer can error
Thanks to the Windows Process Environment Block, it is possible to
obtain handles to the standard input, output, and error streams without
possibility of failure.
2019-11-13 04:01:40 +00:00
Andrew Kelley
8bae70454d
Merge pull request #3675 from Vexu/atomic-store
Add @atomicStore builtin
2019-11-13 03:06:55 +00:00
Andrew Kelley
37318bf151
fn parameters participate in result location semantics
See #3665
2019-11-12 18:55:17 -05:00
Vexu
f0c94d95dd
use @atomicStore in std lib 2019-11-13 00:52:15 +02:00
Sahnvour
956ba8b0e7
Merge pull request #3447 from Sahnvour/vcpkg
build: initial support for using vcpkg libraries
2019-11-12 20:16:01 +01:00
Vexu
5194fc57d1
use enum with atomics in std lib 2019-11-12 17:55:54 +02:00
Andrew Kelley
d4e6a6d5e2
zig fmt: support anon struct and anon list init syntax 2019-11-11 13:12:45 -05:00
Andrew Kelley
5b27943498
implement anon struct literal syntax
This implements stage1 parser support for anonymous struct literal
syntax (see #685), as well as semantic analysis support for anonymous
struct literals and anonymous list literals (see #208). The semantic
analysis works when there is a type coercion in the result location;
inferring the struct type based on the values in the literal is not
implemented yet. Also remaining to do is zig fmt support for this new
syntax and documentation updates.
2019-11-11 13:11:58 -05:00
Andrew Kelley
ae0a219d1f
stop accepting deprecated use keyword
closes #2591
2019-11-11 13:02:39 -05:00
Felix Queißner
cd5c9c8998 Fix missing @as cast in std.fmt.formatInt (#3650) 2019-11-10 23:08:24 +00:00
Andrew Kelley
d44a69689e
std.ChildProcess.spawn has a consistent error set
across targets. Also fix detection of pkg-config not
installed on Windows when using zig build.
2019-11-10 15:40:27 -05:00
Andrew Kelley
891e2149b0
Merge pull request #3635 from lun-4/unify-unix-sockets
std.net: add unix socket support to Address and StreamServer
2019-11-10 20:40:19 +00:00
Luna
c8a8da2804 remove builtin.os check in Address.initUnix 2019-11-10 16:44:18 -03:00
Luna
d1eabe81a9 add sockaddr_un to os/bits/windows 2019-11-10 14:38:33 -03:00
Luna
d99ecef943 replace panic to unreachable
- remove error.UnsupportedOS from StreamServer.listen
2019-11-10 14:17:39 -03:00
Luna
2d02920a90 use hasDecl instead of switch on builtin.os 2019-11-10 14:04:52 -03:00
dimenus
98e37537d1 minor fix due to recent directory handling API changes 2019-11-10 16:34:31 +00:00
Luna
25423eb453 add errors/panics for unsupported OSes 2019-11-10 10:50:22 -03:00
Luna
e4704f68f8 use at-as 2019-11-09 15:10:39 -03:00
Luna
fc2e8f92b2 Merge remote-tracking branch 'upstream/master' into unify-unix-sockets 2019-11-09 15:07:09 -03:00