Skip to content

Commit

Permalink
rename "debug safety" to "runtime safety"
Browse files Browse the repository at this point in the history
closes #437
  • Loading branch information
andrewrk committed Jan 25, 2018
1 parent b71a56c commit e5bc587
Show file tree
Hide file tree
Showing 35 changed files with 221 additions and 243 deletions.
2 changes: 1 addition & 1 deletion build.zig
Expand Up @@ -116,7 +116,7 @@ pub fn build(b: &Builder) -> %void {
test_step.dependOn(tests.addBuildExampleTests(b, test_filter));
test_step.dependOn(tests.addCompileErrorTests(b, test_filter));
test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter));
test_step.dependOn(tests.addDebugSafetyTests(b, test_filter));
test_step.dependOn(tests.addRuntimeSafetyTests(b, test_filter));
test_step.dependOn(tests.addTranslateCTests(b, test_filter));
test_step.dependOn(tests.addGenHTests(b, test_filter));
}
Expand Down
2 changes: 1 addition & 1 deletion doc/docgen.zig
Expand Up @@ -896,7 +896,7 @@ fn genHtml(allocator: &mem.Allocator, tokenizer: &Tokenizer, toc: &Toc, out: &io
}
if (mem.indexOf(u8, result.stderr, error_match) == null) {
warn("{}\nExpected to find '{}' in stderr", result.stderr, error_match);
return parseError(tokenizer, code.source_token, "example did not have expected debug safety error message");
return parseError(tokenizer, code.source_token, "example did not have expected runtime safety error message");
}
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const colored_stderr = try termColor(allocator, escaped_stderr);
Expand Down
12 changes: 6 additions & 6 deletions doc/langref.html.in
Expand Up @@ -3090,7 +3090,7 @@ fn doAThing(nullable_foo: ?&Foo) {
{#header_open|this#}
<p>TODO: example of this referring to Self struct</p>
<p>TODO: example of this referring to recursion function</p>
<p>TODO: example of this referring to basic block for @setDebugSafety</p>
<p>TODO: example of this referring to basic block for @setRuntimeSafety</p>
{#header_close#}
{#header_open|comptime#}
<p>
Expand Down Expand Up @@ -4325,10 +4325,10 @@ test "call foo" {
Tells the optimizer that a function is rarely called.
</p>
{#header_close#}
{#header_open|@setDebugSafety#}
<pre><code class="zig">@setDebugSafety(scope, safety_on: bool)</code></pre>
{#header_open|@setRuntimeSafety#}
<pre><code class="zig">@setRuntimeSafety(safety_on: bool)</code></pre>
<p>
Sets whether debug safety checks are on for a given scope.
Sets whether runtime safety checks are on for the scope that contains the function call.
</p>

{#header_close#}
Expand Down Expand Up @@ -4595,7 +4595,7 @@ pub fn build(b: &Builder) -> %void {
detected at compile-time, Zig emits an error. Most undefined behavior that
cannot be detected at compile-time can be detected at runtime. In these cases,
Zig has safety checks. Safety checks can be disabled on a per-block basis
with <code>@setDebugSafety</code>. The {#link|ReleaseFast#}
with <code>@setRuntimeSafety</code>. The {#link|ReleaseFast#}
build mode disables all safety checks in order to facilitate optimizations.
</p>
<p>
Expand Down Expand Up @@ -5765,7 +5765,7 @@ hljs.registerLanguage("zig", function(t) {
a = t.IR + "\\s*\\(",
c = {
keyword: "const align var extern stdcallcc nakedcc volatile export pub noalias inline struct packed enum union break return try catch test continue unreachable comptime and or asm defer errdefer if else switch while for fn use bool f32 f64 void type noreturn error i8 u8 i16 u16 i32 u32 i64 u64 isize usize i8w u8w i16w i32w u32w i64w u64w isizew usizew c_short c_ushort c_int c_uint c_long c_ulong c_longlong c_ulonglong",
built_in: "breakpoint returnAddress frameAddress fieldParentPtr setFloatMode IntType OpaqueType compileError compileLog setCold setDebugSafety setEvalBranchQuota offsetOf memcpy inlineCall setGlobalLinkage setGlobalSection divTrunc divFloor enumTagName intToPtr ptrToInt panic canImplicitCast ptrCast bitCast rem mod memset sizeOf alignOf alignCast maxValue minValue memberCount typeOf addWithOverflow subWithOverflow mulWithOverflow shlWithOverflow shlExact shrExact cInclude cDefine cUndef ctz clz import cImport errorName embedFile cmpxchg fence divExact truncate",
built_in: "breakpoint returnAddress frameAddress fieldParentPtr setFloatMode IntType OpaqueType compileError compileLog setCold setRuntimeSafety setEvalBranchQuota offsetOf memcpy inlineCall setGlobalLinkage setGlobalSection divTrunc divFloor enumTagName intToPtr ptrToInt panic canImplicitCast ptrCast bitCast rem mod memset sizeOf alignOf alignCast maxValue minValue memberCount typeOf addWithOverflow subWithOverflow mulWithOverflow shlWithOverflow shlExact shrExact cInclude cDefine cUndef ctz clz import cImport errorName embedFile cmpxchg fence divExact truncate",
literal: "true false null undefined"
},
n = [e, t.CLCM, t.CBCM, s, r];
Expand Down
2 changes: 1 addition & 1 deletion src-self-hosted/ir.zig
Expand Up @@ -33,7 +33,7 @@ pub const Instruction = struct {
TypeOf,
ToPtrType,
PtrTypeChild,
SetDebugSafety,
SetRuntimeSafety,
SetFloatMode,
ArrayType,
SliceType,
Expand Down
9 changes: 4 additions & 5 deletions src/all_types.hpp
Expand Up @@ -1255,7 +1255,7 @@ enum BuiltinFnId {
BuiltinFnIdTruncate,
BuiltinFnIdIntType,
BuiltinFnIdSetCold,
BuiltinFnIdSetDebugSafety,
BuiltinFnIdSetRuntimeSafety,
BuiltinFnIdSetFloatMode,
BuiltinFnIdTypeName,
BuiltinFnIdCanImplicitCast,
Expand Down Expand Up @@ -1836,7 +1836,7 @@ enum IrInstructionId {
IrInstructionIdToPtrType,
IrInstructionIdPtrTypeChild,
IrInstructionIdSetCold,
IrInstructionIdSetDebugSafety,
IrInstructionIdSetRuntimeSafety,
IrInstructionIdSetFloatMode,
IrInstructionIdArrayType,
IrInstructionIdSliceType,
Expand Down Expand Up @@ -2214,11 +2214,10 @@ struct IrInstructionSetCold {
IrInstruction *is_cold;
};

struct IrInstructionSetDebugSafety {
struct IrInstructionSetRuntimeSafety {
IrInstruction base;

IrInstruction *scope_value;
IrInstruction *debug_safety_on;
IrInstruction *safety_on;
};

struct IrInstructionSetFloatMode {
Expand Down

0 comments on commit e5bc587

Please sign in to comment.