Commit Graph

1225 Commits (a4eaeee72011a2f7866a18420812178991feaf8d)

Author SHA1 Message Date
Nick Erdmann 6c368b9e73 std/os/uefi: device path protocol improvements 2020-03-12 23:23:02 +01:00
Nick Erdmann 9f475dae14 std/os/uefi: Add shell parameters protocol 2020-03-12 23:22:49 +01:00
Nick Erdmann 52eb4129de std/os/uefi: loaded image protocol improvements 2020-03-12 23:22:08 +01:00
Nick Erdmann e617e8a798 std/os/uefi: require guid output function be comptime 2020-03-12 23:22:08 +01:00
Nick Erdmann 7c12f93734 std/os/uefi: boot services and runtime services improvements
- Several function signatures added
- Add getNextVariableName sentinel termination annotation
2020-03-12 23:22:08 +01:00
Vexu 71d776c3be
add note to disabled tests, improve comptime cmpxchg 2020-03-12 22:42:01 +02:00
LemonBoy bd0b51477a Address review comments 2020-03-12 19:40:42 +01:00
Benjamin Feng 4aae55b4cc Replace fmt with new fmtstream 2020-03-12 10:41:09 -05:00
Benjamin Feng 786216ca5a Slap in workaround for Fifo 2020-03-12 10:41:09 -05:00
Benjamin Feng 6a53fe7c93 Handle potential downcast when translating stream size 2020-03-12 10:41:09 -05:00
Benjamin Feng 0059d9ee3e Convert fmt.bufPrint / fmt.allocPrint 2020-03-12 10:41:09 -05:00
Benjamin Feng 8dd078b99a Convert Buffer to use fmtstream 2020-03-12 10:41:09 -05:00
Benjamin Feng 2429fdd73b Convert JSON to fmtstream 2020-03-12 10:41:09 -05:00
Benjamin Feng 0fbccec000 Convert builtin to fmtstream 2020-03-12 10:41:04 -05:00
Benjamin Feng c11d1055b8 Integrated outstreams with new formatter 2020-03-12 10:26:28 -05:00
Benjamin Feng 7364e965f4 Force error coercion of custom formatters 2020-03-12 10:26:28 -05:00
Benjamin Feng d2e4aafd64 Fixup allocPrint 2020-03-12 10:26:27 -05:00
Benjamin Feng 1c18ab01a4 Add back max_depth test 2020-03-12 09:25:13 -05:00
Benjamin Feng f51c8f26c1 Apply explicit error type 2020-03-12 09:19:32 -05:00
Benjamin Feng 78d12762a9 Re-enable a bunch of tests 2020-03-12 09:15:49 -05:00
Benjamin Feng 8241b96f78 Re-enable testFmt 2020-03-12 09:06:12 -05:00
Benjamin Feng e1e9ff9546 Get formatIntBuf working 2020-03-12 09:06:10 -05:00
Benjamin Feng 278b9ec1aa Blind translation 2020-03-12 09:04:18 -05:00
Benjamin Feng ae3fb6df00 Copy fmtstream 2020-03-12 08:58:36 -05:00
LemonBoy 11df0d0cf8 std: Add setEndPos to fs.file
Allow the user to shrink/grow the file size as needed.
2020-03-12 09:43:45 +01:00
LemonBoy 89d7fc773d std: Fix pwrite invocation on 32bit architectures 2020-03-12 09:43:45 +01:00
Heppokoyuki 3f1c8e3d58 fix bug 2020-03-12 00:29:30 -04:00
Andrew Kelley 75e9a722db
Merge pull request #4714 from mikdusan/target
fix -target and -mcpu issues
2020-03-11 21:47:56 -04:00
Andrew Kelley 3ded862cdf
Merge pull request #4713 from Heppokoyuki/uefi-file-protocols
UEFI library improvements
2020-03-11 21:44:50 -04:00
Michael Dusan c988167377
update/apply CPU features when -mcpu native
- fix: features were not applied if cpu is specified as native
2020-03-11 19:33:11 -04:00
Andrew Kelley 06d2f53ece
windows: detect HANDLE_EOF in ReadFile 2020-03-11 17:39:53 -04:00
Andrew Kelley 3657a54618
fix regressions in elf parsing code 2020-03-11 17:34:12 -04:00
Andrew Kelley 6892865ba7
FixedBufferStream: match file semantics more by clamping pos 2020-03-11 16:14:12 -04:00
Andrew Kelley 04626c176b
Merge remote-tracking branch 'origin/master' into io-stream-iface 2020-03-11 15:47:07 -04:00
Andrew Kelley 431d76c023
add std.io.StreamSource and fixes to emitRaw 2020-03-11 15:40:34 -04:00
Andrew Kelley c71991c869
fix compilation errors for emitRaw 2020-03-11 14:34:13 -04:00
Andrew Kelley 51c6bb92b1
Merge pull request #4709 from LemonBoy/implement-2096
Stricter shift left/right safety checks
2020-03-11 14:22:40 -04:00
Andrew Kelley d96b6c0d9f
fix footguns in File readAll functions 2020-03-11 13:06:30 -04:00
Heppokoyuki 58941927c4 refactor 2020-03-12 00:24:00 +09:00
Heppokoyuki 02ba1d8fe1 add file protocols 2020-03-12 00:24:00 +09:00
Vexu 9262f065f5
Move abi size checking to codegen 2020-03-11 16:48:18 +02:00
Andrew Kelley ed13cffca4
rework some old ELF parsing code and start to fix emitRaw 2020-03-10 22:01:58 -04:00
Andrew Kelley bd14a81e30
fix std.ChildProcess on Windows 2020-03-10 21:09:49 -04:00
Andrew Kelley 2bff0dda79
fix regressions found by test suite 2020-03-10 20:22:30 -04:00
Andrew Kelley 9abee660dc
fix stack trace code not opening files in forced blocking mode 2020-03-10 19:28:05 -04:00
Andrew Kelley cd26d3b0bb
fix regressions caused earlier in this branch 2020-03-10 18:54:24 -04:00
LemonBoy 2f1052a313 std: Fix broken tests 2020-03-10 23:50:04 +01:00
Andrew Kelley 18f1fef142
update standard library to new I/O streams API 2020-03-10 18:44:30 -04:00
Michael Dusan 83f6f730cd std: simplify format enum-literals 2020-03-10 18:09:41 -04:00
Vexu ee5b00a8b9
use atomic bools in std lib 2020-03-10 22:54:47 +02:00
Andrew Kelley b6fbd524f1
(breaking) improve and simplify fixed buffer streams API 2020-03-10 16:31:04 -04:00
Andrew Kelley ba0e3be5cf
(breaking) rework stream abstractions
The main goal here is to make the function pointers comptime, so that we
don't have to do the crazy stuff with async function frames.

