19818 Commits

Author SHA1 Message Date
Andrew Kelley
d75d40dfdf build: make docs a separate step than test 2022-08-19 16:45:15 -07:00
Andrew Kelley
7346600517 CI: avoid concurrent jobs tripping over each other 2022-08-19 16:45:15 -07:00
Andrew Kelley
e3ccea70dd CI: isolate zig-cache for parallel debug/release builds 2022-08-19 16:45:15 -07:00
Andrew Kelley
09ec9b0315 langref: update to new error message 2022-08-19 16:45:15 -07:00
Andrew Kelley
a73b3a0d70 CI: simplify x86 linux test instructions 2022-08-19 16:45:15 -07:00
Andrew Kelley
06c42a0c68 CI: test both stage3-debug and stage3-release on x86-linux 2022-08-19 16:45:15 -07:00
Andrew Kelley
507aae4a1a make self-hosted the default compiler
stage1 is available behind the -fstage1 flag.

closes #89
2022-08-19 16:45:15 -07:00
Andrew Kelley
73bbd1069a build: remove the option to omit stage2 2022-08-19 16:45:15 -07:00
r00ster91
39f43fea8d fix: fix off-by-one for leading zeroes 2022-08-20 01:45:34 +03:00
Andrew Kelley
be2bd5848a
Merge pull request #12472 from ziglang/stage2-stack-protector
stage2: implement stack protectors
2022-08-19 06:41:34 -04:00
Andrew Kelley
fdb934a157 stage2: disable stack-protector on wasm, matching stage1
The CI gave me: unknown import: `env::__stack_chk_fail` has not been
defined
2022-08-19 03:41:13 -07:00
Andrew Kelley
d6ba66e50d Sema: avoid false positive error for linking libc
when extern c functions are called.
2022-08-19 03:41:13 -07:00
Andrew Kelley
c0b7f20893 stage2: implement stack protectors
This is one of the final remaining TODOs for the LLVM backend.
2022-08-19 03:41:13 -07:00
Andrew Kelley
2ccaa5414b
Merge pull request #12145 from ziglang/fixes
More ABI size and alignment fixes
2022-08-19 04:56:08 -04:00
Andrew Kelley
150786e83c test harness: fix handling of object format
Follow-up to b975f7a56fec9e0e7aca9832282bc772c743d731.
2022-08-18 22:02:55 -07:00
Andrew Kelley
5e989fcb67 stage2: pointers to comptime-only types are comptime-only
This is a partial revert of c5ba941b77fbdb06841f28142420c6786f2a4d0c.
2022-08-18 22:02:10 -07:00
Andrew Kelley
cee82c7ce4 improved ABI alignment/size for >= 128-bit integers
* riscv64: adjust alignment and size of 128-bit integers.
 * take ofmt=c into account for ABI alignment of 128-bit integers and
   structs.
 * Type: make packed struct support intInfo
 * fix f80 alignment for i386-windows-msvc
2022-08-18 20:34:36 -07:00
Andrew Kelley
b975f7a56f std.Target gains ObjectFormat field 2022-08-18 18:58:28 -07:00
Andrew Kelley
517eb73b23 LLVM: disable the ABI size safety check
There still more instances of this check being tripped during behavior
tests that we need to fix before we can enable this.
2022-08-18 17:11:34 -07:00
Andrew Kelley
4552ccb685 stage2: make @Vector ABI size agree with LLVM 2022-08-18 17:11:34 -07:00
Andrew Kelley
6e313eb110 stage2: agree with LLVM that @alignOf(u128) is 8
on x86_64 and similar targets.
2022-08-18 17:11:32 -07:00
Andrew Kelley
c5ba941b77 stage2: all pointers have runtime bits 2022-08-18 16:02:29 -07:00
Ben Fiedler
7d674d5fb6 build: Allow comptime_int in OptionsStep.addOption 2022-08-18 23:00:44 +02:00
Jakub Konka
b12992cb01 macho: do not open file handle when building static archive
Firstly, opening a file handle is not really needed since we won't even
use it, and secondly, this can cause AccessDenied errors on Windows
when trying to move a directory from zig-cache/tmp/ to zig-cache/o/
since, without POSIX semantics, it is illegal to move directories
with open handles to any of its resources.
2022-08-18 15:54:09 -04:00
Sage Hane
f6459721e5 std.build: Fix typo in LibExeObjStep.runEmulatable's assertion 2022-08-18 20:08:25 +03:00
Eric Joldasov
b97ae88898 std.zig.system.NativeTargetInfo: look for a shebang line in /usr/bin/env, if any 2022-08-18 19:57:50 +03:00
zooster
4055e6055b
AstGen: disallow leading zeroes in int literals and int types
This makes `0123` and `u0123` etc. illegal.

I'm now confident that this is a good change because
I actually caught two C header translation mistakes in `haiku.zig` with this.
Clearly, `0123` being octal in C (TIL) can cause confusion, and we make this easier to read by
requiring `0o` as the prefix and now also disallowing leading zeroes in integers.

For consistency and because it looks weird, we disallow it for integer types too (e.g. `u0123`).

