Skip to content

Releases: c3lang/c3c

latest

11 Nov 15:46
Compare
Choose a tag to compare
latest Pre-release
Pre-release
Refactor "splat" parsing.

Version 0.6.4

08 Nov 20:01
Compare
Choose a tag to compare

0.6.4 Change list

Changes / improvements

  • Const vector -> const slice implicit conversion.
  • Slicing arrays, slices and bytes at compile time #1466.
  • Better error for int a[4] = .... #1518
  • Better error for int Foo(int a) declarations #1516
  • Improve error message in the case of MyInterface x = foo; #1522
  • Deprecate @adhoc, allow non-nested ad hoc generic types.
  • Constant bytes <=> char[] conversion should work #1514.
  • Infer now works across ternary.
  • Interfaces now support .ptr and .type directly without casting to any.
  • Switch to <* *> docs.
  • Improve error messages on expressions like var $type = int; #1553.
  • Disallow casting a void* to any or an interface, unless it is null.
  • Defer resolution of declarations when looked up in def aliased #1559.
  • Adding constants to the Json AST #1540
  • Adding info to the globals inside Json AST #1541
  • Null-check function pointer invocation #1573.
  • string::new_struct_to_str and io::struct_to_format to dump struct data.
  • io::print will now print structs.
  • Improve error message when using void aliases as variable storage type.
  • Add a target type: "prepare" which doesn't compile anything (but may run exec)

Fixes

  • Unsupported int[*] $x = { 1, 2, 3, 4 } #1489.
  • Unexpected compile error using a typed constant with copysign #1517
  • Incorrect subscript resolution #1519.
  • Segfault with passing a program with - using stdin.
  • Using no module with - would reject the program.
  • Unintended deref of pointers with methods caused regression with hash function.
  • Fix broken sincos function.
  • Bug when a continue is copied in a defer.
  • Compiler error when any/interface initialized using {} #1533.
  • Bug when defers and $if were combined in a macro, which would cause miscompilation.
  • Fixes to the CSV reader.
  • Crash returning struct or vector from function using ternary expression #1537.
  • Improved error message on invalid subscript index type #1535.
  • Improved error message when declaring a variable void!.
  • Cannot use void as a generic parameter #1546
  • Interfaces not correctly copied with generics #1545
  • Memory leak in keys.new_list fixed.
  • Standard library is now correctly weakly linked, fixing the use of C3 .so together with executable. #1549, #1107.
  • Wrong error message for interface methods with body #1536.
  • Empty expression block would crash compiler with debug on #1554.
  • Improve infer conversions on constants, e.g. ZString a = foo ? "a" : "b"; #1561
  • Show error when declarations do not start with fn in interfaces. #1565
  • if (try foo) was handled incorrectly inside a defer.
  • &self argument not implicitly null checked. #1556.
  • (uptr)&((Foo*)null).a incorrectly inserts a null check. #1544
  • Incorrect error message when $eval is provided an invalid string. #1570
  • HashMap.copy_keys did not properly copy keys which needed to be allocated #1569
  • Named vector component access would not fold at compile time. #1574
  • $define would occasionally not properly evaluate declarations it encountered.
  • Fixes with error handling recursive @tag #1583.
  • Sometimes generating introspection info would not be in the global scope causing a crash #1586.
  • @tag on macros cannot be retrieved with tagof #1582
  • Taking the $typeof of a wildcard optional returns void!.

Stdlib changes

  • Remove unintended print of char[] as String
  • Add read/write to stream with big endian ints.
  • Move accidently hidden "wrap_bytes".
  • Added CBool #1530.
  • Added encoding/base32 module.

Version 0.6.3

03 Oct 09:09
Compare
Choose a tag to compare

