Commit Graph

19589 Commits

Author SHA1 Message Date
Veikka Tuominen
8e75ba653b
Merge pull request #12117 from Vexu/stage2-compile-errors
Stage2: explain why value must be comptime known
2022-07-22 13:07:32 +03:00
Andrew Kelley
5cd1ccf4b9 CI: stage3 coverage for test-translate-c 2022-07-21 22:52:08 -07:00
Andrew Kelley
046a4d084b update test-translate-c cases to stage2 2022-07-21 22:51:17 -07:00
Andrew Kelley
3114978389 update standalone test cases for stage2 2022-07-21 22:51:17 -07:00
Andrew Kelley
46a06074eb tests: remove superfluous newlines from logs 2022-07-21 22:51:17 -07:00
Andrew Kelley
f550c29c4e LLVM: fix lowering of structs with underaligned fields
When lowering a struct type to an LLVM struct type, keep track of
whether there are any underaligned fields. If so, then make it a packed
llvm struct. This works because we already insert manual padding bytes
regardless.

We could unconditionally use an LLVM packed struct; the reason we bother
checking for underaligned fields is that it is a conservative choice, in
case LLVM handles packed structs less optimally. A future improvement
could simplify this code by unconditionally using packed LLVM structs
and then make sure measure perf is unaffected.

closes #12190
2022-07-21 22:51:17 -07:00
Andrew Kelley
b749487f48 add new compile error note to old test case 2022-07-21 22:05:46 -07:00
Andrew Kelley
25f3be32db Sema: fix fn pointer align disagrees with fn align error
Check the specified function alignment rather than the effective
function alignment.
2022-07-21 15:19:56 -07:00
Andrew Kelley
fc6e111b76 Sema: improve compile error for bad function alignment
* Integrate more declaratively with src/target.zig
 * Only trigger the check when a function body is found, do not trigger
   for function types.