Fixes #11963
Fixes #12417
2022-08-18 19:54:51 +03:00
Loris Cro
2523b443a4
Merge pull request #12477 from der-teufel-programming/master
Autodoc: HTML files generation
2022-08-18 18:05:11 +02:00
Loris Cro
53e971226d autodoc: minor pr cleanup 2022-08-18 18:02:19 +02:00
Veikka Tuominen
b038dba06b
Merge pull request #12462 from Vexu/stage2-noreturn
Stage2: improve behavior of noreturn
2022-08-18 17:18:57 +03:00
Der Teufel
51a4861a08 Fixed Docgen.zig formatting 2022-08-18 15:44:42 +02:00
Der Teufel
f0bfdf9766 Fixed stage1 compilation error 2022-08-18 15:33:56 +02:00
Luuk de Gram
4f2143becc link/Wasm: improve symbol resolution
This adds additional checks during symbol resolution:
- Ensures function signatures match when a symbol will be replaced.
- Ensures global types match when the symbol is being replaced.
- When both symbols are undefined, ensures they have a matching module name.

Those changes ensure the result will pass the validator when
the runtime compiles the Wasm module.

Additionally, this also slightly changes the behavior when both
the existing symbol and new symbol are both defined. Rather than
always resulting in a collision, it only results in a collision
when both are also weak. Else, the non-weak symbol will be picked.
2022-08-18 14:17:01 +02:00
Luuk de Gram
63c25cc1cc wasm: fix callInstrinsic return value
Rather than storing it in a local and returning that,
we now keep this on the stack as all internal functions
expect it to be on the stack already and therefore were
generating extra `local.set` instructions.
2022-08-18 14:17:01 +02:00
der-teufel-programming
3ed9cdc1cc
Merge branch 'ziglang:master' into master 2022-08-18 14:10:47 +02:00
Der Teufel
656b9429d0 autodoc: An attempt at generating HTML files from all imported source
files. Files generated from the standard library could be considered
for placing with main.js and index.html in lib/docs. Paths should
reflect packages in the future.
2022-08-18 14:03:42 +02:00
Andrew Kelley
df507edffe
Merge pull request #12461 from ziglang/fix-12421
Fixes link-tests and `atomicSymLink` on Windows
2022-08-18 00:50:14 -04:00
Techatrix
79757f233d fix memory leak in NativePaths.zig 2022-08-17 19:05:39 -04:00
Jakub Konka
b6ce0cce69 windows-ci: pass -Domit-stage2 to test-toolchain 2022-08-17 23:13:58 +02:00
Jakub Konka
515ee5b2fa libstd: do not follow symlinks in renameatW
This correctly mimicks POSIX behavior.
2022-08-17 23:13:58 +02:00
Jakub Konka
9b595dd55f link-test: refactor and reorg
Move common tests by target file format (Wasm, MachO) into helper
functions in `link.zig`, and sort alphabetically within for easier
tracking versus file organization on disk.
2022-08-17 23:13:49 +02:00
Andrew Kelley
7f0642b5d3
Merge pull request #12397 from martinhath/issue-12364
Sema: error on ambiguous coercion of comptime float and ints
2022-08-17 17:10:08 -04:00
Andrew Kelley
2cccd14491 fix typo in compile error message 2022-08-17 14:09:42 -07:00
Veikka Tuominen
59b6483d63 add test 2022-08-17 14:09:42 -07:00
Martin Hafskjold Thoresen
07f64a2e13 Sema: error on ambiguous coercion of comptime float and ints
The following, from the documentation as of the time of writing, illustrates
the problem:

```zig
// Compile time coercion of float to int
test "implicit cast to comptime_int" {
    var f: f32 = 54.0 / 5;
    _ = f;
}
```

It is not clear how to unify the types of 54.0 and 5 to perform the
division. We can either

 - cast 54.0 to comptime_int resulting in @as(comptime_int, 10), which is
   casted to @as(f32, 10), or
 - cast 5 to comptime_float resulting in @as(comptime_float, 10.8), which
   is casted to @as(f32, 10.8)

Since the two resulting values are different, a compiler error is appropriate.

If we know that casting to either type will result in the same value we
don't need to error.  For instance, 10.0 / 2 is okay, as is 10 / 2.0.

Fixes: #12364
2022-08-17 14:09:09 -07:00
Jakub Konka
070282a96e libstd: fix off-by-one error in def of ProcSym in pdb
Make sure `ProcSym` includes a single element byte-array which delimits
the start of the symbol's name as part of its definition. This makes
the code more elegant in that accessing the name is equivalent to taking
the address of this one element array.
2022-08-17 16:36:02 -04:00
Veikka Tuominen
233049503a Sema: allow empty enums and unions 2022-08-17 23:03:04 +03:00
Andrew Kelley
c764640e92 Sema: fix generics with struct literal coerced to tagged union
The `Value.eql` function has to test for value equality *as-if* the lhs
value parameter is coerced into the type of the rhs. For tagged unions,
there was a problematic case when the lhs was an anonymous struct,
because in such case the value is empty_struct_value and the type
contains all the value information. But the only type available in the
function was the rhs type.

So the fix involved making `Value.eqlAdvanced` also accept the lhs type,
and then enhancing the logic to handle the case of the `.anon_struct` tag.

closes #12418

Tests run locally:
 * test-behavior
 * test-cases
2022-08-17 13:02:57 -07:00
Veikka Tuominen
c3d5428cba Sema: properly handle noreturn fields in unions 2022-08-17 22:07:48 +03:00
Veikka Tuominen
b0a55e1b3b Sema: make noreturn error union behave correctly 2022-08-17 20:10:18 +03:00