From 76eb7f598349aeec09c2d70a7cf87fced73fd8a8 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 5 Apr 2025 00:45:53 -0600 Subject: libobj, libmisc/private.h: Allow+force semicolons --- libmisc/include/libmisc/private.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libmisc/include') 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_ */ -- cgit v1.2.3-2-g168b From 8a39cfe7f245bea8b3a458238b694de13c61b88a Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 5 Apr 2025 03:41:44 -0600 Subject: SYSTEM headers don't get strict GCC checks, so change them to PUBLIC --- libmisc/include/libmisc/_intercept.h | 4 ++-- libmisc/include/libmisc/rand.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'libmisc/include') 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; } -- cgit v1.2.3-2-g168b