aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-25 10:53:16 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-25 10:53:16 -0400
commit0c233618892636b0be6dec1185de46d48a2862c4 (patch)
tree5ea1303c42185118138d50b60c7f4f8090d493b2
parentf6bce464c79de1e7f3e66046628e3ffada7246d9 (diff)
Clang fixes
-rw-r--r--lib/random/random.tm8
-rw-r--r--src/stdlib/stdlib.c1
-rw-r--r--src/stdlib/stdlib.h1
3 files changed, 4 insertions, 6 deletions
diff --git a/lib/random/random.tm b/lib/random/random.tm
index 14b68d7f..a625bc76 100644
--- a/lib/random/random.tm
+++ b/lib/random/random.tm
@@ -90,7 +90,7 @@ struct RandomNumberGenerator(_chacha:chacha_ctx, _random_bytes:[Byte]=[]; secret
uint64_t range = (uint64_t)@max - (uint64_t)@min + 1;
uint64_t min_r = -range % range;
uint64_t r;
- @random_int64 = &r;
+ @random_int64 = (int64_t*)&r;
for (;;) {
@(rng._fill_bytes(random_int64, 8));
if (r >= min_r) break;
@@ -110,7 +110,7 @@ struct RandomNumberGenerator(_chacha:chacha_ctx, _random_bytes:[Byte]=[]; secret
uint32_t range = (uint32_t)@max - (uint32_t)@min + 1;
uint32_t min_r = -range % range;
uint32_t r;
- @random_int32 = &r;
+ @random_int32 = (int32_t*)&r;
for (;;) {
@(rng._fill_bytes(random_int32, 8));
if (r >= min_r) break;
@@ -130,7 +130,7 @@ struct RandomNumberGenerator(_chacha:chacha_ctx, _random_bytes:[Byte]=[]; secret
uint16_t range = (uint16_t)@max - (uint16_t)@min + 1;
uint16_t min_r = -range % range;
uint16_t r;
- @random_int16 = &r;
+ @random_int16 = (int16_t*)&r;
for (;;) {
@(rng._fill_bytes(random_int16, 8));
if (r >= min_r) break;
@@ -150,7 +150,7 @@ struct RandomNumberGenerator(_chacha:chacha_ctx, _random_bytes:[Byte]=[]; secret
uint8_t range = (uint8_t)@max - (uint8_t)@min + 1;
uint8_t min_r = -range % range;
uint8_t r;
- @random_int8 = &r;
+ @random_int8 = (int8_t*)&r;
for (;;) {
@(rng._fill_bytes(random_int8, 8));
if (r >= min_r) break;
diff --git a/src/stdlib/stdlib.c b/src/stdlib/stdlib.c
index cc0ea114..c1aba23c 100644
--- a/src/stdlib/stdlib.c
+++ b/src/stdlib/stdlib.c
@@ -490,7 +490,6 @@ public void start_inspect(const char *filename, int64_t start, int64_t end)
_inspect_depth += 1;
}
-__attribute__((nonnull))
public void end_inspect(const void *expr, const TypeInfo_t *type)
{
_inspect_depth -= 1;
diff --git a/src/stdlib/stdlib.h b/src/stdlib/stdlib.h
index c4bf83e0..d60ff4fd 100644
--- a/src/stdlib/stdlib.h
+++ b/src/stdlib/stdlib.h
@@ -66,7 +66,6 @@ _Noreturn void fail_text(Text_t message);
Text_t builtin_last_err();
__attribute__((nonnull))
void start_inspect(const char *filename, int64_t start, int64_t end);
-__attribute__((nonnull))
void end_inspect(const void *expr, const TypeInfo_t *type);
#define inspect(type, expr, typeinfo, start, end) {\
start_inspect(__SOURCE_FILE__, start, end); \