Commit Graph

67 Commits

Author SHA1 Message Date
Andrew Kelley
92559cd02c hit a comptime limitation with computing dense sets 2020-01-21 19:40:44 -05:00
Andrew Kelley
91ecce3bc0 fix cache of cpu features 2020-01-21 12:14:43 -05:00
Andrew Kelley
1f7babbc80 properly forward baseline target cpu features to llvm 2020-01-21 03:01:20 -05:00
Andrew Kelley
39759b90fc make zig targets show native cpu name and features 2020-01-21 01:22:37 -05:00
Andrew Kelley
e640d01535 fixups to arch data, support any number of cpu features 2020-01-21 00:34:54 -05:00
Andrew Kelley
f3dd9bbdac improve zig targets 2020-01-20 13:40:25 -05:00
Andrew Kelley
bf82929557 fix std.Target.Arch.parseCpuFeatureSet 2020-01-20 12:41:18 -05:00
Andrew Kelley
8f29d14073 stage1 is building. zig targets now self-hosted 2020-01-20 01:42:31 -05:00
Andrew Kelley
20af858601 some fixes 2020-01-19 21:06:41 -05:00
Andrew Kelley
a313f15384 figure out zig0/stage1 and scanning for native CPU 2020-01-19 20:54:05 -05:00
Andrew Kelley
a867b43366 progress towards merging
see BRANCH_TODO file
2020-01-19 20:54:04 -05:00
Layne Gustafson
430077df1b Allow target details with no LLVM support 2020-01-19 20:53:20 -05:00
Layne Gustafson
35c681b7b1 Fix sentinel mismatch in llvm strings
Previously, buffers were used with toOwnedSlice() to create c strings
for LLVM cpu/feature strings. However, toOwnedSlice() shrinks the
string memory to the buffer's length, which cuts off the null terminator.
Now toSliceConst() is used instead, and the buffer is not deinited
so that the string memory is not freed.
2020-01-19 20:53:20 -05:00
Layne Gustafson
8902f3ca32 Enable 64bit feature for riscv64 2020-01-19 20:53:20 -05:00
Layne Gustafson
a5c9397539 No allocations for n.t. empty strings 2020-01-19 20:53:20 -05:00
Layne Gustafson
40ff359486 Only enable requested features 2020-01-19 20:53:20 -05:00
Layne Gustafson
ebb6f15bba Make sure llvm strings are null-terminated 2020-01-19 20:53:20 -05:00
Layne Gustafson
fd17a9962b Add defaut feature support 2020-01-19 20:53:20 -05:00
Layne Gustafson
03dd376b55 Add builtin.zig support 2020-01-19 20:53:19 -05:00
Layne Gustafson
c61856ebcf Add TargetDetails abstraction 2020-01-19 20:53:19 -05:00
Layne Gustafson
bd6ef21f85 Add cpu/feature specification to cmndline 2020-01-19 20:53:19 -05:00
Layne Gustafson
c131e50ea7 Switch CPU/features to simple format 2020-01-19 20:53:18 -05:00
Layne Gustafson
5bc4690d85 Make targets cmd able to list CPUs and features 2020-01-19 20:53:18 -05:00
Vexu
55348c9b93 translate-c-2 bug fixes
- fix use of undefined value
- fix parenexprclass result not being suppressed
- add an error and a TODO for access of an anonymous field
2019-12-29 19:23:36 +02:00
Vexu
a37caaa528 translate-c-2 parameter name aliasing 2019-12-16 10:39:31 +02:00
Vexu
69dee57d95 remove concept of translate mode 2019-12-12 14:26:24 +02:00
Andrew Kelley
7c1dbfab72 self-hosted: manually parse args 2019-12-11 02:08:33 -05:00
Robin Voetter
c519bb02df Fix usage of freed memory in zig fmt 2019-12-10 11:09:29 -05:00
Andrew Kelley
03396b3caa update docs to new fmt API 2019-12-08 23:46:50 -05:00
Andrew Kelley
8b2622cdd5 std.fmt.format: tuple parameter instead of var args 2019-12-08 22:53:51 -05:00
Andrew Kelley
b36c07a95a Merge remote-tracking branch 'origin/master' into remove-array-type-coercion 2019-12-01 09:56:01 -05:00
Andrew Kelley
413f9a5cfc move std.fs.Dir.cwd to std.fs.cwd
update to non-deprecated std.fs APIs throughout the codebase

Related: #3811
2019-11-30 15:35:27 -05:00
Andrew Kelley
85e1e3b95f Merge pull request #3284 from Sahnvour/export_variables
Improved support for exporting variables
2019-11-30 00:25:52 -05:00
Andrew Kelley
bf3ac66150 remove type coercion from array values to references
* Implements #3768. This is a sweeping breaking change that requires
   many (trivial) edits to Zig source code. Array values no longer
   coerced to slices; however one may use `&` to obtain a reference to
   an array value, which may then be coerced to a slice.

 * Adds `IrInstruction::dump`, for debugging purposes. It's useful to
   call to inspect the instruction when debugging Zig IR.

 * Fixes bugs with result location semantics. See the new behavior test
   cases, and compile error test cases.

 * Fixes bugs with `@typeInfo` not properly resolving const values.

 * Behavior tests are passing but std lib tests are not yet. There
   is more work to do before merging this branch.
