Commit Graph

1913 Commits (0a9672fb86b84658f8780f57e769be45e41f3034)

Author SHA1 Message Date
Jens Goldberg 20c1696865 Removed GetModuleHandleA from user32
GetModuleHandleA is an kernel32 function and already defined there, it doesn't belong in user32.
2020-05-07 12:38:46 -04:00
Jens Goldberg 25810bc1e6 Removed duplicate WM_ACTIVATE 2020-05-07 12:38:46 -04:00
Jonathan Marler 0a76e11617 add failAllocator to enable some regression tests 2020-05-06 23:56:48 -06:00
Jonathan Marler 0c7397b49f fix copy/paste error in AllocWithOptionaPayload 2020-05-06 23:08:08 -06:00
Timon Kruiper b336dda076 Standard library: Fix a regression in loop.waitUntilFdWritableOrReadable
This broke async io on linux.
Regressed in 8ebcca6734
2020-05-06 13:14:06 -04:00
data-man 3c4abacba6 Optimization of vectors hashing 2020-05-06 17:08:49 +05:00
Vexu 0e30edd8d0
std: handle ConnectionTimedOut in switch
regression from #5266
closes #5270
2020-05-06 12:52:26 +03:00
Andrew Kelley 6f3d76f61e simplify test-evented-io build setting 2020-05-05 15:18:04 -04:00
Haze Booth a39cb034ea Add setUseTestEventedIO for test steps in build.zig 2020-05-05 15:16:54 -04:00
Andrew Kelley b13a02ed1a avoid unnecessary fcntl syscalls when setting socket flags 2020-05-05 12:50:50 -04:00
Andrew Kelley 0a2104689b fix incorrect flags being set in os.setSockFlags
fixes networking stuff on darwin
2020-05-05 12:45:39 -04:00
Tadeo Kondrak 84a0a9688c
update docs/tests for async/extern fn removal 2020-05-05 10:31:32 -06:00
StrangeBug 54088fe6e1 Add support for external links and URL to markdown parser. 2020-05-05 18:09:32 +02:00
Tadeo Kondrak 6745a6f6f6
zig fmt 2020-05-05 09:38:02 -06:00
Tadeo Kondrak d0e996405b
add zig fmt fix for async/extern fn 2020-05-05 09:37:59 -06:00
Tadeo Kondrak 7ada59f873
remove nakedcc/stdcallcc/async fn/extern fn fnproto 2020-05-05 09:37:28 -06:00
Jakub Konka 81d824bf80 Clear PreopenList on every populate call 2020-05-05 17:23:49 +02:00
Andrew Kelley e6955688ac
Merge pull request #5272 from tadeokondrak/noasync-to-nosuspend
Noasync to nosuspend
2020-05-05 11:21:02 -04:00
Jakub Konka 07a968b344 Add docs 2020-05-05 17:05:30 +02:00
Jakub Konka 558bb24601 Move preopen and path wasi helpers to std.fs.wasi module
Previously, the path and preopens helpers were prototyped in `std.os.wasi`
module, but since they are higher-level abstraction over wasi, they belong in
`std.fs.wasi` module.
2020-05-05 15:08:52 +02:00
Jakub Konka d4c33129cf Shuffle things around; add PreopenList.findByPath method
This commit removes `std.os.openatWasi` function, and renames it to
`std.os.wasi.openat`. Additionally, the added `PreopenList.findByPath`
method allows querying the list for a matching preopen by path.
2020-05-05 15:08:52 +02:00
Jakub Konka dd238352a4 Encapsulate getPreopens inside PreopenList 2020-05-05 15:08:52 +02:00
Jakub Konka fc77e393fd Remove obsolete PATH_MAX const 2020-05-05 15:08:52 +02:00
Jakub Konka b8112b3d17 Simplify File constructors 2020-05-05 15:08:52 +02:00
Jakub Konka 8bce1b6981 Refactor resolve_preopen into getPreopens function
This commit refactors `std.os.wasi.resolve_preopen` into a (higher-level)
`std.os.wasi.getPreopens` funtion which returns a slice with _all_
preopens at any given time. This fn allows the WASI module to
inquire at any given time for all preopens provided by the runtime.

This commit also makes `cwd()` a compile error on WASI.
2020-05-05 15:08:52 +02:00
Jakub Konka 05fb3e79fe Make std.fs.cwd() return preopen for "." if exists
This commit adds WASI specific impl of `std.fs.cwd()` in which we
emulate the `cwd` behaviour by inquiring the runtime for a "."
preopen if available. This is OK for simple relative ops, but will
not work for any ops which require absolute paths.
2020-05-05 15:08:52 +02:00
Jakub Konka 8e1cd69717 Implement std.fs.Dir.openFileWasi
It seems that `std.os.openZ` is too POSIX-specific, so I think it
should not be a point of entry for WASI `open` call. I figure
WASI should be treated as a separate "os" that's _not_ POSIX
especially given the incoming changes in the ephemeral snapshot.
2020-05-05 15:08:52 +02:00
Jakub Konka d7ca220121 Start drafting out openZ 2020-05-05 15:08:52 +02:00
Tadeo Kondrak fdfdac4939
update comments for nosuspend 2020-05-05 05:55:27 -06:00
Tadeo Kondrak af00afed98
zig fmt 2020-05-05 05:55:25 -06:00
Tadeo Kondrak 8d5636ebe4
Rename noasync to nosuspend in self-hosted, add rewriter 2020-05-05 05:17:33 -06:00
Haze Booth 4cb4097b08
Update ErrorUnion thread spawn result to return null instead of 0 2020-05-05 04:15:43 -04:00
Vexu f127dee474
Merge pull request #5267 from Vexu/const-call
Fix missing compile error on call assigned to const
2020-05-04 21:45:15 +03:00
Jonathan Marler 75b699b2c6 os.zig: add ETIMEDOUT error case to read function
According to documentation ETIMEDOUT (110) is a valid error code for the read function.  I just had my long-running  (been running for about 7 weeks) network program crash because it did not handle the ETIMEDOUT error code from "read".
2020-05-04 13:48:34 -04:00
Vexu 85fd484f07
std: fix blake3 assignment to constant 2020-05-04 14:45:36 +03:00
Cato 9b788b765c Pass filtered_sock_type to system.socket. Cover PermissionDenied error 2020-05-03 15:35:36 -04:00
daurnimator 277d088558
std: use async for MultiOutStream 2020-05-03 18:33:04 +10:00
Andrew Kelley 8a8beefa36 solve the problem with Darwin shims in std.os instead
* implement SOCK_NONBLOCK and SOCK_CLOEXEC Darwin shims in std.os
 * revert changes to std.net
 * remove os.accept and rename os.accept4 to os.accept
