LemonBoy
34ae1d9aa8
Fix unsafe cast in translate_c
...
* Handle EmptyDecls to clean up the generated code
Closes #4143
2020-01-11 15:51:10 -05:00
LemonBoy
570ffc470e
Handle forward-declared functions
...
Closes #4130
2020-01-10 16:34:40 -05:00
travisstaloch
3f98756f85
Fix translation of signed array indices ( #4113 )
...
* cast only if the index is long long or signed
* cast long long to usize rather than c_uint
closes #4075
2020-01-10 00:08:24 -05:00
Andrew Kelley
ae324985a6
clean up a TODO in self-hosted
2020-01-09 15:31:49 -05:00
Rocknest
4613e4d15f
Fix C struct with function pointer member and typedefs mistranslated ( #4122 )
...
fixes #4118
2020-01-09 13:38:31 -05:00
Ryan Liptak
834218d789
Fix remaining variadic formatted prints
...
Used a series of regex searches to try to find as many instances of the old pattern as I could and update them.
2020-01-09 13:36:44 -05:00
LemonBoy
5b34697b21
Cast integer literals to their specified type
2020-01-08 10:19:04 +01:00
LemonBoy
fd7e69a2c0
More translate-c fixes
...
* Translate OpaqueValueExpr
* Translate BinaryConditionalOperator
* Fix translation of boolean->int casts
* Reoder some tokens to avoid rendering errors
2020-01-08 08:43:37 +01:00
David Cao
8e57dd57ca
add --eh-frame-hdr conditionally
2020-01-07 15:58:40 -05:00
David Cao
599213463d
add --eh-frame-hdr arg for linking
2020-01-07 15:58:39 -05:00
via
9390e8b848
Preserve packed attribute in C translated struct ( #4085 )
...
* Preserve packed attribute in C translated struct
* Add tests for packed C struct
2020-01-07 02:36:07 -05:00
LemonBoy
7e7d0e1ffa
Better handling of decayed arrays to pointers
2020-01-06 19:32:53 -05:00
Andrew Kelley
baaef7ed97
Merge pull request #4083 from LemonBoy/better-stdbool
...
Better _Bool translation
2020-01-06 19:21:55 -05:00
LemonBoy
62413da9d3
Add run-translated-c test & fix one more edge case
2020-01-06 19:17:47 -05:00
LemonBoy
1dc25d7550
Translate anonymous union/struct
2020-01-06 19:17:47 -05:00
Tadeo Kondrak
f83b02a581
translate-c: use @intToPtr to cast away qualifiers
2020-01-06 19:09:49 -05:00
Andrew Kelley
5ada610e09
update translate-c and tests for new extern/callconv syntax
2020-01-06 17:54:16 -05:00
Andrew Kelley
0a9daeb37e
Merge branch 'cc-work' of https://github.com/LemonBoy/zig into LemonBoy-cc-work
2020-01-06 14:07:56 -05:00
LemonBoy
cd39f6df95
Better _Bool translation
2020-01-06 00:12:18 +01:00
LemonBoy
6ff70d3c31
Better InitListExpr translation
2020-01-05 17:39:29 -05:00
Andrew Kelley
d7bff05098
Merge pull request #4064 from ziglang/fix-4054
...
use @intCast instead of @as for shift rhs
2020-01-05 15:01:21 -05:00
LemonBoy
a712ea333b
Fix translation of for loop init
...
Closes #4067
2020-01-04 11:49:43 +01:00
LemonBoy
51e430fac0
Fix edge case in hex-literal translation
2020-01-04 11:06:28 +01:00
Josh Wolfe
7838031b43
use @intCast instead of @as for shift rhs
2020-01-03 16:41:32 -07:00
LemonBoy
e9536ca10f
Fix edge case in C tokenizer
...
Closes #4042
2020-01-02 16:44:30 -05:00
Andrew Kelley
fe21d84c94
Merge pull request #4040 from Vexu/translate-c-cast-fixes
...
Translate c cast fixes
2020-01-02 14:57:48 -05:00
LemonBoy
b0fa2ff853
Translate struct/union initializer expressions
2020-01-02 14:16:39 -05:00
LemonBoy
0ccac79c8e
Implement Thiscall CC
2020-01-02 18:57:08 +01:00
LemonBoy
08a26fea09
translate-c tests
2020-01-02 18:57:07 +01:00
LemonBoy
0ec64d4c0c
Integrate callconv into translate-c-2
2020-01-02 18:53:21 +01:00
LemonBoy
563d9ebfe5
Implement the callconv() annotation
2020-01-02 18:53:16 +01:00
LemonBoy
d908ca4823
Translate align attribute
2020-01-02 12:33:19 -05:00
LemonBoy
8e89bdfe99
Translate linksection attribute
2020-01-02 12:32:51 -05:00
Vexu
0f1595e72c
translate-c use @enumToInt
for global enum values
2020-01-02 18:38:20 +02:00
Vexu
386270425f
translate-c use canonical type in casts
2020-01-02 17:49:14 +02:00
Vexu
3dd067fa2b
translate-c fix increment rendering issues
2020-01-02 10:47:14 -05:00
LemonBoy
de894f2bde
Prefer simple ptrCast between opaque types
...
Closes #4031
2020-01-02 10:42:26 -05:00
Vexu
f35a963ac5
translate-c properly handle unused var-args
2020-01-02 10:39:52 -05:00
Andrew Kelley
88c5e2a96e
translate-c: don't export inline functions
2020-01-01 20:54:17 -05:00
Andrew Kelley
a3f741e9b8
translate-c: avoid producing duplicate macro errors
...
This input file, for example, would produce duplicate identifiers
in the translated Zig code:
```
#define bar err(
#define bar err(
```
2020-01-01 20:29:35 -05:00
Andrew Kelley
365a6124d9
translate-c: fix regression from previous commit
...
This made macros which had an error being processed emit multiple times,
causing the self-hosted compiler to fail to build.
2020-01-01 19:58:41 -05:00
Andrew Kelley
ec09b9e5f0
translate-c: prevent name clashing of macros declared after locals
2020-01-01 19:23:46 -05:00
Andrew Kelley
9298b9a4aa
translate-c: prevent name clashing of globals declared after locals
2020-01-01 18:53:08 -05:00
Andrew Kelley
dc28526c6c
translate-c: improve support of integer casting
...
Widening and truncating integer casting to different signedness
works better now. For example `(unsigned long)-1` is now translated
to zig code that compiles correctly.
2020-01-01 18:10:43 -05:00
Andrew Kelley
7b62d5dfd8
translate-c: propagate scope properly in nested assignment
2019-12-31 21:01:49 -05:00
Andrew Kelley
42945a269a
translate-c: better mangling strategy
...
Block-local identifiers have block-local mangling numbers, and more
consistent mangling is applied within blocks. Parameters, for example,
are treated the same as other block-local variables, and are not mangled
unless they conflict with another name in scope.
2019-12-31 20:39:33 -05:00
Andrew Kelley
5749f706ef
translate-c: non-wrapping operator for pointer arithmetic
...
According to C11 6.5.6.8, pointer arithmetic may not overflow. In fact,
it may not even go more than 1 past the end of an object, or UB occurs.
This is the same as Zig pointer arithmetic semantics, and so the
`+` and `+=` operators rather than `+%` and `+%=` are appropriate for
C-translated pointer arithmetic.
2019-12-31 17:33:55 -05:00
Andrew Kelley
39ee3bc0ec
Merge branch 'stage-2-cimport' of https://github.com/Vexu/zig into Vexu-stage-2-cimport
2019-12-31 16:55:41 -05:00
Andrew Kelley
c8c65b0168
translate-c: add pub
to failed-to-translate macros
2019-12-31 16:54:41 -05:00
Vexu
950eb81304
translate-c-2 macro comparision ops
2019-12-29 20:19:30 +02:00
Vexu
ca211617bd
update c_tokenzier tests to new api
2019-12-29 20:04:19 +02:00
frmdstryr
6df9e9fe47
Cleanup c_tokenizer.zig tests
2019-12-29 19:50:58 +02:00
frmdstryr
fcc82a219a
Add macro ops
2019-12-29 19:50:45 +02:00
Vexu
55348c9b93
translate-c-2 bug fixes
...
- fix use of undefined value
- fix parenexprclass result not being suppressed
- add an error and a TODO for access of an anonymous field
2019-12-29 19:23:36 +02:00
Vexu
621629e20d
translate-c-2 fix assertion failure rendering do while
2019-12-29 17:09:31 +02:00
Vexu
f5e7d2d00c
translate-c fix bugs
...
Thanks @daurnimator
2019-12-29 14:01:59 +02:00
Vexu
59cc7072e2
translate-c-2 use intCast
in most places
2019-12-29 11:04:59 +02:00
Vexu
1a3633d786
fix stage2 build
2019-12-29 11:04:58 +02:00
Vexu
3f7bab7373
fix translate-c taking ages
2019-12-29 11:04:58 +02:00
Vexu
1e52b7d690
translate-c-2 improve macro errors
2019-12-28 23:38:07 +02:00
Vexu
aea46dcd7e
translate-c-2 macro conditional operator
2019-12-28 22:32:18 +02:00
LemonBoy
6070ffc28e
Fix crash with forward-declared enums
...
Closes #3754
2019-12-28 00:57:37 +01:00
LemonBoy
a38704d012
Fix crash in translate-c w/ parameterless fn
2019-12-28 00:50:17 +01:00
Vexu
9d31b65b34
translate-c-2 various fixes
...
- make non-namespaced enums ints
- fix .used compound assignments not being grouped
- fix macro calls with casts producing invalid Zig
2019-12-22 14:38:06 +02:00
Vexu
40f607d195
translate-c-2 fix macro regression
2019-12-20 22:48:40 +02:00
Vexu
949f2369c1
translate-c-2 fix bugs found translating SDL
2019-12-20 20:22:22 +02:00
Vexu
9437d99ae2
translate-c-2 final small fixes
2019-12-20 18:51:44 +02:00
Vexu
e0046b737e
translate-c-2 improve macro escape sequences
2019-12-20 13:50:34 +02:00
Vexu
daeb939210
translate-c-2 fix switch range
2019-12-20 11:35:21 +02:00
Vexu
d172a7335c
translate-c-2 copy parametrs to stack
2019-12-20 00:12:08 +02:00
Vexu
b7f18164f9
translate-c-2 add missing casts
2019-12-19 21:30:51 +02:00
Vexu
61482be153
translate-c-2 improve macro fn ptr caller
2019-12-19 20:58:48 +02:00
Vexu
f837c7c9cd
translate-c-2 compound assign
2019-12-19 16:13:28 +02:00
Vexu
6cd402f1b4
translate-c-2 increments worst-case
2019-12-19 10:48:32 +02:00
Vexu
809deb6ec0
translate-c-2 unary operators common case
2019-12-19 09:56:00 +02:00
Vexu
e4c47e80b4
translate-c-2 unaryexprortypetrait + fixes
2019-12-19 08:28:36 +02:00
Vexu
122a9bad39
translate-c-2 fix some casts
2019-12-19 01:38:42 +02:00
Vexu
d54c288bd3
translate-c-2 function calls
2019-12-18 23:56:39 +02:00
Vexu
c2666c48a4
translate-c-2 array access
2019-12-18 22:57:53 +02:00
Vexu
cf7a5b7a4a
translate-c-2 member access
2019-12-18 22:29:42 +02:00
Vexu
e65b9e8f7b
translate-c-2 stmt expr
2019-12-18 21:20:38 +02:00
Vexu
62bfff5e87
translate-c-2 fix expression grouping bugs
2019-12-18 13:32:19 +02:00
Vexu
f54e7d6c99
translate-c-2 update @kavika13's work to removal of TransResult
2019-12-18 12:47:35 +02:00
Vexu
90eed4172d
Merge remote-tracking branch 'kavika13/master' into translate-c-2
2019-12-18 09:51:40 +02:00
Vexu
21bc3353b8
translate-c-2 character literals and more test fixes
2019-12-18 01:04:01 +02:00
Vexu
6d7025d0c5
translate-c-2 various fixes to get more tests passing
2019-12-17 23:28:13 +02:00
Vexu
a6960b89ed
translate-c-2 fix container type resolution
2019-12-17 22:05:07 +02:00
Vexu
65531c73a9
translate-c-2 switch
2019-12-17 17:19:28 +02:00
Vexu
0283ab8a1a
translate-c-2 conditional operator
2019-12-17 12:06:28 +02:00
Vexu
daa22d42b0
translate-c-2 floats
2019-12-17 11:28:56 +02:00
Vexu
9cda93a24e
translate-c-2 don't shadow primitive types
2019-12-17 10:20:02 +02:00
Vexu
ab6fe57462
translate-c-2 for loops
2019-12-17 01:40:06 +02:00
Vexu
d54bcb2b62
translate-c-2 break and continue
2019-12-16 23:54:16 +02:00
Vexu
6a3d48353b
translate-c-2 while loops
2019-12-16 22:10:17 +02:00
Vexu
e3f1bfe483
translate-c-2 if statements
2019-12-16 18:19:37 +02:00
Vexu
626562555e
translate-c-2 wors-case assign
2019-12-16 18:19:37 +02:00
Vexu
d9527edfe0
translate-c-2 comma operator
2019-12-16 18:19:24 +02:00
Andrew Kelley
0f09ff4923
Merge pull request #3916 from Vexu/translate-c-2
...
Translate-c-2 macros
2019-12-16 10:55:32 -05:00
Vexu
04dc0bd0e4
translate-c-2 variable aliasing
2019-12-16 12:45:00 +02:00
Merlyn Morgan-Graham
0c03fe48b3
Fix compile errors after rebasing on master (missing switch->else)
2019-12-16 01:37:53 -08:00
Merlyn Morgan-Graham
89ef635b35
Add boolean and, boolean or binary ops in translate-c-2
2019-12-16 01:34:05 -08:00
Merlyn Morgan-Graham
acff2d407b
Add bit shift binary ops in translate-c-2
2019-12-16 01:34:04 -08:00
Merlyn Morgan-Graham
c8c89648b0
Add comparison and bitwise binary ops in translate-c-2
2019-12-16 01:34:04 -08:00
Vexu
a37caaa528
translate-c-2 parameter name aliasing
2019-12-16 10:39:31 +02:00
Vexu
0f38410ea6
improve extern enum
2019-12-15 19:28:53 -05:00
Vexu
ab60c8e28f
c tokenizer escape sequences
2019-12-16 00:55:50 +02:00
Vexu
9f0e83a571
translate-c-2 macro functions
2019-12-15 23:46:35 +02:00
Vexu
ed2a19dcec
translate-c-2 macro cast
2019-12-15 21:32:30 +02:00
Vexu
57170f9eb6
translate-c-2 macro inline fn
2019-12-15 19:28:34 +02:00
Vexu
75218d4765
translate-c-2 macros
2019-12-15 14:44:11 +02:00
Vexu
c3724a6e72
translate-c-2 c tokenizer
2019-12-15 10:30:38 +02:00
Vexu
e57e3602e7
translate-c-2 implement enums
2019-12-14 23:24:47 +02:00
Vexu
1a967db083
add default initializers to all ast.Node base values
2019-12-14 20:40:56 +02:00
Vexu
1f84586836
translate-c-2 avoid collisions with zig keywords
2019-12-14 17:00:10 +02:00
Vexu
4dae70e702
translate-c-2 container aliases
2019-12-14 13:40:33 +02:00
Vexu
a4ac6d15c4
translate-c-2 array initializer expr
2019-12-14 10:49:25 +02:00
Vexu
e4ca1f441b
translate-c-2 record type
2019-12-14 02:00:01 +02:00
Vexu
41a67126a5
translate-c-2 typedef
2019-12-13 17:40:37 +02:00
Vexu
eb057ef41c
translate-c-2 dont eval init expr
2019-12-13 15:07:10 +02:00
Vexu
0795f17db2
translate-c-2 incompleteArray
2019-12-12 21:39:04 +02:00
Vexu
48ac84db1b
translate-c-2 translate apvalue
2019-12-12 20:35:40 +02:00
Vexu
3bca025091
update tests
2019-12-12 18:18:43 +02:00
Vexu
ef361161e2
translate-c-2 add var decl
2019-12-12 16:12:19 +02:00
Vexu
69dee57d95
remove concept of translate mode
2019-12-12 14:26:24 +02:00
Merlyn Morgan-Graham
12171dba92
Add function parameters to self-hosted translate-C
2019-12-10 23:52:40 -08:00
Merlyn Morgan-Graham
fe415dae04
Add paren expression statements to self-hosted translate-C
2019-12-10 23:52:40 -08:00
Merlyn Morgan-Graham
3e4f5de33c
Add rem binary operator to self-hosted translate-C
2019-12-10 23:52:40 -08:00
Merlyn Morgan-Graham
79fe7e6515
Add mul and div binary operators to self-hosted translate-C
2019-12-10 23:52:40 -08:00
Andrew Kelley
7c1dbfab72
self-hosted: manually parse args
2019-12-11 02:08:33 -05:00
Robin Voetter
4b4fbe3887
Replace @typeOf with @TypeOf in all zig source
...
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
Robin Voetter
c519bb02df
Fix usage of freed memory in zig fmt
2019-12-10 11:09:29 -05:00
Andrew Kelley
a3f6a58c77
remove var args from the language
...
closes #208
2019-12-09 15:27:27 -05:00
Andrew Kelley
f205d23e65
implement async function call with @call
...
this removes the last usage of var args in zig std lib
2019-12-09 15:27:26 -05:00
Andrew Kelley
03396b3caa
update docs to new fmt API
2019-12-08 23:46:50 -05:00
Andrew Kelley
fe4963412f
update self-hosted compiler to new format API
2019-12-08 23:17:03 -05:00
Andrew Kelley
8b2622cdd5
std.fmt.format: tuple parameter instead of var args
2019-12-08 22:53:51 -05:00
Andrew Kelley
525b1e8fb4
Merge pull request #3856 from ziglang/builtin-call
...
introduce `@call` and remove other builtin calls
2019-12-06 15:49:47 -05:00
Andrew Kelley
71b7f4b47f
remove @newStackCall
from zig
2019-12-06 14:52:09 -05:00
Andrew Kelley
1f602fe8c5
implement @call
...
closes #3732
2019-12-05 17:07:15 -05:00
Andrew Kelley
10e172b1d7
add other
OS and fix regression in build-exe for freestanding
2019-12-04 14:42:40 -05:00
Andrew Kelley
dcbd5ad155
remove upstream support for Zen hobby OS
...
The new plan to support hobby operating systems is #3784 .
And what kind of name is "Zen" anyway? There's already a
[Zen programming language](http://zenlang.sourceforge.net/ )
and that's just confusing.
2019-12-02 12:01:49 -05:00
Andrew Kelley
4af5c38674
fixes for self-hosted compiler
2019-12-01 19:22:03 -05:00
Andrew Kelley
b36c07a95a
Merge remote-tracking branch 'origin/master' into remove-array-type-coercion
2019-12-01 09:56:01 -05:00
Andrew Kelley
413f9a5cfc
move std.fs.Dir.cwd
to std.fs.cwd
...
update to non-deprecated std.fs APIs throughout the codebase
Related: #3811
2019-11-30 15:35:27 -05:00
Andrew Kelley
85e1e3b95f
Merge pull request #3284 from Sahnvour/export_variables
...
Improved support for exporting variables
2019-11-30 00:25:52 -05:00
Andrew Kelley
6936243ee1
fix self-hosted compiler regressions
2019-11-29 21:49:08 -05:00
Andrew Kelley
bf3ac66150
remove type coercion from array values to references
...
* Implements #3768 . This is a sweeping breaking change that requires
many (trivial) edits to Zig source code. Array values no longer
coerced to slices; however one may use `&` to obtain a reference to
an array value, which may then be coerced to a slice.
* Adds `IrInstruction::dump`, for debugging purposes. It's useful to
call to inspect the instruction when debugging Zig IR.
* Fixes bugs with result location semantics. See the new behavior test
cases, and compile error test cases.
* Fixes bugs with `@typeInfo` not properly resolving const values.
* Behavior tests are passing but std lib tests are not yet. There
is more work to do before merging this branch.
2019-11-27 03:37:50 -05:00
Vexu
4d8a8e65df
add more workarounds
2019-11-27 10:17:37 +02:00
Vexu
0d55075de4
fix command functions not being async pointers
2019-11-26 22:38:05 +02:00
Vexu
798d05dd02
add workaround for #3190
2019-11-26 22:11:04 +02:00
Vexu
128034481a
solve recursion in self hosted
2019-11-26 18:25:29 +02:00
Vexu
36849d8a7b
fixes and cleanup in self hosted
2019-11-26 11:52:12 +02:00
Jonathan S
4014a8e4b4
Avoid deprecated cwd-based functions for opening directories, preferring to open explicitly relative to Dir.cwd()
.
2019-11-25 23:46:48 -05:00
Andrew Kelley
cb38bd0a14
rename std.heap.direct_allocator to std.heap.page_allocator
...
std.heap.direct_allocator is still available for now but it is marked
deprecated.
2019-11-25 17:25:06 -05:00
Andrew Kelley
15d415e10b
make std.mem.toSlice use null terminated pointers
...
and fix the fallout
2019-11-24 21:21:05 -05:00
Andrew Kelley
34b1ebefaa
Merge remote-tracking branch 'origin/master' into null-terminated-pointers
2019-11-24 20:28:46 -05:00
Sahnvour
696567d9d7
export: check variable type
...
also fixed existing occurrences
2019-11-24 21:33:58 +01:00
Vexu
0cbf00a3ec
self hosted compiler: final small fixes to get it compiling
2019-11-24 10:24:47 +02:00
Andrew Kelley
00878a15d7
zig fmt: support sentinel-terminated pointer syntax
2019-11-23 22:21:25 -05:00
Vexu
010494d8af
only test stage2 on linux
2019-11-23 23:45:54 +02:00
Vexu
b9ef36094c
re-enable stage2 tests
2019-11-23 22:57:34 +02:00
Vexu
d40f204ec0
self hosted compiler: small miscellaneous fixes
2019-11-23 21:57:24 +02:00
Vexu
133579d7c0
fix casts
2019-11-23 19:36:26 +02:00
Vexu
03cc81665b
Merge branch 'master' into modernize-stage2
2019-11-23 19:13:48 +02:00
Andrew Kelley
fd6020c4e2
update tests, better error messages, update self-hosted tokenizer
2019-11-21 20:43:41 -05:00
Andrew Kelley
47f06be369
string literals are now null terminated
...
this also deletes C string literals from the language, and then makes
the std lib changes and compiler changes necessary to get the behavior
tests and std lib tests passing again.
2019-11-21 20:43:41 -05:00
Andrew Kelley
21f344b3b9
add null terminated pointers and arrays to self-hosted
...
as well as `@typeInfo` and `@Type`
2019-11-21 20:43:41 -05:00
daurnimator
ed956b5812
translate-c: add support for MacroQualified definitions
2019-11-19 01:05:17 +00:00
Vexu
b92f42d1f4
implemented container doc comments in stage 2
2019-11-14 16:25:06 +02:00
Andrew Kelley
0237e7a701
std.io.getStdOut and related fns no longer can error
...
Thanks to the Windows Process Environment Block, it is possible to
obtain handles to the standard input, output, and error streams without
possibility of failure.
2019-11-13 04:01:40 +00:00
Andrew Kelley
3cf5c2c62b
fix regressed tests and update docs to use "type coercion"
2019-11-08 15:57:25 -05:00
Andrew Kelley
aa0daea541
update more of the std lib to use @as
2019-11-08 15:57:25 -05:00
Vexu
86d9563d15
self hosted compiler: various small fixes
2019-11-08 00:18:14 +02:00
Vexu
bca672372a
self hosted compiler: move functions to util.zigto avoid defining llvm instricts.
2019-11-07 23:03:57 +02:00
Vexu
56ea07f4fc
self hosted compiler: comment out event.fs stuff
2019-11-07 10:30:56 +02:00
Vexu
7a24334199
self hosted compiler: small fixes to imports and declarations
2019-11-07 10:30:56 +02:00
Vexu
c6076a1360
self hosted compiler: use enum literals
2019-11-07 10:30:56 +02:00
Vexu
7000316113
self hosted compiler: fix calling convention in type.zig
2019-11-07 10:30:47 +02:00
Vexu
9394d14815
self hosted compiler: unify Target and std.Target
2019-11-07 10:30:47 +02:00
Vexu
6dd4a276de
self hosted compiler: update to new std.event
2019-11-07 10:30:37 +02:00
Vexu
110e575497
self hosted compiler: replace Promise with Frame and AnyFrame
2019-11-07 10:30:21 +02:00
Vexu
cb20093614
self hosted compiler: remove await async pattern
2019-11-07 10:30:11 +02:00
Vexu
b06e5b8c68
self hosted compiler: fix internal build info
2019-11-07 10:29:58 +02:00
Andrew Kelley
c3d816a98e
std lib networking improvements, especially non-blocking I/O
...
* delete the std/event/net directory
* `std.event.Loop.waitUntilFdReadable` and related functions
no longer have possibility of failure. On Linux, they fall
back to poll() and then fall back to sleep().
* add some missing `noasync` decorations in `std.event.Loop`
* redo the `std.net.Server` API. it's quite nice now, but
shutdown does not work cleanly. There is a race condition with
close() that I am actively working on.
* move `std.io.OutStream` to its own file to match `std.io.InStream`.
I started working on making `write` integrated with evented I/O,
but it got tricky so I backed off and filed #3557 . However
I did integrate `std.os.writev` and `std.os.pwritev` with evented I/O.
* add `std.Target.stack_align`
* move networking tests to `lib/std/net/test.zig`
* add `std.net.tcpConnectToHost` and `std.net.tcpConnectToAddress`.
* rename `error.UnknownName` to `error.UnknownHostName` within the
context of DNS resolution.
* add `std.os.readv`, which is integrated with evented I/O.
* `std.os.preadv`, is now integrated with evented I/O.
* `std.os.accept4` now asserts that ENOTSOCK and EOPNOTSUPP never
occur (misuse of API), instead of returning errors.
* `std.os.connect` is now integrated with evented I/O.
`std.os.connect_async` is gone. Just use `std.os.connect`.
* fix false positive dependency loop regarding async function frames
* add more compile notes to help when dependency loops occur
in determining whether a function is async.
* ir: change an assert to ir_assert to make it easier to find
workarounds for when such an assert is triggered. In this case
it was trying to parse an IPv4 address at comptime.
2019-10-29 22:59:30 -04:00
Andrew Kelley
845be4ea3e
fix regression in translate-c
2019-10-28 15:29:50 -04:00
Andrew Kelley
4b80e376e3
std.net.getAddressList
2019-10-28 15:29:50 -04:00
Andrew Kelley
79cb383f7d
fix 32-bit build of translate_c.zig
2019-10-24 19:46:11 -04:00
Andrew Kelley
17eb24a7e4
move types from builtin to std
...
* All the data types from `@import("builtin")` are moved to
`@import("std").builtin`. The target-related types are moved
to `std.Target`. This allows the data types to have methods, such as
`std.Target.current.isDarwin()`.
* `std.os.windows.subsystem` is moved to
`std.Target.current.subsystem`.
* Remove the concept of the panic package from the compiler
implementation. Instead, `std.builtin.panic` is always the panic
function. It checks for `@hasDecl(@import("root"), "panic")`,
or else provides a default implementation.
This is an important step for multibuilds (#3028 ). Without this change,
the types inside the builtin namespace look like different types, when
trying to merge builds with different target settings. With this change,
Zig can figure out that, e.g., `std.builtin.Os` (the enum type) from one
compilation and `std.builtin.Os` from another compilation are the same
type, even if the target OS value differs.
2019-10-23 19:09:49 -04:00
Andrew Kelley
f65b1d4680
integrate stage1 progress display with semantic analysis
2019-10-22 17:52:12 -04:00
Andrew Kelley
5b1a492012
breaking: improve std.fs directory handling API
...
* Added `std.c.unlinkat` and `std.os.unlinkat`.
* Removed `std.fs.MAX_BUF_BYTES` (this declaration never made it to
master branch)
* Added `std.fs.Dir.deleteTree` to be used on an open directory handle.
* `std.fs.deleteTree` has better behavior for both relative and
absolute paths. For absolute paths, it opens the base directory
and uses that handle for subsequent operations. For relative paths,
it does a similar strategy, using the cwd handle.
* The error set of `std.fs.deleteTree` is improved to no longer have
these possible errors:
- OutOfMemory
- FileTooBig
- IsDir
- DirNotEmpty
- PathAlreadyExists
- NoSpaceLeft
* Added `std.fs.Dir.posix_cwd` which is a statically initialized
directory representing the current working directory.
* The error set of `std.Dir.open` is improved to no longer have these
possible errors:
- FileTooBig
- IsDir
- NoSpaceLeft
- PathAlreadyExists
- OutOfMemory
* Added more alternative functions to `std.fs` for when the path
parameter is a null terminated string. This can sometimes be more
effecient on systems which have an ABI based on null terminated
strings.
* Added `std.fs.Dir.openDir`, `std.fs.Dir.deleteFile`, and
`std.fs.Dir.deleteDir` which all operate on an open directory handle.
* `std.fs.Walker.Entry` now has a `dir` field, which can be used to do
operations directly on `std.fs.Walker.Entry.basename`, avoiding
`error.NameTooLong` for deeply nested paths.
* Added more docs to `std.os.OpenError`
This commit does the POSIX components for these changes. I plan to
follow up shortly with a commit for Windows.
2019-10-20 21:48:23 -04:00
stratact
e78d3750c5
Use 8192 sized buffers and remove allocator parameters
2019-10-19 14:04:51 -04:00
Andrew Kelley
2d5b2bf1c9
improve progress reporting
...
* use erase rest of line escape code.
* use `stderr.supportsAnsiEscapeCodes` rather than `isTty`.
* respect `--color off`
* avoid unnecessary recursion
* add `Progress.log`
* disable the progress std lib test since it's noisy and uses
`time.sleep()`.
* enable/integrate progress printing with the default test runner
2019-10-17 21:55:49 -04:00
Andrew Kelley
299991019d
rework the progress module and integrate with stage1
2019-10-17 20:20:22 -04:00
Andrew Kelley
185cb13278
Merge remote-tracking branch 'origin/master' into llvm9
2019-09-10 13:00:35 -04:00
Sahnvour
f08c6e4fe6
changing occurrences of HashMap with []const u8 as keys for StringHashMap
2019-09-03 23:53:05 +02:00
Andrew Kelley
6529658ad8
Merge remote-tracking branch 'origin/master' into llvm9
2019-08-16 16:43:56 -04:00
Vexu
2151f84d59
implement new async syntax in self-hosted compiler
2019-08-16 06:17:28 -07:00
Andrew Kelley
13b5a4bf8c
remove cancel
2019-08-15 14:05:12 -04:00
Andrew Kelley
5092634103
avoid the word "coroutine", they're "async functions"
2019-08-13 14:14:19 -04:00
Andrew Kelley
54e716afdc
remove coroutines implementation and promise type
2019-07-19 18:18:44 -04:00
Andrew Kelley
e816d592e8
update zig codebase to llvm 9
2019-07-17 17:47:39 -04:00
emekoi
0435026474
fixed size of ZigClangAPValue on mingw-w64
2019-07-16 09:34:02 -04:00
Andrew Kelley
6fe3b20962
Merge branch 'translate-c-userland' of https://github.com/hryx/zig into hryx-translate-c-userland
2019-07-15 22:19:54 -04:00
Andrew Kelley
4f43a4b30f
zig fmt: fix whitespace
...
closes #2819
closes #2825
2019-07-05 14:46:21 -04:00
Andrew Kelley
2f4faf306d
Merge branch 'function-sections' of https://github.com/timonkruiper/zig into timonkruiper-function-sections
2019-07-03 14:43:33 -04:00
Timon Kruiper
bbc0d440b8
Added ZigLLVMCreateTargetMachine and pass function-sections flag
...
Also added extra cache line
Added the ZigLVVMCreateTargetMachine to self hosted zig code
2019-07-02 19:54:29 +02:00
Andrew Kelley
7d4a0cfed0
enable segfault stack traces in stage1 compiler
2019-07-02 13:41:17 -04:00
Timon Kruiper
7586f613d5
Added function-section functionality
2019-07-01 17:49:08 +02:00
hryx
0e38f7215b
Define different struct size for APValue on Windows (thanks @Sahnvour)
2019-06-29 14:34:00 -07:00
hryx
247e567422
Don't return a slice pointing to a deceased stack address
2019-06-28 18:01:41 -07:00
hryx
102bf5200c
Fix string literal: not null-terminated (thanks @mikdusan)
2019-06-28 17:40:20 -07:00
hryx
cc74bf5136
Translate IntegralCast; add stage2 test coverage
2019-06-27 23:12:33 -07:00
hryx
646268875e
Use new width format option
2019-06-27 22:16:31 -07:00
hryx
2060c7c39b
Merge branch 'master' into translate-c-userland
2019-06-27 22:12:34 -07:00
hryx
3e0ff32bd8
Separate with space instead of LF to prevent rendering excessive indentation
2019-06-27 21:17:27 -07:00
hryx
b4bd52cc51
Create and render big.Int from IntegerLiteral; group BinaryOperator
2019-06-27 21:02:48 -07:00
Marc Tiehuis
f5af349bd6
Merge pull request #2714 from ziglang/fmt-overhaul
...
Add positional, precision and width support to std.fmt
2019-06-25 20:15:33 +12:00
hryx
8435351581
Escape C string literals
2019-06-24 22:37:19 -07:00
hryx
f845994839
transBinaryOperator: Add, Sub
2019-06-23 17:17:21 -07:00
hryx
69b90e0681
transStringLiteral
2019-06-23 15:06:16 -07:00
hryx
b2e06c3bf4
Observe translate mode in stage2
2019-06-23 14:32:45 -07:00
hryx
c423697c78
Merge branch 'master' into translate-c-userland
2019-06-23 12:31:22 -07:00
hryx
1c86a191da
Fix order of tokens; omit 'pub' for fn types
2019-06-23 01:03:28 -07:00
hryx
4c8b460fec
Fix recursive self-referential block
2019-06-22 22:30:15 -07:00
hryx
4ae95d7ffc
Translate assignment BinaryOperator statements
2019-06-22 17:29:36 -07:00
hryx
6325ffc3f1
Assign undefined literal (instead of null) when no init value
2019-06-22 17:29:10 -07:00
Sahnvour
987c209b40
heap: make one global instance of DirectAllocator
...
it is now stateless, so the de/init are not necessary anymore
2019-06-22 14:10:53 -04:00
Marc Tiehuis
11526b6e9d
breaking: Add positional, precision and width support to std.fmt
...
This removes the odd width and precision specifiers found and replacing
them with the more consistent api described in #1358 .
Take the following example:
{1:5.9}
This refers to the first argument (0-indexed) in the argument list. It
will be printed with a minimum width of 5 and will have a precision of 9
(if applicable).
Not all types correctly use these parameters just yet. There are still
some missing gaps to fill in. Fill characters and alignment have yet to
be implemented.
2019-06-21 20:11:15 +12:00
hryx
0f545e5a2b
transReturnStmt
2019-06-10 23:06:54 -07:00
hryx
84e479d94f
(broken) local var decls, integer literals (part)
2019-06-09 23:35:48 -07:00
daurnimator
ed41d10a06
std: existing LinkedList is actually a TailQueue
2019-06-10 15:41:40 +10:00
Andrew Kelley
b735764898
different array literal syntax when inferring the size
...
old syntax: []i32{1, 2, 3}
new syntax: [_]i32{1, 2, 3}
closes #1797
2019-06-09 19:26:32 -04:00
hryx
586c36dd1d
Restore fn decls removed during conflict
2019-06-08 17:02:00 -07:00
hryx
ad0f0562d8
Merge branch 'master' into translate-c-userland
2019-06-08 16:23:27 -07:00
hryx
ed5b8335b5
(broken) translate Paren type
2019-06-08 16:09:25 -07:00
hryx
1692a76d28
transImplictCastExpr: LValueToRValue
2019-06-08 15:57:43 -07:00
hryx
1f82c7ba22
transCStyleCastExpr
2019-06-08 15:54:15 -07:00
Andrew Kelley
5784631fab
update the default macos version min to 10.14
2019-06-07 12:20:02 -04:00
Andrew Kelley
7878f9660f
dep tokenizer: run zig fmt and move exports to canonical location
2019-05-30 12:07:55 -04:00
Andrew Kelley
5954d5235f
Merge pull request #2182 from mikdusan/issue.2046
...
new .d file parser for stage1 compiler
2019-05-30 11:53:08 -04:00
Andrew Kelley
bfc86776d5
run zig fmt to update use
to usingnamespace
2019-05-29 19:09:58 -04:00
hryx
3e14f86f9e
Implement missing clang functions from last commit
2019-05-29 15:33:44 -07:00
Michael Dusan
2975bdc684
add review changes
...
- use std.heap.c_allocator
- use @panic instead of unreachable
- use extern enum for tokenizer result type
2019-05-29 14:39:13 -04:00
Gonzalo Diethelm
6547468af6
clang.zig cleanup #9 : rename arg0 to self
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
8d50d4f3fc
clang.zig cleanup #8 : add missing consts
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
b639447263
clang.zig cleanup #7 : add missing struct
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
f4b4ea402e
clang.zig cleanup #6 : move block around
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
fd9e63da53
clang.zig cleanup #5 : add missing enums
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
7f1dd05fa7
clang.zig cleanup #4 : move block around
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
5df2e791c2
clang.zig cleanup #3 : move block around
2019-05-28 18:05:08 +02:00