Commit Graph

709 Commits

Author SHA1 Message Date
Andrew Kelley
2dd20aa04a
langref: update for sentinel-terminated types 2019-11-23 22:29:12 -05:00
Andrew Kelley
6b623b5ea2
update docs for null terminated stuff 2019-11-21 20:43:42 -05:00
Vexu
314cb707fc
fix containerdoccomment not handled in docgen.zig 2019-11-15 18:44:29 +02:00
Andrew Kelley
c806de8ae7
README: update the short description of what zig is 2019-11-13 13:44:19 -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
8bae70454d
Merge pull request #3675 from Vexu/atomic-store
Add @atomicStore builtin
2019-11-13 03:06:55 +00:00
Andrew Kelley
37318bf151
fn parameters participate in result location semantics
See #3665
2019-11-12 18:55:17 -05:00
Vexu
110ef2e528
add @atomicStore builtin 2019-11-13 00:25:44 +02:00
Andrew Kelley
0c315e7f76
update docs for anonymous struct/list literals 2019-11-11 19:57:57 -05:00
Andrew Kelley
3cf5c2c62b
fix regressed tests and update docs to use "type coercion" 2019-11-08 15:57:25 -05:00
Andrew Kelley
aef04aff0c
initial docs for @as 2019-11-08 15:57:25 -05:00
Brendan Hansknecht
c1e8fdf812 add token for parsing pointer dereference 2019-11-06 14:03:21 -05:00
xackus
8960e8090e make implicit cast of tagged unions to enums easier to find in docs 2019-10-27 21:35:22 +01:00
Maximilian Hunt
dc080573d1 Add documentation on function parameter type inference. 2019-10-22 15:28:21 -04:00
Andrew Kelley
e839250c51
Merge branch 'stratact-no-dir-allocators'
closes #2885
closes #2886
closes #2888
closes #3249
2019-10-21 23:54:29 -04:00
Vexu
2550cb4638 remove pub syntax for container fields 2019-10-21 23:04:19 -04:00
stratact
e78d3750c5
Use 8192 sized buffers and remove allocator parameters 2019-10-19 14:04:51 -04:00
Andrew Kelley
406b70aa56
Merge pull request #3390 from nrdmn/unicode_character_literals
unicode character literals
2019-10-09 13:25:41 -04:00
Nick Erdmann
ae7392e504
unicode character literals 2019-10-07 08:18:16 +02:00
Matt Keeter
e706cc24f0 Fix typo in docs 2019-10-07 02:03:57 -04:00
Andrew Kelley
8e2c441b2e
stage1 parser supports doc comments 2019-10-06 16:39:27 -04:00
Andrew Kelley
2f4dad04e0
langref: no viewport 2019-10-04 14:06:55 -04:00
Andrew Kelley
edef35bb57
docs: use the updated png favicon 2019-10-03 11:15:55 -04:00
Andrew Kelley
6f10e3fda6
llvm 9.0.0 => llvm 10.0.0 2019-10-02 02:11:46 -04:00
Andrew Kelley
5026db1d31
langref: add 0.5.0 docs link 2019-09-30 12:13:51 -04:00
Andrew Kelley
e0eb045b5f
remove unhelpful/outdated/unused doc file 2019-09-30 08:33:04 -04:00
Andrew Kelley
0e9f86b1db
docs: docgen supports release safe exe code examples
and make the type names of `@hasDecl` and `@hasField` consistent
2019-09-29 17:28:30 -04:00
Andrew Kelley
ec545859b9
docgen: support code examples for riscv target 2019-09-29 14:03:49 -04:00
Andrew Kelley
b89a09af4b
docgen: add "process terminated by signal" to exe_err 2019-09-26 13:11:07 -04:00
Andrew Kelley
94e9b9c625
docs: mention release-small along with release-fast 2019-09-26 12:05:49 -04:00
Michael Dusan
efea7958f8 doc: usingnamespace imports only public decls 2019-09-26 10:55:13 -04:00
Andrew Kelley
568c183d2a
docgen: slightly better caching 2019-09-25 17:59:52 -04:00
Andrew Kelley
993d5bc9c9
add docs for usingnamespace
closes #1589
2019-09-24 21:23:12 -04:00
Andrew Kelley
56b1818beb
docgen: test blocks support linking libc 2019-09-24 11:41:19 -04:00
Andrew Kelley
c0b937ba12
docgen: slightly cleaner display of libc cli args 2019-09-24 11:36:59 -04:00
Euan Torano
8a15537c6e Fix #3272 - update docs 2019-09-22 11:23:00 -04:00
Andrew Kelley
ee200aaa8c
fix typo in docs
closes #3267
2019-09-20 11:48:35 -04:00
Andrew Kelley
b76d16c7c7
update remaining llvm 8.0.0 references to 9.0.0 2019-09-19 20:55:02 -04:00
Andrew Kelley
8a30edcde8
Merge remote-tracking branch 'origin/master' into llvm9 2019-09-19 17:02:32 -04:00
Shawn Landden
ff9f3275de docs: clarify @clz and @ctz terminology to not be endian-specific.
This was brought up in IRC a few days ago.
2019-09-19 11:47:02 -04:00
Andrew Kelley
28c7fe60b6
add docs for @splat 2019-09-19 11:14:42 -04:00
Andrew Kelley
380c8ec2c9
implement runtime @byteSwap and other fixups
* update docs for `@byteSwap`.
 * fix hash & eql functions for ZigLLVMFnIdBswap not updated to
   include vector len. this was causing incorrect bswap function
   being called in unrelated code
 * fix `@byteSwap` behavior tests only testing comptime and not
   runtime operations
 * implement runtime `@byteSwap`
 * fix incorrect logic in ir_render_vector_to_array and
   ir_render_array_to_vector with regards to whether or not to bitcast
 * `@byteSwap` accepts an array operand which it will cast to vector
 * simplify `@byteSwap` semantic analysis code and various fixes
