xackus
e7cc456421
better error messages and more tests
2020-03-09 22:33:18 +01:00
xackus
7782c76bee
fix failed assert on generic fn opaque return type
2020-03-08 18:05:45 +01:00
Andrew Kelley
f90fe1f8f2
Merge pull request #4687 from daurnimator/fix-typo
...
Fix grammar from "C pointers cannot point opaque types"
2020-03-08 12:44:56 -04:00
Andrew Kelley
a5cb19c0ac
Merge pull request #4690 from Vexu/translate-c
...
Translate-c fixes
2020-03-08 12:43:49 -04:00
LemonBoy
2b1316954f
std: One more cpuid fix
...
Don't read from stale eax value, rework the logic a bit so that's clear
what's going on.
2020-03-08 12:43:32 -04:00
Vexu
692a974c3e
translate-c reject structs with VLAs
2020-03-08 12:11:37 +02:00
Vexu
5aa993cd61
translate-c fix nested loops without blocks.
2020-03-08 11:26:53 +02:00
daurnimator
c8050a931c
Strip trailing whitespace from src/ir.cpp
2020-03-08 19:18:25 +11:00
daurnimator
b85bb152bf
Fix grammar in error message
2020-03-08 19:18:06 +11:00
Andrew Kelley
9e60c89601
Revert "Translate C: Group generated casts"
...
This reverts commit 895672b3f9
.
2020-03-08 03:53:06 -04:00
Andrew Kelley
8b80cb3072
Revert "translate-c remove redundant grouping, fix nested loops without blocks."
...
This reverts commit abe7305e16
.
2020-03-08 03:52:52 -04:00
Jared Miller
cf38ce9701
Implement UTF-8 to UTF-16LE literal conversion
2020-03-07 19:21:28 -05:00
Andrew Kelley
6ac76bc25e
add missing errors to std.os.windows.CreateDirectoryError
2020-03-07 19:13:21 -05:00
Andrew Kelley
0720f338d4
add std.event.Loop pread and faccessat
...
progress towards std lib tests passing with evented I/O mode
2020-03-07 19:13:21 -05:00
LemonBoy
c5885f012a
std: Fix version detection on x86
...
Call xgetbv only if X{SAVE,RESTORE} and AVX are detected.
Closes #4670
2020-03-07 18:53:34 -05:00
Andrew Kelley
c25d9417d3
fix std.fs.makeDirAbsolute
...
closes #4671
2020-03-07 15:14:47 -05:00
Vexu
abe7305e16
translate-c remove redundant grouping, fix nested loops without blocks.
2020-03-07 12:14:44 -05:00
Lachlan Easton
895672b3f9
Translate C: Group generated casts
...
Translate C: Put an alignCast in c style pointer casts to allow opaque types to cast properly in C macros
Translate C: add test case for aligning opaque types in pointer casts
Translate C: Fix @typeId -> @typeInfo
Add test case to run_translated_c for casting from pointer to opaque type
2020-03-07 03:26:42 -05:00
Andrew Kelley
80ff549e26
fix detectNativeCpuAndFeatures including foreign asm
2020-03-06 21:03:23 -05:00
Andrew Kelley
54799ccaf8
Merge branch 'alichay-master'
...
Closes #4627
2020-03-06 20:47:34 -05:00
Andrew Kelley
e0d5f94a70
simplify the inline assembly
2020-03-06 20:02:08 -05:00
Andrew Kelley
49817c6add
cleanup CPU model & feature detection
...
Add std.Target.Cpu.Model.generic which is even more empty than baseline.
CPU model and feature detection uses this rather than baseline.
Rename cpu_detected to cpu_detection_unimplemented and flip the logic.
It can be relied on by stage2.zig to decide whether the LLVM workaround
is needed without also checking the CrossTarget.
Move the CPU detection to after the OS detection, and use the detected
OS for the CPU detection. This is relevant because operating systems
sometimes emulate certain CPU features, so knowing the OS and version is
relevant for determining CPU features.
Prepare for #4592 by passing the CPU arch to the detection code, instead
of having it rely on Target.current.
The CPU model & feature detection logic is modified. Before:
* Detect actual features
* Use as hint when detecting CPU model
* Populate dependencies of CPU model features
* Merge that into the actual features set
After:
* Detect actual features
* Use as hint when detecting CPU model
* Add known CPU model features to actual features
* Detect actual features again, overriding known CPU model features
* Populate dependencies
2020-03-06 19:47:03 -05:00
alichay
f199182567
Cleaned up CPU detection and fixed incorrect detection bits.
2020-03-06 18:52:09 -05:00
alichay
e24f29bbad
Added self-hosted x86 CPU detection.
2020-03-06 18:52:09 -05:00
Andrew Kelley
7f975bf09f
Merge branch 'daurnimator-less-buffer'
...
Closes #4405
Closes #4656
2020-03-06 18:49:26 -05:00
Andrew Kelley
231a4b8fde
fixups & make some API decisions
...
Removed:
std.io.InStream.readUntilDelimiterBuffer
Deprecated:
std.ArrayList.toSlice
std.ArrayList.toSliceConst
std.ArrayList.at
std.ArrayList.ptrAt
std.ArrayList.setOrError
std.ArrayList.set
std.ArrayList.swapRemoveOrError
std.Buffer.toSlice
std.Buffer.toSliceConst
std.io.InStream.readFull => std.io.InStream.readAll
std.io.InStream.readAllBuffer
New:
std.ArrayList.span
std.ArrayList.expandToCapacity
std.Buffer.span
std.io.InStream.readUntilDelimiterArrayList
2020-03-06 18:49:13 -05:00
daurnimator
4114b63d75
std: use std.ArrayList instead of std.Buffer in std/fmt.zig tests
2020-03-06 18:49:13 -05:00
daurnimator
1cbf352cfb
Remove unused std.Buffer imports
2020-03-06 18:49:13 -05:00
daurnimator
5c0d6ef5ec
std: use ArrayList instead of Buffer from std/process.zig
2020-03-06 18:49:12 -05:00
daurnimator
d136c795af
Fix bug where stdout was checked instead of stderr
2020-03-06 18:49:12 -05:00
daurnimator
8f627593eb
Use in_stream.readAllAlloc where sensible
2020-03-06 18:49:12 -05:00
daurnimator
bcf56c32eb
std: use ArrayList rather than Buffer for in_stream helper functions
...
Buffer's behaviour of retaining a trailing 0 isn't helpful here
2020-03-06 18:49:12 -05:00
daurnimator
fd23decbd9
std: add ArrayList.eql for parity with std.Buffer
2020-03-06 18:49:12 -05:00
daurnimator
119ac13eda
std: add .startsWith and .endsWith to std.ArrayList
2020-03-06 18:49:10 -05:00
Andrew Kelley
fa46bcb368
stage1: make get_optional_type more robust
...
Now it will emit a compile error rather than crashing when the child
type has not been resolved properly.
Introduces `get_optional_type2` which should be used generally inside
ir.cpp.
Fix some std lib compile errors noticed by the provided test case.
Thanks @LemonBoy for the test case. Closes #4377 .
Fixes #4374 .
2020-03-06 18:30:30 -05:00
Vexu
83d27f71ef
translate-c more macro ops
2020-03-06 17:34:37 -05:00
Andrew Kelley
7df9169081
Merge pull request #4651 from LemonBoy/fix-4645
...
std: Nicer way to access the PEB
2020-03-06 17:33:05 -05:00
Andrew Kelley
3163a16617
?HMODULE instead of HMODULE
2020-03-06 16:57:59 -05:00
Andrew Kelley
0e5b48d1a2
fix `@embedFile` docs
2020-03-06 16:01:26 -05:00
Andrew Kelley
3dc8cb12e8
ir: remove pointless and misleading code in `@embedFile`
2020-03-06 15:55:18 -05:00
LemonBoy
2e04b61275
std: Work around unexported NtCurrentTeb
...
Apparently NtCurrentTeb is only exported for i386 and some other
platforms but not for x86_64 nor AArch64. Let's go with the flow and
provide our own NtCurrentTeb like the Windows headers do.
Thank you Microsoft.
2020-03-06 09:17:14 +01:00
LemonBoy
b9a1d67637
std: Nicer way to access the PEB
...
Use the NtCurrentTeb API instead of using some inline asm, this is much
nicer and also more portable.
Closes #4645
2020-03-06 09:06:26 +01:00
Vexu
eaccfffe56
translate-c: default initialize non-extern variables to undefined
2020-03-06 00:06:45 -05:00
Andrew Kelley
6b069f5c8c
Revert "put FreeBSD CI in timeout for misbehavior"
...
This reverts commit c0c9303bd6
.
Thanks to commit c08444b33f
we can now
re-enable FreeBSD in the CI.
2020-03-05 23:37:29 -05:00
Michael Dusan
d31b65e762
std: fix sendfile on macOS and FreeBSD
...
- fix std.os.sendfile/FreeBSD use correct in/out fd_t
- fix std.os.sendfile/macOS use correct in/out fd_t
- undo 1141bfb21b
(no longer needed)
- fix c.freebsd.sendfile use off_t value
- fix c.freebsd.sendfile decl correct in/out fd_t
- fix c.darwin.sendfile decl correct in/out fd_t
fix signature param names
2020-03-05 20:46:28 -05:00
Michael Dusan
428677ea36
stage1: fix regression
...
- regression was introduced by 371c21aa70
2020-03-05 20:45:01 -05:00
Michael Dusan
c08444b33f
srht: workaround FreeBSD fiasco
2020-03-05 19:47:28 -05:00
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 debcc79d56
.
This caused a regression when building self-hosted
2020-03-05 17:19:01 -05:00
Michaël Larouche
f5954dad83
Fix crash when freeing empty string as null-terminated sentinel
2020-03-05 17:08:12 -05:00
Michael Dusan
1091fee242
std: format enum-literals
2020-03-05 16:03:12 -05:00