Changes / improvements

  • Introduce arg: x named arguments instead of .arg = x, deprecate old style.
  • Support splat for varargs #1352.
  • Allow var in lambdas in macros.
  • Support int[*] { 1, 2, 3 } expressions.
  • Support inline struct designated init as if inline was anonymous.
  • Introduce the .paramsof property.
  • Support environment variable 'C3C_LIB' to find the standard library.
  • Support environment variable 'C3C_CC' to find the default C compiler.
  • Support casting bitstructs to bool.
  • Allow user-defined attributes to have typed parameters.
  • Add .gitkeep files to project subfolders.
  • Add env::COMPILER_BUILD_HASH and env::COMPILER_BUILD_DATE
  • Support linking .o files in compilation command. #1417
  • Slicing constant strings at compile time works.
  • Add project fetch subcommand to fetch missing project dependencies (general and target specific)
  • Ability of vendor-fetch to download the dependencies in the first specified path dependencies-search-path
  • Ability of vendor-fetch to register the fetched dependencies in the project file.
  • Allow the "self" parameter to be $/# for macro methods.
  • Support compile time slicing of untyped lists.
  • Allow specifying an import module using @wasm #1305.
  • Deprecated inline generic types outside of struct definitions and macros unless marked @adhoc.
  • Improved method detection in earlier stages of checking.
  • Allow @norecurse attribute for non-recursive imports #1480.
  • wasm32 / wasm64 targets are use-libc=no by default.
  • Add hash/sha256 module

Fixes

  • Issue where a lambda wasn't correctly registered as external. #1408
  • Generic methods were incorrectly registered as functions, leading to naming collisions. #1402
  • Deprecated tuple / triple types.
  • Converting a slice to a vector/array would copy too little data.
  • Crash when reading an empty 'manifest.json'.
  • "optsize" did not work correctly in project.json.
  • l[0].a = 1 now supported for overloads due to better lvalue handling #1357.
  • Asserts are retained regardless of optimization when running tests.
  • Limit object filename lengths. #1415
  • Fix regression for $include.
  • Correct '.so' suffix on dynamic libraries on Linux.
  • Fix bug where inline index access to array in a struct would crash the compiler.
  • Asserts are now correctly included and traced in when running tests.
  • Use atexit to fix finalizers on Windows #1361.
  • Fix bugs in "trap-on-wrap" #1434.
  • Bug with casting anyfault to error.
  • Lambda / function type would accidentally be processed as a method.
  • Fix error message when not finding a particular function.
  • Crash invoking a @body argument with the wrong number of parameters.
  • Fix reordering semantics in struct assignment.
  • Regression when passing types as #expr arguments. #1461
  • Temp allocator overwrites data when doing reset on extra allocated pages. #1462
  • User defined attributes could not have more than 1 parameter due to bug.
  • Folding a constant array of structs at compile time would cause an assert.
  • Enum attributes would be overwritten by enum value attributes.
  • LLVM issue with try when bool is combined #1467.
  • Segfault using ternary with no assignment #1468.
  • Inner types make some errors misleading #1471.
  • Fix bug when passing a type as a compile time value.
  • Fix bug due to enum associated values not being checked for liveness.
  • Regression when compile time accessing a union field not last assigned to.
  • Safer seed of rand() for WASM without libc.
  • Bad error message aliasing an ident with a path. #1481.
  • Error when slicing a struct with an inline array #1488.
  • Improved error messages on Foo a = foo { 1 }; #1496
  • Bug in json decoder escape handling.
  • Fix bug when reading zip manifest, that would not return a zero terminated string. #1490
  • Fix thread tests.
  • Detect recursion errors on non-recursive mutexes in safe mode.
  • Foreach over distinct pointer failed to be caught as error #1506.
  • Foreach over distinct iterable would ignore operator(len).
  • Compiler crash when compiling c code in a library without --obj-out #1503.

Stdlib changes

  • Additional init functions for hashmap.
  • format functions are now functions and work better with splat.
  • Add support for the QOI format.
  • Add io::read_new_fully for reading to the end of a stream.
  • Add io::wrap_bytes for reading bytes with io functions.
  • Add rnd and rand_in_range default random functions.
  • Additional timezone related functions for datetime.
  • Added MD5 and crypto::safe_compare.
  • Added generic HMAC.
  • Added generic PBKDF2 implementation.
  • DString reverse.
  • DString.insert_at now has variants for other types.

Version 0.6.2

03 Sep 09:41
Compare
Choose a tag to compare

