3763 Commits

Author SHA1 Message Date
Andrew Kelley
01c722c21c
Revert "Allow constant struct val to reallocate its fields when resolving an inferred struct field with a comptime value."
This reverts commit debcc79d56a40f77b92e243b4e344fc9385bd405.

This caused a regression when building self-hosted
2020-03-05 17:19:01 -05:00
Alexandros Naskos
debcc79d56 Allow constant struct val to reallocate its fields when resolving an inferred struct field with a comptime value. 2020-03-05 15:48:03 -05:00
Andrew Kelley
c0242f2310
update mingw-w64 source files to v7.0.0 2020-03-05 15:41:28 -05:00
Michael Dusan
371c21aa70
stage1: housekeeping
- use consistent allocator in `realloc_const_vals_ptrs()`
- unexport `create_fn_raw()`
2020-03-05 12:17:47 -05:00
Andrew Kelley
3e3d464884
@TypeOf avoids heap allocation for only 1 parameter 2020-03-04 17:43:23 -05:00
LemonBoy
2e3e8d0c74
ir: Adapt ir_print for the new @TypeOf format 2020-03-04 17:21:10 -05:00
LemonBoy
0c310f0fbf
ir: Implement @TypeOf with multiple arguments
Closes #439
2020-03-04 17:21:10 -05:00
Andrew Kelley
24fc69acad
Merge pull request #4573 from alexnask/tuple_concat
Allow concatenation of tuples that contain a mix of runtime and comptime values
2020-03-04 17:09:43 -05:00
Andrew Kelley
f247a90541
get_codegen_ptr_type returns possible error
And fix most of the fallout. This also makes optional pointers not
require resolving zero bits, because the comptime value struct layout no
longer depends on whether the type has zero bits.

Thanks to @LemonBoy for the behavior test case

