From 6d89d384188ec0996487749919ad1159c85f80be Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Wed, 10 Jul 2024 23:00:00 +0200 Subject: [PATCH] crnlib: implement CRNLIB_ASSUME with static_assert --- crnlib/crn_assert.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/crnlib/crn_assert.h b/crnlib/crn_assert.h index 152a6a19..261d5bb8 100644 --- a/crnlib/crn_assert.h +++ b/crnlib/crn_assert.h @@ -39,15 +39,7 @@ struct crnlib_assume_failure { template struct crnlib_assume_try {}; -#define CRNLIB_JOINER_FINAL(a, b) a##b -#define CRNLIB_JOINER(a, b) CRNLIB_JOINER_FINAL(a, b) -#define CRNLIB_JOIN(a, b) CRNLIB_JOINER(a, b) - -#ifdef NDEBUG -#define CRNLIB_ASSUME(p) -#else -#define CRNLIB_ASSUME(p) typedef crnlib_assume_try)> CRNLIB_JOIN(crnlib_assume_typedef, __COUNTER__) -#endif +#define CRNLIB_ASSUME(p) static_assert(p, "") #ifdef NDEBUG template