Commit Graph

162 Commits

Author SHA1 Message Date
Andrew Kelley
99985ad6fc implement Zig IR for async functions
See #727
2018-02-23 03:03:06 -05:00
Andrew Kelley
236bbe1183 implement IR analysis for async function calls
See #727
2018-02-21 00:52:20 -05:00
Andrew Kelley
65a51b401c add promise type
See #727
2018-02-20 16:42:14 -05:00
Andrew Kelley
21ce559c9c add --forbid-library
to help track down accidentally linking against a library
2018-02-04 22:06:03 -05:00
Andrew Kelley
ef5e7bb469 *WIP* error sets - an inferred error set can end up being the global one 2018-02-03 14:06:37 -05:00
Andrew Kelley
39d5f44863 *WI* error sets - basic support working 2018-02-02 14:26:14 -05:00
Andrew Kelley
cfb2c67692 *WIP* error sets - rewrite "const cast only" function 2018-02-02 11:50:19 -05:00
Andrew Kelley
13b36d458f *WIP* error sets - fix implicit cast 2018-02-01 10:23:25 -05:00
Andrew Kelley
5161d70620 *WIP* error sets 2018-01-31 01:51:31 -05:00
Andrew Kelley
3ef6a00bb8 add compile error for duplicate struct, enum, union fields
closes #730
2018-01-30 11:52:03 -05:00
Andrew Kelley
32ea6f54e5 *WIP* proof of concept error return traces 2018-01-12 02:12:11 -05:00
Andrew Kelley
7ec783876a functions which can return errors have secret stack trace param
See #651
2018-01-11 23:04:08 -05:00
Andrew Kelley
27ba4f0baf export keyword works again 2017-12-19 01:49:42 -05:00
Andrew Kelley
1fdebc1dc4 wip export rewrite 2017-12-18 09:59:57 -05:00
Andrew Kelley
3577a80bb6 translate-c: more complex logic for translating a C cast in a macro 2017-12-08 12:28:21 -05:00
Andrew Kelley
0ad1239522 rework enums and unions and their relationship to each other
* @enumTagName renamed to @tagName and it works on enums and
   union-enums
 * Remove the EnumTag type. Now there is only enum and union,
   and the tag type of a union is always an enum.
 * unions support specifying the tag enum type, and they support
   inferring an enum tag type.
 * Enums no longer support field types but they do support
   setting the tag values. Likewise union-enums when inferring
   an enum tag type support setting the tag values.
 * It is now an error for enums and unions to have 0 fields.
 * switch statements support union-enums

closes #618
2017-12-03 20:43:56 -05:00
Andrew Kelley
137c8f5e8a ability to set tag values of enums
also remove support for enums with 0 values

closes #305
2017-12-02 22:32:39 -05:00
Andrew Kelley
f276fd0f37 basic union support
See #144
2017-11-15 13:04:18 -05:00
Andrew Kelley
c6295fe9ab remove zigrt
adds test case for #394

partially reverts a32b5929cc
2017-09-30 20:21:57 -04:00
Andrew Kelley
816689a3b1 ptrCast gives compile error for increasing alignment
See #37
2017-08-29 16:52:31 -04:00
Andrew Kelley
c5c9d98065 introduce align keyword
* remove `@setGlobalAlign`
 * add align keyword for setting alignment on functions and
   variables.
 * loads and stores use alignment from pointer
 * memcpy, memset use alignment from pointer
 * add syntax for pointer alignment
 * slices can have volatile
 * add u2, i2 primitives
 * ignore preferred align and use abi align everywhere
 * back to only having alignOf builtin.
   preferredAlignOf is too tricky to be useful.
   See #432. Partial revert of
   e726925e80.

See #37
2017-08-29 07:51:34 -04:00
Andrew Kelley
d1e68c3ca8 better bigint/bigfloat implementation 2017-07-08 17:59:10 -04:00
Andrew Kelley
6a93dda3e1 progress toward windows hello world working 2017-06-14 00:04:34 -04:00
Andrew Kelley
e5b90651ba compileError builtin includes "referenced by" notes
to help track down the cause

closes #278
2017-06-03 15:09:40 -04:00
Andrew Kelley
2dfb1ebee2 const global values can reference each other
Before, if you did something like:

```
const hi1 = "hi";
const hi2 = hi1;
```

This would create the "hi" data twice in the built object.
But since the value is const we don't have to duplicate the
data, now we take advantage of this fact.