Changes / improvements

  • Updated LLVM passes
  • Added is_substruct type property.
  • Scalar -> vector not implicit in call or assign.
  • Added --vector-conv to enable the old scalar->vector conversion behaviour.
  • Added "weak" type aliases def Foo = my_foo::Foo @weak;
  • *-add keys in targets in manifest.json and project.json are deprecated.
  • Made "add" the default for things like sources, dependencies and other keys in project and library files.
  • Give some symbol name suggestions when the path is matched.
  • Don't generate .o files on compile and compile-run if there is no main.
  • c3c init-lib does not create the directory with the .c3l suffix #1253
  • Permit foreach values to be optional.
  • Add --show-backtrace option to disable backtrace for even smaller binary.
  • Untested Xtensa support.
  • && doesn't work correctly with lambdas #1279.
  • Fix incorrect override of optimization levels when using projects.
  • Add experimental @noalias attribute.
  • Add a --run-once option to delete the output file after running it.
  • Add @const attribute for macros, for better error messages with constant macros.
  • Add wincrt setting to libraries.
  • Add +++ &&& ||| as replacement for $concat, $and and $or.
  • Add methodsof to type info for struct, union and bitstruct.
  • Added @tag tagof and has_tagof to user defined types and members.
  • Added c-include-dirs project/manifest setting.
  • The compiler now skips UTF8 BOM.
  • Printable values passed to the Formatter as pointers, will print as if passed by value.
  • Pointers are rendered with "0x" prefix when passed to '%s'.
  • Add temp allocator scribble.
  • Use PIC by default on Linux.
  • $exec may now provide a stdin parameter.
  • Introduce $vaarg[...] syntax and deprecate the old $vaarg(...).
  • Similar change to $vasplat: $vasplat and $vasplat[1..].
  • Add $member.get(value) to replace value.$eval($member.nameof)
  • Improve the error message when the compilation does not produce any files #1390.
  • Add fmod implementation for nolibc.

Fixes

  • Broken WASM library code.
  • Regression: Invalid is_random implementation due to changes in 0.6.
  • dbghelp.lib was linked even on nolibc on Windows.
  • Fix incorrect linker selection on some platforms.
  • Struct members declared in a single line declaration were not sharing attributes. #1266
  • opt project setting now properly documented.
  • Incorrect justify formatting of integers.
  • Assertion with duplicate function pointer signatures #1286
  • Distinct func type would not accept direct function address assign. #1287
  • Distinct inline would not implement protocol if the inlined implemented it. #1292
  • Distinct inline can now be called if it is aliasing a function pointer.
  • Bug in List add_array when reserving memory.
  • Fix issue where a compile time parameter is followed by "...".
  • Fix issue with some conversions to untyped list.
  • Issue where a if (catch e = ...) in a defer would be incorrectly copied. Causing codegen error.
  • Variable in if-try / if-catch cannot be a reused variable name.
  • Vararg interfaces were broken.
  • LLVM codegen for constants in enums could fail.
  • Fixes to the socket functions.
  • Improved output when pointer is out of range.
  • Better error when casting to a distinct fails.
  • With single module, name the .o file after what -o provides. #1306
  • Bitstruct members can now have attributes.
  • % analysis was incorrect for int vectors.
  • When resolving inherited interfaces, the interface type wasn't always resolved.
  • Fix issues when checking methods and interfaces hasn't been resolved yet.
  • Fix Vec2.angle
  • Update to libc::setjmp on Win32, to do no stack unwinding.
  • Recursively follow interfaces when looking up method.
  • Int128 alignment change in LLVM fixed on x64.
  • Fix interface lazy resolution errors.
  • Interface resolution when part of generics #1348.
  • Assert not properly traced #1354.
  • Ordering issues with $include / $exec fixed #1302.
  • Issues with wincrt linking.
  • Debug info with recursive canonical type usage could cause segfault.
  • Missing check on optional left hand side for s.x.
  • Incorrect zero analysis on foo["test"] = {} #1360.
  • Bug converting untyped list #1360.
  • Benchmark / test no longer suppresses debug info. #1364.
  • Bug when compile time subtracting a distinct type.
  • insert_at incorrectly prevented inserts at the end of a list.
  • Fix aligned alloc for Win32 targets.
  • Compiler didn't detect when a module name was used both as a generic and regular module.
  • Assigning a const zero to an aliased distinct caused an error.
  • --path is now properly respected.
  • --test will now provide the full filename and the column.
  • Fix of bug in defer (catch err) with a direct return error.
  • Too restrictive compile time checks for @const.
  • Fixes to wasm nolibc in the standard library.
  • Fixed int128 div/mod.
  • Fix WASM memory init priority.
  • Fix bug with defer (catch err) when used together with regular defer.
  • Methods can now properly be aliased using def #1393.
  • Memory leak in Object when not using temp allocators.
  • Tracking allocator would double the allocations in the report.
  • printf will now show errors in the output when there are errors.
  • Bug where if try would work incorrectly in a macro.
  • Prevent loading / storing large structs with LLVM.