Since InStream, OutStream, and SeekableStream are already generic
across error sets, it's not really worse to make them generic across the
vtable as well.

See #764 for the open issue acknowledging that using generics for these
abstractions is a design flaw.

See #130 for the efforts to make these abstractions non-generic.

This commit also changes the OutStream API so that `write` returns
number of bytes written, and `writeAll` is the one that loops until the
whole buffer is written.
2020-03-10 15:32:32 -04:00
Vexu 1ad831a0ef fix zig fmt on noasync block 2020-03-10 15:27:11 -04:00
Jonathan Marler 90c232bbe8 add allocSentinel function 2020-03-10 15:03:59 -04:00
LemonBoy 3e93dce0a1 std: Fix detection of Linux kernel version 2020-03-10 12:55:35 -04:00
Andrew Kelley 638d5c3aca
Merge pull request #4700 from Vexu/noasync
Implement new noasync syntax
2020-03-09 18:36:01 -04:00
daurnimator 648f94c027 std: add some definitions for netlink sockets 2020-03-09 13:02:38 -04:00
Andrew Kelley 6ab156ce7d
Merge pull request #4695 from leroycep/feature-inode-stat
Expose file inode number on posix and file index on windows
2020-03-09 13:01:26 -04:00
Ryan Liptak 9b1b44b41c Windows: Fix std.fs.realpath/os.realpathW for directories 2020-03-09 12:59:17 -04:00
Vexu 03c1431f9c
disallow resume and suspend in noasync scopes 2020-03-09 15:51:51 +02:00
Vexu 6f8d732599
update parsers to new noasync syntax 2020-03-09 12:23:30 +02:00
LeRoyce Pearson 25d9ab95dd Use os.ino_t for everything
Also, define ino_t for windows
2020-03-08 21:52:36 -06:00
LeRoyce Pearson cb84875eed Define ino_t for systems not yet defining it
Also, use ino_t instead of u64 in fs.File.INode
2020-03-08 18:31:18 -06:00
LeRoyce Pearson e1c1ca9903 Add documentation about Stat.inode 2020-03-08 15:47:50 -06:00
LeRoyce Pearson 55077435bf Expose file inode (linux) and file index (windows) 2020-03-08 15:19:02 -06:00
LemonBoy 2b1316954f std: One more cpuid fix
Don't read from stale eax value, rework the logic a bit so that's clear
what's going on.
2020-03-08 12:43:32 -04:00
Jared Miller cf38ce9701 Implement UTF-8 to UTF-16LE literal conversion 2020-03-07 19:21:28 -05:00
Andrew Kelley 6ac76bc25e
add missing errors to std.os.windows.CreateDirectoryError 2020-03-07 19:13:21 -05:00
Andrew Kelley 0720f338d4
add std.event.Loop pread and faccessat
progress towards std lib tests passing with evented I/O mode
2020-03-07 19:13:21 -05:00
LemonBoy c5885f012a std: Fix version detection on x86
Call xgetbv only if X{SAVE,RESTORE} and AVX are detected.

Closes #4670
2020-03-07 18:53:34 -05:00
Andrew Kelley c25d9417d3
fix std.fs.makeDirAbsolute
closes #4671
2020-03-07 15:14:47 -05:00
Andrew Kelley 80ff549e26
fix detectNativeCpuAndFeatures including foreign asm 2020-03-06 21:03:23 -05:00
Andrew Kelley e0d5f94a70
simplify the inline assembly 2020-03-06 20:02:08 -05:00
Andrew Kelley 49817c6add
cleanup CPU model & feature detection
Add std.Target.Cpu.Model.generic which is even more empty than baseline.
CPU model and feature detection uses this rather than baseline.

Rename cpu_detected to cpu_detection_unimplemented and flip the logic.
It can be relied on by stage2.zig to decide whether the LLVM workaround
is needed without also checking the CrossTarget.

Move the CPU detection to after the OS detection, and use the detected
OS for the CPU detection. This is relevant because operating systems
sometimes emulate certain CPU features, so knowing the OS and version is
relevant for determining CPU features.

Prepare for #4592 by passing the CPU arch to the detection code, instead
of having it rely on Target.current.

The CPU model & feature detection logic is modified. Before:

 * Detect actual features
 * Use as hint when detecting CPU model
 * Populate dependencies of CPU model features
 * Merge that into the actual features set

After:

 * Detect actual features
 * Use as hint when detecting CPU model
 * Add known CPU model features to actual features
 * Detect actual features again, overriding known CPU model features
 * Populate dependencies
2020-03-06 19:47:03 -05:00
alichay f199182567
Cleaned up CPU detection and fixed incorrect detection bits. 2020-03-06 18:52:09 -05:00
alichay e24f29bbad
Added self-hosted x86 CPU detection. 2020-03-06 18:52:09 -05:00
Andrew Kelley 231a4b8fde
fixups & make some API decisions
Removed:
  std.io.InStream.readUntilDelimiterBuffer

Deprecated:
  std.ArrayList.toSlice
  std.ArrayList.toSliceConst
  std.ArrayList.at
  std.ArrayList.ptrAt
  std.ArrayList.setOrError
  std.ArrayList.set
  std.ArrayList.swapRemoveOrError
  std.Buffer.toSlice
  std.Buffer.toSliceConst
  std.io.InStream.readFull => std.io.InStream.readAll
  std.io.InStream.readAllBuffer

New:
  std.ArrayList.span
  std.ArrayList.expandToCapacity
  std.Buffer.span
  std.io.InStream.readUntilDelimiterArrayList