closes #336
2017-05-27 00:54:14 -04:00
Andrew Kelley
d6b01931ef implicitly cast by value var args parameters to const references
See #336
2017-05-26 16:44:13 -04:00
Andrew Kelley
fcdd808c5c fix segfault with array of variadic functions
closes #377
2017-05-25 13:48:10 -04:00
Andrew Kelley
9f3cca8615 add error for break/continue exiting defer expression
See #284
2017-05-21 10:44:55 -04:00
Andrew Kelley
b483db4868 typeId builtin instead of isInteger, isFloat, etc
closes #373
2017-05-17 12:26:35 -04:00
Andrew Kelley
01f066de37 ability to slice ptr to hard coded integer at comptime
closes #369
2017-05-09 22:23:38 -04:00
Andrew Kelley
818a0a2629 switch expression - add compile errors
* for duplicate integer value
   * for missing integer values
   * for missing else prong

see #43
2017-05-07 12:07:35 -04:00
Andrew Kelley
17b935325e @import("builtin") instead of @compileVar
See #226
Closes #220
2017-05-01 13:12:38 -04:00
Andrew Kelley
7e11ef79d6 zig test no longer requires a separate test_runner.o file
See #298
2017-04-27 16:19:20 -04:00
Andrew Kelley
7b0542d08b build system: consolidate duplicate code and more
* add ability to add assembly files when building an exe, obj, or lib
 * add implicit cast from `[N]T` to `?[]const T` (closes #343)
 * remove link_exe and link_lib in favor of allowing build_exe and
   build_lib support no root zig source file
2017-04-26 19:17:05 -04:00
Andrew Kelley
6de33ded81 make undefined as a constant value lazy
closes #268
2017-04-23 14:34:40 -04:00
Andrew Kelley
f2140efc52 Merge remote-tracking branch 'origin/parser' 2017-04-13 03:09:09 -04:00
Andrew Kelley
bf57d8a7e3 typedefpocalypse
closes #314
2017-04-13 03:07:58 -04:00
Josh Wolfe
919910312d make it an error to ignore a statement's value
this makes {1;} an error.
2017-04-12 22:21:35 -07:00
Andrew Kelley
11a6550324 fix some -Wconversion errors 2017-04-10 20:02:39 -04:00
Andrew Kelley
095591f0b0 add enumTagName builtin function
closes #299
2017-04-08 17:45:22 -04:00
Andrew Kelley
a32b5929cc add stack protector safety when linking libc
* introduce zigrt file. it contains only weak symbols so that
   multiple instances can be merged. it contains __zig_panic
   so that multiple .o files can call the same panic function.
 * remove `@setFnVisible` builtin and add @setGlobalLinkage builtin
   which is more powerful
 * add `@panic` builtin function.
 * fix collision of symbols with extern prototypes and internal
   function names
 * add stack protector safety when linking against libc. To add
   the safety mechanism without libc requires implementing
   Thread Local Storage. See #276
2017-03-26 21:07:07 -04:00
Andrew Kelley
e1c47d6fe8 fix test regression regarding shadowing names
closes #271
2017-03-20 15:32:13 -04:00
Andrew Kelley
25761570f1 more robust const struct values 2017-02-26 23:50:04 -05:00
Andrew Kelley
3075d8aee7 fix use decls not always working 2017-02-23 16:52:13 -05:00
Andrew Kelley
d794549985 bitfields support for array of non-store-aligned packed structs 2017-02-22 00:49:10 -05:00
Andrew Kelley
0148f39df9 pointers with bit offset contain length
adds compile error when passing pointer that is byte-aligned
at the beginning but not the end to a function expecting
a fully byte aligned pointer

closes #261
2017-02-16 19:35:42 -05:00
Andrew Kelley
fc5d47b9b9 reading from a bit field partially works
See #261

Still need to do:
 * reading a field that has bit offset 0 but still needs to
   shift and truncate
 * writing a field
2017-02-16 15:45:41 -05:00
Andrew Kelley
4b5cc80f66 move volatile pointers to central type table 2017-02-16 13:58:42 -05:00
Andrew Kelley
1fc2082b4c ability to declare const bitfields
See #261
2017-02-15 18:55:29 -05:00
Andrew Kelley
63d37b7cff add runtime debug safety for dividing integer min value by -1
closes #260
2017-02-14 01:08:30 -05:00