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

9 years ago
  1. #define GCC_VERSION (__GNUC__ * 10000 + \
  2. __GNUC_MINOR__ * 100 + \
  3. __GNUC_PATCHLEVEL__)
  4. #if GCC_VERSION < 40900
  5. #error Your GCC version is too old, please switch to >= 4.9
  6. #endif
  7. // Generic wrapper macro for the various dict_write_* functions
  8. // Can be used with gcc >= 4.9 and --std=c11 flag
  9. #define dict_write_value(iter, key, value, ...) _Generic((value), \
  10. uint8_t: dict_write_uint8, \
  11. uint16_t: dict_write_uint16, \
  12. uint32_t: dict_write_uint32, \
  13. unsigned: dict_write_uint32, \
  14. int8_t: dict_write_int8, \
  15. int16_t: dict_write_int16, \
  16. int32_t: dict_write_int32, \
  17. int: dict_write_int32, \
  18. char*: dict_write_cstring, \
  19. uint8_t*: dict_write_data \
  20. )(iter, key, value, ## __VA_ARGS__)