Commit Graph

1560 Commits (a32d3a85d21d614e5960b9eadcd85374954b910f)

Author SHA1 Message Date
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
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
daurnimator d29ed2a785 std: fix StreamSource to disallow writing to a const buffer 2020-04-13 13:26:13 -04: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
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
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