Stdlib changes

  • send and recv added to libc for Posix / Win32.
  • Add support to destroy temp allocators.
  • Deprecated path.append, path.tappend, getcwd, tgetcwd, path.absolute, ls.
  • Deprecated env::get_config_dir, replaced by env::new_get_config_dir.
  • Added path.has_extension, path.new_append, path.temp_append, new_cwd, temp_cwd, path.new_absolute, new_ls, temp_ls.
  • Added dstring.replace
  • New hashmap type, Map
  • Added ElasticArray.
  • Added types::is_signed, types::is_unsigned and types::inner_type.

Version 0.6.1

24 Jul 13:26
Compare
Choose a tag to compare

Changes / improvements

  • Addition of $append and $concat functions.
  • Added $$str_hash, $$str_upper, $$str_lower, $$str_find builtins.
  • Improved error notes when call expressions have errors.
  • Trailing body arguments may now be &ref, #hash, $const and $Type arguments.
  • "panic-msg" setting to suppress panic message output.
  • Require @export functions to have @export types.
  • Disallow leading/trailing/duplicate '_' in module names.
  • Updated mangling.
  • Added $$unaligned_load and $$unaligned_store.
  • --no-headers option to suppress creating headers when generating a library.
  • Support c-file compilation in libraries.
  • Allow using $defined(&a[1]) to check if the operation is supported.
  • Max number of members in a struct is limited to 65535.
  • The maximum number of parameters in a call is now 255, up from 127.
  • Array comparison now uses built-in memcmp on LLVM to enable optimizations.
  • Prevent implicit array casts to pointers with higher alignment #1237.
  • Macro $case statements now pick the first match and does not evaluate the rest.
  • manifest.json is now checked for incorrect keys.
  • Added --list-manifest-properties to list the available properties in manifest.json.
  • Indexing into a constant array / struct now works at compile time.
  • Improved error message when trying user foreach with an untyped list.

Fixes

  • Error with unsigned compare in @ensure when early returning 0 #1207.
  • Prevent Mach-O from removing @init and @dynamic in a more reliable way #1200.
  • Fix of missing copy of parameterized custom attributes.
  • Fixed crash on certain recursive function definitions #1209.
  • Return the typekind "FUNC" for a function pointer.
  • No longer possible to dereference a function pointer.
  • Fix bug with @jump miscompile.
  • Bit negate does implicit integer promotion.
  • Bitstructs, unions and flexible arrays now correctly emitted in headers.
  • Fix distinct inline conversions.
  • Bit negating const zero flags would give an incorrect result.
  • Fix to scalar -> vector conversions.
  • Bug fix for rethrow + defer catch.
  • Wrong size for structs containing overaligned structs #1219
  • $typeof(*x) should be valid when x is an [out] parameter #1226
  • Fix ABI lowering for 128 bit vectors on Linux.
  • Bad error message when using a generic method without generic parameters #1228
  • Private function called from nested macro not visible to linker #1232
  • Bitstructs in structs would not be correctly be handled in some cases.
  • Fix problem where a $$FUNC would return "" when evaluated for a static in a function #1236.
  • ordinal is no longer a valid associated value name for enums.
  • Constants defined by indexing into another constant could fail codegen.
  • Stdlib nolibc code bugs fixed.
  • Regression: duplicate symbols with static variable declared in macro #1248.
  • Unsplat with named parameters was accidentally disallowed.
  • Reference parameter doesn't work with vector subscript #1250.
  • The msvc_sdk script failed to work properly on windows when run in folders with spaces.

