Commit Graph

6817 Commits

Author SHA1 Message Date
Andrew Kelley 034ccb4e4e add missing error code handling on Windows 2019-11-30 16:58:32 -05:00
Andrew Kelley 413f9a5cfc move std.fs.Dir.cwd to std.fs.cwd
update to non-deprecated std.fs APIs throughout the codebase

Related: #3811
2019-11-30 15:35:27 -05:00
Andrew Kelley d039fed831 introduce std.fs.Dir.openFile and std.fs.Dir.createFile
These functions have flags parameters which cover all the use cases. The
other functions are now deprecated.
2019-11-30 13:32:11 -05:00
Andrew Kelley 85e1e3b95f Merge pull request #3284 from Sahnvour/export_variables
Improved support for exporting variables
2019-11-30 00:25:52 -05:00
Andrew Kelley f980c29306 fix typo in error note for integer casting 2019-11-29 22:33:55 -05:00
Andrew Kelley a438a615e6 docs: this statement was in the wrong section 2019-11-29 12:41:07 -05:00
Andrew Kelley 2ab7f31e99 std.math: remove constants that should be expressions
All four of these can be represented in fewer characters with
expressions, which will be guaranteed to happen at compile-time, and
have the same or better precision.

The other math constants here which depend on function calls could be
similarly removed if and when #425 is solved. However I left them for
now since Zig does not eagerly evaluate functions with comptime parameters.
2019-11-29 10:48:46 -05:00
Quetzal Bradley a6c9c5f767 implement correct buffer wrapping logic in std.event.Channel 2019-11-27 23:09:24 -05:00
Michael Dusan ca61a5f0b7 Windows: fix test/standalone/shared_library
- on Windows use first found env var { "Path", "PATH" }

Bug Description: `build test` results in the following error on in
a msys64 shell with "PATH" env var instead of "Path":

    error while loading shared libraries: mathtest.dll:
    cannot open shared object file: No such file or directory
