Commit Graph

805 Commits

Author SHA1 Message Date
Andrew Kelley
1c26c2f4d5 fix crash when compile error evaluating return...
...type of inferred error set. closes #1591
2018-09-26 16:59:08 -04:00
Andrew Kelley
589201b104 fix variables which are pointers to packed struct fields
closes #1121
2018-09-26 14:54:53 -04:00
Andrew Kelley
dcfd15a7f0 the last number in a packed ptr is host int bytes
See #1121
2018-09-26 14:54:52 -04:00
Andrew Kelley
2e562a5f36 fix crash on runtime index into slice of comptime type
closes #1435
2018-09-25 12:03:39 -04:00
Andrew Kelley
eafb8e8572 fix self reference through fn ptr field crash
closes #1208
2018-09-25 10:45:11 -04:00
Andrew Kelley
f8fe517d12 better string literal caching implementation
We were caching the ConstExprValue of string literals,
which works if you can never modify ConstExprValues.
This premise is broken with `comptime var ...`.

So I implemented an optimization in ConstExprValue
arrays, where it stores a `Buf *` directly rather
than an array of ConstExprValues for the elements,
and then similar to array of undefined, it is
expanded into the canonical form when necessary.
However many operations can happen directly on the
`Buf *`, which is faster.

Furthermore, before a ConstExprValue array is expanded
into canonical form, it removes itself from the string
literal cache. This fixes the issue, because before an
array element is modified it would have to be expanded.

closes #1076
2018-09-20 11:04:31 -04:00
Andrew Kelley
345f8db1c4 fix optional pointer to empty struct incorrectly being non-null
closes #1178
2018-09-18 17:51:50 -04:00
Andrew Kelley
9c9eefc841 allow extern structs to have stdcallcc function pointers
closes #1536
2018-09-17 11:22:30 -04:00
Andrew Kelley
dd5b2d1b04 fix crash when pointer casting a runtime extern function 2018-09-16 11:23:38 -04:00
Andrew Kelley
3f776af3fa fix alignment of structs
closes #1248
closes #1052
closes #1154
2018-09-14 19:08:59 -04:00
Andrew Kelley
639c381128 fix coroutine alignment
zig returned the wrong alignment for coroutine promises
in some cases
2018-09-14 13:55:45 -04:00
Andrew Kelley
c06a61e9bf remove this. add @This().
closes #1283
2018-09-13 16:34:33 -04:00
Andrew Kelley
ac0cda8df8 add compile error for merging non- error sets
closes #1509
2018-09-13 13:48:41 -04:00
Andrew Kelley
22e39e1e5a fix tagged union with only 1 field tripping assertion
closes #1495

now the tag type of an enum with only 1 item is comptime_int.
2018-09-13 13:33:11 -04:00
Andrew Kelley
ff0b7fe29a error messages for attempted cache when zig cannot perfectly do it 2018-09-11 22:59:40 -04:00
Andrew Kelley
4af844732a Merge remote-tracking branch 'origin/master' into stage1-caching 2018-09-11 15:56:04 -04:00
Andrew Kelley
7dd3c3814d fix incorrect error union const value generation
closes #1442

zig needed to insert explicit padding into this structure before
it got bitcasted.
2018-09-11 15:16:50 -04:00
Andrew Kelley
67735c6f15 ability to disable cache. off by default except for...
...zig run, zig build, compiler_rt.a, and builtin.a
2018-09-11 00:32:40 -04:00
Andrew Kelley
52f4e934a9 fix llvm assertion and missing compile error 2018-09-10 22:44:27 -04:00
Andrew Kelley
2005898689 improve panic message from previous commit 2018-09-07 20:19:55 -04:00
Andrew Kelley
9c169f3cf7 C ABI: support returning large structs on x86_64
also panic instead of emitting bad code for returning small structs