2020-03-06 18:49:13 -05:00
daurnimator 4114b63d75
std: use std.ArrayList instead of std.Buffer in std/fmt.zig tests 2020-03-06 18:49:13 -05:00
daurnimator 1cbf352cfb
Remove unused std.Buffer imports 2020-03-06 18:49:13 -05:00
daurnimator 5c0d6ef5ec
std: use ArrayList instead of Buffer from std/process.zig 2020-03-06 18:49:12 -05:00
daurnimator d136c795af
Fix bug where stdout was checked instead of stderr 2020-03-06 18:49:12 -05:00
daurnimator 8f627593eb
Use in_stream.readAllAlloc where sensible 2020-03-06 18:49:12 -05:00
daurnimator bcf56c32eb
std: use ArrayList rather than Buffer for in_stream helper functions
Buffer's behaviour of retaining a trailing 0 isn't helpful here
2020-03-06 18:49:12 -05:00
daurnimator fd23decbd9
std: add ArrayList.eql for parity with std.Buffer 2020-03-06 18:49:12 -05:00
daurnimator 119ac13eda
std: add .startsWith and .endsWith to std.ArrayList 2020-03-06 18:49:10 -05:00
Andrew Kelley fa46bcb368
stage1: make get_optional_type more robust
Now it will emit a compile error rather than crashing when the child
type has not been resolved properly.

Introduces `get_optional_type2` which should be used generally inside
ir.cpp.

Fix some std lib compile errors noticed by the provided test case.

Thanks @LemonBoy for the test case. Closes #4377.

Fixes #4374.
2020-03-06 18:30:30 -05:00
Andrew Kelley 7df9169081
Merge pull request #4651 from LemonBoy/fix-4645
std: Nicer way to access the PEB
2020-03-06 17:33:05 -05:00
Andrew Kelley 3163a16617
?HMODULE instead of HMODULE 2020-03-06 16:57:59 -05:00
LemonBoy 2e04b61275 std: Work around unexported NtCurrentTeb
Apparently NtCurrentTeb is only exported for i386 and some other
platforms but not for x86_64 nor AArch64. Let's go with the flow and
provide our own NtCurrentTeb like the Windows headers do.

Thank you Microsoft.
2020-03-06 09:17:14 +01:00
LemonBoy b9a1d67637 std: Nicer way to access the PEB
Use the NtCurrentTeb API instead of using some inline asm, this is much
nicer and also more portable.

Closes #4645
2020-03-06 09:06:26 +01:00
Michael Dusan d31b65e762 std: fix sendfile on macOS and FreeBSD
- fix std.os.sendfile/FreeBSD use correct in/out fd_t
- fix std.os.sendfile/macOS use correct in/out fd_t
- undo 1141bfb21b (no longer needed)
- fix c.freebsd.sendfile use off_t value
- fix c.freebsd.sendfile decl correct in/out fd_t
- fix c.darwin.sendfile decl correct in/out fd_t

fix signature param names
2020-03-05 20:46:28 -05:00
Michaël Larouche f5954dad83 Fix crash when freeing empty string as null-terminated sentinel 2020-03-05 17:08:12 -05:00
Michael Dusan 1091fee242 std: format enum-literals 2020-03-05 16:03:12 -05:00
daurnimator e9c3b65bf4
std: use testing.expectEqual in math.absCast tests 2020-03-05 16:02:26 +11:00
daurnimator 488ba1560f
std: fix math.absCast on i1 2020-03-05 16:00:19 +11:00
daurnimator 4f58bfe1a8
std: fix formatting of i1 integers 2020-03-05 15:52:19 +11:00
daurnimator d5359ea541
std: use testing.expectEqualSlices from tests 2020-03-05 15:51:21 +11:00
LemonBoy e029032251
std: Use @TypeOf(x,y) as return value for max 2020-03-04 17:21:10 -05:00
Andrew Kelley 6cbd1ac51a
zig is now aware of DragonflyBSD versions 2020-03-04 15:34:32 -05:00
pfg e3b37fc9c1 Generated documentation mobile support 2020-03-04 10:47:21 -05:00