1493 Commits

Author SHA1 Message Date
LemonBoy
563d9ebfe5 Implement the callconv() annotation 2020-01-02 18:53:16 +01:00
Andrew Kelley
cb56b26900
fix float ops with respect to vectors
also remove the redundant type parameter
2020-01-01 23:27:43 -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
73e535e112
Merge pull request #3683 from Vexu/atomic-float
Support floats with some atomic operations
2019-12-30 19:19:05 -05:00
LemonBoy
28a8ded95a Resolve more types as needed
Closes #3994
2019-12-30 17:45:09 -05:00
Vexu
fceda07f94
use self hosted translate-c for cimports 2019-12-29 11:04:45 +02:00
Vexu
ab7fc33c83
add zig llvm wrapper for atomicrmw 2019-12-23 11:55:00 +02:00
Vexu
8bb1e04449
support some atomic operations with floats 2019-12-23 11:54:47 +02:00
Andrew Kelley
8d73703d52
fix safety for sentinel-slicing floats 2019-12-20 18:28:59 -05:00
Andrew Kelley
8918cb06fc
sentinel slicing improvements
* add runtime safety for slicing pointers, arrays, and slices.
 * slicing without a sentinel value results in non-sentineled slice
 * improved `std.debug.panic` handling of panic-during-panic
2019-12-20 18:28:59 -05:00
Andrew Kelley
839b3a61ad
expose the ability to disable C sanitization
and disable C sanitization when building libcs.
Empirically, they seem to trigger undef-sanitization.
2019-12-16 13:51:21 -05:00
Andrew Kelley
f8cd981c04
use -fsanitize=undefined for C code in safe build modes
closes #3569
2019-12-16 13:06:02 -05:00
Vexu
0f38410ea6
improve extern enum 2019-12-15 19:28:53 -05:00
LemonBoy
f1407b4b7e Generate the fn pointers into the correct address space
Fixes #3645
2019-12-15 14:42:53 -05:00
LemonBoy
19ddbd9e9e Make sure the address is aligned for intToPtr ops
Closes #773
2019-12-15 14:41:05 -05:00
Andrew Kelley
21a85d4fb6
Merge pull request #3896 from Vexu/translate-c-2
Translate-c self-hosted var decl and remove translate mode
2019-12-13 15:48:10 -05:00
Vexu
45abfa9e71
revert removal of translate mode in stage 1 2019-12-13 19:06:32 +02:00
Andrew Kelley
fff3c1fff4
un-special-case startup code in the std lib
Previously, the compiler had special logic to determine whether to
include the startup code, which was in `std/special/start.zig`. Now,
the file is moved to `std/start.zig`, and there is no special logic
in the compiler. Instead, the standard library unconditionally imports
the `start.zig` file, which then has a `comptime` block that does the
logic of determining what, if any, start symbols to export. Instead of
`start.zig` being in its own special package, it is just another normal
file that is part of the standard library.

`std.builtin.TestFn` is now part of the standard library rather than
specially generated by the compiler.
2019-12-12 18:33:44 -05:00
Vexu
69dee57d95
remove concept of translate mode 2019-12-12 14:26:24 +02:00
Robin Voetter
f0ee0688f2
Replace typeOf with TypeOf in stage0 2019-12-10 11:09:30 -05:00
Andrew Kelley
a3f6a58c77
remove var args from the language
closes #208
2019-12-09 15:27:27 -05:00
Andrew Kelley
6504c5098e
tuple detection does not require AST node 2019-12-08 18:39:52 -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
343987cd05
remove @inlineCall from zig 2019-12-06 14:12:01 -05:00
Andrew Kelley
e41495de9d
private linkage for unnamed internal constants 2019-12-05 23:13:42 -05:00
Andrew Kelley
ef83358eb6
remove @noInlineCall from zig 2019-12-05 17:37:29 -05:00
Andrew Kelley
1f602fe8c5
implement @call
closes #3732
2019-12-05 17:07:15 -05:00
Andrew Kelley
e3ebaab3c7
fix zig builtin 2019-12-03 13:57:13 -05:00
Andrew Kelley
a91f552393
WinMainCRTStartup implies defaulting to console subsystem 2019-12-03 12:52:28 -05:00
Andrew Kelley
6a046c1bcd
activate start code when pub main exists
and rename LinkType->LinkMode, OutType->OutputMode
2019-12-03 12:50:42 -05:00
Vexu
20bcdab462
correct caching and add test for missing fn name 2019-12-03 12:50:41 -05:00
Vexu
a0ca30ce01
move more startup code to std lib 2019-12-03 12:50:18 -05:00
LemonBoy
26c8930b95 Accept comptime-known expression for asm 2019-12-02 19:53:06 -05:00
Andrew Kelley
b5df18c8fd
inline ConstGlobalRefs into ZigValue
Having ConstGlobalRefs be a pointer in ZigValue was a hack that caused
plenty of bugs. It was used to work around difficulties in type coercing
array values into slices.

However, after #3787 is merged, array values no longer type coerce into
slices, and so this provided an opportunity to clean up the code.

This has the nice effect of reducing stage1 peak RAM usage during the
std lib tests from 3.443 GiB to 3.405 GiB (saving 39 MiB).

There is one behavior test failing in this branch, which I plan to debug
after merging #3787.
2019-12-01 00:29:16 -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
Michael Dusan
6c89f96df1
stage1: consolodate interning
- merge const_void_val → intern.x_void
- move const_zero_byte → intern.zero_byte
- wrap intern access
2019-11-25 17:18:56 -05:00
Michael Dusan
a647a88dfc
const interning for 1-possible-value types 2019-11-25 15:04:49 -05:00
Michael Dusan
8f3e972da6
unembed ZigValue from IrInstruction 2019-11-25 15:04:39 -05:00
Michael Dusan
acd95546b7
rename ConstExprValue → ZigValue 2019-11-25 15:04:29 -05:00
Andrew Kelley
34b1ebefaa
Merge remote-tracking branch 'origin/master' into null-terminated-pointers 2019-11-24 20:28:46 -05:00
Sahnvour
1bde3b6821 gen-h: register the need for stdbool.h and stdint.h when exploring types recursively
otherwise they wouldn't be included when only a struct contains them
2019-11-24 21:33:58 +01:00
Sahnvour
49156e3980 gen-h: add a pass for exported variables 2019-11-24 21:33:58 +01:00
Sahnvour
104b6f1629 refactored gen_h_file to improve maintainability and output
- extracted functions
- factorised extern "C" into a block containing all function prototypes instead of writing macros all over the place
- using intermediate buffers instead of writing directly to the output file
2019-11-24 21:33:58 +01:00
Andrew Kelley
4c7b52503b
all tests passing 2019-11-24 02:14:21 -05:00
Andrew Kelley
7597735bad
update the stage1 implementation to the new proposal
See #3731
2019-11-23 04:45:35 -05:00
Vexu
0b63573674
improve broken llvm module error message 2019-11-21 23:21:14 -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
LemonBoy
a11da37734 Update discriminant value also for zero-sized unions
Fixes #3681
2019-11-14 17:07:20 +00:00
Andrew Kelley
d89f39d719
rework layout of struct type fields
This removes the remaining hack in the implementation of anonymous
struct literals, and they can now therefore now have greater than 16
fields/elements.
2019-11-14 03:52:39 -05:00