mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
0.6.0: init_new/init_temp removed. LinkedList API rewritten. List "pop" and "remove" function now return Optionals. RingBuffer API rewritten. Allocator interface changed. Deprecated Allocator, DString and mem functions removed. "identity" functions are now constants for Matrix and Complex numbers. @default implementations for interfaces removed. any* => any, same for interfaces. Emit local/private globals as "private" in LLVM, following C "static". Updated enum syntax. Add support [rgba] properties in vectors. Improved checks of aliased "void". Subarray -> slice. Fix of llvm codegen enum check. Improved alignment handling. Add --output-dir #1155. Removed List/Object append. GenericList renamed AnyList. Remove unused "unwrap". Fixes to cond. Optimize output in dead branches. Better checking of operator methods. Disallow any from implementing dynamic methods. Check for operator mismatch. Remove unnecessary bitfield. Remove numbering in --list* commands Old style enum declaration for params/type, but now the type is optional. Add note on #1086. Allow making distinct types out of "void", "typeid", "anyfault" and faults. Remove system linker build options. "Try" expressions must be simple expressions. Add optimized build to Mac tests. Register int. assert(false) only allowed in unused branches or in tests. Compile time failed asserts is a compile time error. Remove current_block_is_target. Bug when assigning an optional from an optional. Remove unused emit_zstring. Simplify phi code. Remove unnecessary unreachable blocks and remove unnecessary current_block NULL assignments. Proper handling of '.' and Win32 '//server' paths. Add "no discard" to expression blocks with a return value. Detect "unsigned >= 0" as errors. Fix issue with distinct void as a member #1147. Improve callstack debug information #1184. Fix issue with absolute output-dir paths. Lambdas were not type checked thoroughly #1185. Fix compilation warning #1187. Request jump table using @jump for switches. Path normalization - fix possible null terminator out of bounds. Improved error messages on inlined macros.
Upgrade of mingw in CI. Fix problems using reflection on interface types #1203. Improved debug information on defer. $foreach doesn't create an implicit syntactic scope. Error if `@if` depends on `@if`. Updated Linux stacktrace. Fix of default argument stacktrace. Allow linking libraries directly by file path. Improve inlining warning messages. Added `index_of_char_from`. Compiler crash using enum nameof from different module #1205. Removed unused fields in find_msvc. Use vswhere to find msvc. Update tests for LLVM 19
This commit is contained in:
@@ -343,9 +343,9 @@ macro void set_inline(void* dst, char val, usz $len, usz $dst_align = 0, bool $i
|
||||
$$memset_inline(dst, val, $len, $is_volatile, $dst_align);
|
||||
}
|
||||
/**
|
||||
* @require values::@inner_kind(a) == TypeKind.SUBARRAY || values::@inner_kind(a) == TypeKind.POINTER
|
||||
* @require values::@inner_kind(b) == TypeKind.SUBARRAY || values::@inner_kind(b) == TypeKind.POINTER
|
||||
* @require values::@inner_kind(a) != TypeKind.SUBARRAY || len == -1
|
||||
* @require values::@inner_kind(a) == TypeKind.SLICE || values::@inner_kind(a) == TypeKind.POINTER
|
||||
* @require values::@inner_kind(b) == TypeKind.SLICE || values::@inner_kind(b) == TypeKind.POINTER
|
||||
* @require values::@inner_kind(a) != TypeKind.SLICE || len == -1
|
||||
* @require values::@inner_kind(a) != TypeKind.POINTER || len > -1
|
||||
* @require values::@assign_to(a, b) && values::@assign_to(b, a)
|
||||
**/
|
||||
@@ -356,7 +356,7 @@ macro bool equals(a, b, isz len = -1, usz $align = 0)
|
||||
$endif
|
||||
void* x @noinit;
|
||||
void* y @noinit;
|
||||
$if values::@inner_kind(a) == TypeKind.SUBARRAY:
|
||||
$if values::@inner_kind(a) == TypeKind.SLICE:
|
||||
len = a.len;
|
||||
if (len != b.len) return false;
|
||||
x = a.ptr;
|
||||
@@ -403,9 +403,9 @@ macro type_alloc_must_be_aligned($Type)
|
||||
/**
|
||||
* Run with a specific allocator inside of the macro body.
|
||||
**/
|
||||
macro void @scoped(Allocator* allocator; @body())
|
||||
macro void @scoped(Allocator allocator; @body())
|
||||
{
|
||||
Allocator* old_allocator = allocator::thread_allocator;
|
||||
Allocator old_allocator = allocator::thread_allocator;
|
||||
allocator::thread_allocator = allocator;
|
||||
defer allocator::thread_allocator = old_allocator;
|
||||
@body();
|
||||
@@ -415,7 +415,7 @@ macro void @report_heap_allocs_in_scope(;@body())
|
||||
{
|
||||
TrackingAllocator tracker;
|
||||
tracker.init(allocator::thread_allocator);
|
||||
Allocator* old_allocator = allocator::thread_allocator;
|
||||
Allocator old_allocator = allocator::thread_allocator;
|
||||
allocator::thread_allocator = &tracker;
|
||||
defer
|
||||
{
|
||||
@@ -426,7 +426,7 @@ macro void @report_heap_allocs_in_scope(;@body())
|
||||
@body();
|
||||
}
|
||||
|
||||
macro void @stack_mem(usz $size; @body(Allocator* mem)) @builtin
|
||||
macro void @stack_mem(usz $size; @body(Allocator mem)) @builtin
|
||||
{
|
||||
char[$size] buffer;
|
||||
OnStackAllocator allocator;
|
||||
@@ -504,11 +504,6 @@ macro void @pool(TempAllocator* #other_temp = null; @body) @builtin
|
||||
import libc;
|
||||
|
||||
|
||||
|
||||
macro TempAllocator* temp() @deprecated("Use allocator::temp()") => allocator::temp();
|
||||
macro Allocator* current_allocator() @deprecated("Use allocator::heap()") => allocator::heap();
|
||||
macro Allocator* heap() @deprecated("Use allocator::heap()") => allocator::heap();
|
||||
|
||||
module std::core::mem @if(WASM_NOLIBC);
|
||||
|
||||
SimpleHeapAllocator wasm_allocator @private;
|
||||
@@ -552,10 +547,10 @@ fn void* malloc(usz size) @builtin @inline @nodiscard
|
||||
return allocator::malloc(allocator::heap(), size);
|
||||
}
|
||||
|
||||
fn void* tmalloc(usz size, usz alignment = 0, usz offset = 0) @builtin @inline @nodiscard
|
||||
fn void* tmalloc(usz size, usz alignment = 0) @builtin @inline @nodiscard
|
||||
{
|
||||
if (!size) return null;
|
||||
return allocator::temp().acquire(size, false, alignment, 0)!!;
|
||||
return allocator::temp().acquire(size, NO_ZERO, alignment)!!;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -608,16 +603,6 @@ macro alloc_aligned($Type) @nodiscard
|
||||
return ($Type*)malloc_aligned($Type.sizeof, $Type.alignof);
|
||||
}
|
||||
|
||||
macro new_clear($Type) @deprecated("Use mem::new")
|
||||
{
|
||||
return new($Type);
|
||||
}
|
||||
|
||||
macro new_temp($Type) @deprecated("Use mem::temp_alloc or mem::temp_new")
|
||||
{
|
||||
return tmalloc($Type.sizeof);
|
||||
}
|
||||
|
||||
/**
|
||||
* @require $vacount < 2 : "Too many arguments."
|
||||
* @require $or($vacount == 0, $assignable($vaexpr(0), $Type)) : "The second argument must be an initializer for the type"
|
||||
@@ -638,12 +623,6 @@ macro temp_alloc($Type) @nodiscard
|
||||
return tmalloc($Type.sizeof);
|
||||
}
|
||||
|
||||
macro new_temp_clear($Type) @deprecated("use mem::temp_new")
|
||||
{
|
||||
return tcalloc($Type.sizeof);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @require $Type.alignof <= DEFAULT_MEM_ALIGNMENT : "Types with alignment exceeding the default must use 'new_array_aligned' instead"
|
||||
@@ -679,36 +658,16 @@ macro alloc_array_aligned($Type, usz elements) @nodiscard
|
||||
return allocator::alloc_array(allocator::heap(), $Type, elements);
|
||||
}
|
||||
|
||||
macro talloc_array($Type, usz elements) @nodiscard @deprecated("use mem::temp_alloc_array")
|
||||
{
|
||||
return temp_alloc_array($Type, elements);
|
||||
}
|
||||
|
||||
macro temp_alloc_array($Type, usz elements) @nodiscard
|
||||
{
|
||||
return (($Type*)tmalloc($Type.sizeof * elements, $Type.alignof))[:elements];
|
||||
}
|
||||
|
||||
macro temp_array($Type, usz elements) @nodiscard @deprecated("use mem::temp_alloc_array")
|
||||
{
|
||||
return temp_alloc_array($Type, elements);
|
||||
}
|
||||
|
||||
macro temp_new_array($Type, usz elements) @nodiscard
|
||||
{
|
||||
return (($Type*)tcalloc($Type.sizeof * elements, $Type.alignof))[:elements];
|
||||
}
|
||||
|
||||
macro new_zero_array($Type, usz elements) @deprecated("Use new_array")
|
||||
{
|
||||
return new_array($Type, elements);
|
||||
}
|
||||
|
||||
macro temp_zero_array($Type, usz elements) @deprecated("Use temp_new_array")
|
||||
{
|
||||
return temp_new_array($Type, elements);
|
||||
}
|
||||
|
||||
fn void* calloc(usz size) @builtin @inline @nodiscard
|
||||
{
|
||||
return allocator::calloc(allocator::heap(), size);
|
||||
@@ -719,10 +678,10 @@ fn void* calloc_aligned(usz size, usz alignment) @builtin @inline @nodiscard
|
||||
return allocator::calloc_aligned(allocator::heap(), size, alignment)!!;
|
||||
}
|
||||
|
||||
fn void* tcalloc(usz size, usz alignment = 0, usz offset = 0) @builtin @inline @nodiscard
|
||||
fn void* tcalloc(usz size, usz alignment = 0) @builtin @inline @nodiscard
|
||||
{
|
||||
if (!size) return null;
|
||||
return allocator::temp().acquire(size, false, alignment, 0)!!;
|
||||
return allocator::temp().acquire(size, ZERO, alignment)!!;
|
||||
}
|
||||
|
||||
fn void* realloc(void *ptr, usz new_size) @builtin @inline @nodiscard
|
||||
@@ -749,6 +708,6 @@ fn void* trealloc(void* ptr, usz size, usz alignment = mem::DEFAULT_MEM_ALIGNMEN
|
||||
{
|
||||
if (!size) return null;
|
||||
if (!ptr) return tmalloc(size, alignment);
|
||||
return allocator::temp().resize(ptr, size, alignment, 0)!!;
|
||||
return allocator::temp().resize(ptr, size, alignment)!!;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user