Fix alloc empty struct array error
parent
3f90809035
commit
75ff76a999
|
|
@ -300,3 +300,11 @@ fn test_alias_string_contains() {
|
||||||
names := [Str('')]
|
names := [Str('')]
|
||||||
assert (Str('') in names) == true
|
assert (Str('') in names) == true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct XYZ {}
|
||||||
|
|
||||||
|
fn test_array_append_empty_struct() {
|
||||||
|
mut names := []XYZ{cap: 2}
|
||||||
|
names << XYZ{}
|
||||||
|
assert (XYZ{} in names) == true
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ static void __closure_destroy(void *closure) {
|
||||||
|
|
||||||
const c_common_macros = '
|
const c_common_macros = '
|
||||||
#define EMPTY_VARG_INITIALIZATION 0
|
#define EMPTY_VARG_INITIALIZATION 0
|
||||||
#define EMPTY_STRUCT_DECLARATION
|
#define EMPTY_STRUCT_DECLARATION char _dummy
|
||||||
#define EMPTY_STRUCT_INITIALIZATION
|
#define EMPTY_STRUCT_INITIALIZATION
|
||||||
// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...
|
// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...
|
||||||
#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])
|
#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])
|
||||||
|
|
@ -300,8 +300,6 @@ const c_common_macros = '
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __TINYC__
|
#ifdef __TINYC__
|
||||||
#undef EMPTY_STRUCT_DECLARATION
|
|
||||||
#define EMPTY_STRUCT_DECLARATION char _dummy
|
|
||||||
#undef EMPTY_ARRAY_OF_ELEMS
|
#undef EMPTY_ARRAY_OF_ELEMS
|
||||||
#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])
|
#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])
|
||||||
#undef __NOINLINE
|
#undef __NOINLINE
|
||||||
|
|
@ -576,10 +574,8 @@ voidptr memdup(voidptr src, int sz);
|
||||||
#define _Atomic volatile
|
#define _Atomic volatile
|
||||||
|
|
||||||
// MSVC cannot parse some things properly
|
// MSVC cannot parse some things properly
|
||||||
#undef EMPTY_STRUCT_DECLARATION
|
|
||||||
#undef OPTION_CAST
|
#undef OPTION_CAST
|
||||||
|
|
||||||
#define EMPTY_STRUCT_DECLARATION char __pad
|
|
||||||
#define OPTION_CAST(x)
|
#define OPTION_CAST(x)
|
||||||
#undef __NOINLINE
|
#undef __NOINLINE
|
||||||
#undef __IRQHANDLER
|
#undef __IRQHANDLER
|
||||||
|
|
@ -633,7 +629,7 @@ typedef uint8_t byte;
|
||||||
typedef uint32_t rune;
|
typedef uint32_t rune;
|
||||||
typedef size_t usize;
|
typedef size_t usize;
|
||||||
typedef ptrdiff_t isize;
|
typedef ptrdiff_t isize;
|
||||||
#ifndef VNOFLOAT
|
#ifndef VNOFLOAT
|
||||||
typedef float f32;
|
typedef float f32;
|
||||||
typedef double f64;
|
typedef double f64;
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue