19942 Commits

Author SHA1 Message Date
Veikka Tuominen
e2dc77ab62 Sema: correct one possible value for tuples
Closes #12376
2022-08-28 15:41:21 +03:00
Veikka Tuominen
776caaf999 Sema: fix handling of non-standard int types in empty non-exhaustive enums
Closes #12649
2022-08-28 15:41:21 +03:00
Veikka Tuominen
6aead18ab3 add error tests for now correctly behaving cases
Closes #6377
2022-08-28 15:41:21 +03:00
Veikka Tuominen
1401890ed5 Sema: add error for switch on slice
Closes #12651
2022-08-28 15:41:21 +03:00
Veikka Tuominen
fc213e2d61 AstGen: add error for named function type
Closes #12660
2022-08-28 15:41:21 +03:00
Justin Whear
5bb8c03697
std.random: add weightedIndex function
`weightedIndex` picks from a selection of weighted indices.
2022-08-28 14:19:51 +03:00
Loris Cro
0f27836c21 ci: fix wrong path when deploying stdlib docs 2022-08-28 01:20:38 +02:00
Loris Cro
e0103704c5 autodoc: better line counting for decls 2022-08-27 22:48:18 +02:00
Henrique Dante de Almeida
ee12264387 docs: Remove mention of type inference on anytype struct fields
It was removed from the language.
2022-08-27 20:34:13 +02:00
antlilja
ae8d26a6a0 Sema: add error for non-comptime param in comptime func
Adds error for taking a non comptime parameter in a function returning a
comptime-only type but not when that type is dependent on a parameter.

Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-08-27 11:17:48 +03:00
David Gonzalez Martin
da95da438e Add behavior test coverage for nested packed struct field access
Closes #3091
2022-08-26 21:43:38 -04:00
Sébastien Marie
8bcb962ada openbsd: fix sigcontext struct and avoid defining fxsave64
`sc_fpstate` member of `struct sigcontext` is a `struct fxsave64 *`.
use *anyopaque to represent it.

avoid to defining `fxsave64` as it is a packed struct with some arrays.
2022-08-26 17:30:07 +02:00
Loris Cro
2e0ff6c700
Merge pull request #12600 from ominitay/autodocs-errorset
autodocs: improve error set rendering
2022-08-26 16:36:06 +02:00
Loris Cro
a69a16c6bd
Merge pull request #12601 from ominitay/autodocs-shortdesc
autodocs: improve first-line descriptions
2022-08-26 16:35:00 +02:00
Jakub Konka
02e6960966 coff: do not pull in std.log into coff.zig definitions 2022-08-26 16:14:44 +02:00
Motiejus Jakštys
9038528187 copy_file_range: fix zigification of TXTBSY
From `copy_file_range(2)` errors:

    ETXTBSY
           Either fd_in or fd_out refers to an active swap file.

Same error will be used in the upcoming `ioctl_ficlonerange(2)`:

    ETXTBSY
           One of the files is a swap file.  Swap files cannot share storage.
2022-08-26 15:36:40 +03:00
martinhath
3fa5415253
Sema: ensure resolveTypeFields is called for optional and error union types
We call `sema.resolveTypeFields` in order to get the fields of structs
and unions inserted into their data structures. If it isn't called, it
can happen that the fields of a type is queried before those fields are
inserted into (for instance) `Module.Union.fields`, which would result in
a wrong 'no field named' error.

Fixes: #12486
2022-08-26 11:37:17 +03:00
Evan Haas
bcaa9df5b4 translate-c: Don't add self-defined macros to global name table
A self-defined macro is one of the form `#define FOO FOO`

Those types of macros have never been translated; this change will cause
any macros which refer to them to be translated as `@compileError` instead
of referring to a non-existent identifier.

