Andrew Kelley
9dc9e5bfb0
build: fix warning on gcc 6.2
2016-09-06 10:45:40 -04:00
Andrew Kelley
64034a3d1a
maxValue and minValue builtins return number literal
...
closes #170
2016-09-05 23:19:13 -04:00
Andrew Kelley
cfaced3f73
rename errName builtin to errorName
2016-09-05 17:03:11 -04:00
Andrew Kelley
768a9780ca
rename compileErr builtin to compileError
2016-09-05 17:01:54 -04:00
Andrew Kelley
4979e606c3
fix gcc 5.4.0compile errors
2016-09-05 16:18:49 -04:00
Andrew Kelley
20eb749ad6
generate debug info for global constants
...
See #41
2016-09-04 22:32:23 -07:00
Andrew Kelley
4e7effd3d3
port to llvm 3.9
2016-09-04 18:30:40 -07:00
Andrew Kelley
f18e34c2c6
restore shared library functionality
2016-09-01 11:05:36 -07:00
Andrew Kelley
d44ca5baac
tokenizer: add missing return statement on float overflow
...
closes #177
2016-08-29 22:20:12 -07:00
Andrew Kelley
6e6d138c2f
add ability to explicitly cast enum with no payload to int
2016-08-29 22:14:10 -07:00
Andrew Kelley
651dc31247
implement null as a literal type
2016-08-29 22:14:09 -07:00
Andrew Kelley
1f7ec741fa
implement ?return
expression
2016-08-29 22:14:09 -07:00
Andrew Kelley
ed50bd1b65
progress toward stack trace printing
2016-08-17 20:11:04 -07:00
Andrew Kelley
0fbb9e09ea
fix crash when calling method on slice
2016-08-16 23:24:33 -07:00
Andrew Kelley
37d167f6e0
std: conform to style guidelines
2016-08-16 22:42:50 -07:00
Andrew Kelley
0ae9023832
add CBuf to standard library
...
and fix ability to take address of variables
from other namespaces
2016-08-11 22:25:13 -07:00
Andrew Kelley
2ed949a6ae
add zeroes value
2016-08-08 20:43:38 -07:00
Andrew Kelley
0d5ecc4312
ability to have a return type of 'type'
2016-08-07 20:08:37 -07:00
Andrew Kelley
275410dc33
implement multiline C string syntax
2016-08-04 23:10:24 -07:00
Andrew Kelley
d0b11af2bd
new multiline string syntax
...
This patch also moves a bunch of the parser code into the tokenizer.
Closes #162 .
2016-08-04 22:52:38 -07:00
Andrew Kelley
1fa0cabf9d
remove multiline comments
...
closes #161
2016-07-27 23:26:12 -07:00
Andrew Kelley
8552d7fd19
explicit wrapping integer operations
...
instead of wrapping integer types
closes #159
2016-07-27 23:08:27 -07:00
Andrew Kelley
06c4b35eb1
std: improve rand implementation and API
2016-07-26 23:51:58 -07:00
Andrew Kelley
bc81ddfea6
unsigned integers for sizes of things
...
Closes #62 .
2016-07-26 20:40:11 -07:00
Andrew Kelley
78d4fb20c4
inline parameters
...
This replaces the current generic syntax for functions and replaces
it with the concept of inline parameters.
This paves the way for the "all structs anonymous" proposal.
Closes #151 .
2016-07-25 22:55:15 -07:00
Andrew Kelley
425c0ffa01
rename NodeTypeStructDecl to NodeTypeContainerDecl
2016-07-17 16:30:41 -07:00
Andrew Kelley
3971bf3d72
fix not resolving use declarations
...
causing bogus compile errors
2016-07-13 18:22:49 -07:00
Andrew Kelley
f2fc9b8a7b
fix duplicate type defined when imported from parseh
2016-07-09 15:48:25 -07:00
Andrew Kelley
49a4b1b930
ability to cast explicitly from int to enum
...
This commit also fixes a bug where pure functions are marked with
the read-only attribute in debug mode. This resulted in incorrect
codegen because calls to read-only functions with unused values
were not generated.
For example, a call to assert() would not be generated if assert
is marked with read-only. Which it *is* marked with in release
mode.
2016-07-09 15:22:04 -07:00
Andrew Kelley
a5251a1c10
parseh: support octal in C macro string literal
2016-07-09 12:17:31 -07:00
Andrew Kelley
100e8e15fa
fix tokenizing string symbols with hex characters in them
2016-07-09 07:54:55 -07:00
Andrew Kelley
b08bc84a36
don't add no-frame-pointer-elim for inline functions
...
and make syscall functions inline
this gets the tests all passing on i386
2016-05-18 18:30:03 -07:00
Andrew Kelley
762e686d17
inline assembly: allow empty output list
2016-05-18 18:20:15 -07:00
Andrew Kelley
39016c1d3e
fix offset map for inline assembly error messages
2016-05-18 18:05:03 -07:00
Andrew Kelley
f6b16c99ba
fix raw string literal crash
2016-05-18 17:55:07 -07:00
Andrew Kelley
fbb6d1d7ee
support extern C ABI for return types
2016-05-18 15:32:34 -07:00
Andrew Kelley
2c710382a8
fix crash when error evaluating target of for expr
...
closes #153
2016-05-16 22:51:08 -07:00
Andrew Kelley
9813ae8586
add bit_count, is_wrapping, is_signed fields to int types
2016-05-15 01:30:25 -07:00
Andrew Kelley
6ff996f60f
add int_type builtin function
2016-05-15 01:05:24 -07:00
Andrew Kelley
7f90dbbb11
switch on compile var marks entire namespaces
...
as depending on compile vars.
closes #154
2016-05-15 00:25:13 -07:00
Andrew Kelley
6ae6b5f5b5
add compile_err builtin
2016-05-14 18:54:37 -07:00
Andrew Kelley
33e3d56453
add error for wrong return type of main
2016-05-13 13:08:54 -07:00
Andrew Kelley
8e3ab28be9
ability to cast maybe pointer to isize/usize
...
also ability to put noalias on maybe pointer
2016-05-13 09:54:56 -07:00
José Miguel Sánchez
b7b864e5e5
For the sake of correctness: we can always rely on ZIG_STD_DIR
2016-05-12 19:55:50 +02:00
José Miguel Sánchez
a1817f462a
Add --zig-std-dir
2016-05-12 18:41:20 +02:00
Andrew Kelley
1eafc85f1f
add readonly attribute to relevant functions and parameters
2016-05-11 15:58:00 -07:00
Andrew Kelley
26718a619c
recognize ar program and pass --gc-sections to ld
...
See #54
2016-05-11 14:44:10 -07:00
Andrew Kelley
22888ca524
some work in progress networking code
...
also, casting to or from a u8 slice makes a function impure
2016-05-10 15:00:59 -07:00
Andrew Kelley
d92ae20f45
add hashmap to standard library
...
closes #22
2016-05-09 15:07:38 -07:00
Andrew Kelley
f1e5be9686
fix ability to use previous generic params and
...
add error when `%return` shows up in a function with incorrect
return type
2016-05-09 13:44:29 -07:00
Andrew Kelley
745c325d0f
support variable declarations in structs
...
See #22
2016-05-09 12:34:03 -07:00
Andrew Kelley
56908dcb9d
add debug safety for shortening casts
...
closes #150
2016-05-09 08:44:41 -07:00
Andrew Kelley
0c32b0b4ad
add list implementation to standard library
2016-05-08 01:34:00 -07:00
Andrew Kelley
18ed87c695
ability to cast u8 slice to bigger slice
2016-05-08 00:59:21 -07:00
Andrew Kelley
aed96e3512
fix null literal outside function
2016-05-08 00:15:05 -07:00
Andrew Kelley
404defd99b
add div_exact builtin fn
...
closes #149
2016-05-07 20:53:16 -07:00
Andrew Kelley
eb83111f02
add debug safety for division
...
See #149
2016-05-07 19:58:02 -07:00
Andrew Kelley
9d29674711
ability to cast slice to u8 slice
2016-05-07 18:45:28 -07:00
Andrew Kelley
9e0165147e
generic args available to member functions
...
See #22
2016-05-07 17:27:57 -07:00
Andrew Kelley
2ed72022ce
support generic data structures
...
See #22
2016-05-07 17:00:58 -07:00
Andrew Kelley
6f0f357ee4
self hosted tests test release mode too
...
closes #69
2016-05-07 10:14:16 -07:00
Andrew Kelley
8c79438f6b
better array concatenation semantics
...
closes #87
2016-05-07 10:05:59 -07:00
Andrew Kelley
d5d5fd928c
link: don't put -l in front of .a or .so files
2016-05-07 01:58:18 -07:00
Andrew Kelley
c098a8f522
add frame_address and return_address builtins
2016-05-06 23:10:14 -07:00
Andrew Kelley
271a37b418
implicit wrap widening cast on integer peer types
...
closes #46
2016-05-06 19:49:28 -07:00
Andrew Kelley
6131b37163
fix eval integer wrapping and add tests
...
See #46
2016-05-06 19:23:21 -07:00
Andrew Kelley
9db45ac362
add shl_with_overflow builtin function
...
See #46
2016-05-06 16:45:04 -07:00
Andrew Kelley
100802cdc0
add debug safety for left shifting
...
See #46
2016-05-06 15:46:38 -07:00
Andrew Kelley
b8d17b11a7
add tests for integer overflow crashing
...
see #46
2016-05-05 18:07:15 -07:00
Andrew Kelley
094336f07c
add integer wrapping
...
see #46
2016-05-05 17:19:01 -07:00
Andrew Kelley
dedde0d790
add fence builtin function
2016-05-04 18:34:17 -07:00
Andrew Kelley
c95e497857
add cmpxchg builtin function
2016-05-04 18:19:49 -07:00
Andrew Kelley
66ed7a5eb5
beginnings of network standard library code
2016-05-03 20:48:53 -07:00
Andrew Kelley
7f589c0cab
support maybe destructuring into a pointer variable
2016-05-03 15:06:34 -07:00
Andrew Kelley
9ccd0ba961
implement string escapes
2016-05-01 14:53:48 -07:00
Andrew Kelley
d908afe105
add array multiplication operator
2016-04-28 18:03:44 -07:00
Andrew Kelley
46b0b84b90
ability to specify body of an extern function
...
closes #101
2016-04-28 16:04:44 -07:00
Andrew Kelley
a299de2265
better alignment value for stack variables
...
fixes debug info sometimes not being available for parameters
2016-04-28 15:10:27 -07:00
Andrew Kelley
4815c03caa
better parameter codegen
...
* ability to take address of a parameter (closes #97 )
* debug symbols work for parameters
2016-04-27 17:34:53 -07:00
Andrew Kelley
09042f1b0c
add missing debug entry for breakpoint
2016-04-26 15:35:36 -07:00
Andrew Kelley
8ec109de3c
ability to compare booleans
2016-04-26 11:39:31 -07:00
Andrew Kelley
d1fa5692c6
add array bounds checking in debug mode
...
closes #27
2016-04-26 11:36:11 -07:00
Andrew Kelley
d0378057d1
support switching on error union type
...
closes #23
2016-04-25 21:51:04 -07:00
Andrew Kelley
d1b65c6f46
fix ability to parse character literals
2016-04-24 16:36:05 -07:00
Andrew Kelley
3886fdc19b
rename unknown_size_array to slice
2016-04-24 16:33:52 -07:00
Andrew Kelley
8583fd7f9f
add codegen for pointer comparison
...
see #145
2016-04-24 12:27:59 -07:00
Andrew Kelley
8ad75a9bf3
add compile error for invalid equality operator uses
...
See #145
2016-04-24 12:09:51 -07:00
Andrew Kelley
46ab981787
add skeleton for union support
2016-04-24 11:24:04 -07:00
Andrew Kelley
899fb14c30
fix handling of slice of zero bits type
...
closes #143
2016-04-23 13:58:30 -07:00
Andrew Kelley
55b28ab030
fix returning empty struct from function
...
closes #142
2016-04-23 12:21:47 -07:00
Josh Wolfe
4a7911e3eb
fix gcc build errors
2016-04-23 00:26:29 -07:00
Andrew Kelley
66163692ad
parseh: support anonymous enums and enums with initializers
2016-04-22 21:43:48 -07:00
Andrew Kelley
8187396f64
add syntax to allow symbols to have arbitrary strings as names
2016-04-22 15:24:18 -07:00
Andrew Kelley
35362f8137
better parsing of C macros
...
See #88
2016-04-21 15:48:13 -07:00
Andrew Kelley
a380b803ac
ability to use a struct with no fields
2016-04-21 09:47:41 -07:00
Andrew Kelley
ae600d2f7f
fix undeclared identifier not marking function as impure
2016-04-20 17:25:26 -07:00
Andrew Kelley
6acc354957
for loop: add ability to get pointer to elem var
...
see #51
2016-04-20 11:58:01 -07:00
Andrew Kelley
a25307c0a1
add optional continue expression to while loop
...
closes #139
2016-04-19 20:28:44 -07:00
Andrew Kelley
04364c45ce
fix casting with imported symbol not working
2016-04-19 19:37:25 -07:00
Andrew Kelley
36c6acfc76
enum init uses container init syntax instead of fn call
...
See #5
2016-04-19 18:52:09 -07:00
Andrew Kelley
4e37fb2fa2
implement constant initialization of enum values
...
see #5
2016-04-19 17:15:55 -07:00
Andrew Kelley
ff1ab3fe9c
fix crash in non-const expression in struct literal outside fn
2016-04-18 18:18:41 -07:00
Andrew Kelley
5e33175517
add @embed_file builtin function
2016-04-18 15:47:21 -07:00
Andrew Kelley
7f56e4ac16
move more tests to self-hosted land
2016-04-14 11:15:02 -07:00
Andrew Kelley
fcedc35551
fix crash with generic function and implicit cast
2016-04-14 10:39:03 -07:00
Andrew Kelley
83a59c4d07
fix evaluating generic functions in wrong context
2016-04-13 12:28:07 -07:00
Andrew Kelley
3f9632bb40
eval: support array literals
2016-04-13 10:13:49 -07:00
Andrew Kelley
3c27cb2527
more eval tests and fix eval call analyze code
2016-04-12 17:33:46 -07:00
Andrew Kelley
69109bc270
add error for dividing by zero in static function evaluation
2016-04-12 16:18:41 -07:00
Andrew Kelley
be4df96e4b
passing all tests
2016-04-12 13:30:52 -07:00
Andrew Kelley
aa89fd3b3e
eval: ability to eval more things
2016-04-12 09:35:33 -07:00
Andrew Kelley
fa605485ea
eval: support more node types
2016-04-12 09:35:33 -07:00
Andrew Kelley
a177e30534
compile-time function evaluation of pure functions
2016-04-12 09:35:33 -07:00
Andrew Kelley
5a479720ec
add error for unable to infer expression type in if statements
...
closes #136
2016-04-12 08:53:00 -07:00
Andrew Kelley
954a451c51
unsigned ints implicitly cast to signed ints when they fit
...
also fix #135
2016-04-11 22:57:32 -07:00
Andrew Kelley
b117b5907c
add error for accessing empty array
...
closes #134
2016-04-10 13:18:42 -07:00
Andrew Kelley
0683bd8bf6
fix crash when casting undefined to slice
...
also fix crash having to do with runtime allocated stack memory
2016-04-10 12:04:25 -07:00
Andrew Kelley
e66ed0f2e2
add error for assigning null to non-nullable pointer
...
closes #133
2016-04-09 17:35:26 -07:00
Andrew Kelley
707131e37b
goto: jumping out of scope runs defers
...
see #44
2016-04-09 17:26:04 -07:00
Andrew Kelley
7eb6af1d3e
add @breakpoint()
2016-04-09 16:52:52 -07:00
Andrew Kelley
21eca6478f
re-introduce goto
...
see #44
2016-04-09 16:41:17 -07:00
Andrew Kelley
7026bed462
fix debug symbols regression after llvm 3.8.0
2016-04-09 14:21:55 -07:00
Andrew Kelley
7a05e18efb
implement @err_name builtin function
2016-04-09 08:55:53 -07:00
Josh Wolfe
d5d6c93da4
fix parsing of hex literal 0xb
2016-04-08 17:33:59 -07:00
Andrew Kelley
73c814e5c0
support hex escapes in string literals
2016-04-08 17:30:26 -07:00
Andrew Kelley
491e3cb5c5
fix crash when passing empty string to function
2016-04-08 17:09:07 -07:00
Josh Wolfe
4ce85ea067
fix gcc compile error
2016-04-08 16:24:06 -07:00
Andrew Kelley
5dbc21b511
update cat example, refactor std
...
partial implementation of @err_name
2016-04-08 16:21:30 -07:00
Josh Wolfe
f6edba4a87
fix gcc compile errors
2016-04-07 18:02:30 -07:00
Andrew Kelley
28ad4e6d83
fix segfault in generic functions
...
See #22
2016-04-07 15:09:55 -07:00
Andrew Kelley
3b535d2c3a
fix evaluating generic function instance in wrong context
...
See #22
2016-04-07 14:23:06 -07:00
Andrew Kelley
ee22e87296
generic functions use correct type for generic args
...
See #22
2016-04-07 11:34:24 -07:00
Andrew Kelley
1d4c66b56b
support multiple generic function instances
...
See #22
2016-04-07 10:34:54 -07:00
Andrew Kelley
57688dea36
add error for gt and lt comparison of invalid types
2016-04-06 14:15:20 -07:00
Andrew Kelley
7bb67b1fd0
ability to compare function pointers at compile time
2016-04-06 14:09:27 -07:00
Andrew Kelley
22ef416d4d
fix generics not using ast clone
2016-04-06 14:02:29 -07:00
Andrew Kelley
67152f7294
support simple generic functions
2016-04-06 12:58:54 -07:00
Andrew Kelley
e144ddab24
add multiline string literal
...
and make multiple lines in normal string literals an error
2016-04-03 18:59:43 -07:00
Andrew Kelley
76e1541803
update to llvm 3.8.0
2016-03-08 18:56:14 -07:00
Andrew Kelley
f72c36cd37
fix detection of @import and @c_import inside fn body
2016-03-01 17:59:56 -07:00
Andrew Kelley
5df091fea9
c_void is provided outside of C imports
2016-03-01 15:26:41 -07:00
Andrew Kelley
660a50661b
better hash table performance
2016-03-01 14:47:46 -07:00
Andrew Kelley
1d08ab087e
fix comparison of unsigned integers error
2016-03-01 14:08:04 -07:00
Andrew Kelley
f1d338194e
rewrite how importing works
...
* Introduce the concept of packages. Closes #3
* Add support for error notes.
* Introduce `@import` and `@c_import` builtin functions and
remove the `import` and `c_import` top level declarations.
* Introduce the `use` top level declaration.
* Add `--check-unused` parameter to perform semantic
analysis and codegen on all top level declarations, not
just exported ones and ones referenced by exported ones.
* Delete the root export node and add `--library` argument.
2016-03-01 03:13:40 -07:00
Andrew Kelley
0a0494feb8
fix build error with signed/unsigned
2016-02-19 14:02:36 -07:00
Andrew Kelley
e5982e4440
link: on windows link test runner and builtin o files
2016-02-17 21:05:46 -07:00
Andrew Kelley
a7b6fa5bee
os: implement windows os layer
2016-02-17 19:53:30 -07:00
Andrew Kelley
06398a22d0
back to normal print specifiers
...
disable warnings for format specifiers on mingw since the
compiler emits bogus warnings
2016-02-16 21:43:38 -07:00
Andrew Kelley
bb806f941c
use PRIuMAX instead of PRIu64 for mingw
2016-02-16 20:24:51 -07:00
Andrew Kelley
6793548868
fix 64 bit integer printing for mingw
...
in order to do this I had to turn off -pedantic
2016-02-16 20:21:37 -07:00
Andrew Kelley
58c13aa949
rename 'environ' to 'env_type'
...
environ appears to clash with another symbol in mingw land
2016-02-16 20:03:41 -07:00
Andrew Kelley
afa5d1ea12
os: fix ability to compile for windows
2016-02-16 19:55:49 -07:00
Andrew Kelley
194e93a582
add windows os code
2016-02-16 19:42:46 -07:00
Andrew Kelley
0e92b44043
prepend underscore to non exported functions
...
to prevent symbol collisions
2016-02-16 17:06:19 -07:00
Andrew Kelley
77ffb5075b
update bootstrap to work for macos too
...
* Directives can have arbitrary expressions as parameters
* Fix switch statement not generating code sometimes
* Rename "main" fn in bootstrap.zig to "zig_user_main" to
avoid name collisions
* codegen: fix badref when unreachable is last thing in an
expression
* support #condition directive on exported functions
2016-02-16 16:41:56 -07:00
Andrew Kelley
91101f08c2
linking on darwin: provide builtins and -arch
2016-02-15 21:59:20 -07:00
Andrew Kelley
4c30216d1c
add missing system library to darwin linker job
2016-02-15 21:23:03 -07:00
Andrew Kelley
984e7d6cc7
first pass at linking on macos
2016-02-15 20:56:52 -07:00
Andrew Kelley
f580c7fa43
handle libc include path and libc lib path differently
2016-02-15 16:52:37 -07:00
Andrew Kelley
c6bf9c6942
MacOS has the same int sizes as Linux
...
Source: https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/64bitPorting/transition/transition.html
2016-02-15 16:26:33 -07:00
Andrew Kelley
baf889c879
parseh: fix __cdecl causing a fn ptr to be double ptr
2016-02-14 16:14:30 -07:00
Andrew Kelley
87922bfae0
parseh: ZIG_PARSEH_CFLAGS -> ZIG_NATIVE_PARSEH_CFLAGS
2016-02-13 23:04:12 -07:00
Andrew Kelley
fb8700de6c
parseh: support attributed types
2016-02-13 23:03:59 -07:00
Andrew Kelley
5032854aec
parseh: more specific warning for different calling conventions
2016-02-13 23:03:39 -07:00
Andrew Kelley
5771bd805e
respect link order in source code
2016-02-13 23:03:16 -07:00
Andrew Kelley
1141e4f5b2
if any c imports fail, don't emit undefined identifier errors
2016-02-13 23:02:45 -07:00
Andrew Kelley
fe95a227c8
add windows C int sizes
2016-02-13 16:29:30 -07:00
Andrew Kelley
03b51a753a
a = b % c uses the types of b and c instead of a
2016-02-13 15:03:19 -07:00
Andrew Kelley
8d510c699a
parseh: fix branching on undefined memory
2016-02-13 13:25:55 -07:00
Andrew Kelley
c8376af92d
add @ctz, @clz and compiler_rt implementation
2016-02-13 12:50:13 -07:00
Andrew Kelley
a5aeb7381f
if statement children nodes know if they're compiled out
2016-02-12 16:00:50 -07:00
Andrew Kelley
b8a1cb299e
avoid codegening functions never called from conditional compilation
2016-02-12 15:51:12 -07:00
Andrew Kelley
9bf9be9937
fix build on GCC
2016-02-12 14:07:12 -07:00
Andrew Kelley
4e3f6de027
c integer size takes into account architecture and OS
2016-02-12 12:07:11 -07:00
Andrew Kelley
592210a173
i386 support
...
closes #115
Thanks to Seo Sanghyeon for the port code.
2016-02-12 02:04:46 -07:00
Andrew Kelley
0c1ce21f7d
add @compile_var("environ")
2016-02-12 01:23:06 -07:00
Serge Paquet
633b01de23
fix undefined LONG_LONG_MAX compilation error
2016-02-11 22:13:54 -05:00
Andrew Kelley
2dc4ac0e21
add @compile_var("os") and @compile_var("arch")
2016-02-11 18:33:04 -07:00
Andrew Kelley
08eb19456b
add compile error for missing enumeration value in switch
2016-02-11 16:15:08 -07:00
Andrew Kelley
a180168871
fix division by 0 crashing compiler
...
closes #99
closes #124
thanks to Michael Patraw for submitting a patch for this.
2016-02-11 15:02:22 -07:00
Andrew Kelley
2bf6c28bc3
ability to cross compile
...
hello_libc.zig can produce a windows build
2016-02-11 01:33:27 -07:00
Andrew Kelley
54a8b6a110
cleanup target data organization
2016-02-10 16:58:15 -07:00
Andrew Kelley
b642604691
targets command shows which ones are native
2016-02-10 16:35:07 -07:00
Andrew Kelley
1ff2edf67e
add "targets" command to list architectures, oses, abis
2016-02-10 15:41:50 -07:00
Andrew Kelley
aa504275f0
don't create debug type for void arrays
2016-02-09 20:38:42 -07:00
Andrew Kelley
d8f6388b63
if statements can be const expr evaluated
...
also introduce error for unnecessary if statement
but if the condition depends on a compile variable, then
the if statement is OK
2016-02-09 18:53:28 -07:00
Andrew Kelley
f45c374664
fix -dynamic-linker arg to ld when not overridden
2016-02-09 16:55:23 -07:00
Andrew Kelley
5bdcdd1669
@const_eval returns poison value for type when it fails
...
resulting in fewer redundant error messages
2016-02-09 10:02:31 -07:00
Andrew Kelley
207862647c
std: fix parse_u64 implementation and add test
...
also codegen implement comparision with pure errors
2016-02-09 09:51:25 -07:00
Andrew Kelley
1d92700d08
fix build with GCC
2016-02-09 08:46:55 -07:00
Andrew Kelley
e18170ee0b
support overriding the dynamic linker argument to ld
2016-02-08 22:11:09 -07:00
Andrew Kelley
430d0dfcb2
support static linking against libc
2016-02-08 00:50:51 -07:00
Andrew Kelley
96e7deadd4
parseh: tiny performance improvement
2016-02-07 19:07:41 -07:00
Andrew Kelley
87cdbb6c25
improve performance for get_fn_type
2016-02-07 18:32:19 -07:00
Andrew Kelley
6b3ce918db
array.len generates a constant number literal expression
2016-02-07 15:52:52 -07:00
Andrew Kelley
42fe4e3cc8
remove ptr field access of arrays
...
use &array[0] instead
2016-02-07 15:43:19 -07:00
Andrew Kelley
36cf9f0c72
error for non const expr in array size outside fn
2016-02-07 15:16:36 -07:00
Andrew Kelley
26ea20d88f
implement @const_eval
...
closes #73
2016-02-07 15:11:20 -07:00
Andrew Kelley
049e9e5819
add debug info for loop variables
...
closes #112
2016-02-07 12:58:09 -07:00
Andrew Kelley
94ed9f622a
blocks with one statement pass constant expression eval
2016-02-07 12:38:51 -07:00
Andrew Kelley
694cfff23f
fix a bogus call to bignum_normalize causing assertion failure
2016-02-07 03:49:25 -07:00
Andrew Kelley
7b00ed362c
fix debug type of ptr and len fields of slices
2016-02-07 02:20:36 -07:00
Andrew Kelley
642b38a577
add debug info for slices
...
closes #47
2016-02-07 01:53:38 -07:00
Andrew Kelley
7f6b0ba6ea
ability to explicitly cast maybe pointers to each other
2016-02-07 01:25:04 -07:00
Andrew Kelley
4174134108
unreachable return type can cast to any other return type
2016-02-07 00:23:05 -07:00
Andrew Kelley
fc31096519
parseh: fix not properly demoting structs to typedefs
2016-02-07 00:18:24 -07:00
Andrew Kelley
f19fa590e5
parseh understands simple string literal macros
2016-02-06 21:44:22 -07:00
Andrew Kelley
c7dc56f737
add test for ?? return and add const expr eval for ? prefix op
2016-02-06 19:35:33 -07:00
Andrew Kelley
c4f5a00253
rhs of ?? and %% can be any expression
2016-02-06 19:28:11 -07:00
Andrew Kelley
73727bd1c5
parser recognizes %return in a prefix op expression
...
also defer only valid at statement level now
see #110
2016-02-06 19:16:01 -07:00
Andrew Kelley
65a03c5859
implement %defer and ?defer
...
see #110
2016-02-06 16:36:49 -07:00
Andrew Kelley
34a7e6fdb3
codegen: return respects unconditional defer
...
See #110
2016-02-06 01:18:39 -07:00
Andrew Kelley
ec33e5a638
simple unconditional defer support
...
See #110
2016-02-06 01:00:29 -07:00
Andrew Kelley
6a2ede5a6e
parsing code for defer and more
...
* disable goto and label support see #44
* refactor the way block contexts work
2016-02-05 23:20:34 -07:00
Andrew Kelley
4339d55562
update for loop syntax
...
it matches more closely the %% binary operator syntax
See #51
2016-02-05 17:15:19 -07:00
Andrew Kelley
4208435f66
add nonnull to functions with pointer return type
2016-02-05 14:58:18 -07:00
Andrew Kelley
2ee80858b4
codegen: use gen_index for nonnull attribute
...
also put nonnull on sret params
closes #82
2016-02-05 14:48:23 -07:00
realazthat
54fbe7560e
Added code for generating nonnull attributes
2016-02-05 16:29:26 -05:00
Andrew Kelley
15fe3c4235
fix explicit casting from integer literal to float
2016-02-05 04:30:04 -07:00
Andrew Kelley
663a1d0cd5
switch trap in debug mode when no prong found
2016-02-04 17:43:57 -07:00
Andrew Kelley
093e0d1bb0
support variable in switch expression prongs
...
See #43
2016-02-04 17:21:08 -07:00
Andrew Kelley
a4cba900e5
no namespace required when switching on enum
...
See #43
2016-02-04 16:09:06 -07:00
Andrew Kelley
5490f907fe
switch statements resolve peer compatibility
2016-02-04 15:50:06 -07:00
Andrew Kelley
fcbeaddbb2
codegen: fix switch expressions for enums with payloads
2016-02-04 15:26:27 -07:00
Andrew Kelley
b87d0abefe
fix debug info for bool type
2016-02-04 14:02:37 -07:00
Andrew Kelley
25e74cb385
ability to explicitly cast bool to int
2016-02-04 12:59:06 -07:00
Andrew Kelley
32642ac9cb
for loop supports break and continue
...
See #51
2016-02-04 02:49:12 -07:00
Andrew Kelley
fdadab40c6
implement constant values for enums with payload
2016-02-04 02:11:50 -07:00
Andrew Kelley
3a9009b08e
fix crash when initializing struct if field is invalid
2016-02-04 01:06:31 -07:00
Andrew Kelley
1f9734d1ee
allow defining errors with the same name
...
they get the same value, too.
2016-02-04 00:58:45 -07:00
Andrew Kelley
a6d4335217
fix running tests when linking with libc
2016-02-03 23:07:55 -07:00
Andrew Kelley
2521afef69
add ability to call function pointer field
...
also introduce the self hosted tests
closes #108
2016-02-03 21:34:09 -07:00
Andrew Kelley
5c310f4343
skip analyzing parameters of invalid function call
2016-02-03 19:10:02 -07:00
Andrew Kelley
c3123158b7
fix handling of implicit casts in binary operators
2016-02-03 19:07:15 -07:00
Andrew Kelley
39223c1847
test runner prints test names
2016-02-03 18:38:09 -07:00
Andrew Kelley
11a0644365
basic support for building a test target
2016-02-03 18:02:01 -07:00
Andrew Kelley
afdb47c32d
fix debug symbols for byval arguments
2016-02-03 03:32:45 -07:00
Andrew Kelley
815d9a7994
fix debug info for arrays being 1 element too short
2016-02-03 02:44:21 -07:00
Andrew Kelley
f2fe231ddf
add @compile_var("is_release")
2016-02-03 02:21:28 -07:00
Andrew Kelley
b28f7d0808
types sized and aligned with LLVM target data layout API
2016-02-03 02:01:42 -07:00
Andrew Kelley
b04e64d300
add @compile_var builtin and "is_big_endian" compile var
2016-02-02 21:46:53 -07:00
Andrew Kelley
a50474e7cf
fix false positive error with same named methods in incomplete struct
2016-02-02 20:06:51 -07:00
Andrew Kelley
d3de73739f
fix various semantic analyzer crashes
2016-02-02 19:35:02 -07:00
Andrew Kelley
8058b5e0a9
fix crash when incomplete struct used as argument
...
closes #107
2016-02-02 19:09:53 -07:00
Andrew Kelley
79adf55699
fx segfault with colliding bogus top level functions
2016-02-02 15:58:13 -07:00
Andrew Kelley
7af59c76e4
build: fix libc path finding
2016-02-02 15:04:14 -07:00
Andrew Kelley
5824b15249
codegen: ?? prefix operator causes trap in debug mode
2016-02-02 12:37:19 -07:00
Andrew Kelley
5ad84e4724
unreachable causes a trap in debug mode
2016-02-02 02:43:33 -07:00
Andrew Kelley
6f1a7a0d70
add abort function and "cold" fn attribute
2016-02-02 00:42:06 -07:00
Andrew Kelley
d8d0f65654
codegen: avoid table lookup for field access
...
closes #74
2016-02-01 20:17:33 -07:00
Andrew Kelley
a2035eefba
codegen: avoid table lookup in assembly expression
2016-02-01 20:13:36 -07:00
Andrew Kelley
74eaf43768
codegen: avoid a table lookup
2016-02-01 20:05:50 -07:00
Andrew Kelley
0b94c83deb
remove the constructor of hash map
2016-02-01 17:50:46 -07:00
Andrew Kelley
06f6acb4b1
inline is a keyword instead of a directive
2016-02-01 17:25:38 -07:00
Andrew Kelley
122b7b9966
c_import top level decl supports pub
...
See #88
2016-02-01 17:05:07 -07:00
Andrew Kelley
108af28c1b
optimization: avoid codegening unused functions
2016-02-01 02:34:01 -07:00
Andrew Kelley
179443bd61
add ?? prefix operator
2016-02-01 02:11:46 -07:00
Andrew Kelley
b3459f64e7
parseh understands macros which alias global fn ptr vars
2016-02-01 02:00:25 -07:00
Andrew Kelley
6b2e29c6ac
parseh: do not create macro alias for extern vars
2016-02-01 00:01:30 -07:00
Andrew Kelley
2e092e08f4
fix invalid const expr eval for negative floats
2016-01-31 21:50:41 -07:00
Andrew Kelley
675de74412
codegen: fix negation for floats
2016-01-31 21:32:05 -07:00
Andrew Kelley
a4e19f94f1
support casting between floats
2016-01-31 21:22:05 -07:00
Andrew Kelley
e74a7264ad
support casting between int and float types
2016-01-31 21:05:17 -07:00
Andrew Kelley
954afe5d9a
fix C interaction with maybe function pointers
...
See #88
2016-01-31 20:15:47 -07:00
Andrew Kelley
f20d0665bb
typedecl top level decls respect pub
2016-01-31 19:14:25 -07:00
Andrew Kelley
0ac714f0d6
add --library-path cli option
2016-01-31 18:32:07 -07:00
Andrew Kelley
41b95cc237
parseh: correct debug for forward decls
...
also C typedefs emit simply `const Foo = Bar;`
since in C you can implicitly cast from a typedef
child to parent but in zig you can't.
2016-01-31 17:48:19 -07:00
Andrew Kelley
773cd851fe
parser: fix parsing of type decls
2016-01-31 17:17:00 -07:00
Andrew Kelley
1053172854
parseh handles typedef void better
...
and introduce c_long_double type
2016-01-31 15:44:02 -07:00
Andrew Kelley
c77637d172
parseh understands forward struct definitions
...
See #88
2016-01-31 14:54:28 -07:00
Andrew Kelley
c1640a9246
parseh: use the decayed type not original type
2016-01-31 13:20:44 -07:00
Andrew Kelley
4c1f0f02d0
fix some parseh crashes
2016-01-31 02:17:08 -07:00
Andrew Kelley
80a4898e44
delete bogus --help text
2016-01-31 02:05:19 -07:00
Andrew Kelley
55c9ae1193
codegen extern global variables correctly
2016-01-31 01:51:33 -07:00
Andrew Kelley
3c2093fec6
parseh understands types better and handles some situations better
...
See #88
Also, includes partial implementation of typedef top level declaration.
See #95
Also, fix function types. Previously the way we were deduping function type
pointers was incorrect.
2016-01-31 01:20:47 -07:00
Andrew Kelley
436e35516a
parseh properly ignores anonymous structs
...
and nodes get valid create_index values
2016-01-29 17:02:51 -07:00
Andrew Kelley
e4b0435946
parseh understands variable declarations
...
and some initializers such as integers
2016-01-29 16:06:17 -07:00
Andrew Kelley
2e39d9881a
parseh fix crash
2016-01-29 02:38:12 -07:00
Andrew Kelley
a94ad9e89c
parseh defines can reference other defines
2016-01-29 02:17:51 -07:00
Andrew Kelley
c1691afdd9
parseh understands number literal defines
2016-01-29 01:31:40 -07:00
Andrew Kelley
9b2ed1fac5
parseh understands simple character literal macro
2016-01-29 00:28:52 -07:00
Andrew Kelley
923e78785d
attempt to get preprocessor entities from libclang
...
I'm pretty sure it's impossible, the API does not
expose the macro expansion value
and the source location points to the macro's name,
not its value.
2016-01-28 23:18:39 -07:00
Andrew Kelley
650fdded29
fix incorrect loading of files over 8192 bytes
2016-01-28 22:38:18 -07:00
Andrew Kelley
53c14da220
parseh understands bodyless struct used in fn
2016-01-28 21:53:46 -07:00
Andrew Kelley
c3516b8004
parseh handles self referential structs and fn pointers
2016-01-28 21:38:01 -07:00
Andrew Kelley
a5c2de5fee
ability to specify function type
...
closes #14
2016-01-28 20:26:40 -07:00
Andrew Kelley
2bb2e61ee2
parser: allow missing fn name and missing param names
...
now these problems are caught in analyzer
this is for purpose of function type, see #14
2016-01-28 18:58:28 -07:00
Andrew Kelley
d0a1901cb0
fix function calling of pointers
...
See #14
2016-01-28 17:42:29 -07:00
Andrew Kelley
974d69ea3d
ability to call member functions directly
...
see #14
2016-01-28 16:55:54 -07:00
Andrew Kelley
bb4f783528
ability to refer to member function directly
...
See #14
2016-01-28 16:45:17 -07:00
Andrew Kelley
13220ccb51
parsh understands constant sized arrays
2016-01-28 16:09:06 -07:00
Andrew Kelley
ed3117a77f
parseh understands elaborated structs and enums
2016-01-28 15:41:12 -07:00
Andrew Kelley
47c3a30310
parseh understands simple structs
2016-01-28 14:49:34 -07:00
Andrew Kelley
a09b505558
null pointer optimization for ?&T
...
this is necessary for the parseh change where all
pointers from .h files are maybe pointers.
2016-01-28 14:04:22 -07:00
Andrew Kelley
f1c5d3d3a1
add parseh tests
2016-01-28 11:54:34 -07:00
Andrew Kelley
474340a003
parseh recognizes C enums
2016-01-28 11:03:44 -07:00
Andrew Kelley
137bb51e20
parseh: add --c-import-warnings option
2016-01-28 00:25:10 -07:00
Andrew Kelley
97c61313da
c_import of stdio.h works for some functions
...
See #88
2016-01-27 23:23:02 -07:00
Andrew Kelley
b6354ddd5a
move AST rendering code to separate file
2016-01-27 21:10:38 -07:00
Andrew Kelley
c281533638
build command supports -isystem argument
2016-01-27 19:22:58 -07:00