2019-09-19 00:59:04 -04:00
Andrew Kelley
2038f4d45a
rework the implementation
* update documentation
   - move `@shuffle` to be sorted alphabetically
   - remove mention of LLVM
   - minor clarifications & rewording
 * introduce ir_resolve_vector_elem_type to avoid duplicate compile
   error message and duplicate vector element checking logic
 * rework ir_analyze_shuffle_vector to solve various issues
 * improve `@shuffle` to allow implicit cast of arrays
 * the shuffle tests weren't being run
2019-09-18 16:15:19 -04:00
Shawn Landden
193604c837
stage1: add @shuffle() shufflevector support
I change the semantics of the mask operand, to make it a little more
flexible. There is no real danger in this because it is a compile-error
if you do it the LLVM way (and there is an appropiate error to tell you
this).

v2: avoid problems with double-free
2019-09-18 11:26:45 -04:00
Andrew Kelley
185cb13278
Merge remote-tracking branch 'origin/master' into llvm9 2019-09-10 13:00:35 -04:00
Andrew Kelley
0a3c6dbda9
implement noasync function calls
See #3157
2019-09-05 21:55:32 -04:00
Vesa Kaihlavirta
847a262efd Shorten @field documentation and add an example 2019-09-05 13:07:04 -04:00
LemonBoy
fabf45f5fc Add the noinline keyword for function declarations 2019-09-05 13:04:58 -04:00
Andrew Kelley
ac7703f65f
fixups and add documentation for @Type 2019-09-04 11:12:14 -04:00
Sahnvour
f08c6e4fe6 changing occurrences of HashMap with []const u8 as keys for StringHashMap 2019-09-03 23:53:05 +02:00
Andrew Kelley
058050f22c
Merge remote-tracking branch 'origin/master' into llvm9 2019-09-02 20:56:31 -04:00
Andrew Kelley
a223063923
@typeOf now guarantees no runtime side effects
related: #1627
2019-08-31 11:00:31 -04:00
Andrew Kelley
5f3d59f0ac
Merge branch 'master' into llvm9 2019-08-20 19:09:52 -04:00
Aaron Klapatch
efc2237e5a added documentation for field access to C pointers (#3088) 2019-08-19 16:47:16 -04:00
Andrew Kelley
4d8a6f6fea
fix compiler not checking alignment of function frames
closes #3086
2019-08-17 13:04:50 -04:00
Andrew Kelley
6529658ad8
Merge remote-tracking branch 'origin/master' into llvm9 2019-08-16 16:43:56 -04:00
Vexu
2151f84d59 implement new async syntax in self-hosted compiler 2019-08-16 06:17:28 -07:00
Andrew Kelley
d3672493cc
basic docs for new async/await semantics 2019-08-15 16:46:43 -04:00
Andrew Kelley
13b5a4bf8c
remove cancel 2019-08-15 14:05:12 -04:00
Andrew Kelley
5092634103
avoid the word "coroutine", they're "async functions" 2019-08-13 14:14:19 -04:00
Andrew Kelley
4d8d513e16
all tests passing 2019-08-11 19:53:10 -04:00
Andrew Kelley
63ebd9d12e
Merge remote-tracking branch 'origin/master' into llvm9 2019-08-03 12:39:15 -04:00
Andrew Kelley
e68fee3984
docs: add atomicrmw operations list 2019-08-02 18:54:15 -04:00
Andrew Kelley
a2e1be0346
docs: don't try to run the undefined behavior example test 2019-07-20 13:59:18 -04:00
Andrew Kelley
8ea8cff491
slightly simpler implementation 2019-07-19 17:54:06 -04:00
Benjamin Feng
111d3792e0
Docgen invalid for && 2019-07-19 17:11:58 -04:00
Andrew Kelley
23dd7f4527
organize the docs and some rewording 2019-07-16 13:13:21 -04:00
JohnathanFL
475a181028
Add multidimensional array example 2019-07-16 13:02:30 -04:00
Andrew Kelley
92e781baa1
fix documentation regarding mixing object files
closes #2905
2019-07-16 11:50:34 -04:00
Michael Dusan
1766bd8a08 doc clarify struct size and ABI-alignment 2019-07-11 20:36:30 -04:00
hryx
28b59a0be7
Remove reference to Keyword_anyerror in docgen 2019-07-06 18:19:04 -07:00
hryx
cce11a724c
Make anyerror not a keyword 2019-07-06 15:57:32 -07:00
Andrew Kelley
21c60922e3
Merge pull request #2823 from hryx/unicode-escape
Unicode escapes: support u{N...}
2019-07-06 13:14:43 -04:00
Andrew Kelley
273c2b5c25
docs: mention @unionInit in the union section 2019-07-05 14:10:50 -04:00
hryx
e35d49c4d0
Unicode escapes: documentation and grammar 2019-07-04 22:52:17 -07:00
Andrew Kelley
96fd103073
improve the error message and test coverage 2019-07-04 00:35:28 -04:00
Andrew Kelley
bfe0bf695b
Merge branch 'impl-1107' of https://github.com/emekoi/zig into emekoi-impl-1107 2019-07-03 23:40:47 -04:00
Andrew Kelley
c2cf04086a
add docs for enum literals
closes #683
2019-07-03 23:09:58 -04:00
emekoi
a1b952f4b0 added tests for #1107 and a note in the reference 2019-07-03 13:12:14 -05:00
Andrew Kelley
4bae87764f
update @unionInit to integrate with result location semantics 2019-07-03 13:40:40 -04:00
Andrew Kelley
df11512f85
fixups 2019-07-02 16:52:55 -04:00
Andrew Kelley
140335b99f
Merge branch 'has-field' of https://github.com/shawnl/zig into shawnl-has-field 2019-07-02 16:21:40 -04:00
Andrew Kelley
04b32d6a8a
docs: mention the standard library documentation
also mention the FAQ in the README.

also link to the other documentation versions.
2019-07-02 15:21:58 -04:00
emekoi
8156a61de8 fix syntax highlighting 2019-06-29 13:21:27 -04:00
Andrew Kelley
3085d29af8
Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-26 14:44:01 -04:00
Andrew Kelley
33f996bb16
all tests passing on linux 2019-06-26 14:00:44 -04:00
Andrew Kelley
b2cbc59e4c
Merge branch 'simd2' of https://github.com/shawnl/zig into shawnl-simd2 2019-06-23 17:10:33 -04:00
Shawn Landden
71e014caec stage1: add @sin @cos @exp @exp2 @ln @log2 @log10 @fabs @floor @ceil @trunc @round
and expand @sqrt

This revealed that the accuracy of ln is not as good as the current algorithm in
musl and glibc, and should be ported again.

v2: actually include tests
v3: fix reversal of in and out arguments on f128M_sqrt()
    add test for @sqrt on comptime_float
    do not include @nearbyInt() until it works on all targets.
2019-06-22 14:34:34 -05: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
Gray Olson
be51511d29 Update langref.html.in 2019-06-22 01:15:47 -04:00
Shawn Landden
fce2d2d18b stage1: add support for @mulAdd fused-multiply-add for floats and vectors of floats
Not all of the softfloat library is being built....

Vector support is very buggy at the moment, but should work when the bugs are fixed.
(as I had the same code working with another vector function, that hasn't been merged yet).
2019-06-19 12:07:02 -05:00
Boris
99112b5d4a fix tiny typo in langref.html.in 2019-06-18 10:01:48 -04:00
Andrew Kelley
f8f054b354
fix @export for arrays not respecting the symbol name
Previously, the symbol name parameter of `@export` would be ignored for
variables, and the variable name would be used for the symbol name.
Now it works as expected.

See #2679
2019-06-14 17:23:24 -04:00
Nicholas Walton
fcc0728a35 Update langref.html.in
Missing an "it"
2019-06-11 14:37:15 -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
markfirmware
10e33b3536 grammar 2019-06-09 01:34:13 -04:00
Jonathan Pentecost
ad064b4a0b docs: update for else example
Updates: #2614
2019-06-08 22:58:31 -04:00
Shritesh Bhattarai
404e4b0268 docs: add comment about for else and break 2019-06-08 16:21:46 -04:00
Shritesh Bhattarai
6d73e5de05 doc: recommend optional pointers for nullptrs instead of allowzero 2019-05-31 02:26:19 -04:00
Andrew Kelley
78f32259da
default struct field initialization expressions
closes #485
2019-05-30 15:46:11 -04:00
tgschultz
f9e7bd2682 std.meta/trait: def/definition => decl/declaration
TypeInfo: defs/Definition => decls/Declarations
2019-05-29 20:43:07 -04:00
Andrew Kelley
b7a82288ad
change use to usingnamespace
See #2014

`use` syntax is still accepted for now. `zig fmt` automatically
updates code. After a release cycle the old syntax will be removed.
2019-05-29 19:09:58 -04:00
Andrew Kelley
d1b6f29d22
Merge pull request #2523 from shritesh/wasmdoc
docs: wasm
2019-05-27 22:37:15 -04:00
Andrew Kelley
abf959a0c9
fix debug builds of WASI 2019-05-27 02:16:05 -04:00
Andrew Kelley
fda7e0bb01
std lib fixes for zig build on windows 2019-05-27 02:00:39 -04:00
Shawn Landden
5a91dbc16c allow const to be passed to @hasField()
Actually include the tests I wrote
2019-05-27 00:38:36 -05:00
Andrew Kelley
0c6ab61b22
tests passing on linux 2019-05-26 23:35:26 -04:00
Andrew Kelley
2f040a23c8
clean up references to os 2019-05-26 18:32:44 -04:00
Andrew Kelley
daae7e1f5a
more progress on posix API layer
see #2380
2019-05-26 18:32:43 -04:00
Andrew Kelley
67726e36b0
extract posix functions from std/os.zig to std/os/posix.zig
See #2380
2019-05-26 18:32:40 -04:00
Andrew Kelley
269a53b6af
introduce @hasDecl builtin function
closes #1439
2019-05-26 16:21:03 -04:00
Shritesh Bhattarai
b618a0b866 doc: wasm: embedded->host 2019-05-22 09:37:37 -07:00
Shritesh Bhattarai
9e65a144fa docs: clarify why wasm_allocator should be used 2019-05-22 07:43:17 -07:00
Shritesh Bhattarai
3b6fc3fdc7 docs: wasm 2019-05-19 19:32:28 -07:00
Andrew Kelley
80983ca1ca
fixups to the previous commit 2019-05-16 16:37:58 -04:00
Shawn Landden
1fdb24827f
breaking changes to all bit manipulation intrinsics
* `@clz`, `@ctz`, `@popCount`, `@bswap`, `@bitreverse` now
   have a type parameter
 * rename @bitreverse to @bitReverse
 * rename @bswap to @byteSwap

Closes #2119
Closes #2120
2019-05-16 16:37:58 -04:00
Shritesh Bhattarai
56a905c7d1 docgen: add lib codeblock type and use it for wasm32-freestanding 2019-05-16 14:58:10 -04:00
Jimmi Holst Christensen
ba3d18a80e added grammar rule for enum literal to docs 2019-05-11 20:26:41 +02:00
Shawn Landden
d1f9b8184d docs for @hasField 2019-05-06 11:58:04 -05:00
Shritesh Bhattarai
2f39da7cdd docgen: show -target command line argument 2019-05-03 15:56:33 -04:00
Shritesh Bhattarai
5c04c22bcc docgen: support wasm and wasi 2019-05-03 15:56:33 -04:00
Andrew Kelley
8cda4fd73a
docs: remove @setGlobalLinkage section
`@setGlobalLinkage` was removed with #462. The not-yet-implemented
proposal for external weak symbols is #1917.
2019-05-03 13:38:24 -04:00
Andrew Kelley
f8117a0799
docs: update for shared libraries 2019-05-02 12:00:16 -04:00
Andrew Kelley
6e4f69a54a
docgen: add exe_build_err tag 2019-05-01 15:34:36 -04:00
Andrew Kelley
54a93e5393
docs: add note to @setRuntimeSafety 2019-05-01 15:09:03 -04:00
Shritesh Bhattarai
efc5122fb6 docgen: properly close tags for skipped execs 2019-04-26 19:33:33 -04:00
Andrew Kelley
fb2acaff06
@sizeOf returns 0 for comptime types
This defines `@sizeOf` to be the runtime size of a type, which means
that it is zero for types such as comptime_int, type, and (enum
literal).

See #2209
2019-04-24 22:31:53 -04:00
hryx
06bf918436 Sync grammar with spec
- Remove rule LabeledExpr
- Add rule CurlySuffixExpr
2019-04-24 14:38:56 -04:00
Matt Stancliff
3b6a4fe4cd Fix test in langref to assert against modified var 2019-04-18 16:14:30 -04:00
Andrew Kelley
b29241fc08
docs: update intro text 2019-04-16 14:23:58 -04:00
Duncan
a43fd7a550 Add favicon to langref.html 2019-04-13 16:20:33 -04:00
Andrew Kelley
e309ad884a
fix outdated/incorrect docs for @truncate
closes #2234
2019-04-10 23:00:53 -04:00
Jay Weisskopf
98fa065de7 docs: Underline link when hovering over it
In addition to the pointer, this gives some visual feedback to the user
that the element is interactive. This is a very common style pattern
across the web.
2019-04-09 00:31:25 -04:00
Andrew Kelley
974977f12f
docgen: add a space between the header and the section symbol 2019-04-05 23:12:25 -04:00
Andrew Kelley
f6be6ace1f
docgen: allow urls to have numbers 2019-04-05 17:33:58 -04:00
Andrew Kelley
a5b47bc2c2
docs: update @typeInfo definition and clarify field order 2019-04-05 12:38:15 -04:00
Jay Weisskopf
3cce56af99 docs: Use section symbol §, not paragraph symbol ¶
A header may cover more than one paragraph, so a section symbol is more appropriate. 

https://en.wikipedia.org/wiki/Section_sign
2019-04-05 11:09:38 -04:00
Andrew Kelley
7dd1e0fc2b
docs: add Variables section
closes #1927
2019-04-04 12:26:47 -04:00
Andrew Kelley
90b6eab05a
docs: complete the documentation for extern struct
closes #1522
2019-04-04 01:23:41 -04:00
Andrew Kelley
b60f2d0c9f
langref: rework the theming and layout
* Instead of the only color scheme being dark, the language reference
   now has a light theme by default, and respects the user's light/dark
   preference via prefers-color-scheme media query. Most browsers don't
   support this yet, so we just have to wait patiently for the future to
   arrive. closes #2172.

 * Instead of a side bar index, the index is inline with the rest of the
   content. This is simpler and more friendly to all user agents, and means
   we don't need the media query for mobile devices. It also makes
   back-references work, so now headers link to the table of contents
   and the table of contents links to headers.
2019-04-03 17:39:07 -04:00
Andrew Kelley
5aee17e888
regression fixes and fix packed struct abi size 2019-04-02 18:31:19 -04:00
MateuszOkulus
62af701804 Remove binary and octal float literals from documentation.
Part of #2093
2019-03-31 10:49:55 -04:00
Andrew Kelley
5eaead6a56
implement allowzero pointer attribute
closes #1953

only needed for freestanding targets.

also adds safety for `@intToPtr` when the address is zero.
2019-03-25 12:55:45 -04:00
Andrew Kelley
64dddd7afe
add compile error for ignoring error
closes #772
2019-03-23 19:33:00 -04:00
Andrew Kelley
4d50bc3f8d
add peer type resolution for *const T and ?*T
closes #1298
2019-03-23 18:48:12 -04:00
Andrew Kelley
89953ec83d
character literals: allow unicode escapes
also make the documentation for character literals more clear.
closes #2089

see #2097
2019-03-23 17:35:21 -04:00
Andrew Kelley
55cb9ef138
docs: clarify NaN, inf, -inf
closes #2089
2019-03-23 15:25:38 -04:00
Matt Stancliff
1ca78e39e4 Fix typos around pointer usage 2019-03-22 14:10:17 -04:00
Jimmi Holst Christensen
23af502d04 Updated langref to newest grammar 2019-03-22 09:01:30 +01:00
Andrew Kelley
246304125a
add documentation for zig test
closes #1518
2019-03-20 23:50:22 -04:00