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

26 lines
778 B

#define GCC_VERSION (__GNUC__ * 10000 + \
__GNUC_MINOR__ * 100 + \
__GNUC_PATCHLEVEL__)
#if GCC_VERSION < 40900
#error Your GCC version is too old, please switch to >= 4.9
#endif
// Generic wrapper macro for the various dict_write_* functions
// Can be used with gcc >= 4.9 and --std=c11 flag
#define dict_write_value(iter, key, value, ...) _Generic((value), \
uint8_t: dict_write_uint8, \
uint16_t: dict_write_uint16, \
uint32_t: dict_write_uint32, \
unsigned: dict_write_uint32, \
int8_t: dict_write_int8, \
int16_t: dict_write_int16, \
int32_t: dict_write_int32, \
int: dict_write_int32, \
char*: dict_write_cstring, \
uint8_t*: dict_write_data \
)(iter, key, value, ## __VA_ARGS__)