Closes #12471
2022-08-26 11:24:57 +03:00
David Gonzalez Martin
d6bb9af18d stage2: Reference to void constants
Closes #7567
2022-08-26 00:00:22 -04:00
Andrew Kelley
aa4544963c
Merge pull request #12629 from motiejus/libresolv-abilists
glibc/abilists: add libresolv stubs
2022-08-25 23:33:59 -04:00
Andrew Kelley
d2ad8afff4 LLVM: fix missing alignment on wrapping instructions
Previously, when lowering AIR instructions `wrap_errunion_payload`,
`wrap_errunion_err`, and `wrap_optional`, the LLVM backend would create
an alloca instruction to store the result, but did not set the alignment
on it. This caused UB which went undetected for a long time until we
started enabling the stack protector.

Closes #12594
Unblocks #12508
Inspires #12634

Tests passed locally:
 * test-behavior
 * test-cases
2022-08-25 16:15:48 -07:00
Andrew Kelley
9d231c4991 CI: drone: reduce duration of the bottleneck
Empirically, the ReleaseSmall std lib tsets take about 55 minutes on the
CI, and is the bottleneck causing timeouts. So this commit disables full
coverage in favor of running a smaller set of ReleaseSmall std lib tests.
2022-08-25 15:23:01 -07:00
Jakub Konka
d5233ee85c add ability to pass force undefined symbols to the linker
This commit enables `-u <symbol>` for ELF and `-include:<symbol>` for
COFF linkers for use internally. This means we do not expose these
flags to the users just yet, however, we make use of them internally
whenever required. One such use case is forcing inclusion of
`_tls_index` when linking for Windows with mingw and LTO and dead
code stripping enabled. This ensures we add `_tls_index` to the symbol
resolver as an undefined symbol and force the linker to include an atom
that provides it marking it a dead-code-stripping root - meaning it will
not be garbage collected by the linker no matter what.
2022-08-25 16:23:01 -04:00
Jakub Konka
ba346ecfe9 run_translated_c: disable failing test on Windows
ziglang/zig#12630
2022-08-25 17:01:49 +02:00
Motiejus Jakštys
29e90efbb1 src/glibc: remove redundant Arch
abilists now use Zig's arch, no need for a separate one.
2022-08-25 16:46:32 +03:00
Motiejus Jakštys
ea785f70ef glibc/abilists: add libresolv stubs
Generated with https://github.com/ziglang/glibc-abi-tool/pull/2

Fixes #12628
2022-08-25 16:36:10 +03:00
Veikka Tuominen
4405188cf7 Sema: ignore comptime params in partial func type check
This fixes a bug exposed by cd1833044ab7505bc101c85f59889bd3ea3fac80
where a function type would be converted to generic_poison even after
being instantiated due to containing comptime only types.

This could also be fixed by just checking `is_generic_instantiation`
but this way also provides better type names.

Closes #12625
2022-08-25 16:29:23 +03:00
Andrew Kelley
3a7ea0b65e fix order of CLI args passed to clang
Commit eb3f7d2f37cab1d3df7c4493b8239e802b83e521 changed the order of CLI
args passed to clang, making object-specific "extra flags" passed first.
However, these are supposed to be able to override other flags, and this
behavior is exploited by workarounds in mingw.zig to disable LTO.

This commit rectifies the situation by moving extra flags back to being
passed after the call to addCCArgs().
2022-08-25 03:10:41 -07:00
Andrew Kelley
7453f56e67 stage2: explicitly tagged enums no longer have one possible value
Previously, Zig had inconsistent semantics for an enum like this:

`enum(u8){zero = 0}`

Although in theory this can only hold one possible value, the tag
`zero`, Zig no longer will treat the type this way. It will do loads and
stores, as if the type has runtime bits.

Closes #12619

Tests passed locally:
 * test-behavior
 * test-cases
2022-08-24 22:20:31 -07:00
Andrew Kelley
af19909b9c stage2: fix generic function cleanup
When removing generic function instantiations from monomorphed_funcs, we
need to first make sure the function is generic, otherwise the hash map
tries to access the `hash` field of the function which is undefined.