2020-05-02 17:36:28 -04:00
Tadeo Kondrak a62e9bc8e5
Implement @Type for ErrorSet 2020-05-02 14:39:32 -06:00
Tadeo Kondrak 647901b4a8
Constify TypeInfo 2020-05-02 14:39:31 -06:00
Tadeo Kondrak ca6db2d008
Implement @Type() for EnumLiteral and FnFrame 2020-05-02 14:39:28 -06:00
Cato 07bee9da42 Fixed Darwin-incompatible socket flags and unavailable system calls 2020-05-02 16:37:39 -04:00
Andrew Kelley 03a7124543
Merge pull request #5249 from ziglang/FireFox317-windows-evented-io
fix behavior test with --test-evented-io on windows
2020-05-02 16:29:58 -04:00
Andrew Kelley b7914d901c add test coverage for top level fields
closes #2022
2020-05-02 14:53:20 -04:00
Andrew Kelley 7998e2b0f4 Merge remote-tracking branch 'origin/master' into FireFox317-windows-evented-io 2020-05-02 14:16:59 -04:00
Chris Heyes 8ebcca6734
Get evented io code paths to build on macOS (#5233)
* Get evented io code paths to build on macOS
* Use mode_t instead of usize where appropriate
2020-05-02 14:14:46 -04:00
Andrew Kelley 5656f5090d fs.File: improve handling async I/O on Windows
Before it was possible for .intended_io_mode = .blocking,
.capable_io_mode = .evented, and then the implementation would put a
request on the fs thread, which is the wrong behavior. Now it always
calls the appropriate WriteFile/ReadFile function, passing the intended
io mode directly as a parameter.

This makes the behavior tests pass on Windows with --test-evented-io.
2020-05-02 14:09:17 -04:00
Andrew Kelley 9dac8a5be9 update windows impl of child process to new File API 2020-05-02 04:31:26 -04:00
nycex 77376a54bf
correct usages of std.fs.dir.DeleteFileError (#5058)
* correct usages of std.fs.dir.DeleteFileError

* test std.fs.createFileAbsolute() and std.fs.deleteFileAbsolute()
2020-05-02 04:19:07 -04:00
Andrew Kelley 428065da30
Merge pull request #5243 from niacat/kern-arand
Avoid reading from /dev/urandom on NetBSD
2020-05-02 04:16:24 -04:00
Andrew Kelley 6546c74825 child process: no need to remove O_CLOEXEC before execve 2020-05-02 03:38:05 -04:00
Andrew Kelley beebcbb677 Merge remote-tracking branch 'origin/master' into FireFox317-windows-evented-io 2020-05-02 01:53:24 -04:00
Andrew Kelley 43f7856bac fix regressions in windows std lib tests 2020-05-02 01:25:22 -04:00
Andrew Kelley 2272a07ca0 std.event.Loop: promote the fs thread to be available for all OS's 2020-05-02 00:41:19 -04:00
Andrew Kelley 45bce27b8f cleanup and fixes. behavior tests passing with evented I/O 2020-05-01 23:17:28 -04:00
Andrew Kelley 988031c07c Merge branch 'windows-evented-io' of https://github.com/FireFox317/zig into FireFox317-windows-evented-io 2020-05-01 19:02:16 -04:00
Andrew Kelley 3386bb896d
Merge pull request #5192 from ziglang/stage2-tests
add ZIR compare output test case to test suite
2020-05-01 17:35:52 -04:00
Andrew Kelley 94b0d0e802 std.progress: handle error from FillConsoleOutputAttribute
I observed this returning an error. Fall back to not doing
terminal stuff if an error occurs here.

See #5244
2020-05-01 15:14:44 -04:00
Cato Auestad 5418efa1e5 Added socket bits for Darwin 2020-05-01 14:28:33 -04:00
Andrew Kelley ec6ef86219 fix off-by-one error in sizeInBaseUpperBound 2020-05-01 13:33:46 -04:00
nia 14a954f350 Add arc4random_buf() in NetBSD libc, use it to implement getrandom() 2020-05-01 17:22:27 +01:00
Andrew Kelley 4044a77621 update std.meta.IntType => std.meta.Int 2020-05-01 06:49:30 -04:00
Andrew Kelley 8766821157 rework std.math.big.Int
Now there are 3 types:
 * std.math.big.int.Const
   - the memory is immutable, only stores limbs and is_positive
   - all methods operating on constant data go here
 * std.math.big.int.Mutable
   - the memory is mutable, stores capacity in addition to limbs and
     is_positive
   - methods here have some Mutable parameters and some Const
     parameters. These methods expect callers to pre-calculate the
     amount of resources required, and asserts that the resources are
     available.
 * std.math.big.int.Managed
   - the memory is mutable and additionally stores an allocator.
   - methods here perform the resource calculations for the programmer.
   - this is the high level abstraction from before

Each of these 3 types can be converted to the other ones.

You can see the use case for this in the self-hosted compiler, where we
only store limbs, and construct the big ints as needed.

This gets rid of the hack where the allocator was optional and the
notion of "fixed" versions of the struct. Such things are now modeled
with the `big.int.Const` type.
2020-05-01 06:47:56 -04:00
Andrew Kelley f89dbe6c4e link: introduce the concept of output mode and link mode 2020-05-01 06:47:20 -04:00
Andrew Kelley 28729efe29 ZIR: implement return instruction 2020-05-01 06:47:20 -04:00
Andrew Kelley 6b0f7de247 ZIR: add cmp and condbr instructions 2020-05-01 06:47:20 -04:00
Andrew Kelley 2bae942800 add ZIR compare output test case to test suite 2020-05-01 06:47:20 -04:00
Jakub Konka b23a87953a Fast-forward std.os.bits.wasi to match preview1 snapshot ABI
`wasi_snapshot_preview1` introduced a couple of ABI changes. This
commit fast-forwards the types and consts defined in `std.os.bits.wasi`
to match those changes.
2020-04-30 13:28:50 -04:00
wozeparrot 9d79f39844 switch anyerror to OutOfMemory 2020-04-30 12:14:17 -04:00
Vexu 7192ca14b7
Merge pull request #5216 from alexnask/windows_ansi_codes
Progress will now use ANSI escape codes on windows for terminals that support them
2020-04-30 18:35:55 +03:00
Vexu e72f45475d
Merge pull request #4683 from LakeByTheWoods/parser_test
Add visible newlines to parser_test output when there's a failure.
2020-04-30 12:04:23 +03:00
Vexu 611bd8e9f4
Merge pull request #5213 from tadeokondrak/evented-readv-fix
Fix std.event.Loop.readv
2020-04-30 11:00:27 +03:00
Vexu 87c9696121
move printWithVisibleNewlines to testing.expectEqualStrings 2020-04-30 10:34:18 +03:00
Vexu 2d06e731ec
rename diffIndex to indexOfDiff 2020-04-30 10:33:50 +03:00
Jakub Konka 611a1436f0 Update WASI snapshot to preview1
This commit updates the WASI imports to use `wasi_snapshot_preview1`
instead of the old `wasi_unstable`. There are some minor ABI
differences between the two, however, the main motivator for using
the latest "stable" snapshot (aka preview1) is that, at least in
Wasmtime, there has been a lot of improvement work put into preview1
and unfortunately I might add, the improvements were not (in full)
backported to `wasi_unstable` snapshot.

Also, this commit removes the optional bound on the pointer to
`environ_get` syscall.
2020-04-30 01:52:12 -04:00
Alexandros Naskos 61ba52b9e3 Add unreachable branch 2020-04-29 20:07:23 +03:00
wozeparrot bfb40972a9 build.zig recursive dep support 2020-04-29 12:54:06 -04:00
Alexandros Naskos 273d2de099 Progress will now use ANSI escape codes on windows for terminals that support it 2020-04-29 19:49:02 +03:00
Tadeo Kondrak 07c1be80c2
Fix std.event.Loop.readv 2020-04-29 04:33:29 -06:00
Tadeo Kondrak 350b2adacd
std.meta.IntType -> std.meta.Int 2020-04-28 19:11:31 -06:00
Tadeo Kondrak eb183ad9fe
rename std.meta.IntType to std.meta.Int
Closes https://github.com/ziglang/zig/issues/5194
2020-04-28 19:11:18 -06:00
Andrew Kelley 5929e5ca0e
Merge pull request #5196 from tadeokondrak/@vector-to-@type-vector
`@Vector` -> `@Type(.Vector)`
2020-04-28 16:25:40 -04:00
Tadeo Kondrak f977155fdb
@Vector -> std.meta.Vector 2020-04-28 00:47:13 -06:00
Tadeo Kondrak ee5b358d71
add std.meta.Vector to replace @Vector 2020-04-28 00:24:46 -06:00
Tadeo Kondrak 17e41f6cd3
@OpaqueType -> @Type(.Opaque) 2020-04-28 00:02:13 -06:00
wozeparrot 01605a7742 add missing const to pkg dependencies 2020-04-27 18:29:55 -04:00
Žiga Željko 130435a17a Split AES struct into AESEncrypt and AESDecrypt 2020-04-28 04:52:42 +08:00
Andrew Kelley 1e04e85200 std: support `/` in Windows paths 2020-04-27 13:39:06 -04:00
Andrew Kelley 41e17106cd zig fmt: still print the relative path
The previous commit made zig fmt print absolute paths; this commit keeps
the absolute path resolution but still prints the relative paths to
stdout.
2020-04-27 13:38:19 -04:00
Auguste Rame 0df82889cf
Fix issue with std.json incorrectly replacing forward slashes with a backslash (#5167)
* fix breaking typo in json.zig

* add tests
2020-04-27 12:22:43 -04:00
Nick Appleton 28c31a8429
Fix f64 variants of math.cosh and math.sinh to accept negative inputs. (#5172)
* add tests for negative inputs to cosh32 and cosh64. fix bug in cosh64 for negative inputs.

* fix problem with negative input with f64 sinh and add tests
2020-04-26 14:03:19 -04:00
daurnimator 122b992a95
std: add io.MultiOutStream 2020-04-27 02:50:32 +10:00
Andrius Mitkus 6481b02fdc std: fix posix Thread.spawn to accept all startFn types 2020-04-25 16:15:25 -04:00
daurnimator 1d6e53756b
std: add in_stream.isBytes 2020-04-25 20:42:13 +10:00
daurnimator b531c0e676
std: add instream.readBytesNoEof function 2020-04-25 20:38:46 +10:00
Andrew Kelley 7634e67ba5
Merge pull request #5158 from ziglang/zir-to-elf
beginnings of (non-LLVM) self-hosted machine code generation and linking
2020-04-24 15:37:21 -04:00
Andrew Kelley 9ebf25d145 link: change default executable mode to 0o777
Jonathan S writes:

On common systems with a 022 umask, this will still result in a
file created with 755 permissions, but it works appropriately if the
system is configured more leniently. (As another data point, C's fopen
seems to open files with the 666 mode.)
2020-04-24 15:36:08 -04:00
Timon Kruiper c829f2f7b7 Add mips support to standard library 2020-04-24 15:28:55 -04:00
xackus ebbd137a0e fix json.WriteStream.emitJson 2020-04-23 22:14:23 +02:00
Andrew Kelley a3dfe36ca1 zir-to-elf skeleton 2020-04-22 23:42:58 -04:00
Michael Dusan 9a06f966cd
Merge pull request #5125 from mikdusan/kern.osproductversion
macos: add fallback version detection
2020-04-22 15:57:29 -04:00
Andrew Kelley e8545db9d4
Merge pull request #5130 from ziglang/stage2-ir
beginnings of non-LLVM self-hosted backend
2020-04-22 14:42:46 -04:00
Andrew Kelley 173a143dd0
Merge pull request #5133 from LemonBoy/win-progress
Progressbar for Windows
2020-04-22 12:52:48 -04:00
LemonBoy 0a2519fafb stage2: Allow \t in string literals
Lift the ban on literal tab chars in string literals as they have
nothing to do with code formatting.
2020-04-22 12:48:45 -04:00
LemonBoy 155e631aa6 std: Implement progress for Windows
Use the Win32 API instead of using the VT escape sequences.
2020-04-22 12:58:02 +02:00
Andrew Kelley 1eda2ada9a std.math.big.Int: don't rely on the allocator when printing 2020-04-22 03:49:50 -04:00
Andrew Kelley 2cdbb5f472 ir: analyze int casting 2020-04-21 19:48:59 -04:00
Michael Dusan 3df0a3a528
macos: add fallback version detection
Fallback to sysctl `kern.osversion` when `kern.osproductversion` is not
available (prior to 10.13.4) .

The mapping from `sw_vers -buildVersion` to `-productVersion` is
formulaic from 10.8 to 10.15 and older is handled with switch.

closes #5119
2020-04-21 18:37:03 -04:00
Haze Booth 78e2a203e3 Remove std.lazyInit 2020-04-21 18:04:37 -04:00
Andrew Kelley 22e7ca5613 ir: analysis of fn instruction 2020-04-21 16:06:15 -04:00
Robin Voetter 32e5248820 Remove old-style @typeOf compatibility 2020-04-20 22:38:29 -04:00
Andrew Kelley cc1c2bd568 simplify ZIR spec; separate parsing/rendering from analysis 2020-04-20 19:21:03 -04:00
Andrew Kelley 91ca0e4b02 implement rendering escaped zig string literals 2020-04-19 20:33:15 -04:00
Vexu b6fe839248
update std lib to decls being disallowed between fields 2020-04-18 23:56:05 +03:00
LemonBoy 6c907a3509 std: Introduce the Once synchronization primitive
The Once object allows the user to execute a function just once in a
thread-safe way.
2020-04-18 15:48:32 -04:00
Andrew Kelley 3817420d42 ziggurat uses `@truncate` instead of `& 0xff`
This makes it work on 32-bit targets.

closes #2939
2020-04-18 14:41:33 -04:00
Andrew Kelley ca38b18879 rand: ref the decls so they get tested 2020-04-18 14:41:25 -04:00
Charles Shenton e073c8a2b1 Update ziggurat.zig to use `random.int(u64)`
Ziggurat rng was using deprecated `random.scalar(u64)` which was causing compile errors on calls to public facing stdlib APIs (randExp) on 0.6+, this fixed those errors.
2020-04-18 14:39:36 -04:00
Christian Wesselhoeft 344f4d9bc5 std.os.readv: Add missing iov_count declaration 2020-04-18 14:32:52 -04:00
LemonBoy a4b1242f0a build: Create the output directory if it doesn't exist
Fixes #5054
2020-04-17 05:12:42 -04:00
LemonBoy 4872311364 debug: Minor QOL improvements for osx
* Handle FileNotFound errors when searching for .o files
* Use the STAB symbol name when everything else fails
2020-04-16 16:21:54 -04:00
Andrius Mitkus 157f566f2d std: make math.clamp work for common uses, remove automatic bounds swapping 2020-04-16 16:19:12 -04:00
joachimschmidt557 3fd38429e4 Enable formatting in std.big.Int.format 2020-04-15 12:51:43 -04:00
Vexu ca3bf6e6ad
translate-c cleanup and zig fmt 2020-04-15 15:15:32 +03:00
Jakub 1e23a3cd91 Added gdi32.zig and More user32 definitions 2020-04-14 16:20:48 -04:00
markfirmware 5974a88794 Update emit_raw.zig 2020-04-14 16:19:01 -04:00
Lachlan Easton 0122f2cff6 Translate C: Redo Add comment containing c source location for failed decls. 2020-04-14 22:13:43 +10:00
daurnimator d29ed2a785 std: fix StreamSource to disallow writing to a const buffer 2020-04-13 13:26:13 -04:00
Pierre Guilleminot f31e0d9834 docs: use String.repeat for dom templates 2020-04-13 14:03:44 +02:00
daurnimator b702964ae2
std: fix os.fstatat definition (#5016) 2020-04-13 00:45:39 -04:00
Andrew Kelley b8796be79d disable flaky event loop test
See #4922
2020-04-12 23:02:39 -04:00
Pierre Guilleminot 297452cf67 improve search perf: trim search results 2020-04-12 23:17:20 +02:00
Pierre Guilleminot f76d59ef76 improve search perf: batching dom list mutations 2020-04-12 23:13:57 +02:00
Heppoko a3b2de1d1e
fix file protocol structure definitions (#5015) 2020-04-12 16:45:11 -04:00
daurnimator 8e9e126d41 std: add some basic windows user32 definitions 2020-04-12 02:28:52 -04:00
xackus dbc00e2424 ArrayList: remove old (before span) API 2020-04-11 20:40:34 -04:00
Andrew Kelley 4ceaa0595a move fs tests to separate file; disable flaky test
See #5006
2020-04-11 17:50:38 -04:00
Andrew Kelley a6e288d5fe
Merge pull request #4711 from leroycep/feature-file-locks
Add lock option to File.OpenFlags and File.CreateFlags
2020-04-10 15:00:45 -04:00
LemonBoy 72dca05f5c debug: Fix parsing of DWARF info for BE machines
Tested with ppc32
2020-04-10 14:59:19 -04:00
Lachlan Easton daff072af2 Add visible newlines to parser_test output when there's a failure.
Also print first line that differs between expected and result.
2020-04-10 10:38:36 +10:00
Yuri Pieters f5f77089b7 sort.binarySearch: Remove unneeded edge case check 2020-04-09 09:13:47 +01:00
Yuri Pieters b7e72cc421 sort.binarySearch: test for regresson of #4980 2020-04-09 02:00:08 +01:00
Yuri Pieters 447dc2bb90 sort.binarySearch: fix integer underflow (#4980)
When the key was smaller than any value in the array, an error was
ocurring with the mid being zero and having 1 subtracted from it.
2020-04-09 01:58:57 +01:00
LeRoyce Pearson 5951211d3f Reduce file lock test sleep time 2020-04-08 18:03:52 -06:00
LeRoyce Pearson d4161e1667 Close file1 in nonblocking lock test 2020-04-08 16:42:11 -06:00
LeRoyce Pearson 772bb1ade3 Disable open flock flags on darwin
The tests were put into a deadlock, and it seems that darwin doesn't
support `O_SYNC`, though it supports `O_NONBLOCK`. It shouldn't block
even with that, but I'm not sure why else it would fail.
2020-04-08 16:38:58 -06:00
LeRoyce Pearson d0d7895d33 Return error from `else`
That removes the other switch cases (`error.WouldBlock` here) from the
error set, I think.
2020-04-08 08:37:17 -06:00
LeRoyce Pearson 45d6fb9e36 Catch error.WouldBlock as unreachable 2020-04-08 00:39:17 -06:00
Andrew Kelley b3aef49eea
zig provides shlwapi.lib for *-windows-gnu
closes #3711
2020-04-08 01:21:00 -04:00
LeRoyce Pearson 858aefac7f Add `OpenFileW` `share_access_nonblocking` parameter 2020-04-07 21:26:46 -06:00
Phil Schumann b109186dd5
std/zig/parse_string_literal.zig: add hex+unicode escapes (#4678) 2020-04-07 20:27:18 -04:00
LeRoyce Pearson 317f06dc77 Add lock_nonblocking flag for creating or opening files
Also, make windows share delete access. Rationale: this is how it works
on Unix systems, mostly because locks are (usually) advisory on Unix.
2020-04-07 18:00:12 -06:00
LeRoyce Pearson 117d15ed7a Fix file locking on windows
The share_access bitfield was being ORed with what was supposed to be
parts of the default value, meaning that the share_access would be
more permissive than expected.
2020-04-07 16:49:37 -06:00
LeRoyce Pearson 71c5aab3e7 Make lock option an enum
For some reason, this breaks file locking on windows. Not sure if this is
a problem with wine.
2020-04-07 16:49:30 -06:00
xackus 721c76b53c refactor common pattern into a function 2020-04-07 23:37:33 +02:00
xackus bf46117f13 std lib docs: fix null and int values 2020-04-07 23:37:01 +02:00
Andrew Kelley 4d290758bb
fix compile errors in some std.Target functions
The `ve` architecture needed to be added to a couple switch statements.
2020-04-07 15:06:58 -04:00
Andrew Kelley 22dbeab29d
Merge pull request #4857 from LemonBoy/fix-4777
Rewrite the bound checks in slice operator
2020-04-07 14:51:25 -04:00
Andrew Kelley 87a7ea4c42
Merge pull request #4971 from Vexu/const-ref
Fix missing const on address of literal
2020-04-07 14:24:50 -04:00
joachimschmidt557 1ee59c5c31 move big.rational.gcd to big.int.gcd 2020-04-07 13:43:15 -04:00
Michael Neumann 2b9cef1e04 Add missing constants for DragonFly 2020-04-07 17:23:20 +02:00
Vexu 95fefcd4c9
fix broken tests 2020-04-07 16:56:48 +03:00
LeRoyce Pearson 28d71c97d1 Fix compile error on darwin 2020-04-06 23:19:39 -06:00
LeRoyce Pearson 20597c8596 Only call `os.flock` on systems that lack openat locks 2020-04-06 22:28:43 -06:00
LeRoyce Pearson 49886d2e45 Remove return value from os.flock() 2020-04-06 22:07:27 -06:00
LeRoyce Pearson 798207ec80 Merge branch 'master' into feature-file-locks 2020-04-06 21:51:57 -06:00
Andrew Kelley fc662ddd54
mingw-w64: add 32-bit version.def
fixes -lversion on 32-bit windows builds
2020-04-06 20:31:00 -04:00
Andrew Kelley 9ed00b3829
provide ___mb_cur_max_func for i386-windows-gnu 2020-04-06 19:26:31 -04:00
LemonBoy a0b73c9f02 compiler-rt: Separate max size allowed for load/store and CAS
The v6m ISA has no way to express a CAS loop natively without turning
off the interrupts or using the kernel cmpxchg harness.

On such a platform the user has to provide a few __sync_* builtins to
satisfy the linker.
2020-04-06 12:52:53 -04:00
Andrew Kelley 28d9696617 use mingw-w64 to provide -luuid if requested 2020-04-05 23:06:47 -04:00
Benjamin Feng cb98984ae6 Generate clearer size mismatch error message 2020-04-05 18:38:19 -04:00
LemonBoy eff7555d5d
std: Delete a hack in the feature set code
Now that bitwise not works on vectors we can simplify the code.
2020-04-05 18:34:31 -04:00
daurnimator e9e43ed0d3
compiler_rt/atomics: be consistent with `const value` 2020-04-05 14:08:25 +10:00
daurnimator f947444362
Tidy up compiler_rt/atomics 2020-04-05 14:06:12 +10:00
xackus cd20e0cc67 rename mem.separate to mem.split 2020-04-04 17:37:51 -04:00
Andrew Kelley d02838b71a
add libutil to zig's glibc support 2020-04-04 14:43:51 -04:00
Felix (xq) Queißner 12cdea4525 Adds some documentation to std.atomic.Queue. 2020-04-04 13:47:07 -04:00
Andrew Kelley e89c42655c
Merge pull request #4868 from xackus/new-arraylist-api
new ArrayList API
2020-04-03 22:31:15 -04:00
Andrew Kelley e03cbb117e
compiler-rt: don't forget to export these functions 2020-04-03 16:07:32 -04:00
LemonBoy ed69821f5b
compiler-rt: Add the __atomic family of builtins
The implementation was checked against a few files using std::atomic and
compiled using zig c++.

Closes #4887
2020-04-03 16:04:44 -04:00
markfirmware 203d6554b1 Update fmt.zig 2020-04-03 12:12:40 -04:00
Ryan Liptak 08a9ab4d8c Update all remaining uses of &outStream().stream 2020-04-03 12:12:23 -04:00
LemonBoy dc54e50db2 std: Fix one more sentinel buffer overrun 2020-04-03 12:03:36 +02:00
LemonBoy aa5865b9be std: Fix oob slicing operator 2020-04-03 10:58:39 +02:00
LeRoyce Pearson ea32a7d2bc Fix compile errors about adding error.FileLocksNotSupported 2020-04-03 00:27:34 -06:00
LeRoyce Pearson 4dd0822a36 Add LOCK_* constants to BSD `os/bits` 2020-04-02 23:50:12 -06:00
LeRoyce Pearson 733f1c25bd Fix compile errors in stage2 2020-04-02 23:39:25 -06:00
LeRoyce Pearson ea6525797d Use `flock` instead of `fcntl` to lock files
`flock` locks based on the file handle, instead of the process id.
This brings the file locking on unix based systems closer to file
locking on Windows.
2020-04-02 22:57:02 -06:00
LeRoyce Pearson e7cf3f92a9 Add FileLocksNotSupported error to OpenError 2020-04-02 22:12:45 -06:00
LeRoyce Pearson f757f0ea59 Merge branch 'master' into feature-file-locks 2020-04-02 21:47:41 -06:00
LeRoyce Pearson 35c462caf0 Merge branch 'master' into feature-file-locks 2020-04-02 21:46:48 -06:00
Jay Petacat 0dbf8aaab8
crypto: fix benchmark compile error (#4919) 2020-04-02 23:46:46 -04:00
Andrew Kelley 8bf7cffe29
slight modification of the semantics of std.os.getenvW
Now, this function first attempts a case-sensitive lookup.
If no match is found, and `key` is ASCII, then it attempts a
second case-insensitive lookup.

It is not planned to support full Unicode case-insensitivity
on Windows, and in fact relying on non-ASCII case-insensitive
environment variables is fundamentally problematic.
2020-04-02 15:04:42 -04:00
Ilmari Autio ba1a8b64c4
make std.os.getenvW case insensitive
partially addresses #4603

Fixing std.process.getEnvMap is NOT included in this commit.
2020-04-02 13:01:32 -04:00
xackus 7a28c644aa new ArrayList API: fix everything else 2020-04-02 16:12:08 +02:00
xackus d3ab0eb28d new ArrayList API: fix ArrayList.shrink 2020-04-02 15:15:20 +02:00
xackus 93a20f2e82 new ArrayList API: fix std.ArrayListSentineled 2020-04-02 15:14:28 +02:00
xackus dd570dbc0d new ArrayList API, fix enough std lib to test 2020-04-02 15:14:18 +02:00
daurnimator 34524a1792
std: add LinearFifo().inStream 2020-04-02 21:14:15 +11:00
daurnimator 2a031c8825
std: LinearFifo matches ArrayList in always having outStream method 2020-04-02 21:07:44 +11:00
Timon Kruiper eefb0a36c0 Fix CrossTarget.parse test on platforms where abi != gnu
Closes #4902
2020-04-01 18:05:49 -04:00
Andrew Kelley 2e806682f4
(breaking) std.Buffer => std.ArrayListSentineled(u8, 0)
This new name (and the fact that it is a function returning a type) will
make it more clear which use cases are better suited for ArrayList and
which are better suited for ArrayListSentineled.

Also for consistency with ArrayList,
 * `append` => `appendSlice`
 * `appendByte` => `append`

Thanks daurnimator for pointing out the confusion of std.Buffer.
2020-04-01 13:30:07 -04:00
Andrew Kelley 553f0e0546
fixups and revert a few things 2020-04-01 11:56:39 -04:00
daurnimator e535057364
std: use std.ArrayList(u8).OutStream instead of std.Buffer.OutStream 2020-04-01 10:36:38 -04:00
daurnimator 37e6a64690
std: use Buffer.outStream in std/child_process.zig 2020-04-01 10:36:38 -04:00
daurnimator ecbc235403
std: use std.ArrayList(u8) instead of std.Buffer in std/build.zig 2020-04-01 10:36:38 -04:00
daurnimator bb5383cf00
std: don't return sentinel slices from cross_target functions 2020-04-01 10:36:38 -04:00
daurnimator 0ee2462a31
std: add std.ArrayList(u8).outStream() 2020-04-01 10:36:38 -04:00
Andrew Kelley e8a1e2a1d8
Merge pull request #4894 from LemonBoy/netbsd-p2
More NetBSD bits
2020-04-01 10:24:54 -04:00
Andrew Kelley d23f9a164e
Remove unneeeded address-of operator 2020-04-01 10:21:17 -04:00
Vincent Rischmann 748b2c72a3
io: fix COutStream test 2020-04-01 13:13:47 +02:00
LemonBoy 5047cd3d78 Workaround for #4789 2020-04-01 12:46:16 +02:00
Vincent Rischmann f46121b8fc
io: fix serialization compilation and tests 2020-04-01 12:37:02 +02:00
Vincent Rischmann eddf491bf4
io: fix PeekStream compilation 2020-04-01 12:26:49 +02:00
Vincent Rischmann 318abaad02
io: test all files under std/io 2020-04-01 12:24:09 +02:00
LemonBoy 4209ab90a8 std: Use the versioned libc symbols if needed
Many symbols on NetBSD and some on OSX require the definition of an
alias.
2020-04-01 12:23:18 +02:00
LemonBoy 070ace4b22 std: Fix more NetBSD bits
Fix some more libc definitions.
2020-04-01 12:11:19 +02:00
Sebastian 92a423739d mem.zeroes - add sentinel terminated array support 2020-04-01 10:08:29 +01:00
Michaël Larouche a5af78c376 Fix porting of zlib alder32 with large input 2020-03-31 20:08:42 -04:00
Andrew Kelley d34a3c66b3
Merge pull request #4543 from daurnimator/cleanup-json
std.json improvements
2020-03-31 12:07:25 -04:00
Andrew Kelley 28b7306a31
Merge pull request #4880 from daurnimator/use-spanZ
Take advantage of mem.spanZ accepting null
2020-03-31 11:57:31 -04:00
Andrew Kelley d9d8c42426
remove unnecessary `inline`
works around a bug triggered by previous commit
2020-03-31 11:18:11 -04:00
daurnimator 3cf302a71d
Tidy up some mem.spanZ use-sites now that null is accepted 2020-04-01 01:50:34 +11:00
Andrew Kelley 0e372ccff5
clean up the duplicate export logic for __clear_cache 2020-03-31 10:48:48 -04:00
daurnimator b1eb831aba
std: fix mem.span* when an optional pointer is passed 2020-04-01 01:44:55 +11:00
LemonBoy e9c49f423d
compiler-rt: More clear_cache implementations 2020-03-31 10:36:12 -04:00
Tetralux d57b5205c6 Fix std.fifo.LinearFifo
- Fix undeclared variable in 'writeItem'
- Clarify docs of `read` regarding bytes vs. items
- Normalize 'writeable' to 'writable' (the more common parlance)
2020-03-31 10:18:58 -04:00
daurnimator 63409cf422 std: linux syscall numbers are now an extensible enum 2020-03-31 10:16:20 -04:00
Andrew Kelley 839d85e440 fixes to 32-bit handling, to support 32-bit arm 2020-03-31 10:10:31 -04:00
daurnimator 7a3d700fd9
std: introduce json.WriteStream.stringify 2020-04-01 00:13:00 +11:00
daurnimator 42cabe4366
std: use json.StringifyOptions.Whitespace from json.WriteStream 2020-04-01 00:12:59 +11:00
daurnimator a32d88f12c
std: add support to std.json.stringify for null literals 2020-04-01 00:12:59 +11:00
daurnimator 62fbb6b874
std: allow picking between serialising []u8 as string or array 2020-04-01 00:12:59 +11:00
daurnimator edf487b126
std: add options to std.json.stringfy to control escaping 2020-04-01 00:12:59 +11:00
daurnimator 17f5d04bed
std: use json.stringify logic in some json.WriteStream code paths 2020-04-01 00:12:59 +11:00
daurnimator 5a053247e2
std: use stringify from Value.dump; remove other dump helpers 2020-04-01 00:12:59 +11:00
daurnimator e88543a504
std: add jsonStringify trait to json Value objects 2020-04-01 00:07:31 +11:00
daurnimator 48e7c6cca6
std: add whitespace control to json.stringify 2020-03-31 23:57:00 +11:00
daurnimator 3a0875d9e8
std: have json tests take options parameter 2020-03-31 23:19:24 +11:00
Andrew Kelley 83ff94b1cc
compiler-rt: don't export __clear_cache when no impl available 2020-03-30 23:15:07 -04:00
Timon Kruiper f6f03cd90f compiler-rt: implement clear_cache for arm32-linux 2020-03-31 00:29:41 +02:00
Andrew Kelley 9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
Sebastian ef419dd72d mem.zeroes .Array improvements
Before (when given an array with many elements):
```
zig\std\mem.zig:345:13: error: evaluation exceeded 1000
backwards branches
            for (array) |*element| {
            ^
```
related to https://github.com/ziglang/zig/issues/4847#issuecomment-605721461
2020-03-30 11:16:25 -04:00
daurnimator 3be720a729 std: mem span functions can take an optional pointer 2020-03-30 11:04:58 -04:00
daurnimator 8cad453495 std: fix compile error since WinsockError was changed 2020-03-30 11:02:06 -04:00
LemonBoy 1ef6f068f5 compiler-rt: Implement all the shift builtins
* Unify all the code paths with a generic function
* Add some EABI aliases

Closes #4853
2020-03-30 10:58:47 -04:00
daurnimator 9bc8a1e1d0 std: add some missing errnos on linux 2020-03-30 10:55:18 -04:00
daurnimator 356ef3840f std: update for linux 5.6 release 2020-03-30 10:55:18 -04:00
Michael Raymond de9933761c std.zig.render: fix newlines before DocComments 2020-03-29 22:41:39 -04:00
Andrew Kelley b717df786b
Merge pull request #4845 from xackus/fix-parseFloat
fix overflow in parseFloat and cleanup
2020-03-29 22:40:32 -04:00
xackus 6809222d32 cleanup parse_float.zig 2020-03-29 20:52:25 +02:00
Andrew Kelley c70471fae6
enable now-passing test cases
These can now be enabled thanks to bug fixes that landed in
LLVM 10.
2020-03-29 10:34:12 -04:00
xackus d1202b1f66 fix overflow in parseFloat 2020-03-29 11:50:41 +02:00
Sebastian 2b0d66736a tcpConnectToHost - fixed compilation error
before:
```
std\net.zig:403:23: error: type '@TypeOf(std.net.getAddressList).ReturnType.ErrorSet!*std.net.AddressList' does not support field access
    const addrs = list.addrs.toSliceConst();
                      ^
```
2020-03-28 21:34:50 -04:00
LeRoyce Pearson 457f557c37
Merge branch 'master' into feature-file-locks 2020-03-28 17:24:19 -06:00
Luna 2028b4ce91 Fix typo in Serializer declaration 2020-03-28 12:01:29 -04:00
LemonBoy d788b0cd8b std: Minor changes to TLS handling
* Always allocate an info block per-thread so that libc can store
  important stuff there.
* Respect ABI-mandated alignment in more places.
* Nicer code, use slices/pointers instead of raw addresses whenever
  possible.
2020-03-28 11:20:38 -04:00
Andrew Kelley 107b5196f6
Merge pull request #4827 from ziglang/zig-cpp
support compiling and linking c++ code
2020-03-27 22:35:13 -04:00
LemonBoy 0512be227c compiler-rt: Fix __floatunditf
This builtin converts a u64 into a f128, not a u128 into a f128.

Fixes some weird-ass crashes that happened only on AArch64 systems.
2020-03-27 20:10:59 +01:00
LeRoyce Pearson c7f4e68464
Merge branch 'master' into feature-file-locks 2020-03-27 11:32:33 -06:00
Andrew Kelley f407109070
zig c++: get it working with musl and mingw-w64 2020-03-27 12:38:52 -04:00
Timon Kruiper 67e51311c3 fix behavior test with --test-evented-io on windows
also make simple file operations work asynchronously on windows
2020-03-27 17:03:06 +01:00
Andrew Kelley ed0dbe1a64
add libc++ and libc++abi sources
upstream: LLVM 10
2020-03-26 22:41:26 -04:00
Jonathan S cf4cbea88e Factor out arbitrary constant 12 to AtomicFile.RANDOM_BYTES 2020-03-26 15:07:40 -05:00
Jonathan S a779a96d38 In AtomicFile, work relative to the destination's parent directory. This is more robust against concurrent filesystem reorganization and avoids path length issues. 2020-03-25 23:22:36 -05:00
Andrew Kelley f7f563ea53
Revert "Merge pull request #4807 from LemonBoy/tls-touchups"
This reverts commit ee6fda2297, reversing
changes made to f313ab18ae.

This caused a test failure:

```
behavior.misc.test "behavior-arm-linux-none-Debug-bare-multi thread local variable"...test failure
/home/vsts/work/1/s/lib/std/testing.zig:191:14: 0x4608f in std.testing.expect (test)
    if (!ok) @panic("test failure");
             ^
/home/vsts/work/1/s/test/stage1/behavior/misc.zig:616:11: 0x53e93 in behavior.misc.test "behavior-arm-linux-none-Debug-bare-multi thread local variable" (test)
    expect(S.t == 1235);
          ^
```
2020-03-25 21:12:24 -04:00
Andrew Kelley fae6cf0961
improved handling of native system directories
* `-isystem` instead of `-I` for system include directories
   fixes a problem with native system directories interfering with zig's
   bundled libc.
 * separate Stage2Target.is_native into Stage2Target.is_native_os and
   Stage2Target.is_native_cpu.
2020-03-25 20:34:15 -04:00
Michael Dusan dd66fbb96a
Merge pull request #4811 from mikdusan/fix4634
self-hosted: use fs.selfExePathAlloc
2020-03-25 19:49:52 -04:00
Benjamin Feng 9dbfee49d7 Carry-over stream error to JSON.stringify 2020-03-25 18:54:04 -04:00
Andrew Kelley ee6fda2297
Merge pull request #4807 from LemonBoy/tls-touchups
std: Minor changes to TLS handling
2020-03-25 18:53:04 -04:00
Michael Dusan d554070de1
self-hosted: use fs.selfExePathAlloc
- add fs.selfExePathAlloc
- use fs.selfExePathAlloc instead of fs.selfExeDirPathAlloc
- remove redundant code from fs.selfExeDirPath

closes #4634
2020-03-25 18:40:28 -04:00
Andrew Kelley 3869e80331
Merge pull request #4793 from LemonBoy/netbsd-forever
Netbsd forever
2020-03-25 10:19:49 -04:00
LemonBoy abcd9ac9d0 Use const instead of var 2020-03-25 12:37:44 +01:00
LemonBoy a34f67aa66 std: Minor changes to TLS handling
* Always allocate an info block per-thread so that libc can store
  important stuff there.
* Respect ABI-mandated alignment in more places.
* Nicer code, use slices/pointers instead of raw addresses whenever
  possible.
2020-03-25 12:08:50 +01:00
LemonBoy 778dbc17ac std: Fix setsockopt definition
* Add socketpair definition
2020-03-24 16:06:25 -04:00
LemonBoy 3ccf99c0bd std: Slim duplicate logic for some calls 2020-03-24 19:47:18 +01:00
LemonBoy cc774c603b compiler-rt: Add __divtf3 2020-03-24 18:08:53 +01:00
LemonBoy 4e95662a4a std: Add qNaN constants 2020-03-24 18:08:53 +01:00
Andrew Kelley 39589cffe0
compiler-rt: fix __clear_cache on aarch64 darwin 2020-03-24 11:51:13 -04:00
Andrew Kelley 03013e5176
compiler-rt: aarch64 implementation of __clear_cache 2020-03-24 10:33:23 -04:00
Andrew Kelley 93c7fa105f
Merge remote-tracking branch 'origin/llvm10'
LLVM 10 was released today
2020-03-24 09:57:09 -04:00
LeRoyce Pearson 1a6c3aeec9 Block until file is unlocked on windows 2020-03-23 23:20:17 -06:00
LeRoyce Pearson 8bec1304c3 Fix compile error on windows 2020-03-23 22:34:00 -06:00
LeRoyce Pearson 113b217593 Merge branch 'master' into feature-file-locks 2020-03-23 21:39:16 -06:00
Joachim Schmidt 5acc8afb5f
Use math.Order for comparing bigints instead of i8 (#4791) 2020-03-23 23:16:57 -04:00
LeRoyce Pearson 0b93932a21 Add O_SHLOCK and O_EXLOCK to freebsd and netbsd 2020-03-23 21:07:50 -06:00
LeRoyce Pearson 5b278fb606 Use locking open flags if they are defined 2020-03-23 20:59:09 -06:00
LemonBoy c3f93be00c std: Tell pthread the guard page size is zero
On NetBSD this is needed to avoid crashes in pthread_join as the default
value for the guard page size is not ignored even though a custom stack
address is specified.
2020-03-23 23:26:34 +01:00
LemonBoy d6739b1397 std: Fix undefined field error 2020-03-23 23:26:21 +01:00
LemonBoy b21d3535a5 std: Fix parameters for pthread_attr_setstack
The guard page size shouldn't be taken into account, pthread is only
interested in the usable area.
2020-03-23 20:12:10 +01:00
LemonBoy 09a5f172f8 std: Different thread stack allocation for NetBSD
* NetBSD is stricter than other OSs and doesn't allow mprotect to mark a
  non-accessible region as RW
* Fix mprotect call over the whole stack, oops
2020-03-23 19:50:29 +01:00
LemonBoy cda73c3c18 std: Add missing C bits and defines for NetBSD 2020-03-23 18:55:45 +01:00
LemonBoy 761602e3e8 std: Use getdents on all the BSDs
* Use the correct versioned libc calls to avoid nasty surprises
2020-03-23 18:54:14 +01:00
LemonBoy 336ed03f0f debug: Accept relative paths in mapWholeFile 2020-03-23 18:51:49 +01:00
LemonBoy 27344464ed std: Add missing C defines for NetBSD 2020-03-23 18:47:40 +01:00
Andrew Kelley 13d04f9963
Merge pull request #4741 from momumi/master
allow `_` separators in number literals (stage 1)
2020-03-23 00:54:54 -04:00
Andrew Kelley e5e5196d8e
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-22 20:48:21 -04:00
momumi 2d18178c27 minor fixes and more tests for _ separators
* Make the tokenizer spit out an Invalid token on the first invalid
  character found in the number literal.
* More parsing and tokenizer tests for number literals
* fix invalid switch statement in ir.zig
2020-03-23 09:21:34 +10:00
LemonBoy 9d19d9008e debug: Correct version check in debug_line parser
Version 3 is similar to version 2 plus more opcodes.
2020-03-22 19:19:41 -04:00
Andrew Kelley 23c263776c
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-22 15:09:29 -04:00
momumi 8de45e5143 update parsing of int literals in self-hosted
* update std.math.big.Int.setString() to ignore underscores and make it
  case insensitive
* fix issue in ir.zig with leading zeroes in integer literals
2020-03-22 13:59:14 +10:00
dbandstra a8fa1ecd89 fix build.zig addBuildOption function for stream refactor 2020-03-21 23:18:09 -04:00
momumi 29324e6f39 fix formatting in tokenizer tests 2020-03-22 12:41:11 +10:00
momumi 138dab4524 add number `_` separators for stage 2 tokenizer 2020-03-22 10:35:19 +10:00
LemonBoy 28dbc58837 Address review comments 2020-03-21 09:54:49 +01:00
LemonBoy 128e70ff3a ir: Allow errdefer with payload
Closes #1265
2020-03-21 09:54:49 +01:00
Andrew Kelley 3a2c490889 "generate .h files" feature is no longer supported in stage1 2020-03-20 18:33:36 -04:00
Andrew Kelley ef69e4efa0
Merge branch 'mt-panic' of https://github.com/LemonBoy/zig into glibc-add-ld 2020-03-20 13:02:19 -04:00
Andrew Kelley 245dc9d930
include ld symbols when generating glibc dummy objects
closes #4748
2020-03-20 12:59:37 -04:00
LemonBoy 541e763010 ir: Peer type resolution between ?[]T and *[N]T
Closes #4767
2020-03-20 12:23:05 -04:00
Andrew Kelley 53b5aa812b
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-19 22:19:24 -04:00
Andrew Kelley 28a6c136e9
revert std.mem.span to prefer len over sentinel; add spanZ 2020-03-19 19:30:09 -04:00
Andrew Kelley dc04e97098
Merge pull request #4752 from ziglang/slice-array
slicing with comptime start and end indexes results in pointer-to-array
2020-03-19 18:06:16 -04:00
Andrew Kelley 6b6f2fcf96
std.net: remove the hack from earlier in the branch 2020-03-19 15:09:52 -04:00
Andrew Kelley f614d94faa
update std lib to take advantage of slicing with comptime indexes 2020-03-19 14:48:47 -04:00
Andrew Kelley 555a2c0328
(breaking) std.fs.copyFile now integrates with Dir
Removed:
 * `std.fs.updateFile`
 * `std.fs.updateFileMode`
 * `std.fs.copyFile`
 * `std.fs.copyFileMode`

Added:
 * `std.fs.Dir.copyFile`
 * `std.fs.copyFileAbsolute`
 * `std.fs.updateFileAbsolute`

Moved:
 * `std.fs.Dir.UpdateFileOptions` => `std.fs.CopyFileOptions`

Deprecated:
 * `std.fs.deleteDir`
 * `std.fs.deleteDirC`
 * `std.fs.deleteDirW`
 * `std.fs.readLink`
 * `std.fs.readLinkC`
2020-03-19 14:43:41 -04:00
Andrew Kelley 1d7861a36e
fix incorrect sentinel check 2020-03-19 13:18:14 -04:00
Andrew Kelley 61266d2621
test & docs fixups to work with new semantics 2020-03-19 09:53:55 -04:00
Andrew Kelley 7fa88cc0a6
std lib fixups for new semantics
std lib tests are passing now
2020-03-19 09:53:55 -04:00
Andrew Kelley b5dba702ff
fixes to std.meta
behavior tests are passing now
2020-03-19 09:53:55 -04:00
Andrew Kelley 8ea0a00f40
improve std lib code for the new semantics 2020-03-19 09:53:54 -04:00
Andrew Kelley 8d0ac6dc4d
`@ptrCast` supports casting a slice to pointer 2020-03-19 09:53:54 -04:00
Andrew Kelley 0707be8de8
fixes in semantic analysis needed to support this feature 2020-03-19 09:53:54 -04:00
Andrew Kelley 46ffc798b6
fix swapped logic for Windows
Remove `std.fs.deleteTree`. Callers instead should use
`std.fs.cwd().deleteTree`.

Add `std.fs.deleteTreeAbsolute` for when the caller has an absolute
path.
2020-03-18 16:42:47 -04:00
Andrew Kelley 27affde592
(breaking) clarify openDir API
* remove deprecated `std.fs.Dir` APIs
 * `std.fs.Dir.openDir` now takes a options struct with bool fields for
   `access_sub_paths` and `iterate`. It's now much more clear how
   opening directories works.
 * fixed the std lib and various zig code calling the wrong openDir
   function.
 * the runtime safety check for dir flags is removed in favor of the
   cheaper option of putting a comment on the same line as handling
   EBADF / ACCESS_DENIED, since that will show up in stack traces.
2020-03-18 16:10:57 -04:00
LemonBoy c45fe2759f
build: Fix silly bug in directory traversal 2020-03-18 13:45:52 -04:00
LemonBoy e15605e1c1
std: Safety check for iterate()
Calling iterate() on a Dir object returned by openDirTraverse is always
an error.
2020-03-18 13:45:52 -04:00
LemonBoy 4843c3b4c3
std: Introduce fnctl wrapper 2020-03-18 13:45:52 -04:00
LemonBoy 11a4ce42c1
zig fmt: Respect trailing commas in error set declarations
The logic is not perfect as it doesn't take into account the presence of
doc comments, but it's an improvement over the status quo.
2020-03-18 11:15:22 -04:00
LemonBoy 013ada1b59 std: More type checks for Thread startFn return type
Closes #4756
2020-03-18 10:37:35 -04:00
Andrew Kelley dbde5df568
clean up some self-hosted bitrot + don't assume libstdc++
closes #4682

The self-hosted compiler is still bit rotted and still not compiling
successfully yet. I have a more serious rework of the code in a
different branch.
2020-03-17 23:03:45 -04:00
LeRoyce Pearson 613956cc47 Remove `fcntlFlock` and replace with plain `fcntl` 2020-03-17 21:02:19 -06:00
LeRoyce Pearson 32c5825030 Match netbsd's flock fields with others 2020-03-17 20:54:38 -06:00
LeRoyce Pearson b773a8b175 Make `fcntlFlock` follow conventions of `os.zig` 2020-03-17 20:53:43 -06:00
Jonathan Marler 7251eb1681 fix a couple sockfds to be fd_t rather than i32
Using i32 causes compile errors on Windows because it uses *c_void rather than i32 for it's fd_t type.
2020-03-17 12:46:07 -04:00
LeRoyce Pearson 4532f5ecad Change fcntl params to ?*c_void
As recommended by LemonBoy
2020-03-16 21:50:52 -06:00
Timon Kruiper 6a15d668ee Change the default stdin behavior of RunStep to .Inherit
This behaves the same as stdout and stderr behavior which also
default to .inherit. Also adds a field to RunStep to change the behavior.

Since this is a breaking change, previous behavior can be restored by doing:
`RunStep.stdin_behavior = .Ignore`.
2020-03-16 17:23:53 -04:00
LemonBoy 582991a5a8 build: Expose function-sections switch 2020-03-16 13:06:50 -04:00
Andrew Kelley a2432b6755
Merge pull request #4735 from ziglang/renameat
zig build system: correctly handle multiple output artifacts
2020-03-15 17:28:12 -04:00
Andrew Kelley a27a8561e9
adjust renameatW to always supply dest root dir
this fixes tests for wine
2020-03-15 17:26:29 -04:00
Andrew Kelley 7e45a3ef6a fix typo in new mem.len test 2020-03-15 15:57:51 -04:00
Andrew Kelley e369789062 fix std.os.renameatW
Ask for DELETE access when opening the source file.

Additionally, when the source and dest dir are the same, pass null
for RootDirectory.
2020-03-15 15:47:42 -04:00
Andrew Kelley 6c2b23593b fix std.mem.span handling of sentinel-terminated arrays
previously this function would use the array length, but now it scans
the array looking for the first sentinel that occurs.
2020-03-15 15:46:56 -04:00
Andrew Kelley 701aaf0ddf
renameatW: handle more windows nt status codes 2020-03-15 14:46:09 -04:00
Andrew Kelley 0a69a10f2a
Merge pull request #4740 from Vexu/cleanup
Cleanup and a fix in self-hosted parser
2020-03-15 14:18:33 -04:00
momumi 880d8fc380 fix Serializer to work with new OutStream API 2020-03-15 14:17:16 -04:00
momumi 7aac21c6f5 allow `_` separators in number literals (stage 1)
* Underscores `_` may be placed between two digits in a int/float literal
* Consecutive underscores are not allowed
* Fixed parsing bug in exponents of hexadecimal float literals.
  Exponents should always be base 10, but hex characters would be parsed
  inside the exponent and everything after them would be ignored. eg:
  `0x1.0p1ab1` would be parsed as `0x1.0p1`.
2020-03-15 12:38:35 +10:00
LeRoyce Pearson 819537d70a Skip file lock test in single threaded mode 2020-03-14 20:36:26 -06:00
LeRoyce Pearson 947abb7626 Fix compile error on windows 2020-03-14 17:13:46 -06:00
Vexu 57f9f07558
use anon literals in ast.zig and parse.zig 2020-03-15 01:11:58 +02:00