Commit Graph

1181 Commits

Author SHA1 Message Date
Andrew Kelley
5c04730534 use intel dialect for inline assembly
closes #242
2017-03-23 18:59:43 -04:00
Andrew Kelley
fd634f3db3 don't mangle symbols with underscores
closes #275
2017-03-23 18:28:10 -04:00
Andrew Kelley
d6856859d3 improvements for windows and libc integration
* standard library knows if it is linking against libc and will
   sometimes call libc functions in that case instead of providing
   redundant definitions
 * fix infinite loop bug when resolving use declarations
 * allow calling the same C function from different C imports.
   closes #277
 * push more logic from compiler to std/bootstrap.zig
 * standard library provides way to access errno
   closes #274
 * fix compile error in standard library for windows
 * add implementation of getRandomBytes for windows
2017-03-23 02:59:58 -04:00
Andrew Kelley
01b2bf4a44 on Darwin/MacOS/iOS, add c to link libs implicitly 2017-03-22 11:55:41 -04:00
Andrew Kelley
87bc97daef unify main entry point regardless of whether linking libc
closes #248
2017-03-22 11:26:30 -04:00
Andrew Kelley
e1c47d6fe8 fix test regression regarding shadowing names
closes #271
2017-03-20 15:32:13 -04:00
Andrew Kelley
fa7c64ccd5 lazy analysis of top level declarations
previously, we had lazy analysis of top level declarations,
but if a declaration was referenced within a compile-time
if or switch statement, that would still add the top
level declaration to the resolution queue.

now we have a declref ir instruction, which is only resolved
if we analyze the instruction. this takes into account comptime
branching.

closes #270
2017-03-18 11:28:43 -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
329457bb4f Merge branch 'master' into lld 2017-03-14 21:39:04 -04:00
Andrew Kelley
a76558db26 fix behavior with reinterpreting constant memory 2017-03-14 21:38:27 -04:00
Andrew Kelley
7efa2cd81c add --each-lib-rpath option and corresponding config option
This adds an rpath entry for each used dynamic library directory.
This is necessary on some systems such as NixOS.
2017-03-13 13:11:55 -04:00
Andrew Kelley
d10bbd28e9 use lld instead of system linker 2017-03-13 11:54:56 -04:00
Andrew Kelley
7bc0145b80 types with zero bits do not have a pointer handle 2017-03-10 11:30:30 -05:00
Andrew Kelley
434f017aee codegen nullable void the same way as bool
See #104
2017-03-10 11:21:41 -05:00
Andrew Kelley
c78dc5043b add default value for macosx version min when compiling natively
closes #264
2017-03-10 02:58:23 -05:00
Andrew Kelley
c91dbdb27c fix not allocating enough memory for passing args
fixes a bug introduced in c62db5721c
2017-03-10 02:50:53 -05:00
Andrew Kelley
cd31f875a6 update to llvm 4.0 2017-03-10 02:29:01 -05:00
Andrew Kelley
47f267d25f break off some of std.io into std.fmt, generalize printf
closes #250
2017-03-09 19:12:15 -05:00
Andrew Kelley
c62db5721c support passing var args directly
See #77
2017-03-09 16:13:38 -05:00
Andrew Kelley
558ae2f21a fix a case of invalid ptr const-ness 2017-03-08 17:02:18 -05:00
Andrew Kelley
ddd9624e2d fix assertion error, trying to dereference to array
thanks to hoppetosse on IRC for reporting the issue
2017-03-07 19:08:02 -05:00
Andrew Kelley
eb9f1e2d53 add basic emacs syntax file 2017-03-02 23:03:44 -05:00
Andrew Kelley
b78752e2d2 remove zeroes from vim syntax file 2017-03-02 23:03:30 -05:00
Andrew Kelley
0b942f5ee2 Merge pull request #269 from Jmeggesto/master
Fix unused return value in darwin.zig
2017-03-02 19:21:58 -05:00
Jackie Meggesto
5bbde1dc91 Fix unused return value in darwin.zig 2017-03-02 19:21:02 -05: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
03b6d9f547 fix assertion failure for some switch errors 2017-02-28 03:32:12 -05:00
Andrew Kelley
9eb29e81f9 rename CBuf to Buffer0 and some minor std API changes 2017-02-28 03:07:11 -05:00
Andrew Kelley
1195994880 fix inability to write to global in some cases
before, when we initialized a variable by copying the
initialization value, it made the internal const value
references point to a duplicate value, resulting in
a phony duplicate global value being updated instead of
the real on. now the behavior is as expected.

thanks to hoppetosse for pointing out this bug on IRC.
2017-02-27 00:07:11 -05:00
Andrew Kelley
25761570f1 more robust const struct values 2017-02-26 23:50:04 -05:00
Andrew Kelley
8dd0b4e1f1 add passing test for floating point edge case 2017-02-26 16:30:15 -05:00
Andrew Kelley
0ac1934ad6 fix examples 2017-02-26 14:35:30 -05:00
Andrew Kelley
c36b0fec8e README: more robust suggested configuration command
thanks to jabb from IRC
2017-02-24 16:10:11 -05:00
Andrew Kelley
889bed13c3 unwrap error payload instruction has side effects only if safety check on 2017-02-24 15:11:33 -05:00
Andrew Kelley
cd992b89d2 fix unwrap error payload not emitting debug safety 2017-02-24 15:07:46 -05:00
Andrew Kelley
a665872e88 add compile error for ignoring return value
also introduce the _ identifier which you can assign to
to discard a return value

closes #219
2017-02-24 15:01:19 -05:00
Andrew Kelley
3b40aaa01f add compile error for control flow using comptime var at runtime
closes #266
2017-02-24 13:57:00 -05:00
Andrew Kelley
4b99f5978f add character format specifier to std.io.OutStream.printf 2017-02-23 18:56:10 -05:00
Andrew Kelley
3075d8aee7 fix use decls not always working 2017-02-23 16:52:13 -05:00
Andrew Kelley
fe3063e58c update std code for MacOS
closes #264
2017-02-23 16:13:57 -05:00
Andrew Kelley
b1ace32f23 fix wrong format specifier
closes #263
2017-02-22 15:36:57 -05:00
Andrew Kelley
786677f80c fix regression with bit fields that align properly 2017-02-22 00:58:31 -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
cf5108f222 correct size of types for packed structs
with byte aligned but non-power-of-2 fields such as 24
2017-02-21 14:22:23 -05:00
Andrew Kelley
4709fe1176 more robust detection of types that failed to resolve 2017-02-20 19:56:07 -05:00
Andrew Kelley
c4ee37f506 fix assertion failure when first use of a struct is sizeOf 2017-02-18 18:33:21 -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
244362fed7 ability to write to bit fields
See #261
2017-02-16 18:42:52 -05:00
Andrew Kelley
b6e7a0dadd support arithmetic for non byte aligned integer types
see #261
2017-02-16 17:08:55 -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