See #1481
2018-09-07 20:09:33 -04:00
Andrew Kelley
04d7b565f7 stage1: refactor fn type analysis to use C ABI walk fn 2018-09-07 12:23:50 -04:00
Andrew Kelley
be6cccb3a5 stage1: c abi for big struct works 2018-09-07 11:52:57 -04:00
Andrew Kelley
a9a925e500 add C ABI tests 2018-09-06 16:29:35 -04:00
Andrew Kelley
6632d85e5f stage1: improve handling of generic fn proto type expr
closes #902
2018-09-05 21:21:59 -04:00
Andrew Kelley
1d8b8ad687 add compile error for using outer scoped runtime variables
from a fn defined inside it. closes #876
2018-09-05 20:32:06 -04:00
Andrew Kelley
8400163e02 stage1: rename more TypeTableEntry types to ZigType 2018-09-05 18:42:56 -04:00
Andrew Kelley
1f5c7ff4d7 stage1: rename VariableTableEntry to ZigVar 2018-09-05 18:35:57 -04:00
Andrew Kelley
3500d32db5 stage1: rename FnTableEntry to ZigFn 2018-09-05 18:34:33 -04:00
Andrew Kelley
db882e5d63 stage1: rename TypeTableEntry to ZigType 2018-09-05 18:33:07 -04:00
Andrew Kelley
b35c74ea4c stage1: use os_path_resolve instead of os_path_real
to canonicalize imports.

This means that softlinks can represent different files,
but referencing the same absolute path different ways
still references the same import.
2018-09-04 23:17:38 -04:00
Andrew Kelley
68db9d5074 add compile error for comptime control flow inside runtime block
closes #834
2018-09-04 15:28:35 -04:00
Andrew Kelley
bc88ef2dc3 compile errors for unimplemented minValue/maxValue builtins 2018-09-03 22:47:23 -04:00
Andrew Kelley
901b5c1566 add compile error for function prototype with no body
closes #1231
2018-08-28 15:39:32 -04:00
Andrew Kelley
2f2215c9f4 this was intended to be included in the previous commit 2018-08-27 16:26:36 -04:00
Andrew Kelley
526d8425ab fix false negative determining if function is generic
This solves the smaller test case of #1421 but the
other test case is still an assertion failure.
2018-08-27 16:14:48 -04:00
Andrew Kelley
815950996d Merge remote-tracking branch 'origin/master' into macos-stack-traces 2018-08-25 04:48:58 -04:00
Andrew Kelley
b95ff12f2f fix regressions 2018-08-25 03:40:47 -04:00
Andrew Kelley
ac36f98e72 fix stack traces on linux 2018-08-25 03:07:37 -04:00
Andrew Kelley
3a02ba9b82 fix error message for incorrect panic handler fn signature
closes #1353
2018-08-23 23:22:48 -04:00
Andrew Kelley
02c5bda704 remove ability to break from suspend blocks
closes #803
2018-07-27 17:27:03 -04:00
Andrew Kelley
b3f4182ca1 coroutines have 3 more bits of atomic state 2018-07-26 22:26:00 -04:00
Andrew Kelley
2cbad364c1 add compile error for ignoring return value of while loop bodies
closes #1049
2018-07-26 18:29:07 -04:00
Andrew Kelley
2ea08561cf self-hosted: function types use table lookup 2018-07-24 14:20:49 -04:00
Andrew Kelley
29e19ace36 fix logic for determining whether param requires comptime
closes #778
closes #1213
2018-07-24 10:21:33 -04:00
Andrew Kelley
58c5f94a99 self-hosted: share C++ code for finding libc on windows 2018-07-20 23:38:13 -04:00
Jimmi Holst Christensen
fd3a41dadc Allow pointers to anything in extern/exported declarations (#1258)
* type_allowed_in_extern accepts all ptr not size 0

* Generate correct headers for none extern structs/unions/enums
2018-07-18 11:00:42 -04:00
Andrew Kelley
e9a03cccf3 all integer sizes are available as primitives
* fix wrong implicit cast for `@IntType` bit_count parameter.
 * fix incorrect docs for `@IntType` bit_count parameter.

closes #1242
closes #745
closes #1240
2018-07-16 10:53:15 -04:00
Andrew Kelley
3f30897fdc add compile error for disallowed types in extern structs
closes #1218
2018-07-11 14:08:56 -04:00
Andrew Kelley
d8295c1889 add @popCount intrinsic 2018-07-07 00:25:32 -04:00