Commit Graph

1344 Commits

Author SHA1 Message Date
Andrew Kelley
bf67427c67 fix crash when using zig to link
without explicit dynamic linker
2017-04-13 01:15:25 -04:00
Andrew Kelley
41144a8566 ability to inline at function callsite
closes #306
2017-04-13 00:13:54 -04:00
Andrew Kelley
f043e0e85c build: ignore libLLD.so when it is a broken symlink
closes #318
2017-04-13 00:12:44 -04:00
Andrew Kelley
403eb92a62 try harder to find lld 2017-04-11 06:44:45 -04:00
Andrew Kelley
2864359950 zig build system writes template build.zig file when none exists
see #204
2017-04-11 06:14:46 -04:00
Andrew Kelley
7f47b0c271 run alwaysinline pass in debug mode
before this commit, the optimized IR code that is displayed in
--verbose mode is not actually what gets emitted to an object
file.

that is now corrected, and we make sure to run the alwaysinliner
pass even in debug mode, so you can rely on "inline" keyword
inlining a function, guaranteed.

See #306
2017-04-11 03:37:44 -04:00
Andrew Kelley
11a6550324 fix some -Wconversion errors 2017-04-10 20:02:39 -04:00
Andrew Kelley
34eff50326 fix for loops not working at compile-time
closes #315
2017-04-10 03:00:19 -04:00
Andrew Kelley
0e77b0ac89 fix mangling exported global variables
closes #316
2017-04-10 02:32:11 -04:00
Andrew Kelley
095591f0b0 add enumTagName builtin function
closes #299
2017-04-08 17:45:22 -04:00
Andrew Kelley
7611ed3484 allow implicit cast from [N]T to &const []const T
closes #296
2017-04-07 17:56:01 -04:00
Andrew Kelley
5eb78ba177 fix std.mem.IncrementingAllocator
updating ptr casting because of previous commit
2017-04-07 15:38:31 -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
ffb4852012 add compile error for the bug of unable to call var ags at compile time
See #313
2017-04-07 00:33:19 -04:00
Andrew Kelley
a3de550d3b fix var args having wrong index when runtime param before it
closes #312
2017-04-06 21:00:49 -04:00
Andrew Kelley
273cebdf4d peer resolve types [N]T, [M]T as []const T
closes #125
2017-04-06 18:07:38 -04:00
Andrew Kelley
47f58d6d02 fix runtime struct initialization of bitfield
closes #308
2017-04-06 15:04:18 -04:00
Andrew Kelley
10dbc735fe zig build: use -D for options instead of -O
because -O is usually optimization level
2017-04-06 13:59:11 -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
d15bcdce69 std: ChildProcess.spawn looks at PATH env var
closes #303
2017-04-05 17:55:50 -04:00
Andrew Kelley
d65cd73a8b add support to use zig as a linker driver
closes #243

