Commit Graph

953 Commits

Author SHA1 Message Date
Kirk Scheibelhut 971ef7b9c2 Remove primitive values from keyword reference
5a53ab28 removed these as keywords, and the Primitive Values section
of the docs already exists to describe them.
2022-04-09 12:48:36 +02:00
Philipp Lühmann 795f075790 langref: rename incorrect expect to assert 2022-04-04 15:44:01 +03:00
dxps 9a127501f6 chore: doc fixes, closes 11091 2022-03-25 11:22:30 +02:00
Robin Voetter 5c3325588e stage1: make type names more unique 2022-03-19 19:40:46 -04:00
Andrew Kelley f3f5a5d05b stage2: improve @typeName
* make it always return a fully qualified name. stage1 is inconsistent
   about this.
 * AstGen: fix anon_name_strategy to correctly be `func` when anon type
   creation happens in the operand of the return expression.
 * Sema: implement type names for the "function" naming strategy.
 * Put "enum", "union", "opaque", or "struct" in place of "anon" when
   creating respective anonymous Decl names.
 * std.testing: add `expectStringStartsWith`. Didn't end up using it
   after all.

Also this enables the real test runner for stage2 LLVM backend (sans
wasm32) since it works now.
2022-03-18 00:12:22 -07:00
Andrew Kelley 73e51133c3 langref: small clarification of @reduce 2022-03-17 17:22:57 -07:00
Andrew Kelley d42d31f72f basic language features do not belong in std.meta 2022-03-14 00:11:46 -07:00
Andrew Kelley 627209253c langref: fix a stray anyopaque that should be a void 2022-03-08 14:58:53 -07:00
The Depressed Milkman cd43f323d2 correct @frameSize() params in documentation
The documentation omitted the primary parameter, making it difficult to
understand what this function actually does.
2022-03-06 10:32:07 +02:00
Exonorid 91a88a789f Add documentation for common mistakes in errdefer scoping 2022-02-23 14:33:51 +02:00
Veikka Tuominen c9dde10f86 stage1: improve error message when casting tuples 2022-02-17 17:39:54 +02:00
Andrew Kelley dc6553d93e CI: update download page and langref for 0.9.1 2022-02-14 20:08:04 -07:00
Andrew Kelley 1e49d1fca8 langref: correct info about type info of declarations 2022-02-14 12:26:55 -07:00
Andrew Kelley 210ee1067b update more API usage of std.Progress
fixes regression introduced in 5a00e24963
2022-02-08 17:49:40 -07:00
Kirk Scheibelhut 71321b6941 Various documentation fixes
Co-authored-by: Kirk Scheibelhut <kjs@scheibo.com>
Co-authored-by: extrasharp <genericpb@gmail.com>
2022-02-04 21:27:50 +02:00
GithubPrankster 23e981bbd1 Correct f80 description 2022-02-02 15:54:30 +02: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
Sage Hane e288148f60 fs: Use OpenMode enum instead of read/write flags. 2022-01-29 15:52:08 +02:00
Veikka Tuominen 67d04a988a std: add f80 bits 2022-01-28 11:45:04 -07:00
praschke 6d1b1374f7 docs: reorganize @truncate and @intCast for clarity 2022-01-27 19:51:17 +02:00
Philipp Lühmann db1edb6535 fix precedence in langref or example 2022-01-27 19:39:35 +02:00
Exonorid 3e6952ad16 Added documentation for implicit struct pointer dereferencing 2022-01-27 19:33:07 +02:00
r00ster dd076d8cba Add missing package to the langref that's always available 2022-01-07 14:18:47 -05: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
John Schmidt 0d09b87c14 Langref: replace mentions of c_void with anyopaque 2021-12-21 11:13:21 -08:00
Andrew Kelley a18bf7a7bf Release 0.9.0 2021-12-20 13:13:19 -07:00
Andrew Kelley 80b21cef5a langref: fix tidy html error
regressed in 8468b544e8
2021-12-18 23:57:00 -07:00
Isaac Freund 9f9f215305 stage1, stage2: rename c_void to anyopaque (#10316)
zig fmt now replaces c_void with anyopaque to make updating
code easy.
2021-12-19 00:24:45 -05:00
bnprks 8468b544e8 Add Vector documentation (#10303)
* Create Vector language documentation

Main changes to docs:
1. Create brief documentation on Zig vector types with code example
2. Get rid of the SIMD sub-heading under the main Vectors heading,
and update links accordingly
3. Add an example to the `@shuffle` docs
2021-12-18 23:40:57 -05:00
Isaac Freund 516945d7d9 langref: document @prefetch() builtin 2021-12-11 00:29:31 +01:00
Michael Byrne 7e2fae10c9 Add documentation for sentinel-terminated slicing (#10010)
closes #9680
2021-12-03 20:37:48 -05:00
Andrew Kelley f3edff439e improve detection of how to execute binaries on the host
`getExternalExecutor` is moved from `std.zig.CrossTarget` to
`std.zig.system.NativeTargetInfo.getExternalExecutor`.

The function also now communicates a bit more information about *why*
the host is unable to execute a binary. The CLI is updated to report
this information in a useful manner.

`getExternalExecutor` is also improved to detect such patterns as:
 * x86_64 is able to execute x86 binaries
 * aarch64 is able to execute arm binaries
 * etc.

Added qemu-hexagon support to `getExternalExecutor`.

`std.Target.canExecBinaries` of is removed; callers should use the more
powerful `getExternalExecutor` instead.

Now that `zig test` tries to run the resulting binary no matter what,
this commit has a follow-up change to the build system and docgen to
utilize the `getExternalExecutor` function and pass `--test-no-exec`
in some cases to avoid getting the error.

Additionally:

 * refactor: extract NativePaths and NativeTargetInfo into their own
   files named after the structs.
 * small improvement to langref to reduce the complexity of the `callconv`
   expression in a couple examples.
2021-12-02 21:51:14 -07:00
Lee Cannon 02e5e0ba1f allocgate: apply missed changes 2021-11-30 23:32:48 +00: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
Michael Byrne ee98d87008 Minor rewording of "Shadowing" section within language reference 2021-10-23 02:57:20 -04:00
Andrew Kelley 7f006287ae Merge pull request #9878 from pfgithub/patch-4
Add line numbers to langref
2021-10-12 14:21:28 -04: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
Mr. Paul 65e4926c5b langref: Explain Zig Test
Updates the Language Reference sections: Comments, Values, and Zig Test.

Zig Test section moved down with the goal "make sure it can be read top to
bottom sensibly" in mind (issue #1524).

Comments and Values section examples changed test declarations to a main
function and expect statement to print statements.

A print statement was added to the "String Literals and Unicode Code Point"
section's example to demonstrate the "u" format specifier.

Zig Test Section:
* Addresses the question: "How does the syntax work?".
* Partially answers the question: "What can I do with the zig test tool?" but
should be sufficient to understand the examples in all of this document.
* Addresses the question: "How does a top-level test block differ from a function definition?"
* Provides a example to run multiple test.

Lacks clear definitions of containers, top-level, order independence, lazy
analysis, resolve, reference.

GitHub Issues: #8221, #8234
2021-10-04 15:35:01 -04:00
pfg 5d8f8cdca5 fix assuming multiline string tokens end with '\n' 2021-10-03 16:32:30 -04:00
pfg a92b144260 switch back to peg for the grammar type 2021-10-03 16:27:12 -04:00
pfg 0b440d9e29 fix the erroring tests 2021-10-02 17:04:51 -04:00
pfg 224423ac27 fix grammer file name and .y file type 2021-10-02 16:54:05 -04:00
pfg cfbbd97075 fix incorrectly escaped html 2021-10-02 16:33:58 -04:00
pfg d82b3e2fb1 fix fmt 2021-10-01 16:53:58 -04:00
pfg ebdd9e8719 fix style in th 2021-10-01 16:23:58 -04:00
pfg d5c5824c80 fix line numbers on multiline strings, add line numbers to peg grammar 2021-10-01 16:06:30 -04:00
pfg de92925897 Add line numbers to langref (fixes #9870) 2021-10-01 15:43:23 -04:00