authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2023-03-03 16:16:08+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-03-21 15:05:57+02:00
log8642770eff4f1770aa5de88907946c60fe5ff0d8
treea376ed3466dd10ccb8789180d3793e1dc51a465b
parentf9b5829508e4f9a7e2eee2f05f58a38c00318d91

langref: add missing return types to builtin functions

This should add all remaining missing return types to all builtin functions. For @clz, @ctz, and @popCount it uses anytype for the lack of a better alternative. We already use this return type for other builtin functions in the langref to indicate that the type is not always the same. It is not possible to use anytype as the return type for regular functions but builtin functions are special.

1 files changed, 17 insertions(+), 17 deletions(-)

doc/langref.html.in+17-17
...@@ -7814,7 +7814,7 @@ comptime {...@@ -7814,7 +7814,7 @@ comptime {
7814 {#header_close#}7814 {#header_close#}
78157815
7816 {#header_open|@breakpoint#}7816 {#header_open|@breakpoint#}
7817 <pre>{#syntax#}@breakpoint(){#endsyntax#}</pre>7817 <pre>{#syntax#}@breakpoint() void{#endsyntax#}</pre>
7818 <p>7818 <p>
7819 This function inserts a platform-specific debug trap instruction which causes7819 This function inserts a platform-specific debug trap instruction which causes
7820 debuggers to break there.7820 debuggers to break there.
...@@ -7933,7 +7933,7 @@ pub const CallModifier = enum {...@@ -7933,7 +7933,7 @@ pub const CallModifier = enum {
7933 {#header_close#}7933 {#header_close#}
79347934
7935 {#header_open|@cDefine#}7935 {#header_open|@cDefine#}
7936 <pre>{#syntax#}@cDefine(comptime name: []u8, value){#endsyntax#}</pre>7936 <pre>{#syntax#}@cDefine(comptime name: []u8, value) void{#endsyntax#}</pre>
7937 <p>7937 <p>
7938 This function can only occur inside {#syntax#}@cImport{#endsyntax#}.7938 This function can only occur inside {#syntax#}@cImport{#endsyntax#}.
7939 </p>7939 </p>
...@@ -7977,7 +7977,7 @@ pub const CallModifier = enum {...@@ -7977,7 +7977,7 @@ pub const CallModifier = enum {
7977 {#see_also|Import from C Header File|@cInclude|@cDefine|@cUndef#}7977 {#see_also|Import from C Header File|@cInclude|@cDefine|@cUndef#}
7978 {#header_close#}7978 {#header_close#}
7979 {#header_open|@cInclude#}7979 {#header_open|@cInclude#}
7980 <pre>{#syntax#}@cInclude(comptime path: []u8){#endsyntax#}</pre>7980 <pre>{#syntax#}@cInclude(comptime path: []u8) void{#endsyntax#}</pre>
7981 <p>7981 <p>
7982 This function can only occur inside {#syntax#}@cImport{#endsyntax#}.7982 This function can only occur inside {#syntax#}@cImport{#endsyntax#}.
7983 </p>7983 </p>
...@@ -7989,7 +7989,7 @@ pub const CallModifier = enum {...@@ -7989,7 +7989,7 @@ pub const CallModifier = enum {
7989 {#header_close#}7989 {#header_close#}
79907990
7991 {#header_open|@clz#}7991 {#header_open|@clz#}
7992 <pre>{#syntax#}@clz(operand: anytype){#endsyntax#}</pre>7992 <pre>{#syntax#}@clz(operand: anytype) anytype{#endsyntax#}</pre>
7993 <p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type or an integer vector type.</p>7993 <p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type or an integer vector type.</p>
7994 <p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>7994 <p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>
7995 <p>7995 <p>
...@@ -8068,7 +8068,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val...@@ -8068,7 +8068,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
8068 {#header_close#}8068 {#header_close#}
80698069
8070 {#header_open|@compileError#}8070 {#header_open|@compileError#}
8071 <pre>{#syntax#}@compileError(comptime msg: []u8){#endsyntax#}</pre>8071 <pre>{#syntax#}@compileError(comptime msg: []u8) noreturn{#endsyntax#}</pre>
8072 <p>8072 <p>
8073 This function, when semantically analyzed, causes a compile error with the8073 This function, when semantically analyzed, causes a compile error with the
8074 message {#syntax#}msg{#endsyntax#}.8074 message {#syntax#}msg{#endsyntax#}.
...@@ -8081,7 +8081,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val...@@ -8081,7 +8081,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
8081 {#header_close#}8081 {#header_close#}
80828082
8083 {#header_open|@compileLog#}8083 {#header_open|@compileLog#}
8084 <pre>{#syntax#}@compileLog(args: ...){#endsyntax#}</pre>8084 <pre>{#syntax#}@compileLog(args: ...) void{#endsyntax#}</pre>
8085 <p>8085 <p>
8086 This function prints the arguments passed to it at compile-time.8086 This function prints the arguments passed to it at compile-time.
8087 </p>8087 </p>
...@@ -8139,7 +8139,7 @@ test "main" {...@@ -8139,7 +8139,7 @@ test "main" {
8139 {#header_close#}8139 {#header_close#}
81408140
8141 {#header_open|@ctz#}8141 {#header_open|@ctz#}
8142 <pre>{#syntax#}@ctz(operand: anytype){#endsyntax#}</pre>8142 <pre>{#syntax#}@ctz(operand: anytype) anytype{#endsyntax#}</pre>
8143 <p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type or an integer vector type.</p>8143 <p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type or an integer vector type.</p>
8144 <p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>8144 <p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>
8145 <p>8145 <p>
...@@ -8159,7 +8159,7 @@ test "main" {...@@ -8159,7 +8159,7 @@ test "main" {
8159 {#header_close#}8159 {#header_close#}
81608160
8161 {#header_open|@cUndef#}8161 {#header_open|@cUndef#}
8162 <pre>{#syntax#}@cUndef(comptime name: []u8){#endsyntax#}</pre>8162 <pre>{#syntax#}@cUndef(comptime name: []u8) void{#endsyntax#}</pre>
8163 <p>8163 <p>
8164 This function can only occur inside {#syntax#}@cImport{#endsyntax#}.8164 This function can only occur inside {#syntax#}@cImport{#endsyntax#}.
8165 </p>8165 </p>
...@@ -8370,7 +8370,7 @@ export fn @"A function name that is a complete sentence."() void {}...@@ -8370,7 +8370,7 @@ export fn @"A function name that is a complete sentence."() void {}
8370 {#header_close#}8370 {#header_close#}
83718371
8372 {#header_open|@fence#}8372 {#header_open|@fence#}
8373 <pre>{#syntax#}@fence(order: AtomicOrder){#endsyntax#}</pre>8373 <pre>{#syntax#}@fence(order: AtomicOrder) void{#endsyntax#}</pre>
8374 <p>8374 <p>
8375 The {#syntax#}fence{#endsyntax#} function is used to introduce happens-before edges between operations.8375 The {#syntax#}fence{#endsyntax#} function is used to introduce happens-before edges between operations.
8376 </p>8376 </p>
...@@ -8622,7 +8622,7 @@ test "integer cast panic" {...@@ -8622,7 +8622,7 @@ test "integer cast panic" {
8622 {#header_close#}8622 {#header_close#}
86238623
8624 {#header_open|@memcpy#}8624 {#header_open|@memcpy#}
8625 <pre>{#syntax#}@memcpy(noalias dest: [*]u8, noalias source: [*]const u8, byte_count: usize){#endsyntax#}</pre>8625 <pre>{#syntax#}@memcpy(noalias dest: [*]u8, noalias source: [*]const u8, byte_count: usize) void{#endsyntax#}</pre>
8626 <p>8626 <p>
8627 This function copies bytes from one region of memory to another. {#syntax#}dest{#endsyntax#} and8627 This function copies bytes from one region of memory to another. {#syntax#}dest{#endsyntax#} and
8628 {#syntax#}source{#endsyntax#} are both pointers and must not overlap.8628 {#syntax#}source{#endsyntax#} are both pointers and must not overlap.
...@@ -8641,7 +8641,7 @@ mem.copy(u8, dest[0..byte_count], source[0..byte_count]);{#endsyntax#}</pre>...@@ -8641,7 +8641,7 @@ mem.copy(u8, dest[0..byte_count], source[0..byte_count]);{#endsyntax#}</pre>
8641 {#header_close#}8641 {#header_close#}
86428642
8643 {#header_open|@memset#}8643 {#header_open|@memset#}
8644 <pre>{#syntax#}@memset(dest: [*]u8, c: u8, byte_count: usize){#endsyntax#}</pre>8644 <pre>{#syntax#}@memset(dest: [*]u8, c: u8, byte_count: usize) void{#endsyntax#}</pre>
8645 <p>8645 <p>
8646 This function sets a region of memory to {#syntax#}c{#endsyntax#}. {#syntax#}dest{#endsyntax#} is a pointer.8646 This function sets a region of memory to {#syntax#}c{#endsyntax#}. {#syntax#}dest{#endsyntax#} is a pointer.
8647 </p>8647 </p>
...@@ -8753,7 +8753,7 @@ test "@wasmMemoryGrow" {...@@ -8753,7 +8753,7 @@ test "@wasmMemoryGrow" {
8753 {#header_close#}8753 {#header_close#}
87548754
8755 {#header_open|@popCount#}8755 {#header_open|@popCount#}
8756 <pre>{#syntax#}@popCount(operand: anytype){#endsyntax#}</pre>8756 <pre>{#syntax#}@popCount(operand: anytype) anytype{#endsyntax#}</pre>
8757 <p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type.</p>8757 <p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type.</p>
8758 <p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>8758 <p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>
8759 <p>Counts the number of bits set in an integer.</p>8759 <p>Counts the number of bits set in an integer.</p>
...@@ -8767,7 +8767,7 @@ test "@wasmMemoryGrow" {...@@ -8767,7 +8767,7 @@ test "@wasmMemoryGrow" {
8767 {#header_close#}8767 {#header_close#}
87688768
8769 {#header_open|@prefetch#}8769 {#header_open|@prefetch#}
8770 <pre>{#syntax#}@prefetch(ptr: anytype, comptime options: std.builtin.PrefetchOptions){#endsyntax#}</pre>8770 <pre>{#syntax#}@prefetch(ptr: anytype, comptime options: std.builtin.PrefetchOptions) void{#endsyntax#}</pre>
8771 <p>8771 <p>
8772 This builtin tells the compiler to emit a prefetch instruction if supported by the8772 This builtin tells the compiler to emit a prefetch instruction if supported by the
8773 target CPU. If the target CPU does not support the requested prefetch instruction,8773 target CPU. If the target CPU does not support the requested prefetch instruction,
...@@ -8881,21 +8881,21 @@ pub const PrefetchOptions = struct {...@@ -8881,21 +8881,21 @@ pub const PrefetchOptions = struct {
8881 {#header_close#}8881 {#header_close#}
88828882
8883 {#header_open|@setAlignStack#}8883 {#header_open|@setAlignStack#}
8884 <pre>{#syntax#}@setAlignStack(comptime alignment: u29){#endsyntax#}</pre>8884 <pre>{#syntax#}@setAlignStack(comptime alignment: u29) void{#endsyntax#}</pre>
8885 <p>8885 <p>
8886 Ensures that a function will have a stack alignment of at least {#syntax#}alignment{#endsyntax#} bytes.8886 Ensures that a function will have a stack alignment of at least {#syntax#}alignment{#endsyntax#} bytes.
8887 </p>8887 </p>
8888 {#header_close#}8888 {#header_close#}
88898889
8890 {#header_open|@setCold#}8890 {#header_open|@setCold#}
8891 <pre>{#syntax#}@setCold(comptime is_cold: bool){#endsyntax#}</pre>8891 <pre>{#syntax#}@setCold(comptime is_cold: bool) void{#endsyntax#}</pre>
8892 <p>8892 <p>
8893 Tells the optimizer that a function is rarely called.8893 Tells the optimizer that a function is rarely called.
8894 </p>8894 </p>
8895 {#header_close#}8895 {#header_close#}
88968896
8897 {#header_open|@setEvalBranchQuota#}8897 {#header_open|@setEvalBranchQuota#}
8898 <pre>{#syntax#}@setEvalBranchQuota(comptime new_quota: u32){#endsyntax#}</pre>8898 <pre>{#syntax#}@setEvalBranchQuota(comptime new_quota: u32) void{#endsyntax#}</pre>
8899 <p>8899 <p>
8900 Changes the maximum number of backwards branches that compile-time code8900 Changes the maximum number of backwards branches that compile-time code
8901 execution can use before giving up and making a compile error.8901 execution can use before giving up and making a compile error.
...@@ -8930,7 +8930,7 @@ test "foo" {...@@ -8930,7 +8930,7 @@ test "foo" {
8930 {#header_close#}8930 {#header_close#}
89318931
8932 {#header_open|@setFloatMode#}8932 {#header_open|@setFloatMode#}
8933 <pre>{#syntax#}@setFloatMode(comptime mode: @import("std").builtin.FloatMode){#endsyntax#}</pre>8933 <pre>{#syntax#}@setFloatMode(comptime mode: @import("std").builtin.FloatMode) void{#endsyntax#}</pre>
8934 <p>8934 <p>
8935 Sets the floating point mode of the current scope. Possible values are:8935 Sets the floating point mode of the current scope. Possible values are:
8936 </p>8936 </p>