un-special-case startup code in the std lib

Previously, the compiler had special logic to determine whether to
include the startup code, which was in `std/special/start.zig`. Now,
the file is moved to `std/start.zig`, and there is no special logic
in the compiler. Instead, the standard library unconditionally imports
the `start.zig` file, which then has a `comptime` block that does the
logic of determining what, if any, start symbols to export. Instead of
`start.zig` being in its own special package, it is just another normal
file that is part of the standard library.

`std.builtin.TestFn` is now part of the standard library rather than
specially generated by the compiler.
This commit is contained in:
Andrew Kelley
2019-12-12 18:27:17 -05:00
parent b37acc4d68
commit fff3c1fff4
13 changed files with 92 additions and 115 deletions

View File

@@ -623,7 +623,7 @@ int main(int argc, char **argv) {
ZigPackage *build_pkg = codegen_create_package(g, buf_ptr(&build_file_dirname),
buf_ptr(&build_file_basename), "std.special");
g->root_package->package_table.put(buf_create_from_str("@build"), build_pkg);
g->main_pkg->package_table.put(buf_create_from_str("@build"), build_pkg);
g->enable_cache = get_cache_opt(enable_cache, true);
codegen_build_and_link(g);
if (root_progress_node != nullptr) {
@@ -1269,7 +1269,7 @@ int main(int argc, char **argv) {
codegen_set_test_name_prefix(g, buf_create_from_str(test_name_prefix));
}
add_package(g, cur_pkg, g->root_package);
add_package(g, cur_pkg, g->main_pkg);
if (cmd == CmdBuild || cmd == CmdRun || cmd == CmdTest) {
g->c_source_files = c_source_files;