2022-07-21 13:55:29 -07:00
Andrew Kelley
b946934576 build.zig: 32 MiB stack size
This gives more headroom for comptime recursion, especially for debug
builds of Zig.
2022-07-21 12:23:33 -07:00
Andrew Kelley
644baa0f5b constrain target/backend of new test cases
avoids testing stuff that doesn't work yet.
2022-07-21 12:21:30 -07:00
Veikka Tuominen
794beafb9c Sema: validate extern struct field types earlier
`validateExternType` does not require the type to be resolved so we can
check it earlier. Only doing it in `resolveTypeFully` lead to worse or
missing compile errors.
2022-07-21 12:21:30 -07:00
Veikka Tuominen
821e4063f9 Sema: better source location for function call args 2022-07-21 12:21:30 -07:00
Veikka Tuominen
79ef0cdf30 Sema: better function parameter source location 2022-07-21 12:21:30 -07:00
Veikka Tuominen
83b2d2cd3e Sema: better source location for incompatible capture group 2022-07-21 12:21:30 -07:00
Veikka Tuominen
9fb8d21a01 AstGen: add error for fields in opaque types 2022-07-21 12:21:30 -07:00
Veikka Tuominen
1705a21f80 Sema: more union and enum tag type validation 2022-07-21 12:21:30 -07:00
Veikka Tuominen
8feb398760 Sema: validate function parameter types and return type 2022-07-21 12:21:30 -07:00
Veikka Tuominen
d851b24180 Sema: validate function pointer alignment 2022-07-21 12:21:30 -07:00
Veikka Tuominen
76e7959a90 Sema: explain why comptime is needed 2022-07-21 12:21:30 -07:00
Veikka Tuominen
195c3cd89f fix errors in tests not tested locally or on CI 2022-07-21 12:21:30 -07:00
Veikka Tuominen
d729173204 stage2: better pointer source location 2022-07-21 12:21:30 -07:00
Veikka Tuominen
29815fe9de Sema: disallow 'align' on functions on wasm 2022-07-21 12:21:30 -07:00
Veikka Tuominen
62120e3d0e Sema: fix non-exhaustive union switch checks 2022-07-21 12:21:30 -07:00
zc
460211431f complete the drone pipeline runner type and platform os 2022-07-21 11:17:35 -07:00
Yujiri
b8bf5de75a Fix #9184: fmtIntSizeDec/fmtIntSizeBin support FormatOptions 2022-07-21 18:41:21 +03:00
Loris Cro
92966088c2 autodoc: cleanup file-related operations 2022-07-21 16:31:45 +02:00
Loris Cro
d74a49456d autodoc: use already open handles to output docs artifacts 2022-07-21 14:17:25 +02:00
Andrew Kelley
e054877466 CI: stage3 covers test-universal-libc and builds stage1 2022-07-20 23:28:30 -07:00
Andrew Kelley
ca3adb83b7
Merge pull request #12111 from ziglang/ci-stage3
CI: increase stage3 test coverage
2022-07-20 17:07:19 -07:00
Andrew Kelley
5b7e332b28 disable new behavior test in stage1
I regressed this in 379beceffd1b0a0b0d8f3163dc02eba1e53ffa39; sorry
about that.
2022-07-20 16:17:33 -07:00
Motiejus Jakštys
fd9b55a640 build.zig: teach --compress-debug-sections
Now that #11863 is landed, let's expose it to the zig programs that
build stuff via `build.zig`. "Benchmarks" with [turbonss](https://git.sr.ht/~motiejus/turbonss):

Built with:

    $ zig build -Dtarget=x86_64-linux-gnu.2.19 -Dcpu=x86_64_v3 -Drelease-small=true

*Debug, uncompressed*

    174K turbonss-analyze
    161K turbonss-getent
    1.2M turbonss-unix2db
    448K libnss_turbo.so.2.0.0

*Debug, compressed*

     78K turbonss-analyze
     86K turbonss-getent
    572K turbonss-unix2db
    190K libnss_turbo.so.2.0.0

*Stripped, for completeness*

     17K turbonss-analyze
     20K turbonss-getent
    197K turbonss-unix2db
     26K libnss_turbo.so.2.0.0
2022-07-20 18:26:17 -04:00
Andrew Kelley
c1f3aca602
Merge pull request #12177 from Vexu/packed-ptr
stage2 llvm: fix handling of pointer fields in packed structs
2022-07-20 18:22:25 -04:00
Andrew Kelley
379beceffd improve test case from previous commit
Now it checks that the code is correctly compiled rather than only checking
that it does not crash the compiler.
2022-07-20 15:21:24 -07:00
Andrew Kelley
21064d9144 disable std lib test failing with self-hosted ReleaseSafe
I opened a corresponding issue #12178 which has the 0.10.0 milestone, so
this must be fixed before we release.
2022-07-20 12:50:58 -07:00
Andrew Kelley
1ec50613bf CI: increase stage3 test coverage
* Use a debug build of stage3 instead of a debug build of stage2 for
   our self-hosted compiler test coverage.
 * Move coverage from stage1 to stage3 for:
   - building self-hosted without LLVM
   - building self-hosted for 32-bit arm
   - test-compiler-rt
   - test-behavior
   - test-std
   - test-compare-output
   - test-asm-link
   - test-fmt
2022-07-20 12:27:03 -07:00
Andrew Kelley
08f3c7960a build.zig: remove deleted .cpp file 2022-07-20 11:10:46 -07:00
Veikka Tuominen
d41dd499a9 stage2 llvm: fix handling of pointer fields in packed structs 2022-07-20 17:07:12 +03:00
Cody Tapscott
de62bd0647 macho: Pass sections by pointer when slicing names
We were accidentally returning a pointer to stack memory, because these
arguments were passed by value. It's just an accident that stage 1 was
passing these by reference, so things were alright until stage 3.
2022-07-20 03:45:29 -04:00
Loris Cro
268edce862 Autodoc: fix int expr size for 32bit targets 2022-07-20 08:34:05 +02:00
Andrew Kelley
42b2fb4c5d Autodoc: stage2 miscompilation workaround
There is no issue open for this yet; I will file one after pushing this
commit.
2022-07-19 19:55:12 -07:00
Andrew Kelley
aa1a06bf9b Autodoc: small polish on the html 2022-07-19 19:10:12 -07:00
Loris Cro
572f9a5602 Autodoc: add warning banner to html 2022-07-19 19:10:12 -07:00
Andrew Kelley
7d636f0f9d delete the stage1 implementation of autodoc 2022-07-19 19:10:12 -07:00
Andrew Kelley
8df1b91d17 Autodoc: clean up debug printing
use std.log.scoped
2022-07-19 19:10:12 -07:00
Andrew Kelley
e5d21e10bc Autodoc: skip docs when compile errors occur 2022-07-19 19:10:12 -07:00
Andrew Kelley
84adbeb077 Autodoc: update to new array_type ZIR 2022-07-19 19:10:12 -07:00
Andrew Kelley
22d61faf17 Autodoc: update to new ZIR encoding
* error_to_int, int_to_error moved to extended
 * struct field encodings are different
2022-07-19 19:10:12 -07:00
Loris Cro
ad7bc57919 autodoc: fix rendering of function arguments 2022-07-19 19:10:12 -07:00
Loris Cro
8ec34eb046 autodoc: handle result location instructions 2022-07-19 19:10:12 -07:00