aboutsummaryrefslogtreecommitdiff
path: root/tomo.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-06-16 18:09:54 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-06-16 18:09:54 -0400
commit32e82fdbe333a5a2dbaab2b229f0540d0f9d812e (patch)
tree12d89ae3190021ba7290c5afb4c9ba95b9d604de /tomo.c
parent9f8be0c5029a69bfa9796ac31866658b9da70390 (diff)
Remove some dead code and support -l as a tomo flag
Diffstat (limited to 'tomo.c')
-rw-r--r--tomo.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/tomo.c b/tomo.c
index 78f665af..182a1fef 100644
--- a/tomo.c
+++ b/tomo.c
@@ -126,6 +126,10 @@ int main(int argc, char *argv[])
table_t to_link = {};
for (int i = after_flags; i < argc; i++) {
+ if (strncmp(argv[i], "-l", 2) == 0) {
+ ldlibs = CORD_all(ldlibs, " ", argv[i]);
+ continue;
+ }
const char *resolved = resolve_path(argv[i], ".", ".");
if (!resolved) errx(1, "Couldn't resolve path: %s", argv[i]);
build_file_dependency_graph(resolved, &dependency_files, &to_link);
@@ -135,6 +139,8 @@ int main(int argc, char *argv[])
int status;
// Non-lazily (re)compile header files for each source file passed to the compiler:
for (int i = after_flags; i < argc; i++) {
+ if (strncmp(argv[i], "-l", 2) == 0)
+ continue;
const char *filename = argv[i];
status = transpile_header(env, filename, true);
if (status != 0) return status;
@@ -147,10 +153,12 @@ int main(int argc, char *argv[])
if (status != 0) return status;
}
- // env->imports = new(table_t);
+ env->imports = new(table_t);
// Non-lazily (re)compile object files for each source file passed to the compiler:
for (int i = after_flags; i < argc; i++) {
+ if (strncmp(argv[i], "-l", 2) == 0)
+ continue;
const char *filename = argv[i];
status = transpile_code(env, filename, true);
if (status != 0) return status;
@@ -195,6 +203,8 @@ int main(int argc, char *argv[])
FILE *header_prog = CORD_RUN(autofmt ? autofmt : "cat", " 2>/dev/null >", h_filename);
fputs("#pragma once\n", header_prog);
for (int i = after_flags; i < argc; i++) {
+ if (strncmp(argv[i], "-l", 2) == 0)
+ continue;
const char *filename = argv[i];
file_t *f = load_file(filename);
if (!f) errx(1, "No such file: %s", filename);
@@ -216,8 +226,11 @@ int main(int argc, char *argv[])
FILE *files_file = fopen(files_filename, "w");
if (!files_file)
errx(1, "Couldn't open file: %s", files_filename);
- for (int i = after_flags; i < argc; i++)
+ for (int i = after_flags; i < argc; i++) {
+ if (strncmp(argv[i], "-l", 2) == 0)
+ continue;
fprintf(files_file, "%s\n", argv[i]);
+ }
if (fclose(files_file))
errx(1, "Failed to close file: %s", files_filename);
@@ -225,6 +238,8 @@ int main(int argc, char *argv[])
unlink("symbol_renames.txt");
FILE *prog;
for (int i = after_flags; i < argc; i++) {
+ if (strncmp(argv[i], "-l", 2) == 0)
+ continue;
prog = CORD_RUN("nm -U -fjust-symbols ", argv[i], ".o | sed 's/.*/\\0 ", libname_id, "$\\0/' >>symbol_renames.txt");
status = pclose(prog);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)