From 0250c14c9a3c838e7f6a77d350d05cb9108abc77 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 13 Jan 2024 01:24:55 +0100 Subject: Simplify macros --- cbs.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cbs.h b/cbs.h index 0cffcaf..39b03c5 100644 --- a/cbs.h +++ b/cbs.h @@ -76,15 +76,14 @@ #include #include -/* C23 changed a lot so we want to check for it, and some idiot decided that - __STDC_VERSION__ is an optional macro */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000 -# define CBS_IS_C23 +/* C23 changed a lot so we want to check for it */ +#if __STDC_VERSION__ >= 202000 +# define CBS_IS_C23 1 #endif /* Some C23 compat. In C23 booleans are actual keywords, and the noreturn attribute is different. */ -#ifdef CBS_IS_C23 +#if CBS_IS_C23 # define noreturn [[noreturn]] #else # include @@ -94,7 +93,7 @@ /* Give helpful diagnostics when people use die() incorrectly on GCC. C23 introduced C++ attribute syntax, so we need a check for that too. */ #ifdef __GNUC__ -# ifdef CBS_IS_C23 +# if CBS_IS_C23 # define ATTR_FMT [[gnu::format(printf, 1, 2)]] # else # define ATTR_FMT __attribute__((format(printf, 1, 2))) -- cgit v1.2.3