951 Commits

Author SHA1 Message Date
Andrew Kelley
dff7ca6784
annotate TODO comment with bug tracker link 2020-02-21 14:20:07 -05:00
Andrew Kelley
71573584cd
std.Target.parse gives parsing diagnostics 2020-02-21 13:34:55 -05:00
Andrew Kelley
7da7fbb912
update ARM cpu models to correctly include the sub-arch 2020-02-21 12:29:27 -05:00
Andrew Kelley
ab56d3e18c
fix std.Target unit tests 2020-02-21 11:07:56 -05:00
Andrew Kelley
a391a82e49
fix zig build adding invalid cli args 2020-02-21 01:58:40 -05:00
Andrew Kelley
2de7d0b10c
fix zig build, ABI ABI, and update tests to new Target layout 2020-02-20 18:50:20 -05:00
Andrew Kelley
903127f36c
Merge remote-tracking branch 'origin/master' into sub-architecture-annihilation 2020-02-20 18:36:04 -05:00
Andrew Kelley
0f016b368d
support -mcpu=baseline, both in stage1 and stage2
See e381a42de9c0f0c5439a926b0ac99026a0373f49 for more details.
This is set up so that if we wish to make "baseline" depend on the
OS in the future, it is possible to do that.
2020-02-20 18:31:17 -05:00
Andrew Kelley
b0d2ebe529 remove std.io.readLine
This was deceptive. It was always meant to be sort of a "GNU readline"
sort of thing where it provides a Command Line Interface to input text.
However that functionality did not exist and it was basically a red
herring for people trying to read line-delimited input from a stream.

In this commit the API is deleted, so that people can find the proper
API more easily.

A CLI text input abstraction would be useful but may not even need to be
in the standard library. As you can see in this commit, the guess_number
CLI game gets by just fine by using `std.fs.File.read`.
2020-02-20 15:30:00 -05:00
Andrew Kelley
33c69d5cb6
arm: clarify which CPU features are sub-architectures
versus which ones are instruction sets.
2020-02-20 15:27:42 -05:00
Andrew Kelley
ec889d5888
NO_MEDIA_IN_DEVICE => return error.NoDevice 2020-02-20 12:39:46 -05:00
Andrew Kelley
9c3eff9193
Revert "arm: clean up the messy sub-architecture & CPU features"
This reverts commit 96f45c27b65307fe4abd5d1fb1cf314b1f493d8e.
2020-02-20 12:18:32 -05:00
LemonBoy
ae16a6773f std: Handle NO_MEDIA_IN_DEVICE error in openFileWindows
Closes #4507
2020-02-20 13:25:45 +01:00
Andrew Kelley
3c76e5e33d
update tls in std lib for lack of sub-arch 2020-02-19 22:09:35 -05:00
Andrew Kelley
c33cd370fc
fix unit test for Target.parse
I think this is working correctly. Without also removing sse2 from the
feature set, sse gets added back into the set because sse2 is part of
the x86_64 baseline (which is the cpu provided) and sse2 depends on sse.
2020-02-19 21:55:25 -05:00
Andrew Kelley
ef2d237f2f
this is not the proper way to support this feature 2020-02-19 21:51:24 -05:00
Andrew Kelley
84f1893c18
remove the concept of "sub-architecture"
in favor of CPU features. Also rearrange the `std.Target`
data structure.

 * note: `@import("builtin")` was already deprecated in favor of
   `@import("std").builtin`.
 * `std.builtin.arch` is now deprecated in favor of
   `std.builtin.cpu.arch`.
 * `std.Target.CpuFeatures.Cpu` is now `std.Target.Cpu.Model`.
 * `std.Target.CpuFeatures` is now `std.Target.Cpu`.
 * `std.Target` no longer has an `arch` field. Instead it has a
   `cpu` field, which has `arch`, `model`, and `features`.
 * `std.Target` no longer has a `cpu_features` field.
 * `std.Target.Arch` is moved to `std.Target.Cpu.Arch` and
   it is an enum instead of a tagged union.
 * `std.Target.parseOs` is moved to `std.Target.Os.parse`.
 * `std.Target.parseAbi` is moved to `std.Target.Abi.parse`.
 * `std.Target.parseArchSub` is only for arch now and moved
    to `std.Target.Cpu.Arch.parse`.
 * `std.Target.parse` is improved to accept CPU name and features.
 * `std.Target.Arch.getBaselineCpuFeatures` is moved to
   `std.Target.Cpu.baseline`.
 * `std.Target.allCpus` is renamed to `std.Target.allCpuModels`.
 * `std.Target.defaultAbi` is moved to `std.Target.Abi.default`.
 * Significant cleanup of aarch64 and arm CPU features, resulting in
   the needed bit count for cpu feature set going from 174 to 138.
 * Add `std.Target.Cpu.Feature.Set.addFeatureSet` for merging
   feature sets together.