closes #12614
2022-08-24 16:47:58 -07:00
Andrew Kelley
f4980a4800 CI: windows: update tarball
needed because of some changes to std.dwarf
2022-08-24 16:18:42 -07:00
Andrew Kelley
a9af472728 Compilation: move comptime condition first
Avoids compile error on Windows due to not having execv capabilities.

Fixup for eb3f7d2f37cab1d3df7c4493b8239e802b83e521.

See #6768
2022-08-24 15:19:31 -07:00
Jonas Gollenz
07afd5bdba docs: remove confusion about align[For|Back]ward 2022-08-24 17:18:29 -04:00
max
d8e22fcb20 fix coff.zig with const qualifier convert problem 2022-08-24 22:49:47 +02:00
Sébastien Marie
397099b7ee pthread_key_create: make it build with stage2 2022-08-24 16:35:01 -04:00
Loris Cro
eb3f7d2f37 compilation: avoid pointless caching
When the entire purpose of this compilation is to perform a single zig
cc operation we could "tail call" clang by doing an execve, and any use
of the caching system would actually be problematic since the user is
presumably doing their own caching by using dep file flags.

Fixes #12317
2022-08-24 16:33:01 -04:00
Andrew Kelley
7a881435ed
Merge pull request #12623 from Vexu/stage2-fixes
Stage2 fixes
2022-08-24 15:59:46 -04:00
Andrew Kelley
2a96209c40
Merge pull request #12574 from Vexu/remove-bit-op-type-param
stage2+stage1: remove type parameter from bit builtins
2022-08-24 15:57:44 -04:00
Andrew Kelley
80b8294bcc test-stack-traces: restore test coverage
reverts 1ce71c86bff351a4ade4321e188a13c9d3cff8b4
2022-08-24 12:57:31 -07:00
Andrew Kelley
40c9b13608 CI: x86_64-linux: update tarball
I thought this would be needed for dwarf 4 but I think it's not actually
needed. Anyway the tarball is fresher, might as well use it.
2022-08-24 12:57:31 -07:00
Felix "xq" Queißner
b466f8c817 Enables std.build.TranslateCStep to use stage1/stage2 selectively. Unbreaks projects using stage1 and manual TranslateC 2022-08-24 15:41:27 -04:00
Veikka Tuominen
69a3c4e279 Sema: correctly reset inst_map for analyzeInlineCallArg
Closes #12622
2022-08-24 21:31:02 +03:00
Veikka Tuominen
f49dff64c6 Sema: check one possible value earlier in zirValidateArrayInit
Closes #12566
2022-08-24 21:31:02 +03:00
Veikka Tuominen
1d0b729f28 Sema: fix crash on slice of non-array type
Closes #12621
2022-08-24 21:31:02 +03:00
Veikka Tuominen
cd1833044a Sema: do not construct nested partial function types
Closes #12616
2022-08-24 21:31:02 +03:00
Will Hawkins
5fd5950c92 Doc: Add hyphenation for top-level doc 2022-08-24 20:00:46 +03:00
Veikka Tuominen
d515d37934 AstGen: make root decls relative to beginning of file
Closes #12610
2022-08-24 15:26:49 +03:00
Veikka Tuominen
38215ccc3e stage2: handle int_u64 in elemValueAdvanced
Closes #12599
2022-08-24 15:04:31 +03:00
Felix "xq" Queißner
5696cc8ab6 Adds std.meta.FnPtr for easier stage1/stage2 compatibility 2022-08-24 03:13:44 -04:00
Andrew Kelley
5db80a051f Revert "std.os: add INVALID_SOCKET (#12081)"
This reverts commit 0f01e812ff054ea83661272bf0a96af228f2ffe3.

This does not belong in `std.posix`, and it is already provided at
`std.os.windows.ws2_32.INVALID_SOCKET`.

See related issue #5019.
2022-08-23 21:30:23 -07:00