aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-08-19 23:26:02 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-08-19 23:26:02 -0400
commitc19ec4c443af0648c827e771df634394a7ca7f07 (patch)
tree5936cfe8c64e081621d258f562d02a8e8b32cd4f /src
parente552fc2afcf525d0fd7a3ffe137cc28a43f224a2 (diff)
Some pedantic fixes vetted against compiling on mac.
Diffstat (limited to 'src')
-rw-r--r--src/stdlib/integers.c2
-rw-r--r--src/stdlib/text.c8
-rw-r--r--src/tomo.c8
-rw-r--r--src/typecheck.c4
4 files changed, 12 insertions, 10 deletions
diff --git a/src/stdlib/integers.c b/src/stdlib/integers.c
index 037aba0f..64d1d847 100644
--- a/src/stdlib/integers.c
+++ b/src/stdlib/integers.c
@@ -665,7 +665,7 @@ public void Int32$deserialize(FILE *in, void *outval, List_t *pointers, const Ty
if (Int$compare_value(bit_index, I(1)) < 0) \
fail("Invalid bit index (expected 1 or higher): ", bit_index); \
if (Int$compare_value(bit_index, Int$from_int64(sizeof(c_type)*8)) > 0) \
- fail("Bit index is too large! There are only ", sizeof(c_type)*8, " bits, but index is: ", bit_index); \
+ fail("Bit index is too large! There are only ", (uint64_t)sizeof(c_type)*8, " bits, but index is: ", bit_index); \
return ((x & (c_type)(1L << (Int64$from_int(bit_index, true)-1L))) != 0); \
} \
typedef struct { \
diff --git a/src/stdlib/text.c b/src/stdlib/text.c
index 22ebd9c7..6e2e9072 100644
--- a/src/stdlib/text.c
+++ b/src/stdlib/text.c
@@ -828,7 +828,9 @@ public OptionalText_t Text$from_strn(const char *str, size_t len)
if (u32s_normalized != buf2) free(u32s_normalized);
if (unique_clusters.entries.length >= 256) {
- return concat2_assuming_safe(Text$from_components(graphemes, unique_clusters), Text$from_strn(next, (size_t)(end-next)));
+ return concat2_assuming_safe(
+ Text$from_components(graphemes, unique_clusters),
+ Text$from_strn((const char*)next, (size_t)(end-next)));
}
}
@@ -1133,12 +1135,12 @@ PUREFUNC public bool Text$ends_with(Text_t text, Text_t suffix, Text_t *remainde
public Text_t Text$without_prefix(Text_t text, Text_t prefix)
{
- return Text$starts_with(text, prefix, false) ? Text$slice(text, I(prefix.length + 1), I(text.length)) : text;
+ return Text$starts_with(text, prefix, NULL) ? Text$slice(text, I(prefix.length + 1), I(text.length)) : text;
}
public Text_t Text$without_suffix(Text_t text, Text_t suffix)
{
- return Text$ends_with(text, suffix, false) ? Text$slice(text, I(1), I(text.length - suffix.length)) : text;
+ return Text$ends_with(text, suffix, NULL) ? Text$slice(text, I(1), I(text.length - suffix.length)) : text;
}
static bool _has_grapheme(TextIter_t *text, int32_t g)
diff --git a/src/tomo.c b/src/tomo.c
index 4cad76a0..89ff2fcc 100644
--- a/src/tomo.c
+++ b/src/tomo.c
@@ -143,7 +143,7 @@ int main(int argc, char *argv[])
USE_COLOR = false;
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
- arc4random_buf(TOMO_HASH_KEY, sizeof(TOMO_HASH_KEY), 0);
+ arc4random_buf(TOMO_HASH_KEY, sizeof(TOMO_HASH_KEY));
#elif defined(__linux__)
assert(getrandom(TOMO_HASH_KEY, sizeof(TOMO_HASH_KEY), 0) == sizeof(TOMO_HASH_KEY));
#else
@@ -226,7 +226,7 @@ int main(int argc, char *argv[])
}
if (show_changelog) {
- print_inline(string_slice(CHANGES_md, CHANGES_md_len));
+ print_inline(string_slice((const char*)CHANGES_md, CHANGES_md_len));
return 0;
}
@@ -462,8 +462,8 @@ void install_library(Path_t lib_dir)
if (verbose) whisper("Updating debug symbols for ", dest, "/lib", lib_dir_name, SHARED_SUFFIX);
int result = system(String(as_owner, "debugedit -b ", lib_dir,
" -d '", dest, "'"
- " '", dest, "/lib", lib_dir_name, version_suffix, SHARED_SUFFIX, "'"
-));
+ " '", dest, "/lib", lib_dir_name, version_suffix, SHARED_SUFFIX, "' "
+ ">/dev/null 2>/dev/null"));
(void)result;
print("Installed \033[1m", lib_dir_name, "\033[m to "TOMO_PREFIX"/share/tomo_"TOMO_VERSION"/installed/", lib_dir_name, version_suffix);
}
diff --git a/src/typecheck.c b/src/typecheck.c
index d99048ff..dc312cde 100644
--- a/src/typecheck.c
+++ b/src/typecheck.c
@@ -61,7 +61,7 @@ type_t *parse_type_ast(env_t *env, type_ast_t *ast)
code_err(item_type, "Lists can't have stack references because the list may outlive the stack frame.");
if (type_size(item_t) > LIST_MAX_STRIDE)
code_err(ast, "This list holds items that take up ", (uint64_t)type_size(item_t),
- " bytes, but the maximum supported size is ", LIST_MAX_STRIDE, " bytes. Consider using a list of pointers instead.");
+ " bytes, but the maximum supported size is ", (int64_t)LIST_MAX_STRIDE, " bytes. Consider using a list of pointers instead.");
return Type(ListType, .item_type=item_t);
}
case SetTypeAST: {
@@ -72,7 +72,7 @@ type_t *parse_type_ast(env_t *env, type_ast_t *ast)
code_err(item_type, "Sets can't have stack references because the list may outlive the stack frame.");
if (type_size(item_t) > LIST_MAX_STRIDE)
code_err(ast, "This set holds items that take up ", (uint64_t)type_size(item_t),
- " bytes, but the maximum supported size is ", LIST_MAX_STRIDE, " bytes. Consider using an set of pointers instead.");
+ " bytes, but the maximum supported size is ", (int64_t)LIST_MAX_STRIDE, " bytes. Consider using an set of pointers instead.");
return Type(SetType, .item_type=item_t);
}
case TableTypeAST: {