`-target-feature` and `-target-cpu` are removed in favor of
`-mcpu`, to conform to established conventions, and it gains
additional power to support cpu features. The syntax is:
-mcpu=name+on1+on2-off1-off2

closes #4261
2020-02-19 21:30:36 -05:00
Andrew Kelley
96f45c27b6
arm: clean up the messy sub-architecture & CPU features 2020-02-19 19:11:20 -05:00
Andrew Kelley
4c6f207aff
clean up arm CPU features
* remove "cpu features" that are actually just processors
 * rename `v8` to `v8a`. this matches the corresponding
   change to target/aarch64.zig
 * rename types in preparation for removing sub-architecture
   from `std.Target`.

I have other files changed in my dirty working tree, but about to make
some changes to arm.zig that I don't want batched with this commit.
2020-02-19 18:12:06 -05:00
Bas
1483ae37f2
Add an appendValues method to ArrayList to append a value n times. (#4460) 2020-02-19 11:33:35 -05:00
Andrew Kelley
c664692bdd
make the CLI support depending on system headers and libraries
(include and lib search paths)

The detection of native system paths is self-hosted.

closes #2041
2020-02-19 01:24:34 -05:00
Andrew Kelley
d7968c6d33
improvements which allow zig to emit multiple things at once
example: zig build-obj test.zig -femit-llvm-ir -femit-asm

this will generate all three: test.o test.s test.ll
2020-02-18 21:59:43 -05:00
Noam Preil
dba12cd693
Rename produce_* bools to emit_* to match CLI 2020-02-18 18:59:45 -05:00
Noam Preil
2502cb242a
Improve support for generating LLVM IR/asm files 2020-02-18 18:59:45 -05:00
LemonBoy
95a71e29f8
zig fmt: Fix callconv rewriting for extern + string
Closes #4473
2020-02-18 18:18:15 -05:00
Andrew Kelley
ccca4b5a5e
Merge pull request #4474 from LemonBoy/saukerkraut
Patches
2020-02-18 18:15:11 -05:00
Andrew Kelley
a8d7652001
avoid a @ptrCast with an array literal 2020-02-18 16:48:26 -05:00
daurnimator
3632f31ec2
std: use LinearFifo to implement io.BufferedOutStreamCustom 2020-02-18 16:47:03 -05:00
daurnimator
dd75cc214d
std: let PeekStream have static/dynamic variants
This completes a TODO in the existing implementation
2020-02-18 16:47:03 -05:00
daurnimator
38ad7daebb
std: use LinearFifo to implement io.PeekStream 2020-02-18 16:47:03 -05:00
daurnimator
bdff2f43bd
std: use LinearFifo to implement io.BufferedInStreamCustom 2020-02-18 16:47:03 -05:00
Andrew Kelley
d056c7732b
fix std.meta.refAllDecls 2020-02-18 15:34:13 -05:00
Andrew Kelley
e8a84927ab
Merge pull request #4478 from ziglang/self-host-libc-detection
self-hosted libc and dynamic linker detection
2020-02-17 22:45:49 -05:00
Andrew Kelley
35f0cb049e
stage2: fix invalid iteration code in std.ast.Node.Asm
closes #4480
2020-02-17 20:25:02 -05:00
Andrew Kelley
b53afc510c
update dl_iterate_phdr test case to new API 2020-02-17 17:22:32 -05:00
Andrew Kelley
4b91e4c91f fix dynamic linker detection on windows (where there isn't one) 2020-02-17 16:03:01 -05:00
Andrew Kelley
e26f063b22 support the concept of a target not having a dynamic linker 2020-02-17 15:46:53 -05:00
Andrew Kelley
2f9c5c0644
self-host dynamic linker detection 2020-02-17 15:23:59 -05:00
Andrew Kelley
44c14749a1
expand argv[0] when spawning system C compiler
Some C compilers, such as Clang, are known to rely on
argv[0] to find the path to their own executable,
without even bothering to resolve PATH. This results
in the message:

error: unable to execute command: Executable "" doesn't exist!

So we tell ChildProcess to expand argv[0] to the absolute path
to give them a helping hand.
2020-02-17 00:58:30 -05:00
Andrew Kelley
5c54d7bee7
add missing implementations of libc installation to detect msvc paths 2020-02-16 19:58:27 -05:00
Andrew Kelley
8173fbfb66
implement os.faccessat for Windows 2020-02-16 17:10:43 -05:00
LemonBoy
59a243ce24 std: Remove now-superflous hack 2020-02-16 19:53:53 +01:00
Andrew Kelley
4b02a39aa9
self-hosted libc detection
* libc_installation.cpp is deleted.
   src-self-hosted/libc_installation.zig is now used for both stage1 and
   stage2 compilers.
 * (breaking) move `std.fs.File.access` to `std.fs.Dir.access`. The API
   now encourages use with an open directory handle.
 * Add `std.os.faccessat` and related functions.
 * Deprecate the "C" suffix naming convention for null-terminated
   parameters. "C" should be used when it is related to libc. However
   null-terminated parameters often have to do with the native system
   ABI rather than libc. "Z" suffix is the new convention. For example,
   `std.os.openC` is deprecated in favor of `std.os.openZ`.
 * Add `std.mem.dupeZ` for using an allocator to copy memory and add a
   null terminator.
 * Remove dead struct field `std.ChildProcess.llnode`.
 * Introduce `std.event.Batch`. This API allows expressing concurrency
   without forcing code to be async. It requires no Allocator and does
   not introduce any failure conditions. However it is not thread-safe.
 * There is now an ongoing experiment to transition away from
   `std.event.Group` in favor of `std.event.Batch`.
 * `std.os.execvpeC` calls `getenvZ` rather than `getenv`. This is
   slightly more efficient on most systems, and works around a
   limitation of `getenv` lack of integration with libc.
 * (breaking) `std.os.AccessError` gains `FileBusy`, `SymLinkLoop`, and
   `ReadOnlyFileSystem`. Previously these error codes were all reported
   as `PermissionDenied`.
 * Add `std.Target.isDragonFlyBSD`.
 * stage2: access to the windows_sdk functions is done with a manually
   maintained .zig binding file instead of `@cImport`.
 * Update src-self-hosted/libc_installation.zig with all the
   improvements that stage1 has seen to src/libc_installation.cpp until
   now. In addition, it now takes advantage of Batch so that evented I/O
   mode takes advantage of concurrency, but it still works in blocking
   I/O mode, which is how it is used in stage1.
2020-02-16 13:25:30 -05:00
Andrew Kelley
cb3a818699
zig fmt: support noasync await 2020-02-16 01:44:52 -05:00
Vexu
b15958c557 fix c tokenizer bug 2020-02-14 18:57:57 -05:00
Andrew Kelley
40b9db7cad
Merge pull request #4451 from daurnimator/use-testing.allocator
Migrate (more) tests from FixedBufferAllocator to testing.allocator
2020-02-14 09:40:08 -05:00
xackus
7396b144ba modernize std.meta 2020-02-14 09:35:38 -05:00
daurnimator
6ea6d5a4bd
std: use testing.allocator in tests 2020-02-14 19:15:09 +11:00
daurnimator
ca41567924
std: use testing.allocator in big int tests 2020-02-14 18:59:40 +11:00
daurnimator
f20ba7c32c
std: increase memory available to testing allocator 2020-02-14 18:59:25 +11:00