mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
lint: duplicate import (#10519)
This commit is contained in:
parent
7f4fdcc4fc
commit
c08b190c69
29 changed files with 81 additions and 67 deletions
|
|
@ -33,11 +33,11 @@ const wyhash = @import("hash/wyhash.zig");
|
||||||
pub const Wyhash = wyhash.Wyhash;
|
pub const Wyhash = wyhash.Wyhash;
|
||||||
|
|
||||||
test "hash" {
|
test "hash" {
|
||||||
_ = @import("hash/adler.zig");
|
_ = adler;
|
||||||
_ = @import("hash/auto_hash.zig");
|
_ = auto_hash;
|
||||||
_ = @import("hash/crc.zig");
|
_ = crc;
|
||||||
_ = @import("hash/fnv.zig");
|
_ = fnv;
|
||||||
_ = @import("hash/murmur.zig");
|
_ = murmur;
|
||||||
_ = @import("hash/cityhash.zig");
|
_ = cityhash;
|
||||||
_ = @import("hash/wyhash.zig");
|
_ = wyhash;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
// Builtin functions that operate on integer types
|
// Builtin functions that operate on integer types
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const testing = @import("std").testing;
|
const std = @import("std");
|
||||||
const maxInt = @import("std").math.maxInt;
|
const testing = std.testing;
|
||||||
const minInt = @import("std").math.minInt;
|
const maxInt = std.math.maxInt;
|
||||||
|
const minInt = std.math.minInt;
|
||||||
|
|
||||||
const udivmod = @import("udivmod.zig").udivmod;
|
const udivmod = @import("udivmod.zig").udivmod;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ pub fn __multi3(a: i128, b: i128) callconv(.C) i128 {
|
||||||
return r.all;
|
return r.all;
|
||||||
}
|
}
|
||||||
|
|
||||||
const v128 = @import("std").meta.Vector(2, u64);
|
const v128 = std.meta.Vector(2, u64);
|
||||||
pub fn __multi3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
|
pub fn __multi3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
|
||||||
return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{
|
return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{
|
||||||
@bitCast(i128, a),
|
@bitCast(i128, a),
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
|
const std = @import("std");
|
||||||
const neg = @import("negXi2.zig");
|
const neg = @import("negXi2.zig");
|
||||||
const testing = @import("std").testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
const print = @import("std").debug.print;
|
const print = std.debug.print;
|
||||||
|
|
||||||
fn test__negsi2(a: i32, expected: i32) !void {
|
fn test__negsi2(a: i32, expected: i32) !void {
|
||||||
var result = neg.__negsi2(a);
|
var result = neg.__negsi2(a);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
const std = @import("std");
|
||||||
const parity = @import("parity.zig");
|
const parity = @import("parity.zig");
|
||||||
const testing = @import("std").testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
fn paritydi2Naive(a: i64) i32 {
|
fn paritydi2Naive(a: i64) i32 {
|
||||||
var x = @bitCast(u64, a);
|
var x = @bitCast(u64, a);
|
||||||
|
|
@ -25,7 +26,7 @@ test "paritydi2" {
|
||||||
try test__paritydi2(@bitCast(i64, @as(u64, 0xffffffff_fffffffe)));
|
try test__paritydi2(@bitCast(i64, @as(u64, 0xffffffff_fffffffe)));
|
||||||
try test__paritydi2(@bitCast(i64, @as(u64, 0xffffffff_ffffffff)));
|
try test__paritydi2(@bitCast(i64, @as(u64, 0xffffffff_ffffffff)));
|
||||||
|
|
||||||
const RndGen = @import("std").rand.DefaultPrng;
|
const RndGen = std.rand.DefaultPrng;
|
||||||
var rnd = RndGen.init(42);
|
var rnd = RndGen.init(42);
|
||||||
var i: u32 = 0;
|
var i: u32 = 0;
|
||||||
while (i < 10_000) : (i += 1) {
|
while (i < 10_000) : (i += 1) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
const std = @import("std");
|
||||||
const parity = @import("parity.zig");
|
const parity = @import("parity.zig");
|
||||||
const testing = @import("std").testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
fn paritysi2Naive(a: i32) i32 {
|
fn paritysi2Naive(a: i32) i32 {
|
||||||
var x = @bitCast(u32, a);
|
var x = @bitCast(u32, a);
|
||||||
|
|
@ -25,7 +26,7 @@ test "paritysi2" {
|
||||||
try test__paritysi2(@bitCast(i32, @as(u32, 0xfffffffe)));
|
try test__paritysi2(@bitCast(i32, @as(u32, 0xfffffffe)));
|
||||||
try test__paritysi2(@bitCast(i32, @as(u32, 0xffffffff)));
|
try test__paritysi2(@bitCast(i32, @as(u32, 0xffffffff)));
|
||||||
|
|
||||||
const RndGen = @import("std").rand.DefaultPrng;
|
const RndGen = std.rand.DefaultPrng;
|
||||||
var rnd = RndGen.init(42);
|
var rnd = RndGen.init(42);
|
||||||
var i: u32 = 0;
|
var i: u32 = 0;
|
||||||
while (i < 10_000) : (i += 1) {
|
while (i < 10_000) : (i += 1) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
const std = @import("std");
|
||||||
const parity = @import("parity.zig");
|
const parity = @import("parity.zig");
|
||||||
const testing = @import("std").testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
fn parityti2Naive(a: i128) i32 {
|
fn parityti2Naive(a: i128) i32 {
|
||||||
var x = @bitCast(u128, a);
|
var x = @bitCast(u128, a);
|
||||||
|
|
@ -25,7 +26,7 @@ test "parityti2" {
|
||||||
try test__parityti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe)));
|
try test__parityti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe)));
|
||||||
try test__parityti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff)));
|
try test__parityti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff)));
|
||||||
|
|
||||||
const RndGen = @import("std").rand.DefaultPrng;
|
const RndGen = std.rand.DefaultPrng;
|
||||||
var rnd = RndGen.init(42);
|
var rnd = RndGen.init(42);
|
||||||
var i: u32 = 0;
|
var i: u32 = 0;
|
||||||
while (i < 10_000) : (i += 1) {
|
while (i < 10_000) : (i += 1) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
const std = @import("std");
|
||||||
const popcount = @import("popcount.zig");
|
const popcount = @import("popcount.zig");
|
||||||
const testing = @import("std").testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
fn popcountdi2Naive(a: i64) i32 {
|
fn popcountdi2Naive(a: i64) i32 {
|
||||||
var x = a;
|
var x = a;
|
||||||
|
|
@ -24,7 +25,7 @@ test "popcountdi2" {
|
||||||
try test__popcountdi2(@bitCast(i64, @as(u64, 0xffffffff_fffffffe)));
|
try test__popcountdi2(@bitCast(i64, @as(u64, 0xffffffff_fffffffe)));
|
||||||
try test__popcountdi2(@bitCast(i64, @as(u64, 0xffffffff_ffffffff)));
|
try test__popcountdi2(@bitCast(i64, @as(u64, 0xffffffff_ffffffff)));
|
||||||
|
|
||||||
const RndGen = @import("std").rand.DefaultPrng;
|
const RndGen = std.rand.DefaultPrng;
|
||||||
var rnd = RndGen.init(42);
|
var rnd = RndGen.init(42);
|
||||||
var i: u32 = 0;
|
var i: u32 = 0;
|
||||||
while (i < 10_000) : (i += 1) {
|
while (i < 10_000) : (i += 1) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
const std = @import("std");
|
||||||
const popcount = @import("popcount.zig");
|
const popcount = @import("popcount.zig");
|
||||||
const testing = @import("std").testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
fn popcountsi2Naive(a: i32) i32 {
|
fn popcountsi2Naive(a: i32) i32 {
|
||||||
var x = a;
|
var x = a;
|
||||||
|
|
@ -24,7 +25,7 @@ test "popcountsi2" {
|
||||||
try test__popcountsi2(@bitCast(i32, @as(u32, 0xfffffffe)));
|
try test__popcountsi2(@bitCast(i32, @as(u32, 0xfffffffe)));
|
||||||
try test__popcountsi2(@bitCast(i32, @as(u32, 0xffffffff)));
|
try test__popcountsi2(@bitCast(i32, @as(u32, 0xffffffff)));
|
||||||
|
|
||||||
const RndGen = @import("std").rand.DefaultPrng;
|
const RndGen = std.rand.DefaultPrng;
|
||||||
var rnd = RndGen.init(42);
|
var rnd = RndGen.init(42);
|
||||||
var i: u32 = 0;
|
var i: u32 = 0;
|
||||||
while (i < 10_000) : (i += 1) {
|
while (i < 10_000) : (i += 1) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
const std = @import("std");
|
||||||
const popcount = @import("popcount.zig");
|
const popcount = @import("popcount.zig");
|
||||||
const testing = @import("std").testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
fn popcountti2Naive(a: i128) i32 {
|
fn popcountti2Naive(a: i128) i32 {
|
||||||
var x = a;
|
var x = a;
|
||||||
|
|
@ -24,7 +25,7 @@ test "popcountti2" {
|
||||||
try test__popcountti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe)));
|
try test__popcountti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_fffffffe)));
|
||||||
try test__popcountti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff)));
|
try test__popcountti2(@bitCast(i128, @as(u128, 0xffffffff_ffffffff_ffffffff_ffffffff)));
|
||||||
|
|
||||||
const RndGen = @import("std").rand.DefaultPrng;
|
const RndGen = std.rand.DefaultPrng;
|
||||||
var rnd = RndGen.init(42);
|
var rnd = RndGen.init(42);
|
||||||
var i: u32 = 0;
|
var i: u32 = 0;
|
||||||
while (i < 10_000) : (i += 1) {
|
while (i < 10_000) : (i += 1) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
const std = @import("std");
|
||||||
const __truncsfhf2 = @import("truncXfYf2.zig").__truncsfhf2;
|
const __truncsfhf2 = @import("truncXfYf2.zig").__truncsfhf2;
|
||||||
|
|
||||||
fn test__truncsfhf2(a: u32, expected: u16) !void {
|
fn test__truncsfhf2(a: u32, expected: u16) !void {
|
||||||
|
|
@ -217,7 +218,7 @@ fn test__truncdfsf2(a: f64, expected: u32) void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@import("std").debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected });
|
std.debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected });
|
||||||
|
|
||||||
@panic("__trunctfsf2 test failure");
|
@panic("__trunctfsf2 test failure");
|
||||||
}
|
}
|
||||||
|
|
@ -248,7 +249,7 @@ fn test__trunctfhf2(a: f128, expected: u16) void {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@import("std").debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected });
|
std.debug.print("got 0x{x} wanted 0x{x}\n", .{ rep, expected });
|
||||||
|
|
||||||
@panic("__trunctfhf2 test failure");
|
@panic("__trunctfhf2 test failure");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const is_test = builtin.is_test;
|
const is_test = builtin.is_test;
|
||||||
const native_endian = builtin.cpu.arch.endian();
|
const native_endian = builtin.cpu.arch.endian();
|
||||||
|
const std = @import("std");
|
||||||
|
|
||||||
const low = switch (native_endian) {
|
const low = switch (native_endian) {
|
||||||
.Big => 1,
|
.Big => 1,
|
||||||
|
|
@ -13,9 +14,9 @@ pub fn udivmod(comptime DoubleInt: type, a: DoubleInt, b: DoubleInt, maybe_rem:
|
||||||
|
|
||||||
const double_int_bits = @typeInfo(DoubleInt).Int.bits;
|
const double_int_bits = @typeInfo(DoubleInt).Int.bits;
|
||||||
const single_int_bits = @divExact(double_int_bits, 2);
|
const single_int_bits = @divExact(double_int_bits, 2);
|
||||||
const SingleInt = @import("std").meta.Int(.unsigned, single_int_bits);
|
const SingleInt = std.meta.Int(.unsigned, single_int_bits);
|
||||||
const SignedDoubleInt = @import("std").meta.Int(.signed, double_int_bits);
|
const SignedDoubleInt = std.meta.Int(.signed, double_int_bits);
|
||||||
const Log2SingleInt = @import("std").math.Log2Int(SingleInt);
|
const Log2SingleInt = std.math.Log2Int(SingleInt);
|
||||||
|
|
||||||
const n = @ptrCast(*const [2]SingleInt, &a).*; // TODO issue #421
|
const n = @ptrCast(*const [2]SingleInt, &a).*; // TODO issue #421
|
||||||
const d = @ptrCast(*const [2]SingleInt, &b).*; // TODO issue #421
|
const d = @ptrCast(*const [2]SingleInt, &b).*; // TODO issue #421
|
||||||
|
|
|
||||||
|
|
@ -287,5 +287,5 @@ test "Timer" {
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
_ = @import("time/epoch.zig");
|
_ = epoch;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -258,6 +258,6 @@ pub const memcheck = @import("valgrind/memcheck.zig");
|
||||||
pub const callgrind = @import("valgrind/callgrind.zig");
|
pub const callgrind = @import("valgrind/callgrind.zig");
|
||||||
|
|
||||||
test {
|
test {
|
||||||
_ = @import("valgrind/memcheck.zig");
|
_ = memcheck;
|
||||||
_ = @import("valgrind/callgrind.zig");
|
_ = callgrind;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,5 +88,5 @@ pub const DarwinSDK = struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
test "" {
|
test "" {
|
||||||
_ = @import("darwin/macos.zig");
|
_ = macos;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ const ThreadPool = @import("ThreadPool.zig");
|
||||||
const WaitGroup = @import("WaitGroup.zig");
|
const WaitGroup = @import("WaitGroup.zig");
|
||||||
const libtsan = @import("libtsan.zig");
|
const libtsan = @import("libtsan.zig");
|
||||||
const Zir = @import("Zir.zig");
|
const Zir = @import("Zir.zig");
|
||||||
|
const Color = @import("main.zig").Color;
|
||||||
|
|
||||||
/// General-purpose allocator. Used for both temporary and long-term storage.
|
/// General-purpose allocator. Used for both temporary and long-term storage.
|
||||||
gpa: Allocator,
|
gpa: Allocator,
|
||||||
|
|
@ -148,7 +149,7 @@ owned_link_dir: ?std.fs.Dir,
|
||||||
|
|
||||||
/// This is for stage1 and should be deleted upon completion of self-hosting.
|
/// This is for stage1 and should be deleted upon completion of self-hosting.
|
||||||
/// Don't use this for anything other than stage1 compatibility.
|
/// Don't use this for anything other than stage1 compatibility.
|
||||||
color: @import("main.zig").Color = .auto,
|
color: Color = .auto,
|
||||||
|
|
||||||
/// This mutex guards all `Compilation` mutable state.
|
/// This mutex guards all `Compilation` mutable state.
|
||||||
mutex: std.Thread.Mutex = .{},
|
mutex: std.Thread.Mutex = .{},
|
||||||
|
|
@ -790,7 +791,7 @@ pub const InitOptions = struct {
|
||||||
machine_code_model: std.builtin.CodeModel = .default,
|
machine_code_model: std.builtin.CodeModel = .default,
|
||||||
clang_preprocessor_mode: ClangPreprocessorMode = .no,
|
clang_preprocessor_mode: ClangPreprocessorMode = .no,
|
||||||
/// This is for stage1 and should be deleted upon completion of self-hosting.
|
/// This is for stage1 and should be deleted upon completion of self-hosting.
|
||||||
color: @import("main.zig").Color = .auto,
|
color: Color = .auto,
|
||||||
test_filter: ?[]const u8 = null,
|
test_filter: ?[]const u8 = null,
|
||||||
test_name_prefix: ?[]const u8 = null,
|
test_name_prefix: ?[]const u8 = null,
|
||||||
subsystem: ?std.Target.SubSystem = null,
|
subsystem: ?std.Target.SubSystem = null,
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void {
|
||||||
errdefer comp.gpa.free(lib_final_path);
|
errdefer comp.gpa.free(lib_final_path);
|
||||||
|
|
||||||
const llvm = @import("codegen/llvm/bindings.zig");
|
const llvm = @import("codegen/llvm/bindings.zig");
|
||||||
const arch_type = @import("target.zig").archToLLVM(target.cpu.arch);
|
const arch_type = target_util.archToLLVM(target.cpu.arch);
|
||||||
const def_final_path_z = try arena.dupeZ(u8, def_final_path);
|
const def_final_path_z = try arena.dupeZ(u8, def_final_path);
|
||||||
const lib_final_path_z = try arena.dupeZ(u8, lib_final_path);
|
const lib_final_path_z = try arena.dupeZ(u8, lib_final_path);
|
||||||
if (llvm.WriteImportLibrary(def_final_path_z.ptr, arch_type, lib_final_path_z.ptr, true)) {
|
if (llvm.WriteImportLibrary(def_final_path_z.ptr, arch_type, lib_final_path_z.ptr, true)) {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
|
const build_options = @import("build_options");
|
||||||
|
|
||||||
pub const enable = if (builtin.is_test) false else @import("build_options").enable_tracy;
|
pub const enable = if (builtin.is_test) false else build_options.enable_tracy;
|
||||||
pub const enable_allocation = enable and @import("build_options").enable_tracy_allocation;
|
pub const enable_allocation = enable and build_options.enable_tracy_allocation;
|
||||||
pub const enable_callstack = enable and @import("build_options").enable_tracy_callstack;
|
pub const enable_callstack = enable and build_options.enable_tracy_callstack;
|
||||||
|
|
||||||
// TODO: make this configurable
|
// TODO: make this configurable
|
||||||
const callstack_depth = 10;
|
const callstack_depth = 10;
|
||||||
|
|
|
||||||
|
|
@ -820,7 +820,7 @@ fn visitVarDecl(c: *Context, var_decl: *const clang.VarDecl, mangled_name: ?[]co
|
||||||
// The C language specification states that variables with static or threadlocal
|
// The C language specification states that variables with static or threadlocal
|
||||||
// storage without an initializer are initialized to a zero value.
|
// storage without an initializer are initialized to a zero value.
|
||||||
|
|
||||||
// @import("std").mem.zeroes(T)
|
// std.mem.zeroes(T)
|
||||||
init_node = try Tag.std_mem_zeroes.create(c.arena, type_node);
|
init_node = try Tag.std_mem_zeroes.create(c.arena, type_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5211,7 +5211,7 @@ const MacroSlicer = struct {
|
||||||
// mapped function exists in `std.zig.c_translation.Macros`
|
// mapped function exists in `std.zig.c_translation.Macros`
|
||||||
test "Macro matching" {
|
test "Macro matching" {
|
||||||
const helper = struct {
|
const helper = struct {
|
||||||
const MacroFunctions = @import("std").zig.c_translation.Macros;
|
const MacroFunctions = std.zig.c_translation.Macros;
|
||||||
fn checkMacro(allocator: mem.Allocator, pattern_list: PatternList, source: []const u8, comptime expected_match: ?[]const u8) !void {
|
fn checkMacro(allocator: mem.Allocator, pattern_list: PatternList, source: []const u8, comptime expected_match: ?[]const u8) !void {
|
||||||
var tok_list = std.ArrayList(CToken).init(allocator);
|
var tok_list = std.ArrayList(CToken).init(allocator);
|
||||||
defer tok_list.deinit();
|
defer tok_list.deinit();
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ const std = @import("std");
|
||||||
const expect = std.testing.expect;
|
const expect = std.testing.expect;
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
const maxInt = std.math.maxInt;
|
const maxInt = std.math.maxInt;
|
||||||
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
test "int to ptr cast" {
|
test "int to ptr cast" {
|
||||||
const x = @as(usize, 13);
|
const x = @as(usize, 13);
|
||||||
|
|
@ -252,10 +253,7 @@ test "array coersion to undefined at runtime" {
|
||||||
@setRuntimeSafety(true);
|
@setRuntimeSafety(true);
|
||||||
|
|
||||||
// TODO implement @setRuntimeSafety in stage2
|
// TODO implement @setRuntimeSafety in stage2
|
||||||
if (@import("builtin").zig_is_stage2 and
|
if (builtin.zig_is_stage2 and builtin.mode != .Debug and builtin.mode != .ReleaseSafe) {
|
||||||
@import("builtin").mode != .Debug and
|
|
||||||
@import("builtin").mode != .ReleaseSafe)
|
|
||||||
{
|
|
||||||
return error.SkipZigTest;
|
return error.SkipZigTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
const expect = @import("std").testing.expect;
|
const std = @import("std");
|
||||||
const mem = @import("std").mem;
|
const expect = std.testing.expect;
|
||||||
const Tag = @import("std").meta.Tag;
|
const mem = std.mem;
|
||||||
|
const Tag = std.meta.Tag;
|
||||||
|
|
||||||
test "enum value allocation" {
|
test "enum value allocation" {
|
||||||
const LargeEnum = enum(u32) {
|
const LargeEnum = enum(u32) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
const expect = @import("std").testing.expect;
|
const std = @import("std");
|
||||||
const expectEqual = @import("std").testing.expectEqual;
|
const expect = std.testing.expect;
|
||||||
|
const expectEqual = std.testing.expectEqual;
|
||||||
const a_namespace = @import("import/a_namespace.zig");
|
const a_namespace = @import("import/a_namespace.zig");
|
||||||
|
|
||||||
test "call fn via namespace lookup" {
|
test "call fn via namespace lookup" {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ const std = @import("std");
|
||||||
const expect = std.testing.expect;
|
const expect = std.testing.expect;
|
||||||
const maxInt = std.math.maxInt;
|
const maxInt = std.math.maxInt;
|
||||||
const minInt = std.math.minInt;
|
const minInt = std.math.minInt;
|
||||||
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
test "uint128" {
|
test "uint128" {
|
||||||
var buff: u128 = maxInt(u128);
|
var buff: u128 = maxInt(u128);
|
||||||
|
|
@ -21,10 +22,7 @@ test "undefined 128 bit int" {
|
||||||
@setRuntimeSafety(true);
|
@setRuntimeSafety(true);
|
||||||
|
|
||||||
// TODO implement @setRuntimeSafety in stage2
|
// TODO implement @setRuntimeSafety in stage2
|
||||||
if (@import("builtin").zig_is_stage2 and
|
if (builtin.zig_is_stage2 and builtin.mode != .Debug and builtin.mode != .ReleaseSafe) {
|
||||||
@import("builtin").mode != .Debug and
|
|
||||||
@import("builtin").mode != .ReleaseSafe)
|
|
||||||
{
|
|
||||||
return error.SkipZigTest;
|
return error.SkipZigTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
const expect = @import("std").testing.expect;
|
const std = @import("std");
|
||||||
const mem = @import("std").mem;
|
const expect = std.testing.expect;
|
||||||
|
const mem = std.mem;
|
||||||
|
|
||||||
var ok: bool = false;
|
var ok: bool = false;
|
||||||
test "reference a variable in an if after an if in the 2nd switch prong" {
|
test "reference a variable in an if after an if in the 2nd switch prong" {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
const expect = @import("std").testing.expect;
|
const std = @import("std");
|
||||||
const mem = @import("std").mem;
|
const expect = std.testing.expect;
|
||||||
|
const mem = std.mem;
|
||||||
const reflection = @This();
|
const reflection = @This();
|
||||||
|
|
||||||
test "reflection: function return type, var args, and param types" {
|
test "reflection: function return type, var args, and param types" {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
const expect = @import("std").testing.expect;
|
const std = @import("std");
|
||||||
const expectEqual = @import("std").testing.expectEqual;
|
const expect = std.testing.expect;
|
||||||
|
const expectEqual = std.testing.expectEqual;
|
||||||
|
|
||||||
const h = @cImport(@cInclude("behavior/translate_c_macros.h"));
|
const h = @cImport(@cInclude("behavior/translate_c_macros.h"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
const expect = @import("std").testing.expect;
|
const std = @import("std");
|
||||||
const expectEqual = @import("std").testing.expectEqual;
|
const expect = std.testing.expect;
|
||||||
|
const expectEqual = std.testing.expectEqual;
|
||||||
|
|
||||||
const h = @cImport(@cInclude("behavior/translate_c_macros.h"));
|
const h = @cImport(@cInclude("behavior/translate_c_macros.h"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const expect = std.testing.expect;
|
const expect = std.testing.expect;
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
test "integer widening" {
|
test "integer widening" {
|
||||||
var a: u8 = 250;
|
var a: u8 = 250;
|
||||||
|
|
@ -30,8 +31,8 @@ test "float widening" {
|
||||||
|
|
||||||
test "float widening f16 to f128" {
|
test "float widening f16 to f128" {
|
||||||
// TODO https://github.com/ziglang/zig/issues/3282
|
// TODO https://github.com/ziglang/zig/issues/3282
|
||||||
if (@import("builtin").cpu.arch == .aarch64) return error.SkipZigTest;
|
if (builtin.cpu.arch == .aarch64) return error.SkipZigTest;
|
||||||
if (@import("builtin").cpu.arch == .powerpc64le) return error.SkipZigTest;
|
if (builtin.cpu.arch == .powerpc64le) return error.SkipZigTest;
|
||||||
|
|
||||||
var x: f16 = 12.34;
|
var x: f16 = 12.34;
|
||||||
var y: f128 = x;
|
var y: f128 = x;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
const Builder = @import("std").build.Builder;
|
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const CheckFileStep = std.build.CheckFileStep;
|
const CheckFileStep = std.build.CheckFileStep;
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.build.Builder) void {
|
||||||
const target = .{
|
const target = .{
|
||||||
.cpu_arch = .thumb,
|
.cpu_arch = .thumb,
|
||||||
.cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m4 },
|
.cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m4 },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue