Commit Graph

1111 Commits

Author SHA1 Message Date
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
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
Andrew Kelley
1cf3209cb8
Merge pull request #4623 from ziglang/update-glibc
Update glibc to 2.31
Closes #4459.
2020-03-04 09:01:19 -05:00
Andrew Kelley
447a89cd4d
update self-hosted zig targets to print correct glibc availability 2020-03-04 01:05:42 -05:00
Andrew Kelley
cd33c5bfe8
zig build: update InstallRawStep to new std.fs API
closes #4622
2020-03-04 00:00:42 -05:00
Andrew Kelley
3b235cfa80
std.zig.CrossTarget: fix compile errors
closes #4620
2020-03-03 21:09:32 -05:00
Andrew Kelley
1141bfb21b Darwin can return EBADF for sendfile on non-files 2020-03-03 16:52:32 -05:00
Andrew Kelley
4a67dd04c9
breaking changes to std.fs, std.os
* improve `std.fs.AtomicFile` to use sendfile()
   - also fix AtomicFile cleanup not destroying tmp files under some
     error conditions
 * improve `std.fs.updateFile` to take advantage of the new `makePath`
   which no longer needs an Allocator.
 * rename std.fs.makeDir to std.fs.makeDirAbsolute
 * rename std.fs.Dir.makeDirC to std.fs.Dir.makeDirZ
 * add std.fs.Dir.makeDirW and provide Windows implementation of
   std.os.mkdirat. std.os.windows.CreateDirectory is now implemented
   by calling ntdll, supports an optional root directory handle,
   and returns an open directory handle. Its error set has a few more
   errors in it.
 * rename std.fs.Dir.changeTo to std.fs.Dir.setAsCwd
 * fix std.fs.File.writevAll and related functions when len 0 iovecs
   supplied.
 * introduce `std.fs.File.writeFileAll`, exposing a convenient
   cross-platform API on top of sendfile().
 * `NoDevice` added to std.os.MakeDirError error set.
 * std.os.fchdir gets a smaller error set.
 * std.os.windows.CloseHandle is implemented with ntdll call rather than
   kernel32.
2020-03-03 15:23:27 -05:00
daurnimator
1ca5f06762
Update callers of fs.makePath 2020-03-03 13:25:43 -05:00
daurnimator
695b0976c3
std: move makePath to be a Dir method 2020-03-03 13:25:43 -05:00
daurnimator
a19a30bb17
std: move null byte check into toPosixPath
Note that windows NT paths *can* contain nulls
2020-03-03 13:25:43 -05:00
daurnimator
d8f966a04b
std: fix fs.makePath
The previous behaviour of using path.resolve has unexpected behaviour around symlinks.
This more simple implementation is more correct and doesn't require an allocator
2020-03-03 13:25:43 -05:00
daurnimator
bfc569bc98
std: add os.fstatat 2020-03-03 13:25:43 -05:00
daurnimator
627618a38d
std: add Dir.changeDir as wrapper around fchdir 2020-03-03 13:25:43 -05:00
daurnimator
dfb420e6d7
std: add fs.Dir.makeDir 2020-03-03 13:25:43 -05:00
daurnimator
88e27f01c8
std: add mkdirat 2020-03-03 13:25:40 -05:00