Commit Graph

1483 Commits

Author SHA1 Message Date
Andrew Kelley
68238d5678 fix comptime fn execution not returning error unions properly 2018-02-07 22:33:05 -05:00
Andrew Kelley
f99b8b006f error sets - fix most std lib compile errors 2018-02-05 18:09:13 -05:00
Andrew Kelley
6940212ecb error sets: fix peer resolution of error unions 2018-02-05 17:42:13 -05:00
Andrew Kelley
b7bc259093 make OutStream and InStream take an error set param 2018-02-05 07:38:24 -05:00
Andrew Kelley
893f1088df error sets - peer resolution for error unions 2018-02-05 01:49:14 -05:00
Andrew Kelley
15075d2c3d error sets - compile error for equality with no common errors 2018-02-05 00:05:04 -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
61718742f7 *WIP* error sets - std lib test compile but try to link against windows 2018-02-03 14:42:20 -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
abf5ae6897 *WIP* error sets - support fns called at comptime 2018-02-03 11:51:29 -05:00
Andrew Kelley
b8f59e14cd *WIP* error sets - correctly resolve inferred error sets 2018-02-02 18:13:32 -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
406496ca33 *WIP* error sets - allow peer type resolution to create new error set 2018-02-01 23:32:09 -05:00
Andrew Kelley
13b36d458f *WIP* error sets - fix implicit cast 2018-02-01 10:23:25 -05:00
Andrew Kelley
5f518dbeb9 *WIP* error sets converting std lib 2018-01-31 22:48:40 -05:00
Andrew Kelley
5161d70620 *WIP* error sets 2018-01-31 01:51:31 -05:00
Andrew Kelley
40ca39d3d5 fix error message mentioning unreachable instead of noreturn 2018-01-31 01:44:52 -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
1c60f31450 add compile error for calling naked function 2018-01-29 14:01:12 -05:00
Andrew Kelley
abe6c2d585 allow packed containers in extern functions 2018-01-29 10:57:09 -05:00
Andrew Kelley
f66ac9a5e7 fix crash when align 1 field before self referential...
...align 8 field as slice return type

closes #723
2018-01-27 18:30:36 -05:00
Andrew Kelley
ad3e2a5da0 fix compiler crash on function with invalid return type
closes #722
2018-01-26 10:37:18 -05:00
Andrew Kelley
3671582c15 syntax: functions require return type. remove ->
The purpose of this is:

 * Only one way to do things
 * Changing a function with void return type to return a possible
   error becomes a 1 character change, subtly encouraging
   people to use errors.

See #632

Here are some imperfect sed commands for performing this update:

remove arrow:

```
sed -i 's/\(\bfn\b.*\)-> /\1/g' $(find . -name "*.zig")
```

add void:

```
sed -i 's/\(\bfn\b.*\))\s*{/\1) void {/g' $(find ../ -name "*.zig")
```

Some cleanup may be necessary, but this should do the bulk of the work.
2018-01-25 04:10:11 -05:00
Andrew Kelley
e5bc5873d7 rename "debug safety" to "runtime safety"
closes #437
2018-01-25 01:46:12 -05:00
Andrew Kelley
b71a56c9df cleanups that I meant to put in the previous commit 2018-01-23 23:12:38 -05:00
Andrew Kelley
b3a6faf13e replace %defer with errdefer
See #632

now we have 1 less sigil
2018-01-23 23:08:09 -05:00
Andrew Kelley
c2838f2442 fix printf format specifier 2018-01-23 11:40:22 -05:00
Marc Tiehuis
470ec91164 Add array type handling for gen_h 2018-01-23 23:38:20 +13:00
Andrew Kelley
cf39819478 add new kind of test: generating .h files. and more
* docgen supports obj_err code kind for demonstrating
   errors without explicit test cases
 * add documentation for `extern enum`. See #367
 * remove coldcc keyword and add @setIsCold. See #661
 * add compile errors for non-extern struct, enum, unions
   in function signatures
 * add .h file generation for extern struct, enum, unions
2018-01-22 22:24:07 -05:00
Andrew Kelley
cacba6f435 fix crash on union-enums with only 1 field
closes #713
2018-01-22 17:23:23 -05:00
Andrew Kelley
5b7ae86af4 fix crash when switching on enum with 1 field and no switch prongs
closes #712
2018-01-21 14:44:24 -05:00
Andrew Kelley
517e8ea426 remove unused function, fixes mingw build 2018-01-20 02:49:53 -05:00
Andrew Kelley
ddd04a7b46 fix docgen on windows 2018-01-19 22:17:31 -05:00
Andrew Kelley
890bf001db os_rename uses MoveFileEx on windows 2018-01-19 16:53:08 -05:00
Andrew Kelley
9f5c0b6e60 windows-compatible os_rename function
windows libc rename() requires destination file path to not exist
2018-01-19 16:31:21 -05:00
Andrew Kelley
ea623f2d39 all doc code examples are now tested
improve color scheme of docs
make docs depend on no external files
fix broken example code in docs

closes #465
2018-01-19 03:21:47 -05:00
Andrew Kelley
4b64c777ee add compile error for shifting by negative comptime integer
closes #698
2018-01-18 17:47:21 -05:00
Andrew Kelley
0fc645ab70 emit a compile error for @panic called at compile time
closes #706
2018-01-18 17:15:36 -05:00
Andrew Kelley
0b8f19fcba fix null debug info for 0-length array type
closes #702
2018-01-18 15:08:20 -05:00
Jimmi Holst Christensen
fa2c3be341 More tests, and fixed none negative bigint xor 2018-01-17 14:31:47 +01:00
Jimmi Holst Christensen
db0fc32ab2 fixed xor with zero 2018-01-17 14:00:27 +01:00
Andrew Kelley
4bdfc8a10a fix error return traces pointing to off-by-one source line
See #651
2018-01-17 00:22:53 -05:00
Andrew Kelley
ee9ab15679
Merge pull request #695 from Hejsil/tranlate-c-fixes
Tranlate c fixes - undefined variable initialization and non-bool if statements
2018-01-16 10:32:37 -05:00
Jimmi Holst Christensen
3974b7d31d translate_c can now translate if statements on integers and floats 2018-01-16 15:48:28 +01:00
Jimmi Holst Christensen
821cbd7a1b Output "undefined" on uninitialized variables 2018-01-16 15:01:02 +01:00
Andrew Kelley
6a95b88d1b fix bigint remainder division
See #405
2018-01-16 03:09:44 -05:00
Andrew Kelley
84d8584c5b implement bigint div and rem
See #405
2018-01-16 02:22:19 -05:00
Andrew Kelley
92fc5947fc fix compiler crash related to @alignOf 2018-01-15 20:44:21 -05:00
Andrew Kelley
c9ac607bd3 add builtin.have_error_return_tracing 2018-01-15 00:14:14 -05:00