10872 Commits

Author SHA1 Message Date
Veikka Tuominen
3e084d8de3 Sema: only untyped undefined should coerce to all types
Closes #13958
2023-01-05 14:26:53 +02:00
Veikka Tuominen
01dba1c054 Sema: add system for checking backend feature support 2023-01-05 14:26:53 +02:00
Veikka Tuominen
0ecec5fcca resolve some TODOs 2023-01-05 14:26:53 +02:00
Veikka Tuominen
352c71873b Sema: improve struct/union field error locations
Closes #14206
2023-01-05 13:11:36 +02:00
Veikka Tuominen
f83834993e std: collect all options under one namespace 2023-01-05 02:31:29 -07:00
Michael Dusan
e0fb4c29cb llvm codegen: fix f16,f32,f64 nan bitcasts
@bitCast from integer NaN representation to float NaN resulted in
changed bits in float. This only happened with signaled NaN.

- added test for signaled NaN
- added tests for quiet NaN (for completeness)

closes #14198
2023-01-05 02:22:30 -07:00
Casey Banner
a3e2ee0911
Fix another LockViolation case on Windows (#14162)
- Add an assert that an exclusive lock is help to writeManifest
- Only call writeManifest in updateCObject if an exclusive lock is held
- cache: fixup test to verify hits don't take an exclusive lock, instead of writing the manifest
2023-01-04 14:51:43 -05:00
Veikka Tuominen
83fd45d820
Merge pull request #13786 from ziglang/tty-detection
stage2: make --color on affect progress bar too
2023-01-04 16:54:46 +02:00
Maciej 'vesim' Kuliński
2b9478ce12 Sema: implement AVR address spaces
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2023-01-04 01:26:50 +02:00
joachimschmidt557
09122650ba stage2 AArch64: bump up alignment of stack items fitting in regs
This enables us to use more efficient loading and storing for these
small stack items
2023-01-03 19:56:09 +01:00
Loris Cro
755f50a986 autodoc: restore generic function functionality
latest changes to zir encoding broke simple return type detection
2023-01-03 18:20:06 +01:00
Veikka Tuominen
abd005f302 Sema: do not immediately destroy failed generic instantiation
Closes #12535
Closes #12765
Closes #12927
2023-01-03 18:38:15 +02:00
Luuk de Gram
7935135767
Merge pull request #14157 from Luukdegram/wasm-linker-misc
wasm-linker: various fixes & improvements
2023-01-03 15:47:16 +01:00
Andrew Kelley
a31ff072d1 stage2: make --color on affect progress bar too
Before, --color on would affect colored compile error printing but not
affect terminal progress bar printing. It was intended for this option
to affect both; now it does.

This causes a failure when building the language reference, which
contains code for parsing terminal output and rendering HTML. Now it
must be expanded to handle 'K' and 'D' codes to simulate a terminal
cursor moving, and the CI will fail until that capability is added in a
later commit of this branch.

I extracted this change from #13560 so that the idea is not lost but we
can solve this issue separately.
2023-01-03 13:46:47 +02:00
Guillaume Wenzek
a44085dc2a
add -fopt-bisect-limit 2023-01-03 13:05:09 +02:00
Luuk de Gram
b9224c172f
wasm-linker: Fix & mangle symbol name of imports
When outputting the names section, we should output the actual symbol
name rather than the import name. This makes sure that symbols with
an explicit name set have the correct name but retain the import name
too.

We also now correctly mangle the name of an extern function with an
explicit library name. This ensures that functions that have a
different library name, but the same import/function name, can be
resolved correctly with other modules and don't resolve to the
same symbol.
2023-01-03 10:02:54 +01:00
Andrew Kelley
c9ef277fa7
Merge pull request #13980 from ziglang/std.net
networking: delete std.x; add std.crypto.tls and std.http.Client
2023-01-03 02:43:50 -05:00
Michael Dusan
d78a2619ba
link.Elf: resolve CsuObjects TODO 2023-01-02 19:18:32 -05:00
Andrew Kelley
ebcfc86bb9 Compilation: better error message for file not found 2023-01-02 16:57:15 -07:00
Andrew Kelley
c1f404ad53 Compilation: fix merge conflict with previous commit 2023-01-02 16:41:13 -07:00
Andrew Kelley
9bcd48e40e Revert "make a .rsp file for zig clang"
This reverts commit 9db293492bbbc5b8d70638bd9c59dea19d13596c.

It's not OK to call `realpath` in the compiler.

Reopens #12419
2023-01-02 16:31:45 -07:00
Andrew Kelley
df5fcf5432
Merge pull request #14159 from Vexu/err-fix
Sema: prevent spurious "depends on itself" errors
2023-01-02 17:37:27 -05:00
kcbanner
9c951cc874 fmt fixups 2023-01-02 13:56:32 -07:00
Luuk de Gram
e475ddb08e
wasm-linker: export symbols by virtual address
When exporting a data symbol, generate a regular global and use
the data symbol's virtual addres as the value (init) of the global.
2023-01-02 18:36:18 +01:00
Luuk de Gram
86ed96d933
wasm-linker: check for undefined symbols
Unless the `--import-symbols` flag is set, in which case we don't
check for any undefined data symbols.
2023-01-02 18:36:18 +01:00
Luuk de Gram
3ca3fe94f4
wasm-linker: improve indirect function table
Rather than checking for function pointers during the writing phase,
we now create a synethtic symbol when a new link job has started.
This means the symbol can correctly be resolved during link time
with the indirect function table from other object files, ensuring
we are properly performing relocations and our binary writer is now
unaware of any of its logic and simply emits the table according to
the symbol such as any other symbols.
2023-01-02 18:36:17 +01:00
Luuk de Gram
9932372fae
wasm-linker: support export flags
Adds support for both the `-rdynamic` and the `--export=<value>`
flags. Support is added to both the incremental linker as well as
the traditional linker (zld).
2023-01-02 18:36:14 +01:00
Veikka Tuominen
b048fa4f13 Sema: prevent spurious "depends on itself" errors
Closes #14059
2023-01-02 19:23:09 +02:00
Veikka Tuominen
332a43858a Sema: @intToEnum on non-exhaustive enum at comptime should check int is in range
Closes #14155
2023-01-02 17:06:06 +02:00
kcbanner
676e4f3824 cbe: changes to get zig2.c compiling under msvc
- Add cpuid / getXCR0 functions for the cbe to use instead of asm blocks
- Don't cast between 128 bit types during truncation
- Fixup truncation to use functions for shifts / adds
- Fixup float casts for undefined values
- Add test for 128 bit integer truncation
2023-01-01 16:44:29 -05:00
kcbanner
f07d33f54b cbe: fixes for compiling zig2.c under msvc
- add zig_mul_i128
- render slice structs in static initializers without casts / c99 style init
- add negative numbers and u128 to 128-bit multiply test
2023-01-01 16:44:29 -05:00
kcbanner
6ed049fe36 cbe: all behaviour tests now pass on msvc
- Fix zig_clz_u128 not respecting the bits argument. This was crashing the compile-rt addxf3 tests with the cbe
- Instead of redering a negation for negative 128 bit int literals, render the literal as twos complement. This allows
rendering int representations of floats correctly (specifically f80).
2023-01-01 16:44:29 -05:00
kcbanner
2d34477dbb cbe: msvc atomics
- Implement most atomic operations for msvc
- Disable "atomicrmw with floats" test for cbe
2023-01-01 16:44:28 -05:00
kcbanner
b86a8b4a5b cbe: airNot emits zig_not_ calls for integers 2023-01-01 16:44:28 -05:00
kcbanner
3d4ff4fdda cbe: 32 bit fixup for update-zig1 2023-01-01 16:44:28 -05:00
kcbanner
7fb3683c32 cbe: more msvc compatibility work
- Add .StaticInitializer to ValueRenderLocation to indicate that the emitted values
must be constant expressions (no function calls, struct casting).
- Add new path for special float types (nan, inf) that works in constant expressions
- Implement windows.teb() using a syscall for .stage2_c because x64 MSVC
doesn't support any kind of inline asm
2023-01-01 16:44:28 -05:00
kcbanner
7f3bc45772 cbe: nan builtins on msvc, fixup C2099 errors in static initializers
- Map the __builtin_nan(f|l)? functions to nan(f|l)? on msvc
- MSVC throws C2099 when initializing a struct with cast syntax
in a global initializer.  Added zig_as_init_  to handle this case,
 and generate it only in static initializers for > 64 bit ints.
- Change float initialization to emit the integer representation
in global initializers to avoid C2099 caused by calling nan.
2023-01-01 16:44:28 -05:00
kcbanner
351025dc05 cbe: msvc compatible int casting inside renderValue .Packed branch
- Handle non-abiInt source types (like packed union) as sources in renderIntCast
2023-01-01 16:44:28 -05:00
kcbanner
00b54a5fe5 cbe: more msvc fixes
- Add Function.renderIntcast to handle common casting cases
- Fixup casting inside aggregate initialization
- Remove redundant cast in aggregate initialization
- Fix renderValue .Packed branch for > 64 bit types
2023-01-01 16:44:28 -05:00
kcbanner
36212e9d17 cbe: msvc compatibility for > 64 bit intcasts and truncating from > 64 to < 64 bit
- Uses zig_as/zig_lo as necessary when int casting to support !zig_has_int128
- Remove redundant cast if the type is the same
- Use zig_lo when truncating > 64 bits
2023-01-01 16:44:28 -05:00
kcbanner
7225a0043e cbe: handle msvc struct casting quirk
MSVC can't explicitly cast a struct to a typedef of itself (ie. f128 to i128). Added a
set of macros to handle float casting, and to not produce a cast for this specific
case on MSVC. A better approach would probably be to know if the cast is redundant
and not do it.
2023-01-01 16:44:27 -05:00
kcbanner
e6ef579609 cbe: fixup casting to/from 128 bit int types, as they may not have compiler support 2023-01-01 16:44:27 -05:00
kcbanner
a43fdc1620 cbe: first set of changes for msvc compatibility
- Forward declare int builtins, so the definitions aren't assumed incorrectly
- Add define to handle MSVC not support static const in function parameter array lengths
- Fixup several spots where int128 support was assumed.
- Support zig_align
- Support zig_export
- Stub out some missing non-builtin functions
- Added StringLiteral to automatically split string literals when they get to 16380 in size,
which is the maxmimum pre-concatenation string literal size on MSVC.
2023-01-01 16:44:27 -05:00
Veikka Tuominen
af197d4954
Merge pull request #14130 from Vexu/debug-info
Debug info fixes
2022-12-31 11:47:56 +02:00
Manlio Perillo
2419061246 x86_64: remove extra whitespace
Remove extra whitespace at the end of a line in Emit.zig, in regions
where zig fmt is off.
2022-12-30 15:01:19 -05:00
Veikka Tuominen
bd711dfd25 llvm: do not pad vector element debug types 2022-12-30 21:24:40 +02:00
Veikka Tuominen
f874b5e1e0 llvm: work around lldb bugs
Closes #14122
2022-12-30 17:00:50 +02:00
Veikka Tuominen
67316e2eab AstGen: fix dbg_block_end being inserted before last instruction in block
Closes #14125
2022-12-30 17:00:50 +02:00
Veikka Tuominen
4e64373fc0 fix generic function arg debug info referencing wrong parameter
Closes #14123
2022-12-30 17:00:50 +02:00
Andrew Kelley
40ba4d4a89
Merge pull request #14102 from Luukdegram/wasm-undefined-symbols
WebAssembly: remove unconditional --allow-undefined flag
2022-12-29 17:59:44 -05:00