Andrew Kelley
fc100d7b3b
lots of miscellaneous things all in one big commit
...
* add `@compileLog(...)` builtin function
- Helps debug code running at compile time
- See #240
* fix crash when there is an error on the start value of a slice
* add implicit cast from int and float types to int and float
literals if the value is known at compile time
* make array concatenation work with slices in addition to
arrays and c string literals
* fix compile error message for something not having field access
* fix crash when `@setDebugSafety()` was called from a
function being evaluated at compile-time
* fix compile-time evaluation of overflow math builtins.
* avoid debug safety panic handler in builtin.o and compiler_rt.o
since we use no debug safety in these modules anyway
* add compiler_rt functions for division on ARM
- Closes #254
* move default panic handler to std.debug so users can
call it manually
* std.io.printf supports a width in the format specifier
2017-02-09 03:09:25 -05:00
Andrew Kelley
916a96fb72
variables, memcpy, and memset all get alignment
...
See #37
2017-02-07 01:50:10 -05:00
Andrew Kelley
573f3f8d48
coldcc works better
...
* Only use Cold Calling Convention on x86
* Add the cold attribute to functions marked with coldcc
2017-02-06 13:50:19 -05:00
Andrew Kelley
07a71fc322
improved behavior on debug safety crash
...
* instead of emitting a breakpoint for a debug safety crash,
zig calls a panic function which prints an error message
and a stack trace and then calls abort.
* on freestanding OS, this panic function has a default
implementation of a simple infinite loop.
* users can override the panic implementation by providing
`pub fn panic(message: []const u8) -> unreachable { }`
* workaround for LLVM segfaulting when you try to use cold
calling convention on ARM.
closes #245
2017-02-06 03:10:32 -05:00
Andrew Kelley
b840184bb0
memcpy and memset builtins support volatile pointers
...
See #238
2017-02-04 22:12:06 -05:00
Andrew Kelley
419e75eb23
remove volatileStore builtin; add volatile pointers
...
closes #238
2017-02-04 21:49:27 -05:00
Andrew Kelley
0919ea0afd
ability to set global variable alignment and ...
...
..section in the initialization expression
2017-02-04 10:22:07 -05:00
Andrew Kelley
aae168550f
exported global variables get emitted as external in LLVM
2017-02-03 11:59:56 -05:00
Andrew Kelley
71d335e5cc
implement packed structs
...
closes #183
2017-02-03 11:39:24 -05:00
Andrew Kelley
c0b37e8514
add try expression
...
See #83
2017-02-02 17:09:27 -05:00
Andrew Kelley
2b88441295
fix behavior when initializing struct with undefined
2017-02-02 14:55:01 -05:00
Andrew Kelley
d13cec6894
fix var args allocating wrong amount of memory in compiler
2017-01-31 16:04:26 -05:00
Andrew Kelley
d2b94afaf2
fix compile time initialization of array with undefined
2017-01-29 23:35:34 -05:00
Andrew Kelley
32d8686da8
various fixes
...
* comptime expression is a block expression as it should be
* fix var args when number of args passed is 0
* implement const value equality for structs
* fix indent when rendering container decl AST
* IR: prevent duplicate generation of code when it is partially
compile-time evaluated
* implement compile time struct field pointer evaluation
* fix compile time evaluation of slicing
2017-01-23 23:30:20 -05:00
Andrew Kelley
17cb85dfb8
basic support for functions with variable length arguments
...
See #77
2017-01-23 16:40:17 -05:00
Andrew Kelley
e5b1758010
remove staticEval builtin in favor of comptime expression
2017-01-22 23:21:00 -05:00
Andrew Kelley
201a3c121a
introduce comptime expression
...
closes #221
2017-01-22 22:59:52 -05:00
Andrew Kelley
47cf8520ad
use comptime instead of inline for var and params
...
See #221
2017-01-22 19:51:37 -05:00
Andrew Kelley
6a5e61acd1
get rid of zeroes literal
...
closes #222
2017-01-16 17:24:13 -05:00
Andrew Kelley
c7591736b4
fix array of enums. also render debug info for const vars
2017-01-16 01:44:47 -05:00
Andrew Kelley
3752e0c290
fix get_maybe_type not ensuring complete child type
2017-01-15 23:36:14 -05:00
Andrew Kelley
d0b59f20ab
fix llvm assertion failure for zero bits structs
2017-01-15 23:27:14 -05:00
Andrew Kelley
0c1800a9c9
fix some stuff when llvm has assertions on
2017-01-13 17:33:19 -05:00
Andrew Kelley
83f1a6fae2
fix some bugs with structs
2017-01-13 16:24:13 -05:00
Andrew Kelley
c793c534b8
fix use decl regression
2017-01-12 18:10:05 -05:00
Andrew Kelley
d784705353
IR: implement macro for function aliasing function pointer
2017-01-12 03:15:06 -05:00
Andrew Kelley
430e33b869
partially fix parseh command
2017-01-10 15:39:52 -05:00
Andrew Kelley
6caf32195a
pass unnecessary if statement test
2017-01-08 22:25:38 -05:00
Andrew Kelley
23feafdef0
pass more tests
...
by removing assertion, fixing error column,
and updating expected message
2017-01-05 19:25:36 -05:00
Andrew Kelley
28403eaad0
pass more tests by updating expected error messages
2017-01-05 19:20:31 -05:00
Andrew Kelley
349cd79fe4
containers created during eval get names for parameters
2017-01-05 03:22:00 -05:00
Andrew Kelley
c32a060d4f
IR: add unreachable code compiler error
2017-01-04 23:21:33 -05:00
Andrew Kelley
664b41af65
fix debug information for function pointers in structs
2017-01-04 01:56:21 -05:00
Andrew Kelley
ff5120c584
IR: std makes it to codegen
2016-12-31 18:25:10 -05:00
Andrew Kelley
a9acc8cb45
IR: error for returning from defer expression
...
also fix peer type resolution for pure error mixed with error union
2016-12-28 03:47:02 -05:00
Andrew Kelley
f6ac2fa70e
IR: pass pointerToVoidReturnType test
2016-12-28 01:31:46 -05:00
Andrew Kelley
25a5fc32fe
IR: pass passSliceOfEmptyStructToFn test
2016-12-28 01:15:09 -05:00
Andrew Kelley
3ef6663b72
IR: pass genericMallocFree test
2016-12-26 03:02:20 -05:00
Andrew Kelley
f47dea2a2e
IR: support compile time global pointer reinterpret
...
this required moving the place we store types to ConstExprValue
2016-12-25 04:15:23 -05:00
Andrew Kelley
46033a2128
pass void parameters test
2016-12-22 00:46:17 -05:00
Andrew Kelley
43be6ccb03
IR: fix phi instruction when one of the predecessors is unreachable
2016-12-21 23:04:04 -05:00
Andrew Kelley
b4c2f7e310
get_error_type calls ensure_complete_type on child
2016-12-21 22:42:58 -05:00
Andrew Kelley
9b61682037
IR: implement runtime enum init and switch on enum with variable
2016-12-21 21:49:05 -05:00
Andrew Kelley
1f6dacbb2f
IR: enum init support
2016-12-20 01:50:32 -05:00
Andrew Kelley
09c34352f8
IR: if and switch guaranteed compile time if target expr is
2016-12-19 00:04:51 -05:00
Andrew Kelley
132e2fa5d9
errors from inline fn calls include stack trace
2016-12-18 20:52:40 -05:00
Andrew Kelley
82101198f1
workaround for Arch being a primitive type
2016-12-18 20:09:34 -05:00
Andrew Kelley
f12fbce0f5
IR: memoize compile-time evaluated fn invocations
2016-12-18 18:23:46 -05:00
Andrew Kelley
37b13bf151
hello.zig working with all structs anonymous
2016-12-18 17:24:52 -05:00
Andrew Kelley
e50ced44a2
IR: all structs anonymous
2016-12-18 16:56:50 -05:00