diff options
| author | gingerBill <bill@gingerbill.org> | 2021-08-31 22:31:43 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-08-31 22:31:43 +0100 |
| commit | 2db6fea6655215452d445f327cadda815d65afd9 (patch) | |
| tree | 6188c98f879f65df1da271cc57a0fb6c41506d1e /src/main.cpp | |
| parent | b450a853d527df3e7baa2b980504f564a1a94921 (diff) | |
Remove dead code and add debug messages
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index ba09f7b31..b4e6c08af 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2054,7 +2054,7 @@ int strip_semicolons(Parser *parser) { AstPackage *pkg = parser->packages[i]; file_count += pkg->files.count; } - gb_printf_err("File count: %td\n", file_count); + gb_printf_err("File count to be stripped of unneeded tokens: %td\n", file_count); auto generated_files = array_make<StripSemicolonFile>(permanent_allocator(), 0, file_count); @@ -2096,6 +2096,7 @@ int strip_semicolons(Parser *parser) { i64 written = 0; defer (gb_file_truncate(&f, written)); + debugf("Write file with stripped tokens: %s\n", filename); err = write_file_with_stripped_tokens(&f, file->file, &written); if (err) { break; @@ -2122,14 +2123,17 @@ int strip_semicolons(Parser *parser) { char const *old_fullpath_backup = cast(char const *)file->old_fullpath_backup.text; char const *new_fullpath = cast(char const *)file->new_fullpath.text; + debugf("Copy '%s' to '%s'\n", old_fullpath, old_fullpath_backup); if (!gb_file_copy(old_fullpath, old_fullpath_backup, false)) { gb_printf_err("failed to copy '%s' to '%s'\n", old_fullpath, old_fullpath_backup); failed = true; break; } + debugf("Copy '%s' to '%s'\n", new_fullpath, old_fullpath); if (!gb_file_copy(new_fullpath, old_fullpath, false)) { gb_printf_err("failed to move '%s' to '%s' %d\n", old_fullpath, new_fullpath, GetLastError()); + debugf("Copy '%s' to '%s'\n", old_fullpath_backup, old_fullpath); if (!gb_file_copy(old_fullpath_backup, old_fullpath, false)) { gb_printf_err("failed to restore '%s' from '%s'\n", old_fullpath, old_fullpath_backup); } @@ -2137,6 +2141,7 @@ int strip_semicolons(Parser *parser) { break; } + debugf("Remove '%s'\n", old_fullpath_backup); if (!gb_file_remove(old_fullpath_backup)) { gb_printf_err("failed to remove '%s'\n", old_fullpath_backup); } @@ -2149,9 +2154,12 @@ int strip_semicolons(Parser *parser) { auto *file = &generated_files[i]; char const *filename = nullptr; filename = cast(char const *)file->new_fullpath.text; + + debugf("Remove '%s'\n", filename); GB_ASSERT_MSG(gb_file_remove(filename), "unable to delete file %s", filename); filename = cast(char const *)file->old_fullpath_backup.text; + debugf("Remove '%s'\n", filename); if (gb_file_exists(filename) && !gb_file_remove(filename)) { if (i < overwritten_files) { gb_printf_err("unable to delete file %s", filename); @@ -2161,6 +2169,8 @@ int strip_semicolons(Parser *parser) { } } + gb_printf_err("Files stripped of unneeded token: %td\n", file_count); + return cast(int)failed; } |