Commit Graph

61 Commits (f27d82fe90e1d0007bf2d3ef52eac8cdbc381e0d)

Author SHA1 Message Date
Andrew Kelley 3173c90f14 macos stack traces: read debug info sections from .o files 2018-08-23 23:08:34 -04:00
Andrew Kelley 1a28f09684 fix hash map test 2018-08-07 00:54:19 -04:00
Andrew Kelley 97be8debab std.HashMap.autoHash: use xor instead of wrapping mult 2018-08-06 19:09:22 -04:00
Andrew Kelley 5dfcd09e49 self-hosted: watch files and trigger a rebuild 2018-08-03 17:22:17 -04:00
Andrew Kelley e3ae2cfb52 add std.event.RwLock and a few more std changes
* add std.event.RwLock and std.event.RwLocked
 * std.debug.warn does its printing locked
 * add std.Mutex, however it's currently implemented as a spinlock
 * rename std.event.Group.cancelAll to std.event.Group.deinit and change
   the docs and assumptions.
 * add std.HashMap.clone
2018-08-01 16:26:37 -04:00
Andrew Kelley 42ba06133a std.Hashmap - don't use catch unreachable in tests 2018-07-09 10:44:06 -04:00
Andrew Kelley ec1b6f6673
breaking syntax change: ??x to x.? (#1095)
See #1023

This also renames Nullable/Maybe to Optional
2018-06-09 23:42:14 -04:00
Andrew Kelley fcbb7426fa use * for pointer type instead of &
See #770

To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.

This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
2018-05-31 17:28:07 -04:00
Andrew Kelley ea58f4a5a9 run zig fmt on the codebase 2018-05-30 16:09:11 -04:00
Andrew Kelley 4787127cf6 partial conversion to post-fix pointer deref using zig fmt 2018-05-10 00:29:49 -04:00
Jimmi Holst Christensen 87c0060e81 Made container methods that can be const, const 2018-05-04 23:48:14 +02:00
Braedon e907c5cab9 Unified API 2018-05-03 23:54:33 +10:00
Andrew Kelley 58c6424d4f simplify and fix BufMap logic 2018-04-11 00:32:42 -04:00
Andrew Kelley 40dbcd09da fix type_is_codegen_pointer being used incorrectly
The names of these functions should probably change, but at least
the semantics are correct now:
 * type_is_codegen_pointer - the type is either a fn, ptr, or promise
 * get_codegen_ptr_type -
   - ?&T and &T returns &T
   - ?promise and promise returns promise
   - ?fn()void and fn()void returns fn()void
   - otherwise returns nullptr
2018-02-23 12:49:21 -05:00
Andrew Kelley 5f518dbeb9 *WIP* error sets converting std lib 2018-01-31 22:48:40 -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 5aefabe045 docgen: validate See Also sections
See #465
2018-01-17 00:22:53 -05:00
Andrew Kelley 2774fe8a1b docgen auto generates table of contents
See #465
2018-01-17 00:22:53 -05:00
Andrew Kelley 3c094116aa remove %% prefix operator
See #632
closes #545
closes #510

this makes #651 higher priority
2018-01-09 00:51:51 -05:00
Andrew Kelley 66717db735 replace `%return` with `try`
See #632

better fits the convention of using keywords for control flow
2018-01-07 16:53:13 -05:00
Andrew Kelley 4183c6f1a5 move std/debug.zig to a subdirectory
self hosted compiler parser tests do some fuzz testing
2017-12-23 22:15:48 -05:00
Andrew Kelley d917815d81 explicitly return from blocks
instead of last statement being expression value

closes #629
2017-12-22 00:50:30 -05:00
Andrew Kelley 1ac46fac15 add a std lib test for reading and writing files
* fix fstat wrong on darwin
 * move std.debug.global_allocator to std.debug.global_allocator_state and make it private
 * add std.debug.global_allocator as a pointer (to upgrade your zig code remove
   the '&')
2017-11-10 14:17:23 -05: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 7f0620a20f partial implementation of printing floating point numbers with errol3
also add bitCast builtin function. closes #387
2017-06-14 00:24:25 -04:00
Andrew Kelley 698829b772 change while syntax
Old:

```
while (condition; expression) {}
```

New:

```
while (condition) : (expression) {}
```

This is in preparation to allow nullable and
error union types as the condition. See #357
2017-05-03 18:12:07 -04:00
Andrew Kelley 644ea2dde9 remove test and try expressions in favor of if expressions
See #357
2017-05-03 17:23:11 -04:00
Andrew Kelley 24a9a42966 add safe release build mode
closes #288
2017-05-02 17:34:21 -04:00
Andrew Kelley 17b935325e `@import("builtin")` instead of `@compileVar`
See #226
Closes #220
2017-05-01 13:12:38 -04:00
Andrew Kelley 0cce115476 update syntax for try and nullable unwrapping
closes #285
2017-04-21 16:46:33 -04:00
Andrew Kelley e3c524c1d4 rename `@ptrcast` to `@ptrCast` to follow convention 2017-04-21 10:39:13 -04:00
Andrew Kelley f7e9d7aa5d ability to implicitly cast integer literal to &const Int
where Int is an integer type

also introduce `@intToPtr` builtin for converting a usize
to a pointer. users now have to use this instead of `(&T)(int)`.

closes #311
2017-04-07 15:35:38 -04:00
Andrew Kelley 6fbe1632d0 Update zig build system to support user defined options
* Fix assertion failure when switching on type.
   Closes #310
 * Update zig build system to support user defined options.
   See #204
 * fmt.format supports {sNNN} to set padding for a buffer arg.
 * add std.fmt.bufPrint and std.fmt.allocPrint
 * std.hash_map.HashMap.put returns the previous value
 * add std.mem.startsWith
2017-04-06 05:34:04 -04:00
Andrew Kelley c9ae30d27e delete alloca builtin function
See #225

introduce os.EnvMap
2017-04-03 18:11:57 -04:00
Andrew Kelley f8e63c4584 change `@bitcast` to `@ptrcast`
See #290
2017-03-31 06:18:20 -04:00
Andrew Kelley 3ca027ca82 first pass at zig build system
* `zig build --export [obj|lib|exe]` changed to `zig build_obj`,
   `zig build_lib` and `zig build_exe` respectively.
 * `--name` parameter is optional when it can be inferred from the
   root source filename. closes #207
 * `zig build` now looks for `build.zig` which interacts with
   `std.build.Builder` to describe the targets, and then the zig
   build system prints TODO: build these targets. See #204
 * add `@bitcast` which is mainly used for pointer reinterpret
   casting and make explicit casting not do pointer reinterpretation.
   Closes #290
 * fix debug info for byval parameters
 * sort command line help options
 * `std.debug.panic` supports format string printing
 * add `std.mem.IncrementingAllocator`
 * fix const ptr to a variable with data changing at runtime.
   closes #289
2017-03-31 05:55:41 -04:00
Andrew Kelley 7ce753a16b replace "&&" and "||" with "and" and "or"
closes #272
2017-03-26 05:21:28 -04:00
Andrew Kelley 451ce09067 new unreachable syntax
* `noreturn` is the primitive type.
 * `unreachable` is a control flow keyword.
 * `@unreachable()` builtin function is deleted.

closes #214
2017-03-26 04:58:48 -04:00
Andrew Kelley af536ac343 introduce new test syntax
* remove setFnTest builtin
 * add test "name" { ... } syntax
 * remove --check-unused argument. functions are always lazy now.
2017-03-16 16:02:35 -04:00
Andrew Kelley 6d0afc2bd2 add compile error for assigning number literal to non-comptime var 2017-03-02 18:51:19 -05:00
Andrew Kelley 0b34439c1f mem.free no longer requires explicit type argument 2017-01-23 00:11:21 -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 ee09eb7f54 fix hash map implementation
standard library passes all tests now
2017-01-05 03:40:12 -05:00
Andrew Kelley 69132bdeda IR: progress toward compiling standard library
* comptime fn call
 * is_comptime doesn't count as an instruction dependency
 * update more std code to latest zig
2016-12-31 17:10:29 -05:00
Andrew Kelley 76fa6cdce3 eradicate use of zeroes in std 2016-12-31 01:31:23 -05:00
Andrew Kelley a71fbe49cb IR: add FnProto instruction 2016-12-18 19:40:26 -05:00
Andrew Kelley b581da41f8 remove compiler directives
* add `setFnTest`, `setFnVisible`, `setFnStaticEval`,
   `setFnNoInline` builtin functions to replace previous
   directive functionality
 * add `coldcc` and `nakedcc` as keywords which can be used as part
   of a function prototype.
 * `setDebugSafety` builtin can be used to set debug safety features
   at a per block scope level.
 * closes #169
2016-09-28 02:33:32 -04:00
Andrew Kelley 183976b242 add this keyword refers to thing in immediate scope
See #169
2016-09-26 23:47:30 -04:00
Andrew Kelley 06f2f4d64b change `unreachable{}` to `@unreachable()`
instead of a container init expression, it's a builtin
function call.
2016-09-13 16:46:27 -04:00
Andrew Kelley 9e92dbdd08 std: use parameter type inference on min and max functions 2016-09-10 20:53:57 -04:00