From ab4abd28d76dbf3e5c37d5c8e413d3bd5a305e39 Mon Sep 17 00:00:00 2001 From: martinfouilleul Date: Mon, 11 Sep 2023 18:09:47 +0200 Subject: [PATCH] Fix broken build on MSVC due to size_t being considered equivalent to u64 in _Generic associations --- src/util/macros.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/util/macros.h b/src/util/macros.h index c43c99d..6fd9370 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -108,12 +108,19 @@ inline T oc_cube(T a) #else //NOTE(martin): this macros helps generate variants of a generic 'template' for all arithmetic types. // the def parameter must be a macro that takes a type, and optional arguments - #define oc_tga_variants(def, ...) \ - def(u8, ##__VA_ARGS__) def(i8, ##__VA_ARGS__) def(u16, ##__VA_ARGS__) def(i16, ##__VA_ARGS__) \ - def(u32, ##__VA_ARGS__) def(i32, ##__VA_ARGS__) def(u64, ##__VA_ARGS__) def(i64, ##__VA_ARGS__) \ - def(size_t, ##__VA_ARGS__) \ - def(f32, ##__VA_ARGS__) def(f64, ##__VA_ARGS__) + #if OC_COMPILER_CL + #define oc_tga_variants(def, ...) \ + def(u8, ##__VA_ARGS__) def(i8, ##__VA_ARGS__) def(u16, ##__VA_ARGS__) def(i16, ##__VA_ARGS__) \ + def(u32, ##__VA_ARGS__) def(i32, ##__VA_ARGS__) def(u64, ##__VA_ARGS__) def(i64, ##__VA_ARGS__) \ + def(f32, ##__VA_ARGS__) def(f64, ##__VA_ARGS__) + #else + #define oc_tga_variants(def, ...) \ + def(u8, ##__VA_ARGS__) def(i8, ##__VA_ARGS__) def(u16, ##__VA_ARGS__) def(i16, ##__VA_ARGS__) \ + def(u32, ##__VA_ARGS__) def(i32, ##__VA_ARGS__) def(u64, ##__VA_ARGS__) def(i64, ##__VA_ARGS__) \ + def(size_t, ##__VA_ARGS__) \ + def(f32, ##__VA_ARGS__) def(f64, ##__VA_ARGS__) + #endif // This macro generates one _Generic association between a type and its variant #define oc_tga_association(type, name) , type : OC_CAT3(name, _, type)