You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
785 B
C

#pragma once
#define TLSL_TYPES_EQ(TYPE_LHS, TYPE_RHS) ({ \
_Static_assert(__builtin_types_compatible_p(TYPE_LHS, TYPE_RHS), \
"types mismatch"); \
1; \
})
#define TLSL_TYPEOFS_EQ(VAL_LHS, VAL_RHS) TLSL_TYPES_EQ(typeof(VAL_LHS), typeof(VAL_RHS))
#define TLSL_CHECK_TYPE(TYPE, VAL) TLSL_TYPES_EQ(TYPE, typeof(VAL))
#define TLSL_CHECK_ARRAY(VAL) ({ \
_Static_assert(!__builtin_types_compatible_p(typeof(VAL), typeof(&(VAL)[0])), \
"not an array"); \
1; \
})