From 7199d7c77715fe06606c5c89595e6852b3fa8c20 Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Mon, 13 Feb 2023 16:19:17 +0200 Subject: [PATCH] split `@qualCast` into `@constCast` and `@volatileCast` --- doc/langref.html.in | 24 ++++--- lib/docs/main.js | 8 ++- lib/std/child_process.zig | 4 +- lib/std/fs.zig | 2 +- lib/std/mem/Allocator.zig | 4 +- lib/std/os.zig | 2 +- lib/std/os/windows.zig | 14 ++-- lib/std/zig/c_translation.zig | 6 +- src/AstGen.zig | 18 ++++- src/Autodoc.zig | 3 +- src/BuiltinFn.zig | 24 ++++--- src/Sema.zig | 62 +++++++++--------- src/Zir.zig | 12 ++-- src/print_zir.zig | 3 +- stage1/zig1.wasm | Bin 2373912 -> 2377691 bytes test/behavior/cast.zig | 15 +++++ .../cases/compile_errors/invalid_qualcast.zig | 12 ---- .../ptrCast_discards_const_qualifier.zig | 2 +- 18 files changed, 127 insertions(+), 88 deletions(-) delete mode 100644 test/cases/compile_errors/invalid_qualcast.zig diff --git a/doc/langref.html.in b/doc/langref.html.in index 9490c4e69d..a74d06ccbf 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -8129,6 +8129,13 @@ test "main" { {#code_end#} {#header_close#} + {#header_open|@constCast#} +
{#syntax#}@constCast(value: anytype) DestType{#endsyntax#}
+

+ Remove {#syntax#}const{#endsyntax#} qualifier from a pointer. +

+ {#header_close#} + {#header_open|@ctz#}
{#syntax#}@ctz(operand: anytype){#endsyntax#}

{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type or an integer vector type.

@@ -8814,7 +8821,8 @@ pub const PrefetchOptions = struct { {#syntax#}@ptrCast{#endsyntax#} cannot be used for: