summaryrefslogtreecommitdiff
path: root/libmisc/include
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-05 03:41:44 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-05 21:34:27 -0600
commit8a39cfe7f245bea8b3a458238b694de13c61b88a (patch)
tree9969e8e902bedacdde3ebef0ed7ec6a2f0b23618 /libmisc/include
parentd291799fc5bb4fa1bde757c1a78646b0dc2551a1 (diff)
SYSTEM headers don't get strict GCC checks, so change them to PUBLIC
Diffstat (limited to 'libmisc/include')
-rw-r--r--libmisc/include/libmisc/_intercept.h4
-rw-r--r--libmisc/include/libmisc/rand.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/libmisc/include/libmisc/_intercept.h b/libmisc/include/libmisc/_intercept.h
index ab76857..a264144 100644
--- a/libmisc/include/libmisc/_intercept.h
+++ b/libmisc/include/libmisc/_intercept.h
@@ -13,7 +13,7 @@
* own `__lm_` wrappers that GCC/glibc won't interfere with.
*/
-[[format(printf, 1, 2)]]
+[[gnu::format(printf, 1, 2)]]
int __lm_printf(const char *format, ...);
[[noreturn]] void __lm_abort(void);
@@ -21,7 +21,7 @@ int __lm_printf(const char *format, ...);
/* __lm_light_printf is expected to have less stack use than regular
* __lm_printf, if possible. */
-[[format(printf, 1, 2)]]
+[[gnu::format(printf, 1, 2)]]
int __lm_light_printf(const char *format, ...);
#endif /* _LIBMISC__INTERCEPT_H_ */
diff --git a/libmisc/include/libmisc/rand.h b/libmisc/include/libmisc/rand.h
index 8072841..bb1ec0b 100644
--- a/libmisc/include/libmisc/rand.h
+++ b/libmisc/include/libmisc/rand.h
@@ -29,14 +29,14 @@ static inline uint64_t rand_uint63n(uint64_t cnt) {
uint64_t fair_cnt = ((UINT64_C(1)<<62) / cnt) * cnt;
uint64_t rnd;
do {
- rnd = (random() << 31) | random();
+ rnd = (((uint64_t)random()) << 31) | random();
} while (rnd >= fair_cnt);
return rnd % cnt;
} else if (cnt <= UINT64_C(1)<<63) {
uint64_t fair_cnt = ((UINT64_C(1)<<63) / cnt) * cnt;
uint64_t rnd;
do {
- rnd = (random() << 62) | (random() << 31) | random();
+ rnd = (((uint64_t)random()) << 62) | (((uint64_t)random()) << 31) | random();
} while (rnd >= fair_cnt);
return rnd % cnt;
}