Commit ec95e00e28
Changed files (160)
ci
drone
zinc
lib
compiler_rt
std
ci/drone/linux_script_test
@@ -28,7 +28,7 @@ case "$1" in
./build/zig build $BUILD_FLAGS test-std -Dskip-debug -Dskip-release-safe -Dskip-release-fast
;;
6)
- ./build/zig build $BUILD_FLAGS test-minilibc
+ ./build/zig build $BUILD_FLAGS test-universal-libc
./build/zig build $BUILD_FLAGS test-compare-output
./build/zig build $BUILD_FLAGS test-standalone -Dskip-release-safe
./build/zig build $BUILD_FLAGS test-stack-traces
ci/zinc/linux_test.sh
@@ -69,7 +69,7 @@ stage2/bin/zig test test/behavior.zig -I test -fno-LLVM -target x86_64-macos --
$ZIG build test-behavior -fqemu -fwasmtime
$ZIG build test-compiler-rt -fqemu -fwasmtime
$ZIG build test-std -fqemu -fwasmtime
-$ZIG build test-minilibc -fqemu -fwasmtime
+$ZIG build test-universal-libc -fqemu -fwasmtime
$ZIG build test-compare-output -fqemu -fwasmtime
$ZIG build test-standalone -fqemu -fwasmtime
$ZIG build test-stack-traces -fqemu -fwasmtime
doc/langref.html.in
@@ -1040,7 +1040,7 @@ fn addOne(number: i32) i32 {
</p>
<aside>
This documentation discusses the features of the default test runner as provided by the Zig Standard Library.
- Its source code is located in <code class="file">lib/std/special/test_runner.zig</code>.
+ Its source code is located in <code class="file">lib/test_runner.zig</code>.
</aside>
<p>
The shell output shown above displays two lines after the <kbd>zig test</kbd> command. These lines are
lib/std/special/compiler_rt/absv.zig → lib/compiler_rt/absv.zig
File renamed without changes
lib/std/special/compiler_rt/absvdi2_test.zig → lib/compiler_rt/absvdi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/absvsi2_test.zig → lib/compiler_rt/absvsi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/absvti2_test.zig → lib/compiler_rt/absvti2_test.zig
File renamed without changes
lib/std/special/compiler_rt/addo.zig → lib/compiler_rt/addo.zig
File renamed without changes
lib/std/special/compiler_rt/addodi4_test.zig → lib/compiler_rt/addodi4_test.zig
File renamed without changes
lib/std/special/compiler_rt/addosi4_test.zig → lib/compiler_rt/addosi4_test.zig
File renamed without changes
lib/std/special/compiler_rt/addoti4_test.zig → lib/compiler_rt/addoti4_test.zig
File renamed without changes
lib/std/special/compiler_rt/addXf3.zig → lib/compiler_rt/addXf3.zig
File renamed without changes
lib/std/special/compiler_rt/addXf3_test.zig → lib/compiler_rt/addXf3_test.zig
File renamed without changes
lib/std/special/compiler_rt/arm.zig → lib/compiler_rt/arm.zig
File renamed without changes
lib/std/special/compiler_rt/ashldi3_test.zig → lib/compiler_rt/ashldi3_test.zig
File renamed without changes
lib/std/special/compiler_rt/ashlti3_test.zig → lib/compiler_rt/ashlti3_test.zig
File renamed without changes
lib/std/special/compiler_rt/ashrdi3_test.zig → lib/compiler_rt/ashrdi3_test.zig
File renamed without changes
lib/std/special/compiler_rt/ashrti3_test.zig → lib/compiler_rt/ashrti3_test.zig
File renamed without changes
lib/std/special/compiler_rt/atomics.zig → lib/compiler_rt/atomics.zig
File renamed without changes
lib/std/special/compiler_rt/aulldiv.zig → lib/compiler_rt/aulldiv.zig
File renamed without changes
lib/std/special/compiler_rt/aullrem.zig → lib/compiler_rt/aullrem.zig
File renamed without changes
lib/std/special/compiler_rt/bswap.zig → lib/compiler_rt/bswap.zig
File renamed without changes
lib/std/special/compiler_rt/bswapdi2_test.zig → lib/compiler_rt/bswapdi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/bswapsi2_test.zig → lib/compiler_rt/bswapsi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/bswapti2_test.zig → lib/compiler_rt/bswapti2_test.zig
File renamed without changes
lib/std/special/compiler_rt/ceil.zig → lib/compiler_rt/ceil.zig
File renamed without changes
lib/std/special/compiler_rt/clear_cache.zig → lib/compiler_rt/clear_cache.zig
File renamed without changes
lib/std/special/compiler_rt/clzdi2_test.zig → lib/compiler_rt/clzdi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/clzsi2_test.zig → lib/compiler_rt/clzsi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/clzti2_test.zig → lib/compiler_rt/clzti2_test.zig
File renamed without changes
lib/std/special/compiler_rt/cmp.zig → lib/compiler_rt/cmp.zig
File renamed without changes
lib/std/special/compiler_rt/cmpdi2_test.zig → lib/compiler_rt/cmpdi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/cmpsi2_test.zig → lib/compiler_rt/cmpsi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/cmpti2_test.zig → lib/compiler_rt/cmpti2_test.zig
File renamed without changes
lib/std/special/compiler_rt/comparedf2_test.zig → lib/compiler_rt/comparedf2_test.zig
File renamed without changes
lib/std/special/compiler_rt/comparesf2_test.zig → lib/compiler_rt/comparesf2_test.zig
File renamed without changes
lib/std/special/compiler_rt/compareXf2.zig → lib/compiler_rt/compareXf2.zig
File renamed without changes
lib/std/special/compiler_rt/cos.zig → lib/compiler_rt/cos.zig
File renamed without changes
lib/std/special/compiler_rt/count0bits.zig → lib/compiler_rt/count0bits.zig
File renamed without changes
lib/std/special/compiler_rt/ctzdi2_test.zig → lib/compiler_rt/ctzdi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/ctzsi2_test.zig → lib/compiler_rt/ctzsi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/ctzti2_test.zig → lib/compiler_rt/ctzti2_test.zig
File renamed without changes
lib/std/special/compiler_rt/divdf3.zig → lib/compiler_rt/divdf3.zig
File renamed without changes
lib/std/special/compiler_rt/divdf3_test.zig → lib/compiler_rt/divdf3_test.zig
File renamed without changes
lib/std/special/compiler_rt/divsf3.zig → lib/compiler_rt/divsf3.zig
File renamed without changes
lib/std/special/compiler_rt/divsf3_test.zig → lib/compiler_rt/divsf3_test.zig
File renamed without changes
lib/std/special/compiler_rt/divtf3.zig → lib/compiler_rt/divtf3.zig
File renamed without changes
lib/std/special/compiler_rt/divtf3_test.zig → lib/compiler_rt/divtf3_test.zig
File renamed without changes
lib/std/special/compiler_rt/divti3.zig → lib/compiler_rt/divti3.zig
File renamed without changes
lib/std/special/compiler_rt/divti3_test.zig → lib/compiler_rt/divti3_test.zig
File renamed without changes
lib/std/special/compiler_rt/divxf3.zig → lib/compiler_rt/divxf3.zig
File renamed without changes
lib/std/special/compiler_rt/divxf3_test.zig → lib/compiler_rt/divxf3_test.zig
File renamed without changes
lib/std/special/compiler_rt/emutls.zig → lib/compiler_rt/emutls.zig
File renamed without changes
lib/std/special/compiler_rt/exp.zig → lib/compiler_rt/exp.zig
File renamed without changes
lib/std/special/compiler_rt/exp2.zig → lib/compiler_rt/exp2.zig
File renamed without changes
lib/std/special/compiler_rt/extend_f80.zig → lib/compiler_rt/extend_f80.zig
File renamed without changes
lib/std/special/compiler_rt/extendXfYf2.zig → lib/compiler_rt/extendXfYf2.zig
File renamed without changes
lib/std/special/compiler_rt/extendXfYf2_test.zig → lib/compiler_rt/extendXfYf2_test.zig
File renamed without changes
lib/std/special/compiler_rt/fabs.zig → lib/compiler_rt/fabs.zig
File renamed without changes
lib/std/special/compiler_rt/ffsdi2_test.zig → lib/compiler_rt/ffsdi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/ffssi2_test.zig → lib/compiler_rt/ffssi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/ffsti2_test.zig → lib/compiler_rt/ffsti2_test.zig
File renamed without changes
lib/std/special/compiler_rt/fixint_test.zig → lib/compiler_rt/fixint_test.zig
File renamed without changes
lib/std/special/compiler_rt/fixXfYi.zig → lib/compiler_rt/fixXfYi.zig
File renamed without changes
lib/std/special/compiler_rt/fixXfYi_test.zig → lib/compiler_rt/fixXfYi_test.zig
File renamed without changes
lib/std/special/compiler_rt/floatXiYf.zig → lib/compiler_rt/floatXiYf.zig
File renamed without changes
lib/std/special/compiler_rt/floatXiYf_test.zig → lib/compiler_rt/floatXiYf_test.zig
File renamed without changes
lib/std/special/compiler_rt/floor.zig → lib/compiler_rt/floor.zig
File renamed without changes
lib/std/special/compiler_rt/fma.zig → lib/compiler_rt/fma.zig
File renamed without changes
lib/std/special/compiler_rt/fmax.zig → lib/compiler_rt/fmax.zig
File renamed without changes
lib/std/special/compiler_rt/fmin.zig → lib/compiler_rt/fmin.zig
File renamed without changes
lib/std/special/compiler_rt/fmod.zig → lib/compiler_rt/fmod.zig
File renamed without changes
lib/std/special/compiler_rt/fmodq_test.zig → lib/compiler_rt/fmodq_test.zig
File renamed without changes
lib/std/special/compiler_rt/fmodx_test.zig → lib/compiler_rt/fmodx_test.zig
File renamed without changes
lib/std/special/compiler_rt/int.zig → lib/compiler_rt/int.zig
File renamed without changes
lib/std/special/compiler_rt/log.zig → lib/compiler_rt/log.zig
File renamed without changes
lib/std/special/compiler_rt/log10.zig → lib/compiler_rt/log10.zig
File renamed without changes
lib/std/special/compiler_rt/log2.zig → lib/compiler_rt/log2.zig
File renamed without changes
lib/std/special/compiler_rt/lshrdi3_test.zig → lib/compiler_rt/lshrdi3_test.zig
File renamed without changes
lib/std/special/compiler_rt/lshrti3_test.zig → lib/compiler_rt/lshrti3_test.zig
File renamed without changes
lib/std/special/compiler_rt/modti3.zig → lib/compiler_rt/modti3.zig
File renamed without changes
lib/std/special/compiler_rt/modti3_test.zig → lib/compiler_rt/modti3_test.zig
File renamed without changes
lib/std/special/compiler_rt/muldi3.zig → lib/compiler_rt/muldi3.zig
File renamed without changes
lib/std/special/compiler_rt/muldi3_test.zig → lib/compiler_rt/muldi3_test.zig
File renamed without changes
lib/std/special/compiler_rt/mulo.zig → lib/compiler_rt/mulo.zig
File renamed without changes
lib/std/special/compiler_rt/mulodi4_test.zig → lib/compiler_rt/mulodi4_test.zig
File renamed without changes
lib/std/special/compiler_rt/mulosi4_test.zig → lib/compiler_rt/mulosi4_test.zig
File renamed without changes
lib/std/special/compiler_rt/muloti4_test.zig → lib/compiler_rt/muloti4_test.zig
File renamed without changes
lib/std/special/compiler_rt/multi3.zig → lib/compiler_rt/multi3.zig
File renamed without changes
lib/std/special/compiler_rt/multi3_test.zig → lib/compiler_rt/multi3_test.zig
File renamed without changes
lib/std/special/compiler_rt/mulXf3.zig → lib/compiler_rt/mulXf3.zig
File renamed without changes
lib/std/special/compiler_rt/mulXf3_test.zig → lib/compiler_rt/mulXf3_test.zig
File renamed without changes
lib/std/special/compiler_rt/negdi2_test.zig → lib/compiler_rt/negdi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/negsi2_test.zig → lib/compiler_rt/negsi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/negti2_test.zig → lib/compiler_rt/negti2_test.zig
File renamed without changes
lib/std/special/compiler_rt/negv.zig → lib/compiler_rt/negv.zig
File renamed without changes
lib/std/special/compiler_rt/negvdi2_test.zig → lib/compiler_rt/negvdi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/negvsi2_test.zig → lib/compiler_rt/negvsi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/negvti2_test.zig → lib/compiler_rt/negvti2_test.zig
File renamed without changes
lib/std/special/compiler_rt/negXf2.zig → lib/compiler_rt/negXf2.zig
File renamed without changes
lib/std/special/compiler_rt/negXi2.zig → lib/compiler_rt/negXi2.zig
File renamed without changes
lib/std/special/compiler_rt/os_version_check.zig → lib/compiler_rt/os_version_check.zig
File renamed without changes
lib/std/special/compiler_rt/parity.zig → lib/compiler_rt/parity.zig
File renamed without changes
lib/std/special/compiler_rt/paritydi2_test.zig → lib/compiler_rt/paritydi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/paritysi2_test.zig → lib/compiler_rt/paritysi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/parityti2_test.zig → lib/compiler_rt/parityti2_test.zig
File renamed without changes
lib/std/special/compiler_rt/popcount.zig → lib/compiler_rt/popcount.zig
File renamed without changes
lib/std/special/compiler_rt/popcountdi2_test.zig → lib/compiler_rt/popcountdi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/popcountsi2_test.zig → lib/compiler_rt/popcountsi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/popcountti2_test.zig → lib/compiler_rt/popcountti2_test.zig
File renamed without changes
lib/std/special/compiler_rt/README.md → lib/compiler_rt/README.md
File renamed without changes
lib/std/special/compiler_rt/rem_pio2.zig → lib/compiler_rt/rem_pio2.zig
File renamed without changes
lib/std/special/compiler_rt/rem_pio2_large.zig → lib/compiler_rt/rem_pio2_large.zig
File renamed without changes
lib/std/special/compiler_rt/rem_pio2f.zig → lib/compiler_rt/rem_pio2f.zig
File renamed without changes
lib/std/special/compiler_rt/round.zig → lib/compiler_rt/round.zig
File renamed without changes
lib/std/special/compiler_rt/shift.zig → lib/compiler_rt/shift.zig
File renamed without changes
lib/std/special/compiler_rt/sin.zig → lib/compiler_rt/sin.zig
File renamed without changes
lib/std/special/compiler_rt/sincos.zig → lib/compiler_rt/sincos.zig
File renamed without changes
lib/std/special/compiler_rt/sparc.zig → lib/compiler_rt/sparc.zig
File renamed without changes
lib/std/special/compiler_rt/sqrt.zig → lib/compiler_rt/sqrt.zig
File renamed without changes
lib/std/special/compiler_rt/stack_probe.zig → lib/compiler_rt/stack_probe.zig
File renamed without changes
lib/std/special/compiler_rt/subo.zig → lib/compiler_rt/subo.zig
File renamed without changes
lib/std/special/compiler_rt/subodi4_test.zig → lib/compiler_rt/subodi4_test.zig
File renamed without changes
lib/std/special/compiler_rt/subosi4_test.zig → lib/compiler_rt/subosi4_test.zig
File renamed without changes
lib/std/special/compiler_rt/suboti4_test.zig → lib/compiler_rt/suboti4_test.zig
File renamed without changes
lib/std/special/compiler_rt/tan.zig → lib/compiler_rt/tan.zig
File renamed without changes
lib/std/special/compiler_rt/trig.zig → lib/compiler_rt/trig.zig
File renamed without changes
lib/std/special/compiler_rt/trunc.zig → lib/compiler_rt/trunc.zig
File renamed without changes
lib/std/special/compiler_rt/trunc_f80.zig → lib/compiler_rt/trunc_f80.zig
File renamed without changes
lib/std/special/compiler_rt/truncXfYf2.zig → lib/compiler_rt/truncXfYf2.zig
File renamed without changes
lib/std/special/compiler_rt/truncXfYf2_test.zig → lib/compiler_rt/truncXfYf2_test.zig
File renamed without changes
lib/std/special/compiler_rt/ucmpdi2_test.zig → lib/compiler_rt/ucmpdi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/ucmpsi2_test.zig → lib/compiler_rt/ucmpsi2_test.zig
File renamed without changes
lib/std/special/compiler_rt/ucmpti2_test.zig → lib/compiler_rt/ucmpti2_test.zig
File renamed without changes
lib/std/special/compiler_rt/udivmod.zig → lib/compiler_rt/udivmod.zig
File renamed without changes
lib/std/special/compiler_rt/udivmoddi4_test.zig → lib/compiler_rt/udivmoddi4_test.zig
File renamed without changes
lib/std/special/compiler_rt/udivmodti4.zig → lib/compiler_rt/udivmodti4.zig
File renamed without changes
lib/std/special/compiler_rt/udivmodti4_test.zig → lib/compiler_rt/udivmodti4_test.zig
File renamed without changes
lib/std/special/compiler_rt/udivti3.zig → lib/compiler_rt/udivti3.zig
File renamed without changes
lib/std/special/compiler_rt/umodti3.zig → lib/compiler_rt/umodti3.zig
File renamed without changes
lib/std/special/docs/index.html → lib/docs/index.html
File renamed without changes
lib/std/special/docs/main.js → lib/docs/main.js
File renamed without changes
lib/std/special/init-exe/src/main.zig → lib/init-exe/src/main.zig
File renamed without changes
lib/std/special/init-exe/build.zig → lib/init-exe/build.zig
File renamed without changes
lib/std/special/init-lib/src/main.zig → lib/init-lib/src/main.zig
File renamed without changes
lib/std/special/init-lib/build.zig → lib/init-lib/build.zig
File renamed without changes
lib/std/build.zig
@@ -229,7 +229,7 @@ pub const Builder = struct {
self.allocator.destroy(self);
}
- /// This function is intended to be called by std/special/build_runner.zig, not a build.zig file.
+ /// This function is intended to be called by lib/build_runner.zig, not a build.zig file.
pub fn resolveInstallPrefix(self: *Builder, install_prefix: ?[]const u8, dir_list: DirList) void {
if (self.dest_dir) |dest_dir| {
self.install_prefix = install_prefix orelse "/usr";
lib/std/special/build_runner.zig → lib/build_runner.zig
File renamed without changes
lib/std/special/c.zig → lib/c.zig
File renamed without changes
lib/std/special/compiler_rt.zig → lib/compiler_rt.zig
File renamed without changes
lib/std/special/ssp.zig → lib/ssp.zig
File renamed without changes
lib/std/special/test_runner.zig → lib/test_runner.zig
File renamed without changes
src/stage1/all_types.hpp
@@ -2144,7 +2144,6 @@ struct CodeGen {
Buf docs_output_path;
Buf *builtin_zig_path;
- Buf *zig_std_special_dir; // Cannot be overridden; derived from zig_lib_dir.
Stage1ZirInst *invalid_inst_src;
Stage1AirInst *invalid_inst_gen;
src/stage1/codegen.cpp
@@ -10088,7 +10088,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) {
}
static ZigPackage *create_test_runner_pkg(CodeGen *g) {
- return codegen_create_package(g, buf_ptr(g->zig_std_special_dir), "test_runner.zig", "std.special");
+ return codegen_create_package(g, buf_ptr(g->zig_lib_dir), "test_runner.zig", "");
}
static Error define_builtin_compile_vars(CodeGen *g) {
@@ -10141,12 +10141,17 @@ static Error define_builtin_compile_vars(CodeGen *g) {
} else {
g->root_pkg = g->main_pkg;
}
+
+ ZigPackage *compiler_rt_pkg = codegen_create_package(g, buf_ptr(g->zig_lib_dir),
+ "compiler_rt.zig", "compiler_rt");
+
g->compile_var_package->package_table.put(buf_create_from_str("std"), g->std_package);
g->main_pkg->package_table.put(buf_create_from_str("builtin"), g->compile_var_package);
g->main_pkg->package_table.put(buf_create_from_str("root"), g->root_pkg);
g->std_package->package_table.put(buf_create_from_str("builtin"), g->compile_var_package);
g->std_package->package_table.put(buf_create_from_str("std"), g->std_package);
g->std_package->package_table.put(buf_create_from_str("root"), g->root_pkg);
+ g->std_package->package_table.put(buf_create_from_str("compiler_rt"), compiler_rt_pkg);
g->compile_var_import = add_source_file(g, g->compile_var_package, g->builtin_zig_path, contents,
SourceKindPkgMain);
@@ -10454,11 +10459,11 @@ static void gen_root_source(CodeGen *g) {
Buf *import_target_path;
Buf full_path = BUF_INIT;
ZigType *compiler_rt_import;
- if ((err = analyze_import(g, std_import, buf_create_from_str("./special/compiler_rt.zig"),
+ if ((err = analyze_import(g, std_import, buf_create_from_str("compiler_rt"),
&compiler_rt_import, &import_target_path, &full_path)))
{
if (err == ErrorFileNotFound) {
- fprintf(stderr, "unable to find '%s'", buf_ptr(import_target_path));
+ fprintf(stderr, "unable to find '%s'\n", buf_ptr(import_target_path));
} else {
fprintf(stderr, "unable to open '%s': %s\n", buf_ptr(&full_path), err_str(err));
}
@@ -10538,11 +10543,11 @@ void codegen_build_object(CodeGen *g) {
fprintf(stderr, "Unable to create directory %s: %s\n", buf_ptr(doc_dir_path), err_str(err));
exit(1);
}
- Buf *index_html_src_path = buf_sprintf("%s" OS_SEP "special" OS_SEP "docs" OS_SEP "index.html",
- buf_ptr(g->zig_std_dir));
+ Buf *index_html_src_path = buf_sprintf("%s" OS_SEP "docs" OS_SEP "index.html",
+ buf_ptr(g->zig_lib_dir));
Buf *index_html_dest_path = buf_sprintf("%s" OS_SEP "index.html", buf_ptr(doc_dir_path));
- Buf *main_js_src_path = buf_sprintf("%s" OS_SEP "special" OS_SEP "docs" OS_SEP "main.js",
- buf_ptr(g->zig_std_dir));
+ Buf *main_js_src_path = buf_sprintf("%s" OS_SEP "docs" OS_SEP "main.js",
+ buf_ptr(g->zig_lib_dir));
Buf *main_js_dest_path = buf_sprintf("%s" OS_SEP "main.js", buf_ptr(doc_dir_path));
if ((err = os_copy_file(index_html_src_path, index_html_dest_path))) {
@@ -10702,9 +10707,6 @@ CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget
g->main_pkg = new_package(".", "", "");
}
- g->zig_std_special_dir = buf_alloc();
- os_path_join(g->zig_std_dir, buf_sprintf("special"), g->zig_std_special_dir);
-
target_triple_llvm(&g->llvm_triple_str, g->zig_target);
g->pointer_size_bytes = target_arch_pointer_bit_width(g->zig_target->arch) / 8;
src/Compilation.zig
@@ -1352,7 +1352,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
const test_pkg = try Package.createWithDir(
gpa,
options.zig_lib_directory,
- "std" ++ std.fs.path.sep_str ++ "special",
+ null,
"test_runner.zig",
);
errdefer test_pkg.destroy(gpa);
@@ -1382,6 +1382,20 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
try builtin_pkg.add(gpa, "std", std_pkg);
try builtin_pkg.add(gpa, "builtin", builtin_pkg);
+ const main_pkg_in_std = m: {
+ const std_path = try std.fs.path.resolve(arena, &[_][]const u8{
+ std_pkg.root_src_directory.path orelse ".",
+ std.fs.path.dirname(std_pkg.root_src_path) orelse ".",
+ });
+ defer arena.free(std_path);
+ const main_path = try std.fs.path.resolve(arena, &[_][]const u8{
+ main_pkg.root_src_directory.path orelse ".",
+ main_pkg.root_src_path,
+ });
+ defer arena.free(main_path);
+ break :m mem.startsWith(u8, main_path, std_path);
+ };
+
// Pre-open the directory handles for cached ZIR code so that it does not need
// to redundantly happen for each AstGen operation.
const zir_sub_dir = "z";
@@ -1418,15 +1432,15 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
.gpa = gpa,
.comp = comp,
.main_pkg = main_pkg,
- .main_pkg_is_std = try main_pkg.isInsideOf(std_pkg.*),
+ .main_pkg_in_std = main_pkg_in_std,
.root_pkg = root_pkg,
.zig_cache_artifact_directory = zig_cache_artifact_directory,
.global_zir_cache = global_zir_cache,
.local_zir_cache = local_zir_cache,
.emit_h = emit_h,
- .error_name_list = try std.ArrayListUnmanaged([]const u8).initCapacity(gpa, 1),
+ .error_name_list = .{},
};
- module.error_name_list.appendAssumeCapacity("(no error)");
+ try module.error_name_list.append(gpa, "(no error)");
break :blk module;
} else blk: {
@@ -4780,18 +4794,9 @@ fn buildOutputFromZig(
defer tracy_trace.end();
std.debug.assert(output_mode != .Exe);
- const special_sub = "std" ++ std.fs.path.sep_str ++ "special";
- const special_path = try comp.zig_lib_directory.join(comp.gpa, &[_][]const u8{special_sub});
- defer comp.gpa.free(special_path);
-
- var special_dir = try comp.zig_lib_directory.handle.openDir(special_sub, .{});
- defer special_dir.close();
var main_pkg: Package = .{
- .root_src_directory = .{
- .path = special_path,
- .handle = special_dir,
- },
+ .root_src_directory = comp.zig_lib_directory,
.root_src_path = src_basename,
};
defer main_pkg.deinitTable(comp.gpa);
src/main.zig
@@ -3421,8 +3421,8 @@ pub fn cmdInit(
const s = fs.path.sep_str;
const template_sub_path = switch (output_mode) {
.Obj => unreachable,
- .Lib => "std" ++ s ++ "special" ++ s ++ "init-lib",
- .Exe => "std" ++ s ++ "special" ++ s ++ "init-exe",
+ .Lib => "init-lib",
+ .Exe => "init-exe",
};
var template_dir = zig_lib_directory.handle.openDir(template_sub_path, .{}) catch |err| {
fatal("unable to open zig project template directory '{s}{s}{s}': {s}", .{ zig_lib_directory.path, s, template_sub_path, @errorName(err) });
@@ -3571,19 +3571,10 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
};
defer zig_lib_directory.handle.close();
- const std_special = "std" ++ fs.path.sep_str ++ "special";
- const special_dir_path = try zig_lib_directory.join(arena, &[_][]const u8{std_special});
-
var main_pkg: Package = .{
- .root_src_directory = .{
- .path = special_dir_path,
- .handle = zig_lib_directory.handle.openDir(std_special, .{}) catch |err| {
- fatal("unable to open directory '{s}{s}{s}': {s}", .{ override_lib_dir, fs.path.sep_str, std_special, @errorName(err) });
- },
- },
+ .root_src_directory = zig_lib_directory,
.root_src_path = "build_runner.zig",
};
- defer main_pkg.root_src_directory.handle.close();
var cleanup_build_dir: ?fs.Dir = null;
defer if (cleanup_build_dir) |*dir| dir.close();
src/Module.zig
@@ -112,7 +112,7 @@ global_error_set: std.StringHashMapUnmanaged(ErrorInt) = .{},
/// ErrorInt -> []const u8 for fast lookups for @intToError at comptime
/// Corresponds with `global_error_set`.
-error_name_list: ArrayListUnmanaged([]const u8) = .{},
+error_name_list: ArrayListUnmanaged([]const u8),
/// Incrementing integer used to compare against the corresponding Decl
/// field to determine whether a Decl's status applies to an ongoing update, or a
@@ -133,7 +133,7 @@ job_queued_update_builtin_zig: bool = true,
/// This makes it so that we can run `zig test` on the standard library.
/// Otherwise, the logic for scanning test decls skips all of them because
/// `main_pkg != std_pkg`.
-main_pkg_is_std: bool,
+main_pkg_in_std: bool,
compile_log_text: ArrayListUnmanaged(u8) = .{},
@@ -4533,7 +4533,7 @@ fn scanDecl(iter: *ScanDeclIter, decl_sub_index: usize, flags: u4) SemaError!voi
// the test name filter.
if (!mod.comp.bin_file.options.is_test) break :blk false;
if (decl_pkg != mod.main_pkg) {
- if (!mod.main_pkg_is_std) break :blk false;
+ if (!mod.main_pkg_in_std) break :blk false;
const std_pkg = mod.main_pkg.table.get("std").?;
if (std_pkg != decl_pkg) break :blk false;
}
@@ -4544,7 +4544,7 @@ fn scanDecl(iter: *ScanDeclIter, decl_sub_index: usize, flags: u4) SemaError!voi
if (!is_named_test) break :blk false;
if (!mod.comp.bin_file.options.is_test) break :blk false;
if (decl_pkg != mod.main_pkg) {
- if (!mod.main_pkg_is_std) break :blk false;
+ if (!mod.main_pkg_in_std) break :blk false;
const std_pkg = mod.main_pkg.table.get("std").?;
if (std_pkg != decl_pkg) break :blk false;
}
src/Package.zig
@@ -124,11 +124,3 @@ pub fn addAndAdopt(parent: *Package, gpa: Allocator, name: []const u8, child: *P
child.parent = parent;
return parent.add(gpa, name, child);
}
-
-pub fn isInsideOf(pkg: Package, another: Package) !bool {
- var pkg_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
- var another_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
- const pkg_path = try pkg.root_src_directory.handle.realpath(pkg.root_src_path, &pkg_buffer);
- const another_path = try another.root_src_directory.handle.realpath(".", &another_buffer);
- return mem.startsWith(u8, pkg_path, another_path);
-}
build.zig
@@ -450,7 +450,7 @@ pub fn build(b: *Builder) !void {
toolchain_step.dependOn(tests.addPkgTests(
b,
test_filter,
- "lib/std/special/compiler_rt.zig",
+ "lib/compiler_rt.zig",
"compiler-rt",
"Run the compiler_rt tests",
modes,
@@ -462,9 +462,9 @@ pub fn build(b: *Builder) !void {
toolchain_step.dependOn(tests.addPkgTests(
b,
test_filter,
- "lib/std/special/c.zig",
- "minilibc",
- "Run the mini libc tests",
+ "lib/c.zig",
+ "universal-libc",
+ "Run the universal libc tests",
modes,
true, // skip_single_threaded
skip_non_native,
CMakeLists.txt
@@ -478,74 +478,74 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/lib/std/process.zig"
"${CMAKE_SOURCE_DIR}/lib/std/rand.zig"
"${CMAKE_SOURCE_DIR}/lib/std/sort.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/absv.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/addXf3.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/addo.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/arm.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/atomics.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/aulldiv.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/aullrem.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/bswap.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/ceil.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/clear_cache.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/cmp.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/compareXf2.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/cos.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/count0bits.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/divdf3.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/divsf3.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/divtf3.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/divti3.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/divxf3.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/emutls.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/exp.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/exp2.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/extendXfYf2.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/extend_f80.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fabs.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fixXfYi.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floatXiYf.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/floor.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fma.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fmax.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fmin.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/fmod.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/int.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/log.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/log10.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/log2.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/modti3.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/mulXf3.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/muldi3.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/mulo.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/multi3.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/negXf2.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/negXi2.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/negv.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/os_version_check.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/parity.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/popcount.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/rem_pio2.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/rem_pio2_large.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/rem_pio2f.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/round.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/shift.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/sin.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/sincos.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/sparc.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/sqrt.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/stack_probe.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/subo.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/tan.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/trig.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/trunc.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/truncXfYf2.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/trunc_f80.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/udivmod.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/udivmodti4.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/udivti3.zig"
- "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/umodti3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/absv.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/addXf3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/addo.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/arm.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/atomics.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/aulldiv.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/aullrem.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/bswap.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/ceil.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/clear_cache.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/cmp.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/compareXf2.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/cos.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/count0bits.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/divdf3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/divsf3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/divtf3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/divti3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/divxf3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/emutls.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/exp.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/exp2.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extendXfYf2.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/extend_f80.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fabs.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixXfYi.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatXiYf.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floor.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fma.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fmax.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fmin.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fmod.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/int.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log10.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log2.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/modti3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/mulXf3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/muldi3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/mulo.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/multi3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/negXf2.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/negXi2.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/negv.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/os_version_check.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/parity.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/popcount.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/rem_pio2.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/rem_pio2_large.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/rem_pio2f.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/round.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/shift.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/sin.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/sincos.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/sparc.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/sqrt.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/stack_probe.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/subo.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/tan.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/trig.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/trunc.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/truncXfYf2.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/trunc_f80.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/udivmod.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/udivmodti4.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/udivti3.zig"
+ "${CMAKE_SOURCE_DIR}/lib/compiler_rt/umodti3.zig"
"${CMAKE_SOURCE_DIR}/lib/std/start.zig"
"${CMAKE_SOURCE_DIR}/lib/std/std.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target.zig"
@@ -869,7 +869,7 @@ set(BUILD_ZIG1_ARGS
-lc
--pkg-begin build_options "${ZIG_CONFIG_ZIG_OUT}"
--pkg-end
- --pkg-begin compiler_rt "${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt.zig"
+ --pkg-begin compiler_rt "${CMAKE_SOURCE_DIR}/lib/compiler_rt.zig"
--pkg-end
)