Commit Graph

63 Commits

Author SHA1 Message Date
Ali Chraghi
d086b371f0 Compilation: strip debug info from ReleaseSmall by default 2022-10-11 17:51:25 +02:00
Veikka Tuominen
694fab4848 std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
Loris Cro
259f407160 init-exe template: align cli tests to new template 2022-08-05 00:42:53 +02:00
Andrew Kelley
93ae386f56 stage2: don't skip liveness or codegen if -femit-asm is supplied
Fixes Godbolt's CLI usage of Zig.
2022-07-24 15:02:05 -07:00
Ali Chraghi
0b4a3ec950 std: compile error on invalid testing allocator usage 2022-07-24 11:57:00 +03:00
Andrew Kelley
1ec50613bf CI: increase stage3 test coverage
* Use a debug build of stage3 instead of a debug build of stage2 for
   our self-hosted compiler test coverage.
 * Move coverage from stage1 to stage3 for:
   - building self-hosted without LLVM
   - building self-hosted for 32-bit arm
   - test-compiler-rt
   - test-behavior
   - test-std
   - test-compare-output
   - test-asm-link
   - test-fmt
2022-07-20 12:27:03 -07:00
PhaseMage
8a97807d68
Full response file (*.rsp) support
I hit the "quotes in an RSP file" issue when trying to compile gRPC using
"zig cc". As a fun exercise, I decided to see if I could fix it myself.
I'm fully open to this code being flat-out rejected. Or I can take feedback
to fix it up.

This modifies (and renames) _ArgIteratorWindows_ in process.zig such that
it works with arbitrary strings (or the contents of an RSP file).

In main.zig, this new _ArgIteratorGeneral_ is used to address the "TODO"
listed in _ClangArgIterator_.

This change closes #4833.

**Pros:**

- It has the nice attribute of handling "RSP file" arguments in the same way it
  handles "cmd_line" arguments.
- High Performance, minimal allocations
- Fixed bug in previous _ArgIteratorWindows_, where final trailing backslashes
  in a command line were entirely dropped
- Added a test case for the above bug
- Harmonized the _ArgIteratorXxxx._initWithAllocator()_ and _next()_ interface
  across Windows/Posix/Wasi (Moved Windows errors to _initWithAllocator()_
  rather than _next()_)
- Likely perf benefit on Windows by doing _utf16leToUtf8AllocZ()_ only once
  for the entire cmd_line

**Cons:**

- Breaking Change in std library on Windows: Call
  _ArgIterator.initWithAllocator()_ instead of _ArgIterator.init()_
- PhaseMage is new with contributions to Zig, might need a lot of hand-holding
- PhaseMage is a Windows person, non-Windows stuff will need to be double-checked

**Testing Done:**

- Wrote a few new test cases in process.zig
- zig.exe build test -Dskip-release (no new failures seen)
- zig cc now builds gRPC without error
2022-01-30 21:27:52 +02:00
ominitay
7e16bb36d8 Change ArgIterator.next() return type
Changes the return type of `ArgIterator.next()` from
`?(NextError![:0]u8)` to `NextError!?[:0]u8`.
2021-12-21 11:15:33 -08:00
Lee Cannon
1093b09a98
allocgate: renamed getAllocator function to allocator 2021-11-30 23:32:47 +00:00
Lee Cannon
75548b50ff
allocgate: stage 1 and 2 building 2021-11-30 23:32:47 +00:00
Lee Cannon
85de022c56
allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
Andrew Kelley
902df103c6 std lib API deprecations for the upcoming 0.9.0 release
See #3811
2021-11-30 00:13:07 -07:00
Andrew Kelley
6115cf2240 migrate from std.Target.current to @import("builtin").target
closes #9388
closes #9321
2021-10-04 23:48:55 -07:00
Andrew Kelley
cca57042df std: fix regressions from this branch
Also move some usingnamespace test cases from compare_output to
behavior.
2021-09-01 17:54:07 -07:00
Andrew Kelley
3a4a710894 update godbolt test case for unused parameter 2021-06-23 10:44:46 -07:00
Andrew Kelley
f41892f736 std: @import("builtin").StackTrace -> std.builtin.StackTrace 2021-05-17 14:36:51 -07:00
Veikka Tuominen
0a38f61d58 update usage of std.testing in behavior and standalone tests 2021-05-08 15:15:30 +03:00
Ersikan
36db4b7cc4 test-cli: Remove temporary directory after tests 2021-03-17 10:27:41 +01:00
Ersikan
a354000090 zig fmt: fix non-UTF-8 encoding #2820
Fixes #2820

After reading the source code, the first two bytes are inspected, and
if they correspond to a UTF-16 BOM in little-endian order, the source
code is converted to UTF-8.
2021-03-17 10:26:47 +01:00
Tadeo Kondrak
bb4f4c043e
test/cli.zig: Remove inline from panic function in testGodboltApi
Might add another line to stack traces there.
2021-02-10 20:22:20 -07:00
Tadeo Kondrak
5dfe0e7e8f
Convert inline fn to callconv(.Inline) everywhere 2021-02-10 20:06:12 -07:00
Jonathan Marler
1480c42806 require specifier for arrayish types 2021-02-09 22:25:52 -08:00
Andrew Kelley
4592fd26b9 add std.testing.expectStringEndsWith 2020-12-08 21:59:24 -07:00
Isaac Freund
0e4c3934a0 zig fmt: write modified files to stdout not stderr 2020-10-16 20:23:18 -04:00
Andrew Kelley
14d6d07af2 fix the cli test expected string to support native path separators 2020-09-30 01:31:08 -04:00
Andrew Kelley
26f2f9bf1c stage2: implement -fno-emit-bin
we are now passing the cli tests
2020-09-26 12:42:07 -07:00
Andrew Kelley
6af2990549 implement -femit-asm, -femit-docs, -femit-llvm-ir, etc
These CLI options are now forwarded to the stage1 backend.

We're not going to support the -mllvm CLI option any longer. As a
compromise, we unconditionally tell LLVM to output intel x86 syntax when
using -femit-asm.

Simplify stage1 logic; it no longer has the concept of an output
directory. --output-dir is no longer a valid CLI option. cmake uses
the `-femit-bin=[path]` option.

Note the changes to test/cli.zig. This breaks the CLI API that Godbolt
is using so we're going to want to open a PR to help them upgrade to the
new CLI for the upcoming Zig 0.7.0 release.
2020-09-26 01:47:27 -07:00
Andrew Kelley
21b407b17f update test case for init-exe with respect to new template
Now it uses std.log.info instead of std.debug.print
2020-09-25 18:21:21 -07:00
Ryan Liptak
399f6b77c4 Add 'no changes' test to zig fmt cli test 2020-06-20 22:21:23 -07:00
Ryan Liptak
b216d8de88 Simplify unformatted code in zig fmt cli test 2020-06-20 22:20:23 -07:00
Ryan Liptak
ca9d8a1337 Add zig fmt test to cli tests for both files and directories
Should catch basic `zig fmt` regressions that were previously going uncaught and breaking things
2020-06-20 22:02:55 -07: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
Andrew Kelley
46ffc798b6
fix swapped logic for Windows
Remove `std.fs.deleteTree`. Callers instead should use
`std.fs.cwd().deleteTree`.

Add `std.fs.deleteTreeAbsolute` for when the caller has an absolute
path.
2020-03-18 16:42:47 -04:00
Andrew Kelley
55dfedff42
update cli test to new std.fs API 2020-03-03 15:58:14 -05:00
Andrew Kelley
ef24f2dd93
remove special darwin os version min handling
now it is integrated with zig's target OS range.
2020-02-28 14:51:56 -05:00
Andrew Kelley
3c3316d4ba
update tests to new Target API 2020-02-28 14:51:55 -05:00
Benjamin Feng
46d84a1b63 Convert a few more page_allocator 2020-01-30 00:27:44 -06:00
Andrew Kelley
8b2622cdd5
std.fmt.format: tuple parameter instead of var args 2019-12-08 22:53:51 -05:00
Andrew Kelley
b220be7a33
more test regression fixes 2019-11-29 23:04:19 -05:00
Andrew Kelley
cb38bd0a14
rename std.heap.direct_allocator to std.heap.page_allocator
std.heap.direct_allocator is still available for now but it is marked
deprecated.
2019-11-25 17:25:06 -05:00
Andrew Kelley
ce96323ba1
update cli test 2019-11-24 19:24:52 -05:00
Andrew Kelley
064377be9a
test runner: restore previous behavior of printing all tests passed 2019-10-21 22:21:18 -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
Jay Weisskopf
0bdc85181c Create user-specified output-dir
Fixes #2637
2019-09-24 00:20:29 -04:00
Sahnvour
987c209b40 heap: make one global instance of DirectAllocator
it is now stateless, so the de/init are not necessary anymore
2019-06-22 14:10:53 -04:00
Andrew Kelley
b735764898
different array literal syntax when inferring the size
old syntax:  []i32{1, 2, 3}
new syntax: [_]i32{1, 2, 3}

closes #1797
2019-06-09 19:26:32 -04:00
Andrew Kelley
2f040a23c8
clean up references to os 2019-05-26 18:32:44 -04:00
Andrew Kelley
3cdd2c0bdd Merge remote-tracking branch 'origin/master' into llvm8 2019-03-10 13:48:06 -04:00
Andrew Kelley
91955dee58
breaking changes to zig build API and improved caching
* in Zig build scripts, getOutputPath() is no longer a valid function
   to call, unless setOutputDir() was used, or within a custom make()
   function. Instead there is more convenient API to use which takes
   advantage of the caching system. Search this commit diff for
   `exe.run()` for an example.
 * Zig build by default enables caching. All build artifacts will go
   into zig-cache. If you want to access build artifacts in a convenient
   location, it is recommended to add an `install` step. Otherwise
   you can use the `run()` API mentioned above to execute programs
   directly from their location in the cache. Closes #330.
   `addSystemCommand` is available for programs not built with Zig
   build.
 * Please note that Zig does no cache evicting yet. You may have to
   manually delete zig-cache directories periodically to keep disk
   usage down. It's planned for this to be a simple Least Recently
   Used eviction system eventually.
 * `--output`, `--output-lib`, and `--output-h` are removed. Instead,
   use `--output-dir` which defaults to the current working directory.
   Or take advantage of `--cache on`, which will print the main output
   path to stdout, and the other artifacts will be in the same directory
   with predictable file names. `--disable-gen-h` is available when
   one wants to prevent .h file generation.
 * `@cImport` is always independently cached now. Closes #2015.
   It always writes the generated Zig code to disk which makes debug
   info and compile errors better. No more "TODO: remember C source
   location to display here"
 * Fix .d file parsing. (Fixes the MacOS CI failure)
 * Zig no longer creates "temporary files" other than inside a
   zig-cache directory.

This breaks the CLI API that Godbolt uses. The suggested new invocation
can be found in this commit diff, in the changes to `test/cli.zig`.
2019-03-08 23:23:11 -05:00