2019-11-27 19:24:06 -05:00
Felix Queißner f0d6447569 Implements std.testing.expectEqual for tagged unions. (#3773) 2019-11-27 16:35:32 -05:00
Andrew Kelley 0f2a9af4aa Merge pull request #3769 from MCRusher/initcapacity-for-buffer-arraylist
Add initCapacity for buffer & arraylist
2019-11-27 13:40:39 -05:00
Andrew Kelley 83c664eaa0 Merge pull request #3780 from Vexu/stage2-async-review
Update use of async functions in self hosted compiler
2019-11-27 13:38:49 -05:00
Vexu 4d8a8e65df add more workarounds 2019-11-27 10:17:37 +02:00
Andrew Kelley 63300a21dd Merge branch 'kprotty-event_lock'
closes #3751
2019-11-26 21:08:25 -05:00
kprotty ff445814cb remove wait timeout test cases 2019-11-26 20:40:28 -05:00
kprotty 056b5a26c9 ResetEvent: get abstime based on std.time 2019-11-26 20:40:28 -05:00
kprotty ca2d566ec8 replace ThreadParker with ResetEvent + WordLock mutex 2019-11-26 20:40:27 -05:00
kprotty a0955990dc fix ResetEvent windows bugs 2019-11-26 20:40:04 -05:00
kprotty ef208fee3c Definition fixups & ResetEvent test cases 2019-11-26 20:40:04 -05:00
kprotty 9bce97a479 Start on ResetEvent 2019-11-26 20:40:04 -05:00
Andrew Kelley 8ecd6c4d8c add compiler note for bad int coercion
closes #3724
2019-11-26 19:50:52 -05:00
syscall0 a6ef83cccf Fix build system crash when compiling windows dll 2019-11-26 15:40:31 -05:00
Vexu 0d55075de4 fix command functions not being async pointers 2019-11-26 22:38:05 +02:00
Vexu 798d05dd02 add workaround for #3190 2019-11-26 22:11:04 +02:00
Andrew Kelley 7de138ad7c std.elf: breaking improvements to the API
and also integration with std.Target.Arch
2019-11-26 14:25:35 -05:00
Benjamin Feng aca1367533 Optimize binary search algorithm 2019-11-26 13:09:58 -05:00
Vexu 128034481a solve recursion in self hosted 2019-11-26 18:25:29 +02:00
Vexu 36849d8a7b fixes and cleanup in self hosted 2019-11-26 11:52:12 +02:00
Andrew Kelley 76f21852f6 Merge branch 'gereeter-o_path'
closes #3743
2019-11-25 23:46:59 -05:00
Jonathan S ec569ff26a Or in O_DIRECTORY in openDirFlagsC to capture the fact that it is intended for opening directories 2019-11-25 23:46:48 -05:00
Jonathan S 8baf226d69 Add missing shortening of os.windows. 2019-11-25 23:46:48 -05:00
Jonathan S 4014a8e4b4 Avoid deprecated cwd-based functions for opening directories, preferring to open explicitly relative to Dir.cwd(). 2019-11-25 23:46:48 -05:00
Jonathan S 001334266a Don't pass FILE_LIST_DIRECTORY in openDirTraverseW. 2019-11-25 23:46:48 -05:00
Jonathan S 51c5740879 Use a specific access mask in Dir.openDirListW instead of a generic one. Untested.
The actual desired access mask in this case seems quite confusing and badly documented. The previous combination of `GENERIC_READ` and `SYNCHRONIZE` seems both illegal and redundant according to the [`ntifs.h` documentation](https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-ntcreatefile), which specifies that `GENERIC_READ` should not be used for directories and includes `SYNCHRONIZE`. `winnt.h` contains a number of relevant-sounding flags such as `FILE_ADD_FILE`, `FILE_ADD_SUBDIRECTORY`, and `FILE_DELETE_CHILD` that do not show up in documentation at all. These are equal in value to file-specific flags that are documented as flags you should not specify when opening a directory.
2019-11-25 23:46:47 -05:00
Jonathan S 07120c8745 Use O_PATH where available in std.fs.Dir.openPathTraverse. 2019-11-25 23:46:47 -05:00
Jonathan S 17bc1f62a5 Split std.fs.Dir.openDir into openDirList and openDirTraverse to clarify what directories can be iterated. Closes ziglang/zig#3741.
The Windows-inspired nomenclature of "List" and "Traverse" was chosen over POSIX-style "Read" and "Path" (from `O_PATH`) for clarity. Using "Path" makes it look like the function is manipulating strings, and the generic "Read" ending isn't useful when there is no generic read method. Even in implementation details, `read` is never used.

Actual exploitation of the difference between the two functions will come in a later commit.
2019-11-25 23:46:47 -05:00
Michael Dusan f96d818770 Merge pull request #3776 from mikdusan/stage1-intern-housekeeping
stage1: fix bad intern counting
2019-11-25 23:12:55 -05:00
daurnimator c0cb676745 std: refactor std/debug.zig DwarfInfo operations to be methods 2019-11-25 22:49:46 -05:00
Michael Dusan d20df7df09 stage1: fix bad intern counting 2019-11-25 20:41:17 -05:00
Andrew Kelley f8a2dec243 docs: update references to wasm_allocator 2019-11-25 19:30:41 -05:00
Michael Dusan 6b7e1085e3 Merge pull request #3774 from mikdusan/stage1-intern-housekeeping
stage1: consolodate interning
2019-11-25 19:19:32 -05:00
Michael Dusan fe254ea309 stage1: avoid building empty memory_profiling.cpp
During build an empty .o on macOS/Xcode emits warning:

    ranlib: file: zig_cpp/libcompiler.a(memory_profiling.cpp.o) has no symbols
    ranlib: file: zig_cpp/libcompiler.a(memory_profiling.cpp.o) has no symbols
2019-11-25 19:08:36 -05:00
Andrew Kelley 80f79cc9e8 Merge branch 'fengb-wasi-run-tests'
closes #3730
2019-11-25 18:46:35 -05:00
Andrew Kelley 4261fa3c49 move logic to the appropriate layers; add new compile error 2019-11-25 18:46:17 -05:00
Andrew Kelley 659c1bdeee Merge branch 'wasi-run-tests' of https://github.com/fengb/zig into fengb-wasi-run-tests 2019-11-25 17:53:26 -05:00
Andrew Kelley cb38bd0a14 rename std.heap.direct_allocator to std.heap.page_allocator
std.heap.direct_allocator is still available for now but it is marked
deprecated.
2019-11-25 17:25:06 -05:00
Michael Dusan 6c89f96df1 stage1: consolodate interning
- merge const_void_val → intern.x_void
- move const_zero_byte → intern.zero_byte
- wrap intern access
2019-11-25 17:18:56 -05:00
Andrew Kelley 35d65cceb8 Merge pull request #3502 from mikdusan/stage1-mem-diet
unembed ConstExprValue from IrInstruction and intern 1-possible-value types
2019-11-25 16:01:13 -05:00
Michael Dusan a647a88dfc const interning for 1-possible-value types 2019-11-25 15:04:49 -05:00
Michael Dusan 8f3e972da6 unembed ZigValue from IrInstruction 2019-11-25 15:04:39 -05:00