Closes #4357
Closes #4359
2020-03-04 17:04:59 -05:00
Timon Kruiper
e095475d92 Fix docs generation
Commit edb210905dcbe666fa5222bceacd2e5bdb16bb89 caused the docs generation
to fail, because all the type information in pass1 was already freed in
`zig_llvm_emit_output`.
2020-03-04 09:59:21 -05:00
Alexandros Naskos
b838122cc0 Merge branch 'master' of https://github.com/ziglang/zig into tuple_concat 2020-03-02 00:55:19 +02:00
Alexandros Naskos
78e4daaa03 Removed unused variable 2020-03-02 00:54:57 +02:00
Andrew Kelley
b99c6d56da
stage1: fix compilation on 32-bit arm 2020-03-01 03:27:09 -05:00
Andrew Kelley
7617610400
Merge pull request #4550 from ziglang/os-version-ranges
introduce operating system version ranges as part of the target; self-host native dynamic linker detection and native glibc version detection
2020-02-29 01:57:06 -05:00
Alexandros Naskos
1b41f2d77e
C pointer slices are no longer allowzero (#4462)
* Slices from C pointers are no longer allowzero but instead insert a runtime assertion.

* Added a test, fixed code for cases with non-allowzero C pointers

* Create new type when flipping allow_zero, sometimes we get a cached value back from adjust_ptr_len.

* Added comments, changed panic message

* Added runtime safety test.
2020-02-29 01:36:42 -05:00
Andrew Kelley
3cba603eae
fix crash when building docgen 2020-02-29 01:05:11 -05:00
Andrew Kelley
a5a53a182a
fix typo from other commit
d2535c003c6188fcc362028e01ef9f7fb3356727
2020-02-28 16:06:06 -05:00
Andrew Kelley
bee4007ec9
fix crash with multiple comptime fn calls and...
...default initialized array to undefined

closes #4578
2020-02-28 15:49:19 -05:00
Andrew Kelley
578dc16910
fix compiler crash when comptime parsing targets 2020-02-28 15:41:30 -05:00
Andrew Kelley
500dde32d5
dynamic_linker becomes a field of std.zig.CrossTarget 2020-02-28 14:51:56 -05:00
Andrew Kelley
ef24f2dd93
remove special darwin os version min handling
now it is integrated with zig's target OS range.
2020-02-28 14:51:56 -05:00
Andrew Kelley
d45ea4d89d
stage1: make get_native_target go through self-hosted 2020-02-28 14:51:56 -05:00
Andrew Kelley
c8669a4cf8
improve debug info for optionals 2020-02-28 14:51:54 -05:00
Andrew Kelley
d4f375c46b
stage1: remove get_self_libc_path
and glibc_detect_native_version
2020-02-28 14:51:53 -05:00
Andrew Kelley
4616af0ca4
introduce operating system version ranges as part of the target
* re-introduce `std.build.Target` which is distinct from `std.Target`.
   `std.build.Target` wraps `std.Target` so that it can be annotated as
   "the native target" or an explicitly specified target.
 * `std.Target.Os` is moved to `std.Target.Os.Tag`. The former is now a
   struct which has the tag as well as version range information.
 * `std.elf` gains some more ELF header constants.
 * `std.Target.parse` gains the ability to parse operating system
   version ranges as well as glibc version.
 * Added `std.Target.isGnuLibC()`.
 * self-hosted dynamic linker detection and glibc version detection.
   This also adds the improved logic using `/usr/bin/env` rather than
   invoking the system C compiler to find the dynamic linker when zig
   is statically linked. Related: #2084
   Note: this `/usr/bin/env` code is work-in-progress.
 * `-target-glibc` CLI option is removed in favor of the new `-target`
   syntax. Example: `-target x86_64-linux-gnu.2.27`

closes #1907
2020-02-28 14:51:53 -05:00
Andrew Kelley
fba39ff331
restructuring std.Target for OS version ranges, pass 1 2020-02-28 14:51:50 -05:00
Michael Dusan
a6087a7bc1
stage1: housekeeping 2020-02-28 08:30:43 -05:00
Alexandros Naskos
11848fcb5f Removed unused variable 2020-02-28 03:48:30 +02:00
Alexandros Naskos
c020bc27ac More fixes, removed debug prints 2020-02-28 02:43:33 +02:00
Alexandros Naskos
95a1d2feb4 Fixed tuple concatenation with runtime and comptime values. 2020-02-28 02:19:17 +02:00
Andrew Kelley
c39d7a6326
fix exported variable not respecting linkage 2020-02-27 11:51:43 -05:00
LemonBoy
2696c8b42d ir: Robust checking for init expr type
Closes #3979
2020-02-27 10:40:22 -05:00
LemonBoy
fd1eade4ca ir: Allow empty inferred error sets
Closes #4564
2020-02-26 21:02:22 -05:00
Andrew Kelley
62de32a18c
call deinit on the hashmaps introduced in the prev commit 2020-02-26 11:21:10 -05:00
Vexu
215797749d
fix @intToEnum on extern enums 2020-02-26 11:19:40 -05:00
Vexu
d505ea6caf
fix @tagName on extern and non-exhaustive enums 2020-02-26 11:19:39 -05:00
Andrew Kelley
c4a2734aa0
Merge pull request #4561 from LemonBoy/fix-4536-1
Resend of #4552
2020-02-26 11:11:28 -05:00
LemonBoy
d2535c003c ir: Fix regression with self-referencing containers 2020-02-26 10:05:04 +01:00
Andrew Kelley
dad62a7e27
Revert "ir: Fix sizeOf comparison with ptr to zst"
This reverts commit 89812217b4e5fee7e2851266c17c9d47204a1573.

This caused #4560
2020-02-25 21:23:35 -05:00
LemonBoy
e9bac8be6b ir: Fix array to slice conversion for zero-sized arrays
Closes #3848
2020-02-25 17:40:01 -05:00
LemonBoy
55ea855e2c ir: Various fixes for comptime ptr handling
* Correctly fold ptrToInt on optional types
* Generate null as ConstPtrSpecialNull in intToPtr
* Correctly stop ptrToInt on ?*T where T is zero-sized

Closes #4535
2020-02-25 17:38:56 -05:00
LemonBoy
89812217b4 ir: Fix sizeOf comparison with ptr to zst
Closes #4536
2020-02-25 17:36:54 -05:00
Michael Dusan
416a547cdb
Merge pull request #4515 from mikdusan/stage1-gen-constants
stage1: free more heap after analysis
2020-02-25 10:57:47 -05:00
LemonBoy
b46efcde82 ir: Fix sizeOf comparison with ptr to zst
Closes #4536
2020-02-25 12:48:08 +01:00
Vexu
d56115ef41
remove @IntType and @ArgType (mostly) from the compiler 2020-02-25 01:27:34 +02:00
Vexu
3458fb891d
remove @typeId, @memberCount, @memberName and @memberType from the compiler 2020-02-24 23:21:11 +02:00
Andrew Kelley
1d06c82c3b
Merge pull request #4516 from xackus/remove-bytes-to-slice
remove @bytesToSlice, @sliceToBytes from the language
2020-02-24 13:51:47 -05:00
xackus
9c35f680f7 nuke @bytesToSlice, @sliceToBytes in stage1 2020-02-23 19:03:55 +01:00
Andrew Kelley
936d0b18b1
update std lib to integrate with libc for environ
closes #3511
2020-02-22 15:59:13 -05:00
Andrew Kelley
dca19b6757
fix regression in detecting native glibc version
closes #4519
2020-02-21 20:48:50 -05:00