Stdlib changes

  • Added remove_first_item remove_last_item and remove_item as aliases for the match functions.
  • Added @str_hash, @str_upper, @str_lower, @str_find compile time macros.
  • Remove "panic" text from unreachable() when safe mode is turned off.
  • Added @unaligned_store and @unaligned_load.
  • Null ZString, DString or pointer prints "(null)" for printf.
  • Updated sorting API.
  • Insertion sort and counting sort added.
  • Added missing mem and mem::allocator functions for aligned allocations.
  • Added new_init_with_array and temp_init_with_array for List.
  • Fixed posix NativeMutex.lock_timeout.
  • Fixed env::ARCH_32_BIT and env::ARCH_64_BIT.
  • Added time::us.

Release 0.6.0

12 Jun 14:32
Compare
Choose a tag to compare

First release of 0.6

Changes / improvements

  • @default implementations for interfaces removed.
  • any* => any, same for interfaces.
  • Private / local globals now have internal visibility in LLVM.
  • Updated enum syntax.
  • 'rgba' also available for swizzling.
  • The name "subarray" has been replaced by the more well known name "slice' across the codebase.
  • Improved alignment handling.
  • Add --output-dir to command line. #1155
  • Allow making distinct types out of "void", "typeid", "anyfault" and faults.
  • Removed --system-linker setting.
  • "Try" expressions may not be any binary or unary expressions. So for example try foo() + 1 is disallowed.
  • Added $$REGISTER_SIZE for int register size.
  • assert(false) only allowed in unused branches or in tests. Compile time failed asserts is a compile time error.
  • Require expression blocks returning values to have the value used.
  • Detect "unsigned >= 0" as errors.
  • Improve callstack debug information #1184.
  • Request jump table using @jump for switches.
  • Improved inline debug information.
  • Improved error messages on inlined macros.
  • Introduce MSVC compatible SIMD ABI.
  • $foreach doesn't create an implicit syntactic scope.
  • Error of @if depends on @if
  • Support defer (catch err)
  • Added print-input command argument to print all files used for compilation
  • Allow recursive function definitions as long as they are pointers. #1182
  • Default CPU to native if less than AVX, otherwise use AVX.
  • Bounds checking on length for foo[1:2] slicing #1191.
  • Foreach uses non-wrapping add/dec.

Fixes

  • Fixed issue in safe mode when converting enums.
  • Better checking of operator methods.
  • Bug when assigning an optional from an optional.
  • Lambdas were not type checked thoroughly #1185.
  • Fix problems using reflection on interface types #1203.
  • @param with unnamed macro varargs could crash the compiler.
  • Compiler crash using enum nameof from different module #1205.
  • Incorrect length passed to scratch buffer printf.
  • Casting to a bitstruct would be allowed even if the type was the wrong size.
  • Generic modules parameterized with constants would sometimes get the wrong parameterized module name causing conversion errors #1192.
  • Duplicate emit of expressions on negation would incorrectly compile negated macros.
  • Casting a slice address to its pointer type should not compile #1193.
  • Union is not properly zero-initialized with designated initializer #1194.
  • Compile time fmod evaluates to 0 #1195.
  • Assertion failed when casting (unsigned) argument to enum #1196
  • Correct debug info on parameters without storage.
  • Fix location on foreach debug output.
  • Compiler crash on designated initializer for structs with bitstruct.

Stdlib changes

  • "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.
  • Removed 'append' from Object and List, replaced by 'push'.
  • GenericList renamed AnyList.
  • Proper handling of '.' and Win32 '//server' paths.
  • Path normalization - fix possible null terminator out of bounds.
  • Add 'zstr' variants for string::new_format / string::tformat.
  • Fix mutex and wait signatures for Win32.

Release 0.5.5

18 Mar 23:31
Compare
Choose a tag to compare

Changes / improvements

  • Disallow multiple _ in a row in digits, e.g. 1__000.
  • Added @link attribute.
  • New 'linker' build option.
  • "linker" project setting updated, "system-linker" removed.

