compiler: add polyfill for typeof()

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-02-19 15:12:58 +00:00
parent 3e0fd094ab
commit 1fd43b863e
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
1 changed files with 3 additions and 1 deletions

View File

@ -8,7 +8,9 @@
// clang-format off
#if __STDC_VERSION__ <= 201710L
#define auto __auto_type
// Polyfill for C23's `auto` and `typeof`
# define auto __auto_type
# define typeof __typeof__
#endif
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)