diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-05 21:41:15 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-05 21:41:15 -0600 |
commit | 5d72b64e90cd5252c2c25b6c6eb1e9cf5cc739f9 (patch) | |
tree | 3a29d91c3dfb3c7c580c87184a15b5bd54e55172 /libmisc/include | |
parent | 7fe3755f3a3dc11f1371b2b104fe3cf357da2310 (diff) | |
parent | 9758d91ea795448689ec401570bf556b8107177c (diff) |
Merge branch 'lukeshu/net-flash'
Diffstat (limited to 'libmisc/include')
-rw-r--r-- | libmisc/include/libmisc/_intercept.h | 4 | ||||
-rw-r--r-- | libmisc/include/libmisc/private.h | 4 | ||||
-rw-r--r-- | libmisc/include/libmisc/rand.h | 4 |
3 files changed, 6 insertions, 6 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/private.h b/libmisc/include/libmisc/private.h index c5382a7..5518d1f 100644 --- a/libmisc/include/libmisc/private.h +++ b/libmisc/include/libmisc/private.h @@ -11,7 +11,7 @@ #define YES LM_SENTINEL() #define IS_IMPLEMENTATION_FOR(name) LM_IS_SENTINEL(IMPLEMENTATION_FOR_##name) -#define BEGIN_PRIVATE(name) LM_IF(IS_IMPLEMENTATION_FOR(name))()(struct {) -#define END_PRIVATE(name) LM_IF(IS_IMPLEMENTATION_FOR(name))()(} LM_CAT2_(_HIDDEN_, __COUNTER__);) +#define BEGIN_PRIVATE(name) LM_IF(IS_IMPLEMENTATION_FOR(name))()(struct {) struct {} LM_CAT2_(_PRIVATE_FORCE_SEMICOLON_, __COUNTER__) +#define END_PRIVATE(name) LM_IF(IS_IMPLEMENTATION_FOR(name))(struct {} LM_CAT2_(_PRIVATE_FORCE_SEMICOLON_, __COUNTER__))(} LM_CAT2_(_PRIVATE_, __COUNTER__)) #endif /* _LIBMISC_PRIVATE_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; } |