aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-12-25 15:18:03 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-12-25 15:18:03 -0500
commitf6b140681d21a6cb631e0ea5733d82a53ef97d25 (patch)
tree68d851293d95475ff034417fe93cce671af4c018 /src
parent5acea7089c82c7449ada88ed60d61797f0303e2a (diff)
General cleanup
Diffstat (limited to 'src')
-rw-r--r--src/compile/comparisons.c1
-rw-r--r--src/compile/functions.c2
-rw-r--r--src/stdlib/text.c2
-rw-r--r--src/stdlib/text.h4
-rw-r--r--src/tomo.c7
5 files changed, 9 insertions, 7 deletions
diff --git a/src/compile/comparisons.c b/src/compile/comparisons.c
index 62196cdf..c2d376ef 100644
--- a/src/compile/comparisons.c
+++ b/src/compile/comparisons.c
@@ -41,6 +41,7 @@ Text_t compile_comparison(env_t *env, ast_t *ast) {
} else {
code_err(ast, "I can't do comparisons between ", type_to_text(lhs_t), " and ", type_to_text(rhs_t));
}
+ assert(operand_t);
Text_t lhs, rhs;
lhs = compile_to_type(env, binop.lhs, operand_t);
diff --git a/src/compile/functions.c b/src/compile/functions.c
index 9b8ba096..a3c25c37 100644
--- a/src/compile/functions.c
+++ b/src/compile/functions.c
@@ -633,7 +633,7 @@ static void check_unused_vars(env_t *env, arg_ast_t *args, ast_t *body) {
// Global/file scoped vars are okay to mutate without reading
if (get_binding(env, entry->name) != NULL) continue;
ast_t *var = Table$str_get(assigned_vars, entry->name);
- code_err(var, "This variable was assigned to, but never read from.");
+ if (var) code_err(var, "This variable was assigned to, but never read from.");
}
}
diff --git a/src/stdlib/text.c b/src/stdlib/text.c
index 969c2e51..ce48091a 100644
--- a/src/stdlib/text.c
+++ b/src/stdlib/text.c
@@ -1113,7 +1113,7 @@ static bool _has_grapheme(TextIter_t *text, int32_t g) {
}
public
-OptionalInt_t Text$find(Text_t text, Text_t target, Int_t start) {
+PUREFUNC OptionalInt_t Text$find(Text_t text, Text_t target, Int_t start) {
if (text.length < target.length) return NONE_INT;
if (target.length <= 0) return I(1);
TextIter_t text_state = NEW_TEXT_ITER_STATE(text), target_state = NEW_TEXT_ITER_STATE(target);
diff --git a/src/stdlib/text.h b/src/stdlib/text.h
index d3ed032b..44b7d736 100644
--- a/src/stdlib/text.h
+++ b/src/stdlib/text.h
@@ -86,7 +86,7 @@ PUREFUNC bool Text$starts_with(Text_t text, Text_t prefix, Text_t *remainder);
PUREFUNC bool Text$ends_with(Text_t text, Text_t suffix, Text_t *remainder);
Text_t Text$without_prefix(Text_t text, Text_t prefix);
Text_t Text$without_suffix(Text_t text, Text_t suffix);
-OptionalInt_t Text$find(Text_t text, Text_t target, Int_t start);
+PUREFUNC OptionalInt_t Text$find(Text_t text, Text_t target, Int_t start);
Text_t Text$replace(Text_t text, Text_t target, Text_t replacement);
Text_t Text$translate(Text_t text, Table_t translations);
PUREFUNC bool Text$has(Text_t text, Text_t target);
@@ -120,7 +120,7 @@ Text_t Text$layout(Text_t text);
void Text$serialize(const void *obj, FILE *out, Table_t *, const TypeInfo_t *);
void Text$deserialize(FILE *in, void *out, List_t *, const TypeInfo_t *);
-MACROLIKE int32_t Text$get_grapheme(Text_t text, int64_t index) {
+MACROLIKE PUREFUNC int32_t Text$get_grapheme(Text_t text, int64_t index) {
TextIter_t state = NEW_TEXT_ITER_STATE(text);
return Text$get_grapheme_fast(&state, index);
}
diff --git a/src/tomo.c b/src/tomo.c
index 4e2cdf5d..080edc96 100644
--- a/src/tomo.c
+++ b/src/tomo.c
@@ -78,9 +78,10 @@ static List_t format_files = EMPTY_LIST, format_files_inplace = EMPTY_LIST, pars
run_files = EMPTY_LIST, uninstall_libraries = EMPTY_LIST, libraries = EMPTY_LIST, args = EMPTY_LIST;
static OptionalText_t show_codegen = NONE_TEXT,
- cflags = Text("-Werror -fdollars-in-identifiers -std=c2x -Wno-trigraphs "
+ cflags = Text("-Werror -fdollars-in-identifiers -std=c2x -Wno-trigraphs"
" -ffunction-sections -fdata-sections"
- " -fno-signed-zeros "
+ " -fno-signed-zeros"
+ " -flto=auto -fno-fat-lto-objects -Wl,-flto"
" -D_XOPEN_SOURCE -D_DEFAULT_SOURCE -fPIC -ggdb"
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
" -D_BSD_SOURCE"
@@ -952,7 +953,7 @@ Path_t compile_executable(env_t *base_env, Path_t path, Path_t exe_path, List_t
// the libraries that are used.
" ", is_gcc ? Texts("-Wl,--start-group ", list_text(archives), " -Wl,--end-group") : list_text(archives),
// Tomo static library:
- " ", TOMO_PATH, "/lib/libtomo@", TOMO_VERSION, ".a",
+ " -Wl,--no-whole-archive", " ", TOMO_PATH, "/lib/libtomo@", TOMO_VERSION, ".a",
// Output file:
" -o ", exe_path);