I also added --grep to ./run_tests if you want to single out
some specific tests
2017-04-05 07:49:40 -04:00
Andrew Kelley
8c10b6dcbd ability to use zig as an assembler
see #243
2017-04-05 03:36:55 -04:00
Andrew Kelley
a461ae6c1f fix crash when referencing invalid member of builtin enum
closes #304
2017-04-04 21:36:24 -04:00
Andrew Kelley
e30f713640 more accurate detection of pub main 2017-04-04 21:19:22 -04:00
Andrew Kelley
0edc2b19fe support module level assembly
closes #256
2017-04-04 19:47:22 -04:00
Andrew Kelley
d97285eb65 doc: link to Andrea's emacs mode 2017-04-04 15:37:42 -04:00
Andrew Kelley
9c803af044 zig build system: fix cleanup on error, report spawn error 2017-04-04 06:47:42 -04:00
Andrew Kelley
00efbfa054 link: correctly print debug linker invocation 2017-04-04 06:15:23 -04:00
Andrew Kelley
8db9d04e6f link: fix ignoring first linker arg
LLD treats the first argument as arg[0], the exe name
2017-04-04 06:07:09 -04:00
Andrew Kelley
e332cd65c9 zig build system: delete ./build file on success
see #204
2017-04-04 02:02:51 -04:00
Andrew Kelley
1c6000d047 zig build system improvements, add some std API
* add std.buf_map.BufMap
 * add std.buf_set.BufSet
 * add std.mem.split
 * zig build system improvements (See #204)
   - automatically parses NIX_CFLAGS_COMPILE and NIX_LDFLAGS
   - add builder.addCIncludePath
   - add builder.addRPath
   - add builder.addLibPath
   - add exe.linkLibrary
2017-04-04 01:52:20 -04:00
Andrew Kelley
72fb2443e0 API for command line args
closes #300
2017-04-04 00:17:24 -04:00
Andrew Kelley
b46344fd01 link: delete code that checks the linker version
since we depend on LLD for linking
2017-04-03 23:29:53 -04:00
Andrew Kelley
55dd2676ef fix std build for darwin 2017-04-03 19:30:03 -04:00
Andrew Kelley
c9ae30d27e delete alloca builtin function
See #225

introduce os.EnvMap
2017-04-03 18:11:57 -04:00
Andrew Kelley
c400cb429a zig build system: add setLinkerScript and setTarget
* See #204 - zig build system
 * allow builtin types Os, Environ, Arch to be used at runtime.
   they have zero_bits=false and debug info now.
 * Eradicate use of `@alloca` in std for syscalls. See #225
 * add `std.io.writeFile`
 * `std.debug.panic` adds a newline to format
2017-04-03 05:04:46 -04:00
Andrew Kelley
a1363b5227 proof of concept build system
see #204
2017-04-02 20:44:04 -04:00
Andrew Kelley
640389bb2b expose environment variables in standard library
closes #118
2017-04-02 19:14:23 -04:00
Andrew Kelley
8fd0fddce5 zig build system progress
* In-progress os.ChildProcess.spawn implementation. See #204
 * Add explicit cast from integer to error. Closes #294
 * fix casting from error to integer
 * fix compiler crash when initializing variable to undefined
   with no type
2017-04-02 18:19:59 -04:00
Josh Wolfe
0594487a2e fix else-if parsing
implicit semicolon rules apply recursively to the "else" clause of if and try

if (a) {} else {} // implicit semicolon
if (a) {} else if (a) {} // implicit semicolon
if (a) {} else while (a) {} // implicit semicolon
2017-04-02 15:15:48 -07:00
Josh Wolfe
a33be6fc99 defer without a block body requires a following semicolon 2017-04-02 13:47:23 -07:00
Josh Wolfe
8d03d666af add secret void expression after defer statement if it's the last statement in a block 2017-04-02 13:18:12 -07:00
Josh Wolfe
e3c796258c allow implicit semicolon after defer {} 2017-04-02 13:01:23 -07:00
Josh Wolfe
136a9a9d6b variable declarations must be followed by semicolon 2017-04-02 12:46:18 -07:00
Josh Wolfe
4b9e782d37 fix confusion in block expression parsing
closes #292

* if, try, while, for, comptime, defer are "greedy" with {} blocks,
  meaning if their bodies are blocks, then no suffix operator is allowed
  after the block. The {} block gets "built into" the containing statement,
  like the body of a switch statement.
* the Expression syntactic element is no longer "greedy" with {} blocks,
  meaning it's possible to have suffix operators after {} blocks without
  needing the {} block to be an rhs operand first.
2017-04-02 11:50:34 -07:00
Josh Wolfe
9968879261 Require top-level-declaration comptime use {}
This forbids `comptime 1 comptime 1` at top-level scope.
2017-04-02 11:02:47 -07:00
Josh Wolfe
087324a639 show implicit semicolon rules in langref grammar 2017-04-02 10:53:00 -07:00
Josh Wolfe
36a015741d clean up analysis of {blocks}
* Don't insert void statements all over the place. {} now stays as
  {} instead of {{}}, and {;} becomes {} instead of {{};{}}.
* Ensure final statement is always the return value statement, or
  the block is empty. This means {label:} becomes {label:{}}.
2017-03-31 08:54:03 -07:00
Josh Wolfe
d5a6cdb03f ignore eclipse project configuration 2017-03-31 08:47:09 -07:00
Andrew Kelley
f8e63c4584 change @bitcast to @ptrcast
See #290
2017-03-31 06:18:20 -04:00