Fixes

  • Struct/union members now correctly rejects members without storage size #1147.
  • math::pow will now correctly promote integer arguments.
  • Pointer difference would fail where alignment != size (structs etc) #1150
  • Fixed array calculation for npot2 vectors.
  • $$memcpy_inline and $$memset_inline fixed.
  • .$Type = ... and .$foo = ... now works #1156.
  • int.min incorrect behaviour #1154.
  • Bitstruct cast to other bitstruct by way of underlying type would fail #1159.
  • Bug in time.add_seconds #1162.
  • Remove initial './' in Win32 and convert '/' to '' for paths when running a binary.
  • 'output' directory for projects was incorrect in templates.
  • Regression: no stacktrace.
  • For MacOS, running with higher optimization would crash as initializers were removed.
  • compile-run and run now returns the proper return code.
  • Allow String constants -> ichar*, and allow integer pointers to explicitly convert between unsigned signed.
  • Bug in unaligned return value lowering for Aarch64.

Stdlib changes

  • Added new_aligned and alloc_aligned functions to prevent accidental under-alignment when allocating simd.
  • Fixes to realloc of aligned allocations
  • Use native Windows calls on aligned allocations on Windows.
  • mem::copy_inline, mem::clear_inline and mem::set_inline added.
  • mem::copy / clear / set no longer has an $inline attribute.
  • Native aligned libc malloc on Windows & POSIX.
  • Simplification of the allocator interface.
  • CoreFoundation only linked on MacOS when used.

Release 0.5.4

17 Feb 13:59
Compare
Choose a tag to compare

Changes / improvements

  • Hash variables may now take a designated initializer.
  • Added @safemacro to override the @ requirement for non-function-like macros.
  • More information available with debug log in non debug builds.
  • Removed install_win_reqs.bat which didn't work well.
  • Support ** to mean ./**
  • MacOS init/finalizer now respects priority.
  • Bitstructs supports != and ==.
  • Support Windows .def files using --windef.
  • Bitstructs now fold compile time constant bit ops.
  • Fix issue where in some cases a constant global with a string wasn't folded (e.g. in asm stmts)
  • Lateral implicit imports removed.
  • Default to '.' if no libdir is specified.
  • Improved error messages for --lib.
  • Added --linker to set the linker #1067.

Fixes

  • Fixes to macro context evaluation with macro varargs.
  • Dynamic methods registered before init functions on MacOS.
  • Fixed clobber on x86 cpuid instruction.
  • Removed invalid syntax from grammar.y.
  • output project setting now respected.
  • Aliased declarations caused errors when used in initializers.
  • Aliased consts used as constant initializers caused errors.
  • Exported module names replace :: by _.
  • Const ternary would evaluate incorrectly for ?:
  • $$MODULE would report the incorrect module name in macros.
  • Fixed debug info for globals and for/switch scopes.
  • out now correctly detects subscript[] use.
  • Ambiguous recursive imports are now correctly detected.
  • Overzealous local escape check corrected #1127.
  • Fixes to the matrix functions #1130.

Stdlib changes

  • Deprecated Allocator helper functions.
  • Added mem::allocator functions corresponding to removed allocator functions.
  • Changed mem::new / mem::temp_new to accept an optional initializer, and will clear by default.
  • Mem _clear and _zero variants deprecated. "new_*" functions will clear by default.
  • Mem "alloc_" functions replace old "new_" behaviour.
  • Fixed temp memory issue with formatter.
  • Added temp_push and temp_pop for pushing / popping the temp allocator manually (or from C).
  • Added byte_size to List
  • Added GenericList.

0.5.0 Release

21 Nov 09:39
Compare
Choose a tag to compare
0.5.0 Release Pre-release
Pre-release

First 0.5 release. Using the 0.5 release has the following stability guarantees: no changed standard library functions, no change in language syntax and semantics. However, compiler and standard library bugs will be fixed as long as they do not change behaviour.

Update with no-emit-stdlib

09 Jun 08:26
Compare
Choose a tag to compare
Pre-release
0.4godbolt-v2

--obj, --emit-stdlib, --strip-unused