Commit Graph

159 Commits

Author SHA1 Message Date
Ryan Liptak
08a9ab4d8c Update all remaining uses of &outStream().stream 2020-04-03 12:12:23 -04: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
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
bb5383cf00 std: don't return sentinel slices from cross_target functions 2020-04-01 10:36:38 -04:00
Andrew Kelley
839d85e440 fixes to 32-bit handling, to support 32-bit arm 2020-03-31 10:10:31 -04: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
Michael Raymond
de9933761c std.zig.render: fix newlines before DocComments 2020-03-29 22:41:39 -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
Andrew Kelley
93c7fa105f Merge remote-tracking branch 'origin/llvm10'
LLVM 10 was released today
2020-03-24 09:57:09 -04: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
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
Andrew Kelley
23c263776c Merge remote-tracking branch 'origin/master' into llvm10 2020-03-22 15:09:29 -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
53b5aa812b Merge remote-tracking branch 'origin/master' into llvm10 2020-03-19 22:19:24 -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
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
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
Vexu
57f9f07558 use anon literals in ast.zig and parse.zig 2020-03-15 01:11:58 +02:00
Vexu
5e5dee829d remove .Cancel correct merge err set parsing 2020-03-15 01:02:33 +02:00
Andrew Kelley
656ba530d8 Merge remote-tracking branch 'origin/master' into llvm10 2020-03-13 15:17:53 -04:00
Andrew Kelley
4905102901 fix all the TODOs from the pull request
* `std.Buffer.print` is removed; use `buffer.outStream().print`
 * `std.fmt.count` returns a `u64`
 * `std.Fifo.print` is removed; use `fifo.outStream().print`
 * `std.fmt.bufPrint` error is renamed from `BufferTooSmall`
   to `NoSpaceLeft` to match `std.os.write`.
 * `std.io.FixedBufferStream.getWritten` returns mutable buffer
   if the buffer is mutable.
2020-03-13 12:02:58 -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
3657a54618 fix regressions in elf parsing code 2020-03-11 17:34:12 -04: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
18f1fef142 update standard library to new I/O streams API 2020-03-10 18:44:30 -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
LemonBoy
3e93dce0a1 std: Fix detection of Linux kernel version 2020-03-10 12:55:35 -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
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
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
96c07674fc Merge remote-tracking branch 'origin/master' into llvm10 2020-03-07 12:18:41 -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
3178807657 Merge remote-tracking branch 'origin/master' into llvm10 2020-03-04 15:35:46 -05:00
Andrew Kelley
6cbd1ac51a zig is now aware of DragonflyBSD versions 2020-03-04 15:34:32 -05:00
Andrew Kelley
3b235cfa80 std.zig.CrossTarget: fix compile errors
closes #4620
2020-03-03 21:09:32 -05:00
Andrew Kelley
d1cb16aace Merge remote-tracking branch 'origin/master' into llvm10 2020-03-03 09:44:13 -05:00
Andrew Kelley
c81345c8ae breaking: std.os read/write functions + sendfile
* rework os.sendfile and add macosx support, and a fallback
   implementation for any OS.
 * fix sendto compile error
 * std.os write functions support partial writes. closes #3443.
 * std.os pread / pwrite functions can now return `error.Unseekable`.
 * std.fs.File read/write functions now have readAll/writeAll variants
   which loop to complete operations even when partial reads/writes
   happen.
 * Audit std.os read/write functions with respect to Linux returning
   EINVAL for lengths greater than 0x7fff0000.
 * std.os read/write shim functions do not unnecessarily loop. Since
   partial reads/writes are part of the API, the caller will be forced
   to loop anyway, and so that would just be code bloat.
 * Improve doc comments
 * Add a non-trivial test for std.os.sendfile
 * Fix std.os.pread on 32 bit Linux
 * Add missing SYS_sendfile bit on aarch64
2020-03-03 02:25:26 -05:00
Andrew Kelley
ae99fabfe4 Merge pull request #4585 from LemonBoy/fix-4581
target: Implement OS version detection for Windows
2020-03-01 02:53:51 -05:00
Andrew Kelley
f082e253b5 fix native OS version detection on macOS
closes #4583
2020-03-01 01:17:50 -05:00
Andrew Kelley
2246812184 use an explicit error set to fix a compilation error
this function has conditionally compiled out code in it about looking
for native glibc.
2020-02-29 22:20:44 -05:00