Commit Graph

1418 Commits

Author SHA1 Message Date
Andrew Kelley 4e9b1f5479 Merge pull request #4290 from ziglang/split-ir-structs
split IrInstruction into IrInst, IrInstSrc, IrInstGen
2020-01-25 23:24:41 -05:00
Andrew Kelley 6aac423964 split IrInstruction into IrInst, IrInstSrc, IrInstGen
This makes it so that less memory is used for IR instructions, as well
as catching bugs when one expected one kind of instruction and received
the other.
2020-01-25 21:49:32 -05:00
Michael Dusan aa75df36df Merge pull request #4279 from mikdusan/create-global-cache
stage1: make sure to create native_libc.txt dir
2020-01-24 00:31:18 -05:00
Tadeo Kondrak 3d8328abce Don't include stdbool.h for void and unreachable
Fixes https://github.com/ziglang/zig/issues/4272
2020-01-23 23:24:45 -05:00
Michael Dusan b54040d394 stage1: make sure to create native_libc.txt dir
- fix regression from #4186
2020-01-23 21:59:28 -05:00
Andrew Kelley b5ac079f88 Merge pull request #4191 from Vexu/non-exhaustive-enums
Implement non-exhaustive enums
2020-01-17 14:26:12 -05:00
Vexu df03fcf5f0 implement @bitSizeOf 2020-01-16 13:13:45 -05:00
Vexu d84569895c turn panics into compile errors, require at least 1 field in non-exhaustive enum 2020-01-16 09:04:11 +02:00
Vexu 5c2238fc4a small fixes
* error for '_' prong on exhaustive enum
* todo panic for `@tagName`  on non-exhaustive enum
* don't require '_' field on tagged unions
2020-01-15 22:09:19 +02:00
Michael Dusan 0a41051955 stage1: move local native_libc.txt to global
Automatic creation of `native_libc.txt` now occurs only in global
cache. Manual creation/placement into local cache is supported.

closes #3975
2020-01-15 13:42:12 -05:00
Vexu 6fd0dddf18 implement non-exhaustive enums 2020-01-15 20:24:59 +02:00
LemonBoy 505b9db909 Fix codegen error for some union initializers
Closes #3377
2020-01-14 14:57:03 -05:00
LemonBoy cae93c860b Allow switching on pointer types
Closes #4074
2020-01-13 22:18:49 +01:00
LemonBoy 95619ecb8c Stop dropping errors from clang
* Refactor the error-writing code to be more compact and flexible
2020-01-11 15:48:32 -05:00
LemonBoy 84e98405de Inform the debugger about the effective type sizes
Makes every debugger happy and closes #2685
2020-01-10 16:42:49 -05:00
LemonBoy 5ab5de89c0 New @export() handling
Use a struct as second parameter to be future proof (and also allows to
specify default values for the parameters)

Closes #2679 as it was just a matter of a few lines of code.
2020-01-09 13:43:06 -05:00
Andrew Kelley af390b75db cleanups related to --eh-frame-hdr 2020-01-07 16:02:38 -05:00
David Cao 8e57dd57ca add --eh-frame-hdr conditionally 2020-01-07 15:58:40 -05:00
Andrew Kelley 5951b79af4 remove stdcallcc, extern, nakedcc from stage1; zig fmt rewrites 2020-01-06 15:23:05 -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
Andrew Kelley 14fcfe2981 translate-c supports --cache on
this will be used to provide a zig build step
2020-01-03 22:11:19 -05:00
Andrew Kelley 213ff939f1 fix comptime vector float ops and add test coverage
also rename `@ln` to `@log` to match libc convention.
2020-01-02 14:01:48 -05:00
LemonBoy 435528a7c5 Use the LLVM C++ API 2020-01-02 18:57:09 +01:00
LemonBoy 0ccac79c8e Implement Thiscall CC 2020-01-02 18:57:08 +01:00
LemonBoy 271fc6a247 Catch more errors during the type resolution phase
Returning the uninitialized/stale error condition made the compiler turn
a blind eye to some problems.
2020-01-02 18:53:20 +01:00
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