Fixed svec warnings on MSVC

Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
2022-01-31 19:20:52 +02:00
parent 40017d2ad0
commit c49ab87286

View File

@@ -126,8 +126,9 @@ ev_vec_init_impl(
#define ev_svec_init(T, ...) __ev_svec_init_impl(T, EV_ARRSIZE((T[])__VA_ARGS__), __VA_ARGS__) #define ev_svec_init(T, ...) __ev_svec_init_impl(T, EV_ARRSIZE((T[])__VA_ARGS__), __VA_ARGS__)
#define ev_svec_init_w_cap(T, cap) __ev_svec_init_w_cap_impl(T, cap) #define ev_svec_init_w_cap(T, cap) __ev_svec_init_w_cap_impl(T, cap)
#define __ev_svec_structname(T) EV_CAT(EV_CAT(svec_type_##T##_,__COUNTER__),__LINE__)
#define __ev_svec_init_impl(T, len, ...) \ #define __ev_svec_init_impl(T, len, ...) \
(ev_svec(T))&((struct { \ (ev_svec(T))&((struct __ev_svec_structname(T) { \
struct ev_vec_meta_t meta; \ struct ev_vec_meta_t meta; \
EV_ALIGNAS(EV_ALIGNOF(T)) T data[len]; \ EV_ALIGNAS(EV_ALIGNOF(T)) T data[len]; \
}) { \ }) { \
@@ -140,13 +141,14 @@ ev_vec_init_impl(
}).data }).data
#define __ev_svec_init_w_cap_impl(T, cap) \ #define __ev_svec_init_w_cap_impl(T, cap) \
(ev_svec(T))&((struct { \ (ev_svec(T))&((struct __ev_svec_structname(T) { \
struct ev_vec_meta_t meta; \ struct ev_vec_meta_t meta; \
EV_ALIGNAS(EV_ALIGNOF(T)) T data[cap]; \ EV_ALIGNAS(EV_ALIGNOF(T)) T data[cap]; \
}) { \ }) { \
.meta.length = 0, \ .meta.length = 0, \
.meta.capacity = cap, \ .meta.capacity = cap, \
.meta.typeData = TypeData(T), \ .meta.typeData.size = sizeof(T), \
.meta.typeData.alignment = EV_ALIGNOF(T), \
.meta.allocationType = EV_VEC_ALLOCATION_TYPE_STACK, \ .meta.allocationType = EV_VEC_ALLOCATION_TYPE_STACK, \
.data = { 0 } \ .data = { 0 } \
}).data }).data