2019-11-27 03:37:50 -05:00
Jonathan S
4014a8e4b4 Avoid deprecated cwd-based functions for opening directories, preferring to open explicitly relative to Dir.cwd(). 2019-11-25 23:46:48 -05:00
Andrew Kelley
15d415e10b make std.mem.toSlice use null terminated pointers
and fix the fallout
2019-11-24 21:21:05 -05:00
Andrew Kelley
34b1ebefaa Merge remote-tracking branch 'origin/master' into null-terminated-pointers 2019-11-24 20:28:46 -05:00
Sahnvour
696567d9d7 export: check variable type
also fixed existing occurrences
2019-11-24 21:33:58 +01:00
Vexu
03cc81665b Merge branch 'master' into modernize-stage2 2019-11-23 19:13:48 +02:00
Andrew Kelley
47f06be369 string literals are now null terminated
this also deletes C string literals from the language, and then makes
the std lib changes and compiler changes necessary to get the behavior
tests and std lib tests passing again.
2019-11-21 20:43:41 -05:00
Andrew Kelley
0237e7a701 std.io.getStdOut and related fns no longer can error
Thanks to the Windows Process Environment Block, it is possible to
obtain handles to the standard input, output, and error streams without
possibility of failure.
2019-11-13 04:01:40 +00:00
Andrew Kelley
aa0daea541 update more of the std lib to use @as 2019-11-08 15:57:25 -05:00
Vexu
c6076a1360 self hosted compiler: use enum literals 2019-11-07 10:30:56 +02:00
Andrew Kelley
c3d816a98e std lib networking improvements, especially non-blocking I/O
* delete the std/event/net directory
 * `std.event.Loop.waitUntilFdReadable` and related functions
   no longer have possibility of failure. On Linux, they fall
   back to poll() and then fall back to sleep().
 * add some missing `noasync` decorations in `std.event.Loop`
 * redo the `std.net.Server` API. it's quite nice now, but
   shutdown does not work cleanly. There is a race condition with
   close() that I am actively working on.
 * move `std.io.OutStream` to its own file to match `std.io.InStream`.
   I started working on making `write` integrated with evented I/O,
   but it got tricky so I backed off and filed #3557. However
   I did integrate `std.os.writev` and `std.os.pwritev` with evented I/O.
 * add `std.Target.stack_align`
 * move networking tests to `lib/std/net/test.zig`
 * add `std.net.tcpConnectToHost` and `std.net.tcpConnectToAddress`.
 * rename `error.UnknownName` to `error.UnknownHostName` within the
   context of DNS resolution.
 * add `std.os.readv`, which is integrated with evented I/O.
 * `std.os.preadv`, is now integrated with evented I/O.
 * `std.os.accept4` now asserts that ENOTSOCK and EOPNOTSUPP never
    occur (misuse of API), instead of returning errors.
 * `std.os.connect` is now integrated with evented I/O.
   `std.os.connect_async` is gone. Just use `std.os.connect`.
 * fix false positive dependency loop regarding async function frames
 * add more compile notes to help when dependency loops occur
   in determining whether a function is async.
 * ir: change an assert to ir_assert to make it easier to find
   workarounds for when such an assert is triggered. In this case
   it was trying to parse an IPv4 address at comptime.
2019-10-29 22:59:30 -04:00
Andrew Kelley
f65b1d4680 integrate stage1 progress display with semantic analysis 2019-10-22 17:52:12 -04:00
Andrew Kelley
5b1a492012 breaking: improve std.fs directory handling API
* Added `std.c.unlinkat` and `std.os.unlinkat`.
 * Removed `std.fs.MAX_BUF_BYTES` (this declaration never made it to
   master branch)
 * Added `std.fs.Dir.deleteTree` to be used on an open directory handle.
 * `std.fs.deleteTree` has better behavior for both relative and
   absolute paths. For absolute paths, it opens the base directory
   and uses that handle for subsequent operations. For relative paths,
   it does a similar strategy, using the cwd handle.
 * The error set of `std.fs.deleteTree` is improved to no longer have
   these possible errors:
   - OutOfMemory
   - FileTooBig
   - IsDir
   - DirNotEmpty
   - PathAlreadyExists
   - NoSpaceLeft
 * Added `std.fs.Dir.posix_cwd` which is a statically initialized
   directory representing the current working directory.
 * The error set of `std.Dir.open` is improved to no longer have these
   possible errors:
   - FileTooBig
   - IsDir
   - NoSpaceLeft
   - PathAlreadyExists
   - OutOfMemory
 * Added more alternative functions to `std.fs` for when the path
   parameter is a null terminated string. This can sometimes be more
   effecient on systems which have an ABI based on  null terminated
   strings.
 * Added `std.fs.Dir.openDir`, `std.fs.Dir.deleteFile`, and
   `std.fs.Dir.deleteDir` which all operate on an open directory handle.
 * `std.fs.Walker.Entry` now has a `dir` field, which can be used to do
   operations directly on `std.fs.Walker.Entry.basename`, avoiding
   `error.NameTooLong` for deeply nested paths.
 * Added more docs to `std.os.OpenError`

This commit does the POSIX components for these changes. I plan to
follow up shortly with a commit for Windows.
2019-10-20 21:48:23 -04:00
stratact
e78d3750c5 Use 8192 sized buffers and remove allocator parameters 2019-10-19 14:04:51 -04:00
Andrew Kelley
2d5b2bf1c9 improve progress reporting
* use erase rest of line escape code.
 * use `stderr.supportsAnsiEscapeCodes` rather than `isTty`.
 * respect `--color off`
 * avoid unnecessary recursion
 * add `Progress.log`
 * disable the progress std lib test since it's noisy and uses
   `time.sleep()`.
 * enable/integrate progress printing with the default test runner
2019-10-17 21:55:49 -04:00
Andrew Kelley
299991019d rework the progress module and integrate with stage1 2019-10-17 20:20:22 -04:00
Sahnvour
f08c6e4fe6 changing occurrences of HashMap with []const u8 as keys for StringHashMap 2019-09-03 23:53:05 +02:00