aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-05-17 15:29:06 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-05-17 16:09:20 -0700
commitd5e894a9a7c63ebbfaa3c4eb6d173e15745ad39c (patch)
treecb1b68b50d9012c2c63ae2c4ad0469caeaaefef6
parentab6b0ad8a4f858c8e4e5591b2383156eab8ac0e4 (diff)
downloadzig-d5e894a9a7c63ebbfaa3c4eb6d173e15745ad39c.tar.gz
zig-d5e894a9a7c63ebbfaa3c4eb6d173e15745ad39c.zip
stage2: get rid of failed_root_src_file
-rw-r--r--BRANCH_TODO19
-rw-r--r--src/Compilation.zig12
-rw-r--r--src/Module.zig3
3 files changed, 11 insertions, 23 deletions
diff --git a/BRANCH_TODO b/BRANCH_TODO
index d5bc2c5fba..f1981b6236 100644
--- a/BRANCH_TODO
+++ b/BRANCH_TODO
@@ -1,17 +1,8 @@
- * modify stage2 CBE tests so that only 1 uses pub export main and the
- rest use pub fn main
-
- * get the test runner and `zig test` working
- * get behavior tests passing for stage2
-
* use a hash map for instructions because the array is too big
- no, actually modify the Zir.Inst.Ref strategy so that each decl gets
their indexes starting at 0 so that we can use an array to store Sema
results rather than a map.
- * implement the new AstGen compile errors
-
- * get rid of failed_root_src_file
* get rid of Scope.DeclRef
* get rid of NameHash
* handle decl collision with usingnamespace
@@ -68,3 +59,13 @@
* repl: if you try `run` with -ofmt=c you get an access denied error because it
tries to execute the .c file as a child process instead of executing `zig run`
on it.
+
+=== file issues: ===
+
+ * C backend: honor the exported symbol name. Right now if you do `pub fn main`
+ it generates bogus C code because the `@export` name is not honored, and it allows
+ the `main` which should be not exported, to clobber the exported symbol name.
+
+ * get the test runner and `zig test` working
+ - get behavior tests passing for stage2
+
diff --git a/src/Compilation.zig b/src/Compilation.zig
index e792a9e6b6..ff50ce8d6c 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -1681,8 +1681,7 @@ pub fn totalErrorCount(self: *Compilation) usize {
var total: usize = self.failed_c_objects.count() + self.misc_failures.count();
if (self.bin_file.options.module) |module| {
- total += module.failed_exports.items().len +
- @boolToInt(module.failed_root_src_file != null);
+ total += module.failed_exports.items().len;
for (module.failed_files.items()) |entry| {
if (entry.value) |_| {
@@ -1789,15 +1788,6 @@ pub fn getAllErrorsAlloc(self: *Compilation) !AllErrors {
for (module.failed_exports.items()) |entry| {
try AllErrors.add(module, &arena, &errors, entry.value.*);
}
- if (module.failed_root_src_file) |err| {
- const file_path = try module.root_pkg.root_src_directory.join(&arena.allocator, &[_][]const u8{
- module.root_pkg.root_src_path,
- });
- const msg = try std.fmt.allocPrint(&arena.allocator, "unable to read {s}: {s}", .{
- file_path, @errorName(err),
- });
- try AllErrors.addPlain(&arena, &errors, msg);
- }
}
if (errors.items.len == 0 and self.link_error_flags.no_entry_point_found) {
diff --git a/src/Module.zig b/src/Module.zig
index b74ef1cc81..6dc0b2a256 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -92,9 +92,6 @@ error_name_list: ArrayListUnmanaged([]const u8) = .{},
/// previous analysis.
generation: u32 = 0,
-/// When populated it means there was an error opening/reading the root source file.
-failed_root_src_file: ?anyerror = null,
-
stage1_flags: packed struct {
have_winmain: bool = false,
have_wwinmain: bool = false,