Andrew Kelley
783cb980ab
Release 0.7.1
2020-12-13 12:14:58 -07:00
Andrew Kelley
cf0e453cc9
Merge pull request #7406 from ifreund/dyn-musl2
...
stage2: support dynamically linking musl libc
2020-12-12 16:52:55 -07:00
Andrew Kelley
9d2e5bbcb4
glibc: do not provide -lcrypt
...
glibc is dropping this functionality moving forward.
This is a partial revert of commit
97c0e1cc41
2020-12-12 12:44:41 -07:00
Andrew Kelley
a42c712934
std.fs.path.extension: different behavior for ending dot
...
extension("a.") now returns "." instead of "".
This matches both Python and Node.js standard library behavior as well
as my personal opinion on how this function should be defined.
Apologies for missing this in the code review.
2020-12-11 18:23:57 -07:00
Andrew Kelley
1bbf731e7e
stage2: proper file extension stripping
...
Previously it used mem.split on "." and took the first iterated item.
Now it uses fs.path.extension and strips off that number of bytes.
Closes #7404
2020-12-11 17:44:33 -07:00
Andrew Kelley
a6de0b4136
std.fs.path.extension: add additional API guarantee
...
Added:
The returned slice is guaranteed to have its pointer
within the start and end pointer address range of `path`,
even if it is length zero.
2020-12-11 17:44:27 -07:00
Andrew Kelley
5df9f15843
Merge pull request #7098 from MasterQ32/std.fs.path.extension
...
Implements std.fs.path.extension
2020-12-11 17:44:19 -07:00
Andrew Kelley
4797fdb3db
fix deadlock with build-exe on an object for windows
...
The steps to repro this issue are:
zig build-obj hello.zig -target x86_64-windows-msvc
zig build-exe hello.obj -target x86_64-windows-msvc --subsystem console
-lkernel32 -lntdll
What was happening is that the main Compilation added a work item to
produce kernel32.lib. Then it added a sub-Compilation to build zig's
libc, which ended up calling a function with extern "kernel32", which
caused the sub-Compilation to also try to produce kernel32.lib. The main
Compilation and sub-Compilation do not coordinate about the set of
import libraries that they will be trying to build, so this caused a
deadlock.
This commit solves the problem by disabling the extern "foo" feature
from working when building compiler_rt or libc. Zig's linker code is now
responsible for putting the appropriate import libs on the linker line,
if any for compiler_rt and libc.
Related: #5825
2020-12-11 17:23:55 -07:00
Andrew Kelley
74c17aa8c5
mingw-w64: add .def files for xinput1_4
...
closes #7398
2020-12-11 17:23:50 -07:00
Andrew Kelley
465b90c1fa
mingw-w64: add support for -lwldap32
...
closes #7395
2020-12-11 00:51:28 -07:00
LemonBoy
00664dbdce
zig fmt: Fix alignment of initializer elements
...
Resetting `column_counter` is not needed as the effective column number
is calculated by taking that value modulo `row_size`.
Closes #7289
2020-12-11 00:40:05 -07:00
Vexu
c9bc8b9d0c
zig fmt: improve var decl initializer formatting
2020-12-11 00:39:52 -07:00
Andrew Kelley
fd4c98cbb7
stage2: detect redundant C/C++ source files
...
Cache exposes BinDigest.
Compilation gains a set of a BinDigest for every C/C++ source file. We
detect when the same source/flags have already been added and emit a
compile error. This prevents a deadlock in the caching system.
Closes #7308
2020-12-11 00:33:59 -07:00
Andrew Kelley
21236c0151
CLI: improved local cache directory logic
...
Previously, when choosing the local cache directory, if there was no
root source file, an explicitly chosen path, or other clues, zig would
choose cwd + zig-cache/ as the local cache directory.
This can be problematic if Zig is invoked with the CWD set to a
read-only directory, or a directory unrelated to the actual source files
being compiled. In the real world, we see this when using `zig cc` with
CGo, which for some reason changes the current working directory to the
read-only go standard library path before running the C compiler.
This commit conservatively chooses to use the global cache directory
as the local cache directory when there is no other reasonable choice,
and no longer will rely on the cwd path to choose a local cache directory.
As a reminder, the --cache-dir CLI flag and ZIG_LOCAL_CACHE_DIR
environment variable are available for overriding the decision. For the
zig build system, it will always choose the directory that build.zig is
+ zig-cache/.
Closes #7342
2020-12-10 17:00:46 -07:00
antlilja
ea70a983ba
Added global-cache argument to build system + removed extra args.
...
* Field global_cache_root was added to Builder struct along with
mandatory argument for build_runner.zig. Logic for using the custom
global cache was also added.
* The arguments --cache-dir and --global-cache-dir are no longer passed
directly through to build_runner.zig and are instead only passed through the
mandatory cache_root and global_cache_root arguments.
2020-12-10 17:00:38 -07:00
Vexu
235d56cb82
make std.json.unescapeString pub
2020-12-10 14:10:48 -07:00
Andrew Kelley
b4c0396d3c
CLI: infer --name based on first C source file or object
...
Previously, --name would only be inferred if there was exactly 1 C
source file or exactly 1 object. Now it will be inferred if there is at
least one of either.
2020-12-09 21:21:27 -07:00
Timon Kruiper
97692cb4fe
Do not keep the build.zig cache manifest file locked.
...
This allows to have multiple instances of `zig build` at the same
time. For example when you have a long running `zig build run` and
then want to run `zig build somethingelse`.
2020-12-09 20:16:26 -07:00
Andrew Kelley
d9c808e3ff
mingw-w64: patch to silence implicit-function-declaration warnings
...
Closes #7356
I did this as a patch to the source rather than passing flags so that
it would intentionally be reverted when we update to the next release of
mingw-w64. At this time if any warnings are still emitted we should find
out why and make sure upstream is aware of the problem.
2020-12-09 17:32:32 -07:00
Andrew Kelley
1f09584d05
MoveFileEx can return ACCESS_DENIED
...
I observed this on Windows 10, trying to use MoveFileEx with
MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH
to overwrite a running executable.
2020-12-09 17:32:26 -07:00
Martin Wickham
cad2e8da9d
Fix operator precedence documentation
2020-12-09 17:31:49 -07:00
Andrew Kelley
b124d04e6a
Merge pull request #7366 from LemonBoy/fix-7346
...
Some compiler-rt fixes
2020-12-09 12:21:28 -07:00
Lee Cannon
a7eea0813f
Fixes #7352 - ignore zig fmt ignore zig-cache
2020-12-09 11:44:40 -07:00
Andrew Kelley
85c1db9222
Merge pull request #7355 from ziglang/lld-child-process
...
invoke LLD as a child process rather than a library
2020-12-09 00:32:30 -07:00
antlilja
40e37d4324
Change tag returned by zigTagType for c_longdouble to Float.
...
Function was returning Int before.
2020-12-08 17:10:55 -07:00
Nathanaël Courant
1ec0261518
Fix general purpose allocator incorrectly modifying total_requested_bytes in some cases
2020-12-08 13:57:02 -07:00
Andrew Kelley
5c13a4e54a
tests: run-translated-c now respects -Dtarget
2020-12-08 13:56:56 -07:00
Andrew Kelley
c2de3bdc12
always use codeview (pdb) when object_format is PE/COFF
...
Previously, when mixing Zig and C/C++ code for windows-gnu targets, zig
would get codeview format but the C/C++ code would not get any debug
info. Now, C/C++ code properly emits debug info in codeview format and
everything just works.
2020-12-08 13:56:50 -07:00
Andrew Kelley
ad95eecf37
glibc: additionally provide -lcrypt
...
also remove redundant "util" string matching.
2020-12-08 13:56:21 -07:00
Nathan Michaels
83b2785a43
Implement msp430 mapping for c_longdouble. ( #7333 )
2020-12-08 11:14:33 -07:00
LemonBoy
e2104ecc2d
stage1: Fix type mapping for c_longdouble
...
A quick and dirty job to let the compiler use the correct size and
alignment.
2020-12-08 11:14:21 -07:00
xackus
05fefc0d3f
std.c: freeing null is a no-op
2020-12-08 11:11:49 -07:00
Veikka Tuominen
01ff3684dc
Merge pull request #7313 from LemonBoy/booo
...
Fix a few unsound optimizations on single-element union/enum
2020-12-06 12:37:18 -07:00
Andrew Kelley
48c8948f49
update to latest clang C headers
2020-12-04 17:25:55 -07:00
Jakub Konka
f385419259
macho: specify -install_name as full dylib's name
...
This then allows for proper resolution of names via runpath search
path list, i.e., `-rpath @loader_path` will correctly resolve
to `@rpath/libxxx.dylib (...)` in the linked binary.
2020-12-04 14:54:17 -07:00
Jakub Konka
96a703ee6d
Version-gate appending -syslibroot flag to lld
...
This commit version-gates appending `-syslibroot` flag to lld. This
is predicated upon the fact that for versions of macOS lower than
11, lld would fail to find and link against frameworks with this
flag specified.
Co-authored-by: Andrew Kelley <andrew@ziglang.org >
2020-12-04 12:39:07 -07:00
Jakub Konka
32997a2fb0
Merge pull request #7293 from kubkon/fix-7030
...
stage1: allow idx 0 err to be put into error_name_table
2020-12-04 12:39:01 -07:00
Andrew Kelley
a1d0c77539
add more mingw-w64 .def files
...
closes #7268
2020-12-03 18:04:39 -07:00
Andrew Kelley
2ce5f84c2f
stage1: compile error for pointer arithmetic on ptr-to-array
...
See #2018
2020-12-03 17:46:21 -07:00
Andrew Kelley
05265160ae
add @cImport files to Compilation cache manifest
...
closes #7007
2020-12-03 16:08:55 -07:00
Koakuma
52de625df9
Fix floating point parsing on BE systems ( #7256 )
...
* Fix floating point parsing on BE systems
* Load the appropriate endian.h files for macOS and BSD
* Add endian definition for Windows and extra check for ldshape selection
* Fix endian macro definition for macOS
Apparently their macros are defined without a leading __.
* Define new macro for endian checking purposes
This is gross and I really do not like the lack of standardization
around this part, but what can I do?
2020-12-03 13:47:31 -07:00
Miles Alan
cdde9d8885
std/event: Fix import path for WaitGroup
2020-12-03 13:44:25 -07:00
Andrew Kelley
ff802cc996
stage2: don't pass -l arguments when building .a or .o files
...
See #7094
2020-12-02 20:25:03 -07:00
LemonBoy
0ac43154eb
std: Add nosuspend around stderr.print calls
2020-12-02 17:54:34 -07:00
Vexu
401d091fb4
std.build: addBuildOption special handling for SemanticVersion
2020-12-02 17:54:29 -07:00
Andrew Kelley
b1f52ca7f2
stage2: linkAsArchive: respect disable_lld_caching
...
Closes #7274
Closes #6943
2020-12-02 16:40:00 -07:00
LemonBoy
02cb3841a6
ci: Retry apt-get install at most three times
...
Try harder instead of failing after the first invocation fails.
2020-12-02 16:16:36 -07:00
LemonBoy
7c13bec7cb
std: make the use of pthread_join POSIX-compliant
...
Applications supplying their own custom stack to pthread_create are not
allowed to free the allocated memory after pthread_join returns as,
according to the specification, the thread is not guaranteed to be dead
after the join call returns.
Avoid this class of problems by avoiding the use of a custom stack
altogether, let pthread handle its own resources.
Allocations made on the child stack are now done on the C heap.
Thanks @semarie for noticing the problem on OpenBSD and suggesting a
fix.
Closes #7275
2020-12-02 16:16:31 -07:00
Mathieu Guay-Paquet
7add370371
fix the tinyest typo
2020-12-02 16:16:02 -07:00
daurnimator
d15a0ec7b2
Localhost is special ( #6955 )
...
* std: always return loopback address when looking up localhost
* std: also return Ipv6 loopback
* std: remove commented out obsolete code
2020-12-01 17:14:43 -07:00
LemonBoy
0858d7b0df
stage2: Create cache manifest before calling final
...
If we enter the `if` because `comp.disable_c_depfile` is false the `man`
object has no manifest and calling .final on it will trip an assertion.
Closes #7096
2020-12-01 16:52:52 -07:00
Andrew Kelley
a4c8bd8fd4
stage2: add -femit-foo=bar args to the cache hash
...
Closes #6979
Closes #7036
2020-12-01 16:36:37 -07:00
Alexandros Naskos
7099dff7ea
Add package names and paths to the zig root module cache hash.
...
Add package names to the stage1 cache hash and package files to the
stage1 manifest file.
2020-12-01 14:57:27 -07:00
Timon Kruiper
6bf19e32e7
Make sure to include the root_name in the cache.
...
This fixes a bug where the caching system did not notice when the
--name flag changed.
2020-12-01 11:39:15 -07:00
Andrew Kelley
c8b8f0ea13
COFF linking: fix incorrectly passing .dll instead of .lib
...
commit 9d1816111d used the "output path"
as the path for passing shared library artifact paths to the Zig CLI.
For Windows, this was incorrect because it would pass the .dll instead
of the .lib file. This commit passes the "output lib path" instead,
which makes it pass the .lib path in case of a .dll on Windows.
This way the linker does not complain and say, "bad file type. Did you
specify a DLL instead of an import library?"
2020-12-01 11:31:48 -07:00
Andrew Kelley
d2445764a9
restore -target wasm32-freestanding-musl for C headers
...
See #5854
Some tiny tweaks too:
* Use `wasm-freestanding-musl` instead of `wasm32-freestanding-musl`,
making it pointer-size-agnostic.
* Fix trying to build non-existent wasm musl start files.
2020-11-30 20:58:31 -07:00
Andrew Kelley
a9b7d8fa07
stage2: fix not detecting all dynamic libraries
...
Positional shared library arguments were not being detected as causing
dynamic linking, resulting in invalid linker lines. LLD did not have an
error message for this when targeting x86_64-linux but it did emit an
error message when targeting aarch64-linux, which is how I noticed the
problem.
This surfaced an error having to do with fifo.pipe() in the cat example
which I did not diagnose but solved the issue by doing the revamp that
was already overdue for that example.
It appears that the zig-window project was exploiting the previous
behavior for it to function properly, so this prompts the question, is
there some kind of static/dynamic executable hybrid that the compiler
should recognize? Unclear - but we can discuss that in #7240 .
2020-11-30 20:58:15 -07:00
Andrew Kelley
57ac835a03
Merge branch 'alexnask-fix_6868' into master
...
Closes #7139
Closes #6868
2020-11-30 18:13:06 -07:00
Andrew Kelley
3c907e51d1
fix regression on wasm targets
...
The previous commit broke wasm targets because the linking step would
look for the compiler-rt lib in the wrong place. Fixed in this commit.
2020-11-30 17:47:24 -07:00
Andrew Kelley
791e38da8c
Merge branch 'alexnask-bundle_compiler_rt' into master
...
Closes #7013
Closes #6817
2020-11-30 16:50:56 -07:00
Michael Freundorfer
1a61a9d4bf
Fix WindowsDynLib.openW trying to strip the \??\ prefix when it does not exist
2020-11-30 12:13:17 -07:00
Jonathan Marler
8f346d9a4b
fix memory leak in BufMap
2020-11-30 11:40:44 -07:00
LemonBoy
a7c2cfe16d
stage1: Fix typeInfo generation for arrays w/o sentinel
...
ZigTypeIdOptional types have a different way of specifying their payload
value depending on whether the child type is a pointer or not (plus some
other special cases).
Fixes #7251
2020-11-29 11:39:35 -07:00
LemonBoy
0a4a99ec87
stage1: Add missing bitcast when rendering var ptr
...
Some types require this extra bitcast, eg. structs or unions with extra
padding fields inserted by the compiler.
Fixes #7250
2020-11-29 11:37:44 -07:00
LemonBoy
be2adff087
std: Avoid deadlock in the signal handler
...
stderr_mutex may still be held when we reach the signal handler, grab
our own stderr handle to print the error messages and avoid deadlocking.
Closes #7247
2020-11-29 11:31:38 -07:00
christian-stephen
a6222d1d4b
Add readAllArrayListAligned to Reader which can accept an arbitrary alignment
2020-11-27 18:01:49 -07:00
Andrew Kelley
f09f960ce4
Merge branch 'kubkon-elf-soname-opt-in' into master
...
closes #7162
2020-11-27 17:57:11 -07:00
LemonBoy
288b8b535f
stage1: Fix crash in *[N]T to []T conversion with zst
...
Prevent the crash by not making the codegen try to access the
non-existing ptr field in the slice.
Closes #6951
2020-11-27 15:34:13 -07:00
LemonBoy
36b8f5d194
stage1: Force union member types to be resolved
...
No test case because I couldn't reduce the huuuge test case.
Fixes the problem discovered by @ifreund.
2020-11-26 11:50:38 -07:00
Isaac Freund
41d57b051f
std/os: fix prctl constants
2020-11-25 16:47:44 -07:00
LemonBoy
24d4bfb666
stage1: Fix ICE when generating struct fields with padding
...
Make gen_const_ptr_struct_recursive aware of the possible presence of
some trailing padding by always bitcasting the pointer to its expected
type.
Not an elegant solution but makes LLVM happy and is consistent with how
the other callsites are handling this case.
Fixes #5398
2020-11-25 16:36:57 -07:00
Jonathan Marler
06a75c16ff
fix for GCC 9.2: -Wno-maybe-uninitialized
2020-11-24 18:32:57 -07:00
Frank Denis
8af016c5be
Update the minimum cmake version we require
...
Recent versions of cmake complain about it:
<<
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
>>
We don't require anything from version 2.8.5, and version 2.8.12 was
released in 2011, so it is very unlikely that anyone still uses 2.8.5.
2020-11-24 18:32:51 -07:00
Isaac Freund
a05ae01b4f
std/os: define and use dev_t for linux x86_64
2020-11-20 18:36:23 -07:00
Isaac Freund
1344706b47
std/os: add time_t definiton for x86_64 linux
2020-11-20 18:36:15 -07:00
LemonBoy
72980388ca
stage1: Resolve usingnamespace decls when calling @typeInfo
...
Closes #7176
2020-11-20 18:02:20 -07:00
LemonBoy
c6c25a1c09
stage1: Fix undefined assignment for bitfields
...
Prevents silent memory corruption.
Closes #7055
2020-11-18 22:51:34 -07:00
Frank Denis
3f134cfe5e
edwards25519 - skip useless operations and duplicate lookup table
...
Just some trivial changes; no functional changes.
Skip useless nul additions and multiplications and comptime the
basepoint multiples only once.
2020-11-18 21:45:42 -08:00
breakin
e814f71052
Change seed for Murmur2_64 from u32 to u64
2020-11-18 18:06:04 -07:00
Veikka Tuominen
50269f2315
Merge pull request #6649 from Rocknest/verparse
...
make Version.parse less strict
2020-11-18 17:47:43 -07:00
Vexu
8af0a1987b
make help in commands more consistent
...
Closes #7101
Co-authored-by: pfg <pfg@pfg.pw >
2020-11-18 17:37:14 -07:00
Timon Kruiper
b498d26376
Allow Zig to be built with clang 11 and -Werror
...
This was brought to the horizon when using zig-bootstrap to cross compile
Zig for windows-gnu.
2020-11-18 17:32:48 -07:00
LemonBoy
d3f1a4edce
stage1: Add architecture-specific clobbers to asm()
...
We're basically following Clang's lead, add the necessary clobbers to
minimize the risk of generating wrong code.
2020-11-18 17:32:41 -07:00
Veikka Tuominen
1add7c616f
Merge pull request #7084 from xackus/mem-volatile
...
std.mem: make sliceAsBytes, etc. respect volatile
2020-11-18 17:31:11 -07:00
Frank Denis
5f9a664de9
STAGE1_SOURCES: In 0.7.x, leb128.zig is in std/debug ( #7148 )
...
* STAGE1_SOURCES: In 0.7.x, leb128.zig is in std/debug
* codegen/aarch64.zig doesn't exist in 0.7.x
Co-authored-by: Frank Denis <github@purftpd.org >
2020-11-18 14:53:47 -05:00
LemonBoy
1c8cd268be
stage1: Fix asyncCall with non-abi-aligned arguments
...
Make the code used to calculate the variable slot index into the frame
match what's done during the structure layout calculation.
Prevents a few nasty LLVM errors when such types are passed around.
2020-11-17 16:55:44 -07:00
Andrew Kelley
eea4cd2924
cli: make -h, --help consistent in usage text and parsing
...
also trivial fixes in the general usage text
2020-11-17 16:54:15 -07:00
Guoxin Yin
4d44a813de
Add -h alias for --help
2020-11-17 11:39:42 -07:00
johnLate
51ffb0548d
CMake: properly detect when to rebuild zig1.o
...
This is andrewrk's patch from ziglang#6724 (rebased)
CMake: Fix dependency problem
I don't know whether the error was expected cmake behavior or a bug.
This change seems to fix the issue. See ziglang#6724 for details.
cmake: add the correct set of zig stage2 sources
2020-11-16 18:04:54 -07:00
Alex Cameron
5b42704ea7
Prevent double file close in MachO linking
2020-11-16 15:00:22 -07:00
Frank Denis
c8b6e407ba
Enable loop interleaving when unrolling is enabled
...
This mimics clang's default behavior.
2020-11-16 15:00:16 -07:00
LemonBoy
9e1e91dafc
std: Make windows.ReadFile allow short reads
...
Make it behave like the read() wrapper for unix systems.
Reading the whole buffer breaks some use-cases like buffered readers
over sockets.
Closes #7121
2020-11-16 14:35:28 -07:00
LemonBoy
6624f9cd5c
stage1: Fix generation of pass-by-value args in async fns
...
The mismatch between the argument slot type in the frame structure and
the one used in the store operation made the generated code write
garbage over the nearby fields.
Fixes #7104
2020-11-16 11:37:49 -07:00
Andrew Kelley
7d0c461b77
std.fs.path.dirname: return null when input path is root
...
This intentionally diverges from the unix dirname command, as well as
Python and Node.js standard libraries, which all have this edge case
return the input path, unmodified. This is a footgun, and nobody should
have ever done it this way.
Even the man page contradicts the behavior. It says:
"strip last component from file name". Now consider, if you
remove the last item from an array of length 1, then you
have now an array of length 0. After you strip the last component, there
should be no components remaining. Clearly, returning the input parameter
unmodified in this case does not match the documented behavior. This is
my justification for taking a stand on this API design.
closes #6746
closes #6727
closes #6584
closes #6592
closes #6602
2020-11-15 10:53:06 -07:00
LemonBoy
2d280825cd
stage1: Disambiguate Wasm imports with same name
...
Closes #7088
2020-11-13 14:33:20 -07:00
LemonBoy
10617593f8
stage1: Resolve ErrorUnion children types
...
Since the code is accessing the abi_size field compute the full type
size for both err_set_type and payload_type, not only for the latter.
2020-11-13 14:29:38 -07:00
LemonBoy
10b1001a12
stage1: Ask LLVM to produce compact code in ReleaseSize mode
...
Let's follow what Clang does for -Oz and apply the `minsize` and
`optsize` attributes by default.
Closes #7048
Supersedes #7077
2020-11-13 10:27:26 -07:00
Hubert Jasudowicz
eaa1db2002
std: Fix code model argument
2020-11-11 19:33:10 -07:00
Vexu
1aec406311
std: fix HashMap.clearRetainingCapacity
2020-11-11 19:33:03 -07:00
Vexu
b6350a2b3f
std: fix HashMap.putAssumeCapacity
2020-11-11 19:32:58 -07:00
Vexu
8c62733927
ensure TypeInfo payload is not undefined
2020-11-11 19:32:30 -07:00
LemonBoy
aa6fc29744
stage1: Fix crash in comptime struct generation
...
Using the gen_index rather than the src_index is needed to handle
structures containing zero-sized or comptime only types.
Closes #7027
2020-11-11 19:14:03 -07:00
Jonas Carpay
01a927a0cb
Fix backticked code in langref
2020-11-11 19:13:52 -07:00
LemonBoy
7d3c5f207a
stage1: Avoid resolving type entry in [0]T
...
The logic was already there but this rule was only applied in some
places, apply it in the remaining code paths.
Closes #7058
2020-11-11 19:13:04 -07:00
Andrew Kelley
0405698696
add missing -m<os>-version-min CLI args to clang
...
This fixes some code generation issues when targeting macOS and
compiling C/C++ code.
2020-11-10 15:24:57 -07:00
Andrew Kelley
73455eaf42
std.Target: bump default version max for macos
2020-11-10 15:24:51 -07:00
LemonBoy
85665386c6
stage1: Fix comparison of unions containing zero-sized types
...
The code tried to be too smart and skipped the equality (returning true)
if the payload type was zero-sized.
This optimization is completely wrong when the union payload is a
metatype!
Fixes #7047
2020-11-10 15:24:41 -07:00
Andrew Kelley
2c0caa8533
main: updateModule returns an error when there are any compile errors
...
closes #6976
2020-11-09 20:52:08 -07:00
daurnimator
904c513a1e
Fix json parser close tracking ( #6865 )
...
* std: fix json parsing with unmatched closing tokens
* std: fix swapped json parsing errors
2020-11-09 16:29:22 -07:00
LemonBoy
0e2eb6eb65
stage1: Print correct error message for vector @intCast
2020-11-09 16:25:47 -07:00
Frank Denis
c2c3177d82
Don't prevent compilation on platforms where debug info is unsupported
...
We don't support debug information on platforms that are not tier-1,
but it shouldn't be a hard error that completely prevents compilation.
2020-11-09 16:23:27 -07:00
Alexandros Naskos
a28c244afb
Windows TLS startup symbols are already provided by libcrt when linking against libc
2020-11-09 15:47:37 -07:00
Andrew Kelley
97ec177953
std.ResetEvent: disable flaky test on Windows
...
See #7009
2020-11-09 15:36:51 -07:00
data-man
810c03f426
Fix reduce documentation
2020-11-09 15:36:46 -07:00
Andrew Kelley
0f4b893d6d
langref: add 0.7.0 link
2020-11-09 15:36:36 -07:00
Frank Denis
61507d95d8
Bump Zig version to 0.7.0
2020-11-09 15:36:26 -07:00
Andrew Kelley
0c90ccc297
Release 0.7.0
2020-11-08 12:02:09 -07:00
joachimschmidt557
03ae77b8b0
stage2 ARM: miscellaneous improvements
2020-11-07 17:27:23 +01:00
Alexandros Naskos
5430642fa0
Merge pull request #7008 from xackus/minor-fixes
...
change debug.assert to testing.expect in tests
2020-11-07 11:34:51 +02:00
Andrew Kelley
67ea47babd
Revert "update runtime safety test case - unsigned-signed vector cast"
...
This reverts commit 663f0b399c .
The behavior appears to be inconsistent between running locally and on
the CI.
I suspect it could be based on what vector CPU features are available.
2020-11-06 18:58:10 -07:00
Andrew Kelley
663f0b399c
update runtime safety test case - unsigned-signed vector cast
...
now it returns "integer cast truncated bits" instead of "attempt to cast
negative value to unsigned integer" which I think is correct.
2020-11-06 17:15:05 -07:00
Andrew Kelley
ceaa569bfa
disable flaky file locking test on Windows
...
See #7010
2020-11-06 17:00:51 -07:00
Andrew Kelley
c923f74fc9
std.ResetEvent: disable flaky test on macOS
...
See #7009
2020-11-06 16:46:30 -07:00
xackus
c9fa57541b
remove outdated comment
2020-11-06 22:58:58 +01:00
xackus
5c8f7f81cd
change debug.assert to testing.expect in tests
2020-11-06 22:48:54 +01:00
Andrew Kelley
e5fab3ba68
update musl sources to 1.2.1
2020-11-06 14:13:57 -07:00
Andrew Kelley
dba94f453a
update musl headers to 1.2.1
2020-11-06 13:53:47 -07:00
Andrew Kelley
008dd90f1f
update process_headers tool
2020-11-06 13:51:33 -07:00
Jay Petacat
030f00391a
std: Introduce SemanticVersion data structure
...
This will parse, format, and compare version strings following the
SemVer 2 specification. See: https://semver.org
Updates #6466
2020-11-06 15:07:48 -05:00
Andrew Kelley
d1b1f053b0
Merge pull request #6941 from LemonBoy/floateqapprox
...
std: Implement more useful approxEq semantics
2020-11-06 14:09:31 -05:00
LemonBoy
b9391c9564
std: Make file locking tests less fragile
2020-11-06 14:02:11 -05:00
Jeremy Huffman
9f1639a6bb
Fix std.ResetEvent.timedWait on darwin/macOS. ( #6914 )
2020-11-06 14:01:52 -05:00
Andrew Kelley
a9e09a8be4
Merge pull request #6990 from kubkon/system-linker-hack
...
Re-enable system linker hack
2020-11-06 13:22:03 -05:00
Alexandros Naskos
a1a16a941e
Merge pull request #7001 from Vexu/translate-c
...
Translate-c: fix macro functions with no arguments
2020-11-06 19:22:56 +02:00
Jakub Konka
ab69b89d52
Address review comments
2020-11-06 11:57:53 +01:00
Vexu
79549e0ac1
translate-c: fix macro functions with no arguments
2020-11-06 12:48:52 +02:00
Jakub Konka
b7c3ebcb9e
Rely on ZIG_SYSTEM_LINKER_HACK instead of input flags
2020-11-06 11:34:51 +01:00
Andrew Kelley
c9551652b0
Merge pull request #6978 from LemonBoy/statshit
...
Decouple kernel and libc stat definitions
2020-11-05 17:27:22 -05:00
Andrew Kelley
cf7505da1f
Merge pull request #6974 from daurnimator/prctl-cleanup
...
prctl improvements
2020-11-05 17:25:24 -05:00
LemonBoy
78840c4ab2
stage1: Make sure union(enum(T)) is valid
...
The T type should be wide enough to fit values in the 0...num field
range.
Closes #6988
2020-11-05 17:24:04 -05:00
Andrew Kelley
f85d719952
Merge pull request #6895 from jorangreef/fallocate
...
linux: add fallocate()
2020-11-05 17:23:00 -05:00
Frank Denis
e7b60b219b
std/crypto: don't constrain Gimli hash output to a fixed length
...
As documented in the comment right above the finalization function,
Gimli can be used as a XOF, i.e. the output doesn't have a fixed
length.
So, allow it to be used that way, just like BLAKE3.
2020-11-05 17:21:19 -05:00
Frank Denis
2e354c387e
math.shl/math.shr: add support for vectors
2020-11-05 17:20:54 -05:00
Frank Denis
73aef46f7d
std.crypto: namespace constructions a bit more
...
With the simple rule that whenever we have or will have 2 similar
functions, they should be in their own namespace.
Some of these new namespaces currently contain a single function.
This is to prepare for reduced-round versions that are likely to
be added later.
2020-11-05 17:20:25 -05:00
Frank Denis
4417206230
Now that they support vectors, use math.rot{l,r}
2020-11-05 17:19:48 -05:00
Andrew Kelley
34502b9c4d
Merge pull request #6991 from alexnask/upgrade_mingw-w64
...
Upgrade mingw-w64 to version 8.0.0
2020-11-05 17:18:01 -05:00
Alexandros Naskos
3e1639c53b
Fixed mingw-w64 8.0.0 compilation
...
Reaplied mingw-w64 header patch
2020-11-05 20:04:25 +02:00
Jakub Konka
e0e3ceac19
Re-enable system linker hack
...
It is now possible to force linking with system linker `ld` instead
of the LLVM `lld` linker when building natively on the target. This
can be done at each stage by specifying `--system-linker-hack` flag,
and can be useful on platforms where `lld` fails to operate properly
such as macOS 11 Big Sur on ARM64 where every binary/dylib is expected
to be codesigned.
Some example invocations for each stage of compilation of Zig
toolchain:
```
cmake .. -DCMAKE_PREFIX_PATH=/path/to/llvm -DSYSTEM_LINKER_HACK=1
```
```
build/zig build test --system-linker-hack
```
```
build/zig build --prefix $(pwd)/stage2 -Denable-llvm
--system-linker-hack
```
```
build/zig build-exe hello.zig --system-linker-hack
```
2020-11-05 18:35:51 +01:00
Alexandros Naskos
708962d51e
Updated mingw-w64 to version 8.0.0
2020-11-05 18:59:36 +02:00
LemonBoy
ff14451b4a
std: Implement more useful approxEq semantics
...
Comparisons with absolute epsilons are usually useful when comparing
numbers to zero, for non-zero numbers it's advised to switch to relative
epsilons instead to obtain meaningful results (check [1] for more
details).
The new API introduces approxEqAbs and approxEqRel, where the former
aliases and deprecated the old `approxEq`, allowing the user to pick the
right tool for the job.
The documentation is meant to guide the user in the choice of the
correct alternative.
[1] https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
2020-11-05 16:08:49 +01:00
LemonBoy
cca6b11138
Label WASI stat as kernel_stat
...
We're using WASI syscalls, it makes sense to put the kernel_ prefix.
2020-11-05 12:44:43 +01:00
LemonBoy
0e95fa455c
std: Split kernel&libc definitions of stat struct
...
There's no guarantee for the kernel definition to be ABI compatible with
the libc one (and vice versa).
There's also no guarantee of ABI compatibility between musl/glibc.
Fun, isn't it?
2020-11-05 09:38:50 +01:00
Alexandros Naskos
17837affd2
Merge pull request #6982 from Rageoholic/master
...
Fix CoInitializeEx so it can take a null pointer
2020-11-05 09:00:03 +02:00
rageoholic
e5100605e9
Add missing LONG_PTR type
2020-11-04 18:30:48 -06:00
rageoholic
04267fb1ba
Fix CoInitializeEx so it can take a null pointer
2020-11-04 16:53:05 -06:00
Frank Denis
bb14bd35bd
Update wasmtime to version 0.20
...
The version we were using in CI is now getting quite old, and we
want to make sure that the code we produce is compatible with
current versions of Wasmtime.
2020-11-04 20:28:54 +01:00
LemonBoy
346a686b9d
std: Correct stack_t definition for mips
2020-11-04 15:55:06 +01:00
LemonBoy
f313c88428
std: Fix pipe syscall stub for sparc64
2020-11-04 15:54:38 +01:00
daurnimator
b42ffbe9e8
std: use PR enum as only location of opcode numbers
2020-11-04 22:39:35 +11:00
daurnimator
b90fb1e96b
std: add PR enum for the prctl opcode
2020-11-04 22:32:57 +11:00
daurnimator
02252f3f07
std: workaround #280 in prctl
2020-11-04 22:23:59 +11:00
Frank Denis
342ba960f7
sparc64 has a 8Kb page size
2020-11-03 17:29:20 -05:00
Andrew Kelley
ede41759be
std.fs.File.writeFileAll: support unseekable files
...
With this commit, the function tries to use more efficient syscalls, and
then falls back to non-positional reads.
The motivating use case for this change is to support something like the
following:
try io.getStdOut().writeFileAll(dest_file, .{});
2020-11-03 15:25:43 -07:00
Frank Denis
37bc6ee54a
std.meta: test that const and mut variables have different addresses
...
We are checking that two identical, constant values, are stored at
different addresses.
But sharing a unique location doesn't look like something the compiler
wouldn't do.
It may make more sense to check that a const variable and a mutable
variable set to the same value have different addresses.
2020-11-03 16:52:51 -05:00
Andrew Kelley
f2cb63c2e1
Merge pull request #6956 from jedisct1/more-gimli-be-fixes
...
Another big-endian fix for Gimli
2020-11-03 11:22:54 -05:00
Jakub Konka
5060497174
Merge pull request #6921 from xackus/gimmeMoreOfThoseSweetSweetFileDescriptors
...
stage2: ask for more file descriptors
2020-11-03 10:07:39 +01:00
Frank Denis
8d7c160fb4
Make Gimli test vector look like the python implementation
2020-11-03 09:13:14 +01:00
Joran Dirk Greef
8193f55820
Support 32-bit big-endian targets
2020-11-03 06:03:38 +02:00
Frank Denis
d764636d21
Another big-endian fix for Gimli
...
We read and write bytes directly from the state, but in the init
function, we potentially endian-swap them.
Initialize bytes in native format since we will be reading them
in native format as well later.
Also use the public interface in the "permute" test rather than an
internal interface. The state itself is not meant to be accessed directly,
even in tests.
2020-11-03 02:01:48 +01:00
xackus
e023a5fe5d
force comptime on isDarwin
2020-11-03 00:58:35 +01:00
Jakub Konka
8dda64fa3e
Fix Darwin codepath
...
On Darwin, according to the man pages for setrlimit(), when adjusting
max number of open fds, the reported hard max by getrlimit() is only
theoretical, while the actual maximum, set in the kernel, is hardcoded
in the header file. Therefore, the reported max has to be adjusted
as `min(OPEN_MAX, lim.max)`.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-11-03 00:38:43 +01:00
xackus
06b4526a3e
fix freebsd compilation
2020-11-02 23:18:55 +01:00
Andrew Kelley
b30a765b95
fix cmake logic for checking LLVM version
2020-11-02 12:16:10 -07:00
LemonBoy
35a8d90e55
std: Make parseInt/parseUnsigned detect the radix
2020-11-02 14:13:06 -05:00
Andrew Kelley
00ceb592ef
Merge pull request #6932 from kubkon/fix-6318
...
macOS: fix linking issues on BigSur
2020-11-02 13:41:32 -05:00
LemonBoy
be26c3bf4e
stage1: Fix *WithOverflow intrinsics with u0 values
...
Closes #5369
2020-11-02 13:40:00 -05:00
Frank Denis
ad9655db3a
Fix Gimli for big-endian targets
2020-11-02 13:38:20 -05:00
Andrew Kelley
061ff11b2b
Merge pull request #6927 from LemonBoy/mipsbe-std
...
Fixes for stdlib for mips BE targets
2020-11-02 13:37:24 -05:00
Jakub Konka
6ecefd5903
Add std.Target.current.isDarwin() to exclude non-macs in comptime
2020-11-02 19:31:07 +01:00
Alex Cameron
ecdd636605
Fix file descriptor leak in fs.openFileZ.
2020-11-02 13:28:29 -05:00
Isaac Freund
50ba018223
std/ascii: add spaces array
...
This may be combined with std.mem.trim to form a proper replacement for
the now deprecated std.fmt.trimWhitespace().
2020-11-02 13:20:58 -05:00
Jakub Konka
f42ebd1b0a
Update src/Compilation.zig
...
Co-authored-by: Andrew Kelley <andrew@ziglang.org >
2020-11-02 18:56:08 +01:00
Jakub Konka
7f5c96378d
Refactor the code according to Andrew's suggestions
2020-11-02 18:38:09 +01:00
Jakub Konka
317c555a5c
Fix linking issues on BigSur
...
This commit fixes linking issue on macOS 11 BigSur by appending
a prefix path to all lib and framework search paths known as
`-syslibroot`.
The reason this is needed is that in macOS 11, the system libraries
and frameworks are no longer readily available in the filesystem.
Instead, the new macOS ships with a built-in dynamic linker cache
of all system-provided libraries, and hence, when linking with either
`lld.ld64` or `ld64`, it is required to pass in `-syslibroot [dir]`.
The latter can usually be obtained by invoking `xcrun --show-sdk-path`.
With this commit, Zig will do this automatically when compiling natively
on macOS. However, it also provides a flag `-syslibroot` which can be
used to overwrite the automtically populated value.
To summarise, with this change, the user of Zig is not required to
generate and append their own syslibroot path. Standard invocations
such as `zig build-exe hello.zig` or `zig build` for projects will
work out of the box. The only missing bit is `zig cc` and `zig c++`
since the addition of the `-syslibroot` option would be a mismatch
between the values provided by `clang` itself and Zig's wrapper.
2020-11-02 17:06:09 +01:00
LemonBoy
dc872a221d
std: Fix syscall stubs passing 64bit offsets for BE targets
2020-11-02 12:11:07 +01:00
LemonBoy
76e9a4ae83
std: Fix std.unicode test cases for BE targets
2020-11-02 11:48:06 +01:00
LemonBoy
02efc2236a
std: Fix json utf{8,16} decoding on BE targets
...
Byteswap some values when LE ordering is required.
2020-11-02 11:46:50 +01:00
LemonBoy
4fd1ec78e9
std: Re-enable union behaviour test for mips targets
2020-11-02 11:46:26 +01:00
LemonBoy
307496fcd7
std: Re-enable ArrayHashMap test for mips targets
2020-11-02 11:46:07 +01:00
Joran Dirk Greef
78e9e131e0
Pending #5127
2020-11-02 12:37:55 +02:00
Joran Dirk Greef
067bd7e424
Switch back to writing Zig
2020-11-02 09:55:25 +02:00
Joran Dirk Greef
9dec310826
Debug unhandled errno
2020-11-02 09:52:42 +02:00
Andrew Kelley
909aae8153
Merge pull request #6792 from koachan/sparc64-linux
...
Initial sparc64-linux bringup
2020-11-01 22:14:56 -05:00
Andrew Kelley
af60931a48
Merge pull request #6888 from jcmoyer/issues/6874
...
Update std.fmt docs and add test for null terminated slices with embedded null bytes
2020-11-01 18:30:09 -05:00
xackus
7703f4c60a
stage2: ask for more file descriptors
2020-11-01 23:32:25 +01:00
LemonBoy
445d808bae
std: Fix early overflow in time calculation
...
Closes #6867
2020-11-01 17:06:14 -05:00
Andrew Kelley
2e1cef7508
Merge branch 'LemonBoy-morereduce'
2020-11-01 14:39:56 -07:00
Andrew Kelley
f4ed5d7d48
langref tidy html fixup
2020-11-01 14:39:45 -07:00
LemonBoy
577b994507
docs: Add @reduce documentation
2020-11-01 14:30:31 -07:00
LemonBoy
0d6a7088dc
stage1: Implement Add/Mul reduction operators
2020-11-01 14:30:31 -07:00
LemonBoy
6f3d6c1f45
std: Fix expectWithinEpsilon with negative values
2020-11-01 14:30:31 -07:00
LemonBoy
2957433b25
stage1: Fix comptime comparison of NaNs
2020-11-01 14:30:31 -07:00
Jakub Konka
d530e7f9c7
Make std.fmt.bufPrintIntToSlice public
...
Deprecate `std.fmt.trim` and `std.fmt.isWhiteSpace` in favour of
`std.mem` alternatives.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-11-01 15:48:50 -05:00
xackus
6418284680
std: add {set,get}rlimit bits and improve test
2020-11-01 15:47:46 -05:00
frmdstryr
36f1788762
Add missing arg
2020-11-01 15:40:42 -05:00
Frank Denis
c387f1340f
std/crypto: make Hkdf functions public
2020-11-01 18:27:11 +02:00
Joran Dirk Greef
c910f03a7b
Swap endianness
2020-11-01 13:14:32 +02:00
Joran Dirk Greef
a67f140d2f
Add test
2020-11-01 11:55:27 +02:00
Joran Dirk Greef
2dd8613adc
"The Traveling Wilburys' - Handle With Care"
...
Both `offset` and `len` are `off_t`.
Like the rest of the std lib we assume that `_FILE_OFFSET_BITS == 64`
is always true, so that `off_t` is a `u64`.
When passing to 32-bit kernels, we split these into two `u32`
parameters.
2020-11-01 11:49:08 +02:00
Joran Dirk Greef
2fdb30a571
Add definitions for FALLOC_FL_ mode flags
2020-11-01 11:47:09 +02:00
Joran Dirk Greef
888af655e0
Add libc signature
2020-11-01 11:46:08 +02:00
Veikka Tuominen
9ca9819488
Merge pull request #6883 from Vexu/translate-c
...
translate-c: correctly handle pointers to opaque demoted structs
2020-10-31 15:25:14 +02:00
Joran Dirk Greef
8fd88fdb31
linux: add fallocate()
2020-10-31 13:39:33 +02:00
Vexu
28a0583b84
run zig fmt on src/ and test/
2020-10-31 12:21:49 +02:00
Veikka Tuominen
7c8d9cfa40
Merge pull request #6660 from Vexu/stage2
...
Stage2 switch and package imports
2020-10-31 09:39:28 +02:00
Vexu
3ff381385a
translate-c: correctly handle pointers to opaque demoted structs
2020-10-31 09:30:13 +02:00
J.C. Moyer
788900c35c
Add test for null terminated slices with embedded null bytes
2020-10-30 23:58:23 -04:00
J.C. Moyer
b38dea37c7
Update doc comments to reflect current behavior
2020-10-30 23:58:23 -04:00
Travis
bb6e39e274
remove extra space in .** error message
2020-10-30 21:26:05 +02:00
Andrew Kelley
e59f44712d
Merge pull request #6875 from jorangreef/mips_syscalls
...
Add more mips syscall numbers
2020-10-30 13:31:12 -04:00
Veikka Tuominen
80dd432137
Merge pull request #6858 from travv0/no-star-after-dot-star
...
don't allow a token starting with an asterisk directly following .*
2020-10-30 16:08:04 +02:00
Vexu
22ec5e0859
stage2: fix typo in liveness; add comptime switch test
2020-10-30 15:58:13 +02:00
Vexu
4ed2c52fb7
stage2: switch put swap condbr and block
...
condbr is noreturn so having the other way around caused
subsequent cases to be eliminated as dead
2020-10-30 15:58:13 +02:00
Vexu
e2e0b6272b
stage2: return same hash for different representations of same value
2020-10-30 15:58:13 +02:00
Vexu
3cc68bd913
stage2: switch liveness analysis
2020-10-30 15:58:13 +02:00
Vexu
769d5a9c43
stage2: switch comptime execution
2020-10-30 15:58:13 +02:00
Vexu
12e4c648cc
stage2: implement switch validation for integers
2020-10-30 15:58:13 +02:00
Vexu
4155d2ae24
stage2: switch ranges and multi item prongs
2020-10-30 15:58:13 +02:00
Vexu
3c96d79953
stage2: disallow switching on floats
2020-10-30 15:58:13 +02:00
Vexu
7db17a2d89
stage2: redesign switchbr
...
Switchbr now only handles single item prongs.
Ranges and multi item prongs are checked with
condbrs after the switchbr.
2020-10-30 15:58:12 +02:00
Vexu
95467f3249
stage2: dump generated zir with --verbose-ir
2020-10-30 15:58:12 +02:00
Vexu
570f610341
stage2: fix test harness tmp path handling
2020-10-30 15:58:12 +02:00
Vexu
2020ca640e
stage2: switch emit zir
2020-10-30 15:58:12 +02:00
Vexu
11998d2972
stage2: basic switch analysis
2020-10-30 15:58:12 +02:00
Vexu
2c12f4a993
stage2: implement Value.eql for void, null and types
2020-10-30 15:58:12 +02:00
Vexu
7e2774367e
stage2: implement Value.hash
2020-10-30 15:58:12 +02:00
Vexu
27d233cef7
stage2: basic switch validation
2020-10-30 15:58:11 +02:00
Vexu
ad32e46bce
stage2: switch astgen
2020-10-30 15:58:11 +02:00
Vexu
a1d7f0053d
stage2: support imports inside packages
2020-10-30 15:58:11 +02:00
Vexu
8421b8a898
stage2: detect import outside file path
2020-10-30 15:58:11 +02:00
Joran Dirk Greef
ab1ed93ad9
Add close_range, faccessat2 and process_madvise
2020-10-30 12:39:01 +02:00
Joran Dirk Greef
9423ed1671
Add more mips syscall numbers
...
As per: lib/libc/musl/arch/mips/bits/syscall.h.in
...and as promised: https://github.com/ziglang/zig/pull/6356#issuecomment-696023349
Thanks @daurnimator again for the help with #6356 .
2020-10-30 11:53:45 +02:00
Koakuma
891c6ddd5f
Select stat struct type based on whether we are linking with libc
2020-10-30 11:46:33 +07:00
zhaozg
72343ffd06
fix #3237 : resolve undefined symbol _DllMainCRTStartup
2020-10-29 20:09:22 -04:00
LemonBoy
490cafe2c5
stage1: Error out when trying to execute unreachable
...
Closes #6802
2020-10-29 20:06:52 -04:00
Andrew Kelley
f4bb8be9fc
Merge pull request #6654 from joachimschmidt557/stage2-arm
...
stage2 ARM: more stuff
2020-10-29 18:29:24 -04:00
Andrew Kelley
aaff66b8ed
Merge pull request #6866 from LemonBoy/fix-zlib
...
Fix zlib EOB condition
2020-10-29 18:23:36 -04:00
Andrew Kelley
a41c0b63bb
Merge pull request #6356 from jorangreef/io_uring
...
std: add io_uring library
2020-10-29 18:20:38 -04:00
Travis
f51ccf0d1f
panic when empty string passed as dest_rel_path to addInstallFileWithDir
...
causes the creation of a file instead of the directory that's meant to
be created
2020-10-29 15:22:39 -04:00
Frank Denis
26793453a7
std/crypto/blake2b: allow the initial output length to be set
...
BLAKE2 includes the expected output length in the initial state.
This length is actually distinct from the actual output length
used at finalization.
BLAKE2b-256/128 is thus not the same as BLAKE2b-128.
This behavior can be a little bit surprising, and has been "fixed"
in BLAKE3.
In order to support this, we may want to provide an option to set the
length used for domain separation.
In Zig, there is another reason to allow this: we assume that the
output length is defined at comptime.
But BLAKE2 doesn't have a fixed output length. For an output length that
is not known at comptime, we can't take the full block size and
truncate it due to the reason above.
What we can do now is set that length as an option to get the correct
initial state, and truncate the output if necessary.
2020-10-29 15:18:37 -04:00
wozeparrot
32e65c3f96
make addBuildOption append type ( #6801 )
...
* add addBuildOption test
2020-10-29 15:16:47 -04:00
Andrew Kelley
3a0e8c2b45
Merge pull request #6838 from LemonBoy/netstuff
...
std: Add basic smoke test for net functionality
2020-10-29 15:10:29 -04:00
Travis
f54605ecc2
add missing Invalid_periodasterisks case in docgen
2020-10-29 14:02:08 -05:00
Andrew Kelley
844eb932f4
Merge pull request #6841 from ifreund/fix-event-loop
...
std/event: fix poll error set handling
2020-10-29 14:41:18 -04:00
Frank Denis
e59dd7eecf
std/crypto/x25519: return encoded points directly + ed->mont map
...
Leverage result location semantics for X25519 like we do everywhere
else in 25519/*
Also add the edwards25519->curve25519 map by the way since many
applications seem to use this to share the same key pair for encryption
and signature.
2020-10-29 14:39:58 -04:00
Timon Kruiper
ad6e095ef6
stage2.Elf: fix off by one error in writeOffsetTableEntry
...
The code was using the length of the local symbols, which also
includes the null symbol. Fix this by using the offset table instead,
which only keeps track of the symbols that end up in the got.
2020-10-29 14:38:48 -04:00
LemonBoy
4fb896f16e
stage1: Fix bug in internal string slicing ( #6843 )
...
Closes #6456
2020-10-29 14:38:13 -04:00
=
6f3c84834d
Changed macosx to macos in support os to better relfect the output of zig targets
2020-10-29 14:35:29 -04:00
Frank Denis
5764c550ed
std/crypto: vectorize Salsa20
...
20% faster on x86_64, slower on aarch64 as usual :/
2020-10-29 14:34:58 -04:00
Jakub Konka
17575019a0
Set page size to 16KB for aarch64 macos
...
With this tweak, `test-std` pass on Apple Silicon + BigSur.
2020-10-29 14:21:43 -04:00
Frank Denis
bb3dfd2708
std/math: add support for vectors to rotl()/rotr()
2020-10-29 14:17:46 -04:00
Vexu
a63fd34c50
return a valid node even if invalid deref was used
2020-10-29 19:20:15 +02:00
Travis
d7f9128b5d
add error message to zig side of tokenizing/parsing
2020-10-29 12:03:45 -05:00
Travis
960b5b518f
updated zig tokenizer to handle .*** and added tests
2020-10-29 12:03:45 -05:00
Travis
3c7a49c494
add missing case for TokenizeStateSawDotStar at eof
2020-10-29 12:03:45 -05:00
Travis
069aee1495
don't allow a token starting with an asterisk directly following .*
2020-10-29 12:03:45 -05:00
LemonBoy
20fba0933f
std/deflate: Avoid reading past end of stream
...
Use a conservative (and slower) approach in the Huffman decoder fast
path.
Closes #6847
2020-10-29 17:16:03 +01:00
Koakuma
5125eb77bd
Use the *_stat type as self
2020-10-29 21:37:45 +07:00
LemonBoy
b3314a8be6
stage1: Fix small bug in pointer type analysis
...
A flag meant to catch recursively-defined types was never reset, leading
the compiler to generate wrong answers when asked for its
type/alignment.
Closes #6850
2020-10-29 15:41:45 +02:00
Veikka Tuominen
85dd5746bd
Merge pull request #6678 from s-ol/doc-type-aware
...
generated docs improvements: add vector, fntype, anytype type-printing; bool, function value-printing
2020-10-29 15:19:02 +02:00
LemonBoy
fe6cc0c3ba
std: Better handling of type values in expectEqual
2020-10-29 15:13:44 +02:00
LemonBoy
88eb3ae8e5
std: Better handling of type values in expectEqual
2020-10-29 11:10:21 +01:00
Andrew Kelley
81f5e1e667
ci: freebsd: skip non-native tests to save time
2020-10-28 22:59:23 -07:00
Andrew Kelley
fd3da3348c
ci: macos: rebuild zig1.o with stage1
...
see #6830 for details.
2020-10-28 16:31:59 -07:00
s-ol
6e96352b90
docs: link to functions in getValueText and getCallHtml
2020-10-29 00:10:22 +01:00
LemonBoy
7bc9531698
stage1: Correctly generated optional constant values
...
Closes #6799
2020-10-28 21:56:28 +02:00
Frank Denis
0adc144f88
std/crypto: adjust aesni parallelism to CPU models
...
Intel keeps changing the latency & throughput of the aes* and clmul
instructions every time they release a new model.
Adjust `optimal_parallel_blocks` accordingly, keeping 8 as a safe
default for unknown data.
2020-10-28 21:44:00 +02:00
Frank Denis
ea45897fcc
PascalCase *box names, remove unneeded comptime & parenthesis
...
Also rename (salsa20|chacha20)Internal() to a better name.
And sort reexported crypto.* names
2020-10-28 21:43:15 +02:00
LemonBoy
6d2f103bfb
stage1: Fix crash in comptime struct value copy
...
Comptime fields are never materialized in the ZigValue so pay attention
when iterating over the fields array.
Fixes #6800
2020-10-28 21:13:32 +02:00
Koakuma
3a58b2330c
Update stack traces testcases
2020-10-28 17:46:26 +07:00
Jakub Konka
1a171a143a
Merge pull request #6842 from kubkon/aarch64-macos-fix
...
std: Apple Silicon: no fstat$INODE64 symbol found
2020-10-28 11:38:46 +01:00
Jakub Konka
4f50958407
Clean up exporting of symbols on Darwin
2020-10-28 10:36:19 +01:00
LemonBoy
7f46672193
More fixups for Windows targets
...
* Use closeSocket on sockets instead of plain old close, the latter
doesn't work on them.
* Use winsocket2 everywhere, mingw has no BSD sockets.
2020-10-28 10:03:23 +01:00
Jakub Konka
bda9a159aa
Apple Silicon: no fstat$INODE64 symbol found
...
It seems that Apple has finally got rid of the 32bit versions of
`fstat` and `fstatat`, and instead, only 64bit versions are available
on BigSur and Apple Silicon.
The tweak in this commit is required to make Zig stage1 compile on
BigSur + aarch64.
2020-10-27 22:47:53 +01:00
Andrew Kelley
e1ca6946be
rename ZigClangFloatingLiteral_getValueAsApproximateDouble
2020-10-27 14:16:43 -07:00
johnLate
1ea0d40e5e
std.os.c.accept/accept4: allow null for addr and len
...
See ziglang#6832.
2020-10-27 21:52:47 +01:00
johnLate
23c28c72b7
std.os.linux.accept/accept4: allow null for addr and len
...
std.os.accept already wants to allow null, which matches `man 3p accept`:
> address Either a null pointer, or a pointer to a sockaddr structure
> where the address of the connecting socket shall be re‐
> turned.
>
> address_len Either a null pointer, if address is a null pointer, or a
> pointer to a socklen_t object which on input specifies the
> length of the supplied sockaddr structure, and on output
> specifies the length of the stored address.
Fixes ziglang#6832.
2020-10-27 21:52:47 +01:00
LemonBoy
8044ed4c66
std: Add basic smoke test for net functionality
2020-10-27 21:52:47 +01:00
Isaac Freund
504f259c24
std/event: fix zig fmt regression
2020-10-27 21:40:22 +01:00
Isaac Freund
1b34365ca1
std/event: fix poll error set handling
...
This has been broken since 127fa80
2020-10-27 21:28:31 +01:00
Koakuma
2b87cc7ed3
starting_stack_ptr -> argc_argv_ptr to reflect actual use
2020-10-27 22:46:18 +07:00
Žiga Željko
7c2bde1f07
std/crypto: API cleanup
2020-10-26 19:19:34 -04:00
Andrew Kelley
e2caf57527
Merge branch 'frmdstryr-import-empty-file'
2020-10-26 16:07:46 -07:00
Andrew Kelley
435c8ad703
non-hacky workaround for the empty file bug
...
See #3328
2020-10-26 16:06:14 -07:00
Andrew Kelley
c1ae9f40c7
stage1: support "native" as the OS string in -target
...
This should help for bootstrapping purposes, intending to fix the macOS
CI.
2020-10-26 15:48:48 -07:00
frmdstryr
1ce0994897
Fix @import of empty file
2020-10-26 13:29:32 -07:00
Andrew Kelley
e83334274f
add regression test for already fixed bug
...
closes #6781
2020-10-26 13:18:44 -07:00
data-man
194e29adfc
Format null type in std.fmt
2020-10-26 15:40:48 -04:00
Andrew Kelley
a0f4606f32
ci: still build zig even though we are using (older) zig cc
2020-10-26 10:50:43 -07:00
Yanis Zafirópulos
c6747e1063
Copy editing :)
2020-10-26 18:39:34 +01:00
Frank Denis
74a1175d9d
std/*: add missing MIT license headers
2020-10-26 17:41:29 +01:00
mlarouche
e3fed3c814
Temp Fix for deadlock in C compilation, found and tested on Windows
2020-10-25 21:33:46 -04:00
johnLate
0a619c68a6
fix type mismatch in std.net.StreamServer
...
Parameter in std.os.listen is u31.
Fixes ziglang#6775
2020-10-25 21:18:24 -04:00
dec05eba
c0fa5963ee
Make lastIndexOf use the same cut-off between BMH as indexOf
...
Also update test to use a string longer than 52 characters
to test both BMH and linear path.
2020-10-25 21:17:22 -04:00
Frank Denis
72064eba23
std/crypto: vectorize BLAKE3
...
Gives a ~40% speedup on x86_64.
However, the generic code remains faster on aarch64.
This is still processing only one block at a time for now.
I'm pretty confident that processing more blocks per round
will eventually give a substantial performance improvement on
all platforms with vector units.
2020-10-25 21:13:14 -04:00
Frank Denis
1b4ab749cf
std/crypto: add the bcrypt password hashing function
...
The bcrypt function intentionally requires quite a lot of CPU cycles
to complete.
In addition to that, not having its full state constantly in the
CPU L1 cache causes a massive performance drop.
These properties slow down brute-force attacks against low-entropy
inputs (typically passwords), and GPU-based attacks get little
to no advantages over CPUs.
2020-10-25 21:11:40 -04:00
Sébastien Marie
2a0a11aa66
openbsd: make dl_phdr_info cross arches
...
introduce Addr and Half definition to std.elf, and use them for dl_phdr_info
2020-10-25 20:46:28 -04:00
Andrew Kelley
0088efc4b2
Merge pull request #6809 from jedisct1/salsa
...
std/crypto: add (X)Salsa20 and NaCl boxes
2020-10-25 20:34:35 -04:00
Andrew Kelley
bbd1e122d4
ci: skip compile error tests on freebsd to save time
2020-10-25 17:29:10 -07:00
Frank Denis
0c7a99b38d
Move ed25519 key pairs to a KeyPair structure
2020-10-25 21:55:05 +01:00
Frank Denis
28fb97f188
Add (X)Salsa20 and NaCl boxes
...
The NaCl constructions are available in pretty much all programming
languages, making them a solid choice for applications that require
interoperability.
Go includes them in the standard library, JavaScript has the popular
tweetnacl.js module, and reimplementations and ports of TweetNaCl
have been made everywhere.
Zig has almost everything that NaCl has at this point, the main
missing component being the Salsa20 cipher, on top on which NaCl's
secretboxes, boxes, and sealedboxes can be implemented.
So, here they are!
And clean the X25519 API up a little bit by the way.
2020-10-25 18:04:12 +01:00
Koakuma
cbc8750502
Separate libc stat and kernel stat definitions
2020-10-25 23:52:08 +07:00
Koakuma
3ce9428e3d
Various formatting fixes
2020-10-25 21:53:16 +07:00
Koakuma
5474d43389
Zero %i6 to terminate backchain
2020-10-25 21:51:01 +07:00
Koakuma
1a362ea5b0
Fix sparc64 bits definitions
2020-10-25 21:38:39 +07:00
Koakuma
785153d756
Fix SA_* constants for sparc64
2020-10-25 20:39:32 +07:00
Koakuma
f018201009
Predict error-less path on syscalls
2020-10-25 20:07:18 +07:00
joachimschmidt557
7b4f3c7cfc
stage2 ARM: genSetStack and genSetReg from stack
2020-10-25 12:51:19 +01:00
joachimschmidt557
7d14426da4
stage2 ARM: enable backpatching return statement
2020-10-25 12:51:19 +01:00
joachimschmidt557
0e16328636
stage2 ARM: add multiply and multiply long instructions
2020-10-25 12:51:19 +01:00
joachimschmidt557
7391087df1
stage2 ARM: better immediate loading feat. movw and movt
2020-10-25 12:51:19 +01:00
Vincent Rischmann
59af275680
test runner: use the correct number in leak report
2020-10-25 11:28:36 +02:00
Sébastien Marie
3115d2f2cd
readd original code from #6638 . realpathZ() is expected to take a [*:0]const u8
2020-10-25 10:02:10 +01:00
Koakuma
2e7a4758b3
Add back ppc input/output/clobber definitions
...
Accidentally removed when rebasing, this adds it back.
2020-10-25 13:39:22 +07:00
Koakuma
1d3abb761d
"zig fmt" on lib/std/os/linux.zig
2020-10-25 13:38:08 +07:00
Jakub Konka
872bc787b5
cc: fix regression on macOS after adding libc headers
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-24 17:32:50 +02:00
Koakuma
e7369ada93
Fix boolean operator in if clause
2020-10-24 21:33:40 +07:00
Koakuma
73e62f22ec
Fix sigaction(2) call on sparc64
2020-10-24 20:05:37 +07:00
Koakuma
792526c0bd
Fix sparc64 argument loading
2020-10-24 20:05:36 +07:00
Koakuma
cdbf66e36e
Add sparc64-specific values for the various SA_ and SIG_ constants
2020-10-24 20:05:34 +07:00
Koakuma
268516d5d9
Fix constants
2020-10-24 20:04:18 +07:00
Koakuma
238f253de9
Move comptime out
2020-10-24 20:03:41 +07:00
Koakuma
cefbe4e7be
Use correct names for generic SPARC targets
...
LLVM calls generic sparc32 CPUs "v8" and generic sparc64 CPUs "v9".
2020-10-24 20:03:41 +07:00
Koakuma
341eec71fd
Add clone(2) implementation
...
This implementation kindly provided by @LemonBoy at GitHub
https://github.com/ziglang/zig/pull/6187#issuecomment-682635168
2020-10-24 20:03:41 +07:00
Koakuma
300cfbf252
Add TLS implementation for sparc64
2020-10-24 20:03:40 +07:00
Koakuma
6146f81c6e
Add pipe(2) support
2020-10-24 20:03:37 +07:00
Koakuma
dba009fd21
Account for the delay slot
2020-10-24 20:01:32 +07:00
Koakuma
c29da84c0e
Add sp loading
2020-10-24 20:01:29 +07:00
Koakuma
23433fb317
Fix register naming
2020-10-24 19:59:05 +07:00
Koakuma
206f96d474
Add sparc64 linux C ABI
2020-10-24 19:59:04 +07:00
Koakuma
de06b0a635
Add sparc64 linux bits
2020-10-24 19:59:04 +07:00
Koakuma
e5a11020cc
Add sparc64 syscall interface
2020-10-24 19:59:04 +07:00
Frank Denis
91a1c20e74
Fix a typo (s/multple/multiple/)
2020-10-24 07:57:34 +02:00
s-ol
300b617140
generated docs: add FnFrame type support
...
See #3404
2020-10-23 15:44:32 +02:00
Timon Kruiper
4b48fccadd
When checking a cache hit, make sure to handle a (re)moved source file
...
When a file cannot be found in the cache, it is not a hit.
Closes #6729
2020-10-23 01:01:37 -04:00
Andrew Kelley
3af9025a1d
Merge pull request #6719 from jedisct1/ed25519-batch
...
std/crypto/25519: add support for batch Ed25519 signature verification
2020-10-23 00:58:53 -04:00
Andrew Kelley
392e6da8a3
update stack trace test case
2020-10-22 21:57:30 -07:00
Andrew Kelley
59c26c79e8
Merge branch 'BarabasGitHub-improve-windows-networking'
2020-10-22 17:45:31 -07:00
Andrew Kelley
569f7ce49e
Merge branch 'improve-windows-networking'
...
of https://github.com/BarabasGitHub/zig into
BarabasGitHub-improve-windows-networking
Conflicts:
lib/std/os.zig
This commit resolves conflicts with the changes to std.os which removed
the EAGAIN error handling interactions with the event loop. The solution
to the conflict was to apply EAGAIN => return error.WouldBlock into the
improved windows networking branch.
2020-10-22 16:59:15 -07:00
DixiE
79ec08fe2f
Fix Compiler Error When Using wWinMain Entry-Point
...
The fix for #6715 introduced a new compiler error when attempting to use
wWinMain as the application entry-point.
The Windows API often relies on implicit casts between signed and
unsigned variables. In this case, wWinMain returns an INT despite the
fact this value is intended to feed into ExitProcess, which expects a
UINT, so I've restored the bitcast from #5613 .
2020-10-22 19:50:06 -04:00
Paul Espinosa
ddd39b994b
Use std.testing.expect in language reference samples
...
In this commit, the code samples in the language reference have been changed to
use `std.testing.expect` rather than `std.debug.assert` when they are
written in `test` code. This will teach Zig learners best practices when
they write their own test code.
Not all uses of `std.debug.assert` have been replaced. There are examples where
using `assert` fits the context of the sample.
Using `std.debug.assert` in test code can lead to errors if running tests in
ReleaseFast mode. In ReleaseFast mode, the `unreachable` in `assert` is
undefined behavior. It is possible that `assert` always causes `zig test` to
pass thus possibly leading to incorrect test code outcomes. The goal is to
prevent incorrect code from passing test cases.
Closes #5836
2020-10-22 15:54:57 -07:00
chwayne
1e13e8e817
Make argsAlloc/ArgIterator return zero-sentinel strings ( #6720 )
2020-10-22 17:52:48 -04:00
xackus
2ee79f149b
std: reference more declarations in std.build
2020-10-22 17:44:23 -04:00
Andrew Kelley
e02655798f
Merge pull request #6743 from LemonBoy/someppc64stuff
...
Some ppc64 stuff
2020-10-22 17:39:26 -04:00
Andrew Kelley
e6ac082437
Merge pull request #6744 from LemonBoy/intcast-vec
...
stage1: Implement `@intCast` between vectors
2020-10-22 17:36:18 -04:00
Andrew Kelley
78199a684f
stage2 LLD .ar linking: fix wrong object file path
...
closes #6721
closes #6722
2020-10-22 14:33:46 -07:00
s-ol
bf982cd4e9
generated docs: add anyframe type support
...
See #3404
2020-10-22 16:05:59 +02:00
s-ol
c81e8c2125
generated docs: add vector type support
...
See #3404
2020-10-22 16:05:59 +02:00
Andrew Kelley
198d1438ea
ci: fix regression from not building docs
...
0e4f7a8e3f forgot to build the docs,
causing CI failures
2020-10-22 01:18:55 -07:00
Frank Denis
047599928a
Add a benchmark for signature verifications
2020-10-22 09:58:26 +02:00
Frank Denis
2d9befe9bf
Implement multiscalar edwards25519 point multiplication
2020-10-22 09:58:26 +02:00
Frank Denis
0fb6fdd7eb
Support variable-time edwards25519 scalar multiplication
...
This is useful to save some CPU cycles when the scalar is public,
such as when verifying signatures.
2020-10-22 09:58:26 +02:00
Frank Denis
ff658abe79
std/crypto/25519: use Barrett reduction for scalars (mod l)
2020-10-22 09:58:26 +02:00
Frank Denis
8e79b3cf23
std/crypto/25519: add support for batch Ed25519 signature verification
2020-10-22 09:58:26 +02:00
LemonBoy
0c355bef9e
std: Slim down the error code path in initStaticTLS
...
Calling @panic made the executable ~30x times bigger, use a simple
`abort()` and let the user figure out what went wrong.
Supporting ARMv6 (and earlier?) platforms is not a priority.
Closes #6676
2020-10-21 23:35:06 -04:00
heidezomp
1e07487904
Fix std.net.connectUnixSocket in evented I/O mode
...
The event loop constant was missing.
2020-10-21 23:32:12 -04:00
Andrew Kelley
ce5035c07d
Merge branch 'kubkon-macos-libc'
...
closes #6752
closes #5031
2020-10-21 19:59:12 -07:00
Andrew Kelley
11a9eff36e
add another copyright notice to macos stdint.h
2020-10-21 19:58:47 -07:00
Andrew Kelley
b61733a4b8
readme: rewrite the license section
2020-10-21 19:55:35 -07:00
Jakub Konka
7d0acacfc3
Add minimal set of macOS libc headers
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-21 19:45:21 -07:00
LemonBoy
44f8e6a534
stage1: Fix edge case in Union ZigValue generation
...
Unions that passed the one_possible_value check were incorrectly
generated, none of their internal fields were initialized.
Fixes #6758
2020-10-21 22:42:03 -04:00
frmdstryr
52879b50d9
Update enable-valgrind flag to fvalgrind
2020-10-21 22:41:11 -04:00
Frank Denis
0e4f7a8e3f
MSVC CI: run tests individually ( #6751 )
...
This slightly reduces the amount of peak RSS needed, buying us more time until stage2 is shipping.
2020-10-21 22:40:41 -04:00
xackus
36d586336c
std docs: print bool values
2020-10-20 23:27:12 +03:00
LemonBoy
90f7034b69
std: Implement featureSetHasAny/featureSetHasAll
...
Introduce two helper functions to avoid writing short novels only to check for more
than a single feature.
2020-10-20 23:23:43 +03:00
Rocknest
a123378141
langref: fix equations
2020-10-20 23:22:08 +03:00
John Burton
33c4ad7f3a
Add missing std in dump function json.zig
...
Add missing std to use of std.io.getStdErr in the function dump
so that it compiles.
2020-10-20 13:39:38 +03:00
LemonBoy
475fc2934b
Update langref errors
2020-10-20 10:05:44 +02:00
LemonBoy
39e34081ca
Update the stack-traces tests
2020-10-19 20:09:43 +02:00
LemonBoy
2f465761bb
stage1: Implement @intCast between vectors
...
Explicit and implicit integer casts on vector types are now supported
and follow the same rules as their scalar counterparts.
Implicit float casts are accidentally supported, `@floatCast` is still
not vector-aware.
2020-10-19 20:05:09 +02:00
LemonBoy
96fe971051
std: Minor changes to startup code
...
* Smaller startup sequence for ppc64
* Terminate the frame-pointer chain when executing _start
* Make the stack traces work on ppc64
* Make the stack traces coloured on ppc64, some ioctls numbers are
different and the whole set of constants should be audited.
2020-10-19 15:15:43 +02:00
Nathan Bourgeois
3ab4d112e0
Update Documentation to use -O instead
2020-10-19 13:00:04 +03:00
Frank Denis
6ddb05d996
Darwin has arc4random(), too
2020-10-18 18:24:36 +02:00
Jakub Konka
b28992de71
Disable build.zig tests on WASI since rely on cwd()
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-18 18:20:43 +02:00
Jakub Konka
dc68aab6fb
Merge pull request #6728 from Snektron/std-build-dupePkg-fix
...
Fix invalid call to dupePkg in build.zig
2020-10-18 15:29:51 +02:00
Robin Voetter
3d857f7808
add addPackage test
2020-10-18 13:35:24 +02:00
Robin Voetter
29c580304b
Fix invalid call to dupePkg in build.zig
2020-10-18 13:20:19 +02:00
Andrew Kelley
919dcc5104
coff: link in CRT for DLLs that want -lc
...
see #5748
closes #5870
2020-10-17 20:35:44 -07:00
Jesse Rudolph
e821a57683
add Builder.dupePkg()
...
mimics the duplication of strings in `Builder` for `Pkg`. This
ensures the lifetime of the memory backing strings in a `Pkg`
struct and the `Pkg.dependencies` slice is not shorter than the
`Builder` that the data is associated with.
2020-10-17 22:35:36 -04:00
Andrew Kelley
b0684bf084
std.mem: expose the simpler linear functions
...
The new defaults that came in with
644400054c are nice, however, it is still
possible that someone knows their inputs are always small and wants to
use the simpler implementations. We keep the default to make the choice
at runtime, but expose the linear functions in the public interface of
std.mem.
Also improved the doc comments.
2020-10-17 19:24:52 -07:00
Andrew Kelley
644400054c
Merge pull request #6259 from dec05eba/master
...
Use boyer-moore-horspool algorithm for indexOfPos and lastIndexOf unless the haystack or needle is very small
2020-10-17 21:38:50 -04:00
Nathan Bourgeois
e55244c4c6
BYOS support for system.isatty(fd: fd_t); ( #6686 )
2020-10-17 21:13:10 -04:00
Felix (xq) Queißner
b014bc77c8
Fixes std.meta.Tuple and std.meta.ArgsTuple for zero-sized types (like void).
2020-10-17 21:10:01 -04:00
LemonBoy
2a256d5ea0
stage1: Fix type-checking of unary neg for vector types
...
Validate the vector element type as done for the scalar case.
Fixes #6708
2020-10-17 21:08:39 -04:00
Andrew Kelley
e51bc19e4a
Merge pull request #6394 from Vexu/fmt
...
std.fmt add specifier for printing Zig identifiers
2020-10-17 21:06:54 -04:00
Andrew Kelley
71ac5b1515
Merge branch 'semarie-openbsd-minimal'
2020-10-17 17:53:47 -07:00
Andrew Kelley
05b1a7414e
code cleanups
...
* in selfExePath, return errors instead of defaulting to bogus data
* less invasive edits to the logic of link/Elf.zig
* less indentation
2020-10-17 17:52:09 -07:00
Andrew Kelley
03f7cffce9
Merge branch 'openbsd-minimal' of https://github.com/semarie/zig into semarie-openbsd-minimal
2020-10-17 17:34:43 -07:00
Andrew Kelley
9052e0b137
Merge pull request #6713 from jprudil/close-6697
...
Make std.meta.Int accept a signedness parameter
2020-10-17 18:55:25 -04:00
Frank Denis
fa17447090
std/crypto: make the whole APIs more consistent
...
- use `PascalCase` for all types. So, AES256GCM is now Aes256Gcm.
- consistently use `_length` instead of mixing `_size` and `_length` for the
constants we expose
- Use `minimum_key_length` when it represents an actual minimum length.
Otherwise, use `key_length`.
- Require output buffers (for ciphertexts, macs, hashes) to be of the right
size, not at least of that size in some functions, and the exact size elsewhere.
- Use a `_bits` suffix instead of `_length` when a size is represented as a
number of bits to avoid confusion.
- Functions returning a constant-sized slice are now defined as a slice instead
of a pointer + a runtime assertion. This is the case for most hash functions.
- Use `camelCase` for all functions instead of `snake_case`.
No functional changes, but these are breaking API changes.
2020-10-17 18:53:08 -04:00
Andrew Kelley
0011def2b2
fix compilation error when building with io_mode evented
...
The merge of #5613 introduced a regression when building with io_mode
evented, fixed in this commit.
closes #6715
2020-10-17 15:46:36 -07:00
Vexu
e8ca1b254d
std: remove renderStringLiteral in favor of std.fmt specifier
2020-10-17 23:20:38 +03:00
Sebastien Marie
35a7247a2c
Merge branch 'master' into openbsd-minimal
2020-10-17 17:38:23 +02:00
Jan Prudil
132813849c
Convert remaining call sites
2020-10-17 14:50:26 +02:00
Jan Prudil
aadccc4206
Make std.meta.Int accept a signedness parameter
2020-10-17 14:09:59 +02:00
Vexu
2c294676b5
use new format specifier in translate-c and std lib
2020-10-17 10:27:19 +03:00
Vexu
8d38a91ca8
std.fmt: add specifier for Zig identifiers
2020-10-17 10:26:59 +03:00
Andrew Kelley
245d98d32d
Merge pull request #6291 from pixelherodev/cbe_arithmetic
...
CBE: addition and subtraction
2020-10-17 01:00:38 -04:00
Andrew Kelley
9241c1b772
Merge branch 'nmichaels-zbs-doc'
...
closes #5800
2020-10-16 21:33:04 -07:00
Andrew Kelley
9ca8bcb4d9
langref cleanups
...
* move the opaque section to after struct, enum, union, and add
hyperlinks
* improve the introduction of the zig build system. don't link to the
wiki.
* update to the latest zig init-exe example code
* rename headers to avoid redundant words such as "zig"
* simplify example code
2020-10-16 21:29:33 -07:00
Nathan Michaels
eb80cc2b9e
Add some basic examples for the Zig Build System.
2020-10-16 21:29:22 -07:00
Andrew Kelley
6850e54cc0
Merge branch 'vegecode-byteOffsetOf_fix'
...
closes #5713
2020-10-16 21:25:42 -07:00
vegecode
2545f44db0
byteOffsetOf add fields to non-packet struct to maintain symmetry
2020-10-16 20:04:42 -07:00
vegecode
0456b2145d
byteOffsetOf rounds up using bit offset in host integer
2020-10-16 20:04:42 -07:00
Juha Syrjälä
79ef96b6a4
Add support for zig build run -- arg1 arg1 in file created by init-exe
2020-10-16 21:29:24 -04:00
Andrew Kelley
8a2d12d707
Merge pull request #6393 from onebsv1/priority-queue-update
...
Adding a function to update the priority of an element
2020-10-16 21:26:04 -04:00
LemonBoy
d44486b274
std: Add libssp implementation for GNU/Windows targets
...
Unlike glibc and musl, MinGW provides no libssp symbols leading to
countless compile errors if FORTIFY_SOURCE is defined.
Add a (incomplete) implementation of libssp written in Zig so that
linking succeeds.
Closes #6492
2020-10-16 21:22:14 -04:00
Andrew Kelley
2aff27d922
Merge branch '6604'
...
closes #6604
2020-10-16 18:15:31 -07:00
Andrew Kelley
5c16022c81
rename WaitpidRet to WaitPidResult
2020-10-16 18:14:39 -07:00
stf
3921cb0d8d
std.os.waitpid: also return pid of child
...
closes #6581
2020-10-16 17:26:50 -07:00
Isaac Freund
0e4c3934a0
zig fmt: write modified files to stdout not stderr
2020-10-16 20:23:18 -04:00
Andrew Kelley
8364417c8f
trivial refactor to remove redundant function call
2020-10-16 16:15:50 -07:00
Jakub Konka
fe127a3691
Add llvm-config detection when dynlinking clang
2020-10-16 19:14:42 -04:00
Jakub Konka
abd72781a3
Allow linking with dynamic libraries in main CLI
2020-10-16 19:14:42 -04:00
Frank Denis
0b4a5254fa
Vectorize Gimli
2020-10-16 18:41:11 -04:00
LemonBoy
f78380b936
stage1: Don't ask LLVM to emit misaligned memcpy
...
Pay close attention to the RHS type alignment when rendering an
assignment op as it may differ from the LHS pointer one.
This problem was noticed when debugging a CI failure in #6648 : due to
sheer luck the misalignment caused a segfault on macos that was also
reproduced locally.
I tried to write a small test case but it turned out to be a daunting
task as I couldn't manage to trigger the problem consistently (and stop
the optimizer from simplifying everything). Patches welcome.
2020-10-16 18:39:48 -04:00
LemonBoy
2a62d4b20b
stage1: Expand undefined struct/arrays when indexed
...
Fixes #6693
2020-10-16 17:13:38 +03:00
Andrew Kelley
996a2284dd
Merge branch 'AnthonyYoManz-5002-fix-entrypoint-with-winmain'
...
closes #5002
closes #5613
2020-10-15 19:39:44 -07:00
Andrew Kelley
d87bd3d8af
fixups regarding windows wide strings
...
* remove GetModuleHandleA from kernel32.zig. use of A functions
considered harmful.
* make it a compile error to expose WinMain instead of wWinMain. same
thing.
* start code declares wWinMainCRTStartup instead of WinMainCRTStartup
when it has the choice.
2020-10-15 19:37:55 -07:00
Andrew Kelley
c7c38e7279
Merge branch '5002-fix-entrypoint-with-winmain' of https://github.com/AnthonyYoManz/zig into AnthonyYoManz-5002-fix-entrypoint-with-winmain
2020-10-15 18:22:12 -07:00
Frank Denis
51a3d0603c
std.rand: set DefaultCsprng to Gimli, and require a larger seed
...
`DefaultCsprng` is documented as a cryptographically secure RNG.
While `ISAAC` is a CSPRNG, the variant we have, `ISAAC64` is not.
A 64 bit seed is a bit small to satisfy that claim.
We also saw it being used with the current date as a seed, that
also defeats the point of a CSPRNG.
Set `DefaultCsprng` to `Gimli` instead of `ISAAC64`, rename
the parameter from `init_s` to `secret_seed` + add a comment to
clarify what kind of seed is expected here.
Instead of directly touching the internals of the Gimli implementation
(which can change/be architecture-specific), add an `init()` function
to the state.
Our Gimli-based CSPRNG was also not backtracking resistant. Gimli
is a permutation; it can be reverted. So, if the state was ever leaked,
future secrets, but also all the previously generated ones could be
recovered. Clear the rate after a squeeze in order to prevent this.
Finally, a dumb test was added just to exercise `DefaultCsprng` since
we don't use it anywhere.
2020-10-15 20:57:16 -04:00
Andrew Kelley
f701459f04
Merge pull request #6685 from ifreund/bufprint0
...
std/fmt: rename allocPrint0() to allocPrintZ(), add bufPrintZ()
2020-10-15 20:51:25 -04:00
Frank Denis
cb44f27104
std/crypto/hmac: remove HmacBlake2s256 definition
...
HMAC is a generic construction, so we allow it to be instantiated
with any hash function.
In practice, HMAC is almost exclusively used with MD5, SHA1 and SHA2,
so it makes sense to define some shortcuts for them.
However, defining `HmacBlake2s256` is a bit weird (and why
specifically that one, and not other hash functions we also support?).
There would be nothing wrong with that construction, but it's not
used in any standard protocol and would be a curious choice.
BLAKE2 being a keyed hash function, it doesn't need HMAC to be used as
a MAC, so that also doesn't make it a good example of a possible hash
function for HMAC.
This commit doesn't remove the ability to use a Hmac(Blake2s256) type
if, for some reason, applications really need this, but it removes
HmacBlake2s256 as a constant.
2020-10-15 20:50:34 -04:00
Andrew Kelley
a66449c1ed
Merge pull request #6616 from fengb/darwin-rusage
...
Darwin rusage
2020-10-15 20:49:54 -04:00
Andrew Kelley
ee0ba9ec7d
Merge branch 'g-w1-master'
...
closes #6627
2020-10-15 17:44:26 -07:00
Andrew Kelley
09a250c531
adjust error message of zig run with no args
...
previously it said "one source file" which was not correct
2020-10-15 17:44:10 -07:00
g-w1
dfce396cf8
friendly error message for zig run with no args
2020-10-15 17:43:44 -07:00
Tadeo Kondrak
e892ee17e6
std: move std.meta.refAllDecls to std.testing
2020-10-15 20:34:22 -04:00
Andrew Kelley
0da027f078
Merge branch 'g-w1-zig-test-zig-run-execve'
...
closes #6653
2020-10-15 17:19:47 -07:00
Andrew Kelley
43c2ce10a1
fixups
...
* extract logic into a `os_can_execve` and use it in the other place
that we execve
* outdent some code by introducing `run_or_test` variable
* delete unnecessary and wasteful memory management logic
* better error message for when execve fails
* add comment to explain why we do not execve for `zig test`
2020-10-15 17:18:40 -07:00
g-w1
1c36680928
stage2: use execve where available for zig test and zig run
...
closes #6531
2020-10-15 16:54:50 -07:00
Andrew Kelley
e17297102a
Merge branch 'kubkon-enable-stage2-macos-tests'
...
closes #6661
2020-10-15 16:48:44 -07:00
Andrew Kelley
d91e75f5ca
getExternalExecutor fixups regarding dynamic linker
...
* std.Target.standardDynamicLinkerPath: macOS has a dynamic linker
* no need to override the default dynamic linker in the macos
CrossTarget initialization in the tests
* in getExternalExecutor, when validating the dynamic linker path, take
into account the standard dynamic linker path.
2020-10-15 16:44:16 -07:00
Clayton Voges
8c4031fd87
replaced inStream() with reader()
...
`inStream()` is now deprecated and deserves replacing.
2020-10-15 19:30:21 -04:00
Jakub Konka
0e1afee732
Enable stage2 end-to-end tests on macOS run natively
...
This commit enables stage2 end-to-end tests to run natively on macOS
(where and when applicable). Since QEMU on macOS doesn't support
the same type of architecture emulation as it does on linux (i.e.,
there is no `qemu-x86_64` for instance), this commit ensures that we
specify a path to dynamic linker on macOS (`/usr/lib/dyld`) which
is then checked for existence in `std.CrossTarget.getExternalExecutor()`
function, and if exists, we can run the test natively.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-15 15:59:16 -07:00
Frank Denis
f3667e8a80
std/crypto/25519: do cofactored ed25519 verification
...
This is slightly slower but makes our verification function compatible
with batch signatures. Which, in turn, makes blockchain people happy.
And we want to make our users happy.
Add convenience functions to substract edwards25519 points and to
clear the cofactor.
2020-10-15 18:49:10 -04:00
LemonBoy
ab585c680b
stage1: Off-by-one error in int to float conversion
...
The base is 2^64 and not 2^64-1.
Closes #6683
2020-10-15 21:25:59 +03:00
Isaac Freund
7b150dd05e
docs: snake_case enums/unions in langref examples
...
This follows the accepted change to the style guide:
https://github.com/ziglang/zig/issues/2101
2020-10-15 18:55:57 +03:00
Isaac Freund
d52035f401
std/fmt: add bufPrintZ()
2020-10-15 12:21:19 +02:00
Isaac Freund
b259696cfb
std/fmt: rename allocPrint0() to allocPrintZ()
...
This is consistent with other standard library functions working with
null terminated pointers/slices.
2020-10-15 12:21:14 +02:00
Andrew Kelley
3b4432d9a6
Merge pull request #6655 from kprotty/timers
...
Integrate std.time.sleep with the event loop
2020-10-14 21:49:45 -04:00
Andrew Kelley
2f52f95b92
Merge pull request #6669 from ifreund/color-fixes
...
std/build: support --color
2020-10-14 21:35:43 -04:00
Matthew Knight
352976ed23
Event Channel: updated linked list node initialization ( #6652 )
...
fixed node init method
2020-10-14 21:33:53 -04:00
Andrew Kelley
aa5ff867a2
Merge branch 'jedisct1-tbd-dylib'
...
closes #6681
2020-10-14 18:24:21 -07:00
Andrew Kelley
816304e7e1
add .tbd to usage text
2020-10-14 18:22:50 -07:00
Frank Denis
c0e9d3fb86
Classify .tbd files as shared libraries
...
On macOS, a .tbd ("text-based dylib definition") file is a shared library
stub, allowing symbols to be defined only once for all the architectures
the library was compiled for.
.tbd files can be linked like .dylib files.
2020-10-14 18:19:57 -07:00
Andrew Kelley
477798b37e
ci: macos: unset ZIG_LIBC before testing
...
otherwise cross compiling gets incorrectly affected by the environment
variable.
2020-10-14 17:59:29 -07:00
Andrew Kelley
540364e6c1
ci: macos: update to new cache tarball
...
This tarball contains LLVM, Clang, LLD, Zig, and libz.a for macOS. This
is everything we need for the CI to produce a working Zig executable.
2020-10-14 17:36:43 -07:00
Andrew Kelley
bf8cc73cf3
ci: macos: take advantage of zig-bootstrap
2020-10-14 02:25:51 -07:00
Andrew Kelley
0f4386875f
stage2: support ZIG_LIBC env var and detect self as system C compiler
2020-10-14 02:05:56 -07:00
Jakub Konka
68b31c59a6
Merge pull request #6650 from kubkon/macho-incremental
...
stage2: enable incremental MachO linking
2020-10-14 08:20:33 +02:00
Rocknest
548fd6e87b
force comptime on comptimePrint
2020-10-14 01:03:01 -04:00
Andrew Kelley
3811602ad7
Merge pull request #6643 from jedisct1/chacha-vec
...
std/crypto: add a vectorized ChaCha20 implementation
2020-10-14 00:52:36 -04:00
LemonBoy
0570df69b1
stage1: Fix missing runtime safety check for intToPtr
...
Elide the alignment check if the pointer alignment is one, the null
check must be preserved as it depends on the pointer type.
Fixes #6667
2020-10-14 00:05:50 -04:00
Isaac Freund
6ba1fdf7e0
stage2: use meta.stringToEnum for Color parsing
...
This requires renaming the variants to be snake_case, which is the new
recommended style anyways.
2020-10-13 20:17:30 +02:00
Isaac Freund
f01c3150c1
std/build: support --color
2020-10-13 20:06:03 +02:00
Jakub Konka
adfd298e44
Do not rewrite paths to dyld and libSystem unless changed
2020-10-13 08:38:17 +02:00
Jakub Konka
951721343f
Reuse text blocks; enable all incremental tests
2020-10-13 08:38:17 +02:00
Jakub Konka
cf2aea7b41
Enable incremental testcase for macOS
2020-10-13 08:38:17 +02:00
Jakub Konka
ecd480fe93
Fix writing of load cmds headers *after* symtab update
2020-10-13 08:38:17 +02:00
Jakub Konka
fc660af077
Update allocateTextBlock to use node free list
2020-10-13 08:38:17 +02:00
Jakub Konka
78ec7b671d
Add mechanism for growing/shrinking text blocks
2020-10-13 08:38:17 +02:00
Jakub Konka
0b77152faa
Add local and offset free lists
2020-10-13 08:38:17 +02:00
Andrew Kelley
ea45ee5484
cmake: remove all the LLVM 10 workarounds
2020-10-12 22:35:06 -07:00
Andrew Kelley
9e05f42fee
ci: macos: set the cross compile cmake option
...
This should avoid invoking llvm-config to work around a symbol
not found inside libstdc++, and plus it's technically more correct
anyway.
2020-10-12 22:32:14 -07:00
Andrew Kelley
92926c4331
ci: no space in vmImage I guess
2020-10-12 21:58:46 -07:00
Andrew Kelley
461792f9de
ci: update to macos 10.15 image
2020-10-12 21:53:13 -07:00
Andrew Kelley
68e6da7c00
CI: enable all the freebsd tests
2020-10-12 20:51:16 -07:00
Andrew Kelley
27b04d5905
disable the failing std lib freebsd tests
...
enable std lib freebsd tests on the CI
See #1759
2020-10-12 20:08:23 -07:00
Andrew Kelley
74e3ffa9b4
ci: update llvm 10 => 11
2020-10-12 18:38:28 -07:00
Andrew Kelley
c19dcafa17
Merge remote-tracking branch 'origin/master' into llvm11
2020-10-12 17:57:35 -07:00
Vignesh Rajagopalan
2ab0c7391a
Rename .macosx to .macos
2020-10-12 18:56:25 -04:00
kprotty
12508025a4
Add more comments & cleanup AutoResetEvent
2020-10-11 19:16:07 -05:00
kprotty
e9a4c3dd82
fix DelayQueue typos
2020-10-11 14:21:36 -05:00
kprotty
aa53f6d0b5
integrate std.time.sleep with the event loop
2020-10-11 14:18:19 -05:00
kprotty
a42c0f88e0
AutoResetEvent
2020-10-11 14:17:51 -05:00
Sébastien Marie
161eb4a000
initialize std.os.argv in stage1 compiler. it is needed for selfExePath under OpenBSD
2020-10-11 12:25:16 +00:00
Sébastien Marie
a6dc2b7fcc
openbsd: selfExePath adjustements
2020-10-11 12:23:52 +00:00
Sébastien Marie
4c4211ea8e
merge netbsd and openbsd cases
2020-10-11 10:22:28 +00:00
Sébastien Marie
9ff51f22b4
openbsd: address link/Elf.zig comments
...
- restore correct behaviour on Android target for appending "crtend_android.o"
- some nits
2020-10-11 10:12:40 +00:00
Sébastien Marie
97ec9fdd79
opensd: selfExePath: do not rely on environment as it could be inherited
2020-10-11 08:23:37 +00:00
Sébastien Marie
78a7543056
openbsd: use mem.span() + mem.indexOf() instead of defining custom function
2020-10-11 08:23:37 +00:00
Sébastien Marie
f33a610c84
add minimal openbsd support
2020-10-11 08:23:36 +00:00
Frank Denis
9f109ba0eb
Simpler ChaCha20 vector code
2020-10-10 22:45:41 +02:00
Frank Denis
459128e059
Use an array of comptime_int for shuffle masks
...
Suggested by @LemonBoy - Thanks!
2020-10-10 22:45:41 +02:00
Frank Denis
9b386bda33
std/crypto: add a vectorized ChaCha20 implementation
...
Brings a 30% speed boost on x86_64 even though we still process only
one block at a time for now.
Only enabled on x86_64 since the non-vectorized implementation seems
to currently perform better on some architectures (at least on aarch64).
But the non-vectorized implementation still gets a little speed boost
as well (~17%) with these changes.
2020-10-10 22:45:41 +02:00
Jakub Konka
53c63bdb73
Update WASI preopens doc section to use GPA
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-10 20:07:16 +02:00
redj
c0b2813e04
tools/update_clang_options: add zig run usage example. fix src-self-hosted path. ( #6635 )
...
* tools/update_clang_options: fix src-self-hosted path now simply src.
* tools/update_clang_options: add zig run usage example.
2020-10-09 23:09:36 -04:00
LemonBoy
a31b70c4b8
std: Add/Fix/Change parts of big.int
...
* Add an optimized squaring routine under the `sqr` name.
Algorithms for squaring bigger numbers efficiently will come in a
PR later.
* Fix a bug where a multiplication was done twice if the threshold for
the use of Karatsuba algorithm was crossed. Add a test to make sure
this won't happen again.
* Streamline `pow` method, take a `Const` parameter.
* Minor tweaks to `pow`, avoid bit-reversing the exponent.
2020-10-09 22:16:48 -04:00
Andrew Kelley
fbc6a00b0a
Merge branch 'mlarouche-Fix_6500'
2020-10-09 16:49:05 -07:00
Andrew Kelley
9f8f446435
fixups to previous commit
...
* std.fs.Dir.readFile: add doc comments to explain what it means when
the returned slice has the same length as the supplied buffer.
* introduce readSmallFile / writeSmallFile to abstract over the
decision to use symlink or file contents to store data.
2020-10-09 16:45:39 -07:00
mlarouche
57912964af
Use regular file for caching stage 1 hash digest instead of symlink, fix zig build caching on Windows
...
Fix #6500
2020-10-09 16:50:43 -04:00
Jakub Konka
04b0ffdd13
Merge pull request #6577 from kubkon/macho-trie
...
stage2: add export trie generation in MachO linker
2020-10-09 17:41:52 +02:00
Jakub Konka
8dc4023615
Apply nitpick: top-level doc comments
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-09 17:40:37 +02:00
Josh Wolfe
bc6904eccc
include compiler_rt and c for wasm static libraries
2020-10-09 01:54:42 -04:00
Andrew Kelley
1951ecb228
add a code of conduct
...
this has always been the rules, they are just written down now.
also link to ziglearn.org in the readme
2020-10-08 22:48:16 -07:00
Andrew Kelley
a4828f6d0f
std.c (darwin) update to new opaque syntax
...
This was an undetected conflict between
76a195473d and
95a37373e9
2020-10-08 22:45:39 -07:00
Andrew Kelley
76a195473d
Merge pull request #6516 from LemonBoy/fastfilecopy
...
std: Make file copy ops use zero-copy mechanisms
2020-10-08 20:14:47 -04:00
Andrew Kelley
4053b95d8e
run update_clang_options on llvm 11 rc6
2020-10-08 16:13:37 -07:00
Andrew Kelley
8b7539bd95
Merge remote-tracking branch 'origin/master' into llvm11
...
Conflicts:
src/clang.zig
Master branch renamed an enum; this branch gave it an explicit tag type
and explicitly initialized values. This commit combines the changes
together.
2020-10-08 15:47:45 -07:00
Andrew Kelley
b02341d6f5
Merge pull request #6614 from jedisct1/aes-arm
...
std/crypto/aes: add AES hardware acceleration on aarch64
2020-10-08 18:09:40 -04:00
Frank Denis
1bc2b68916
ghash: add pmull support on aarch64
2020-10-08 18:09:23 -04:00
Benjamin Feng
9de0f15b8e
Rename ix_rss -> ixrss
2020-10-08 15:31:36 -05:00
Benjamin Feng
fd3f676cdb
Pull in Darwin definitions for rusage
2020-10-08 15:19:52 -05:00
Jakub Konka
ba41e599bf
Clean up writing the trie into ULEB128 byte stream
...
Prealloc as much as possible to improve alloc performance.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-08 19:53:23 +02:00
Jakub Konka
5f86505cf7
Fix ULEB128 encoding of trie
...
Use algorithm described in official Apple `ld64` implementation.
Link: https://opensource.apple.com/source/ld64/ld64-123.2.1/src/abstraction/MachOTrie.hpp
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-08 19:53:03 +02:00
Frank Denis
60d1e675d2
aes/aesni is not based on a Go implementation, only aes/soft is
...
Don't blame them for our bugs :)
2020-10-08 14:55:11 +02:00
Frank Denis
f39dc00ed4
std/crypto/aes: add AES hardware acceleration on aarch64
2020-10-08 14:55:08 +02:00
Tadeo Kondrak
83eda21488
zig_clang/translate_c: Use opaque declarations in Zig
2020-10-08 12:29:59 +03:00
Tadeo Kondrak
0e57f220fb
stage1: Disallow arrays in function parameters or return types
...
Closes #6535 .
2020-10-08 04:17:32 -04:00
xavier
eb33394d14
notice more kinds of optimization flags and debug flags
...
Closes #6091
2020-10-07 18:43:05 -04:00
Jakub Konka
ea44d12d1b
Add writeULEB128Mem test and couple fixes
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-07 23:54:51 +02:00
xavier
a0a834a2f2
restore ability to do comptime math
...
until https://github.com/ziglang/zig/issues/6168 is implemented,
partially revert 0bd53dd203
in order to restore the ability to use std.math in comptime functions.
2020-10-07 17:04:48 -04:00
Andrew Kelley
95a37373e9
Merge pull request #6421 from tadeokondrak/opaque-syntax
...
Add opaque syntax that allows declarations
2020-10-07 16:58:50 -04:00
Andrew Kelley
3c43eeceab
Merge pull request #6595 from tadeokondrak/comptime-print-0
...
std.fmt.comptimePrint: Return null terminated string
2020-10-07 16:55:03 -04:00
Jakub Konka
b5b25d38a8
Fix improper reuse of global symbols in MachO
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-07 20:34:40 +02:00
Jakub Konka
bdab4f53c1
Move trie structure into its own file-module
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-07 20:34:34 +02:00
Jakub Konka
b13b36a71d
Approach using array list for auto mem mgmt
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-07 20:33:47 +02:00
Jakub Konka
e76fb8d8c8
Add incomplete writing of trie to bytes buffer
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-07 20:33:28 +02:00
Tadeo Kondrak
e9bca9de3c
std.fmt.comptimePrint: Properly null-terminate result and add test
2020-10-07 11:43:23 -06:00
Jakub Konka
f0a73df8e7
Add prototype for export trie generation in MachO linker
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-07 18:31:02 +02:00
Jakub Konka
07c33dfc95
Remove obsolete addPadding fn and callsites from MachO linker
...
This is no longer needed due to the way writing to the output
file is structured.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-07 17:18:37 +02:00
LemonBoy
03762da2af
New review round
2020-10-07 11:13:26 +02:00
Loris Cro
53dee08af9
add WaitGroup to std.event
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-10-07 04:34:09 -04:00
Tadeo Kondrak
0a6863a267
Remove .Cold calling convention.
...
This isn't a stable, defined calling convention, so it shouldn't be
grouped in with the others.
Closes https://github.com/ziglang/zig/issues/6556
2020-10-07 04:31:20 -04:00
pfg
ae161863db
stage1: improve error messages for missing try statements
2020-10-07 03:50:11 -04:00
Andrew Kelley
b5a36f676b
Merge remote-tracking branch 'origin/master' into llvm11
...
Conflicts:
cmake/Findllvm.cmake
The llvm11 branch changed 10's to 11's and master branch added the
"using LLVM_CONFIG_EXE" help message, so the resolution was to merge
these changes together.
I also added a check to make sure LLVM is built with AVR enabled, which
is no longer an experimental target.
2020-10-07 00:46:05 -07:00
Andrew Kelley
f2d374e846
Merge branch 'FireFox317-fix-32-bit-target'
2020-10-07 00:42:58 -07:00
Andrew Kelley
b2b0bf0506
fixups for the previous commit
...
* std.fs.File.copyRange and copyRangeAll return u64 instead of usize -
the returned value is how much of the `len` is transferred, so the
types should match. This removes the need for an `@intCast`.
* fix typo that removed a subtraction
* Fix the size of codegen.AnyMCValue which gave me a compile error when
I tried to build self-hosted for i386-linux.
* restore the coercion to u64 of syms_sect.sh_info. We want to make
sure the multiplication happens with 64 bits and not the smaller type
used by the ELF format.
* fix another offset parameter in link/Elf.zig to be u64 instead of usize
* add a nice little TODO note to help out Jakub
* FmtError already has FileTooBig in it; we just need to return it.
2020-10-07 00:39:13 -07:00
Timon Kruiper
bd7eab573a
Fix building the zig compiler for 32-bit targets
2020-10-06 23:39:58 -07:00
Noam Preil
7d69e1d84e
Rename variables in resolvePeerTypes for clarity
2020-10-07 02:36:04 -04:00
Noam Preil
de093879cc
Fix peer type resolution
2020-10-07 02:31:47 -04:00
Tadeo Kondrak
49e68bdcf3
std.fmt.comptimePrint: Return null terminated string
2020-10-06 22:21:06 -06:00
Tadeo Kondrak
bf4bfe54ac
Update compile error test for field access of opaque type
2020-10-06 22:08:30 -06:00
Tadeo Kondrak
6b8ae6fffb
langref: update for opaque {} syntax
2020-10-06 22:08:29 -06:00
Tadeo Kondrak
0a56390230
stage1: use size_t over int as index in resolve_opaque_type
2020-10-06 22:08:28 -06:00
Tadeo Kondrak
d71f339395
stage1: disallow fields in opaque types
2020-10-06 22:08:27 -06:00
Tadeo Kondrak
d5b8172a82
translate_c: emit opaque {} instead of @Type(.Opaque)
2020-10-06 22:08:26 -06:00
Tadeo Kondrak
2b4b03d301
Update zig files for opaque type syntax
2020-10-06 22:08:25 -06:00
Tadeo Kondrak
069fbb3c01
Add opaque type syntax
2020-10-06 22:08:24 -06:00
Timon Kruiper
d6d05fc84d
Update the list of libraries that llvm11 uses
2020-10-06 20:07:40 -04:00
Frank Denis
fb63a2cfae
std/crypto: faster (mod 2^255-19) square root computation
...
251 squarings, 250 multiplications -> 251 squarings, 11 multiplications
2020-10-06 19:48:26 -04:00
travisstaloch
dd4771a5d2
cache-hash: add test_filter and test_name_prefix ( #6583 )
2020-10-06 19:36:14 -04:00
LemonBoy
87807d53dd
stage2: Fix arg processing for zig run
...
* Stop parsing arguments after `--`
* Calculate the correct index for the first argument after `--`
2020-10-06 19:31:57 -04:00
Noam Preil
7b88215a49
Replace error message with unreachable
2020-10-06 15:09:57 -04:00
Noam Preil
a2e1639d6d
Peer type resolution: comptime_int decay to other int
2020-10-06 15:09:57 -04:00
Noam Preil
ea7b2750c8
CBE: addition and subtraction
2020-10-06 15:09:57 -04:00
Noam Preil
e06ba9e86e
CBE: properly resolve Insts
2020-10-06 15:09:57 -04:00
Noam Preil
9ef6c0a035
CBE: utilize per-function arena allocator
2020-10-06 15:09:56 -04:00
Noam Preil
9979719a9d
Stage2 peer type resolution: comptime_int + other_int_type
2020-10-06 15:09:56 -04:00
Noam Preil
ce29fc0947
Make indentation adjustable (hardcode 4 spaces for now)
2020-10-06 15:09:56 -04:00
LemonBoy
1f7ec0de70
Address review comments & fix compilation errors
2020-10-06 11:57:23 +02:00
LemonBoy
a419a1aabc
Move copy_file to fs namespace
...
Now it is a private API.
Also handle short writes in copy_file_range fallback implementation.
2020-10-06 09:38:59 +02:00
Vexu
58502b8bfe
translate-c: respect C operator precedence in macros
2020-10-05 22:26:11 -04:00
Noah Altunian
c507c7862e
Fix spelling in code comment
...
Changed **an handle** -> **a handle**.
2020-10-05 22:25:07 -04:00
Andrew Kelley
41aa5edaaf
Merge pull request #6580 from jedisct1/aesgcm
...
std/crypto: Add support for AES-GCM
2020-10-05 22:20:29 -04:00
Timon Kruiper
75db8d9e2c
Fix cross-compiling the zig compiler
...
zig0 is only used for building objects, thus it has no options like
`build-exe/obj`. But when cross-compiling, we have a working zig
compiler on the host, thus we need to pass `build-obj` to the zig compiler.
2020-10-05 22:18:42 -04:00
Isaac Freund
0741505d6d
std/zig: handle underscore in kernel version
...
On some distros (e.g. Void Linux) the release field of the tsname
struct may contain an underscore followed by a revision number at the
end. (e.g. 5.8.12_2).
2020-10-05 22:17:28 -04:00
LemonBoy
dbc11be038
std: Fix two bugs in bigint pow
...
* Correctly scan all the exponent bits, this caused the incorrect result
to be computed for exponents being powers of two.
* Allocate enough limbs to make llmulacc stop whining.
2020-10-05 22:16:26 -04:00
Frank Denis
06c16f44e7
std/crypto: Add support for AES-GCM
...
Already pretty fast on platforms with AES-NI, even though GHASH
reduction hasn't been optimized yet, and we don't do stitching either.
2020-10-06 00:00:33 +02:00
Frank Denis
d343b75e7f
ghash & poly1305: fix handling of partial blocks and add pad()
...
pad() aligns the next input to the first byte of a block, which is
useful to implement the IETF version of ChaCha20Poly1305 and AES-GCM.
2020-10-05 23:50:38 +02:00
Andrew Kelley
7f7e2d608a
Revert "revert adding std.event.Loop.runDetached"
...
This reverts commit 70f3767903 .
After discussion, I can see the value provided here, specifically with
avoiding the footgun of defer { suspend { free(@frame()); } }.
However the doc comments are updated to explain the semantics directly,
rather than basing them on the behavior of another programming language.
2020-10-05 14:41:51 -07:00
Andrew Kelley
939b4860ef
Merge pull request #6472 from alexnask/add_some_frees
...
Add a few missing deallocations of temporaries to stage1
2020-10-05 04:56:58 -04:00
LemonBoy
22b5e47839
stage1: Implement @reduce builtin for vector types
...
The builtin folds a Vector(N,T) into a scalar T using a specified
operator.
Closes #2698
2020-10-05 04:51:45 -04:00
joachimschmidt557
7c5a24e08c
Turn zig fmt back on in various src/ files
2020-10-05 04:48:58 -04:00
Alexandros Naskos
9952a072cc
Remove MSVC 2015 from supported compilers in README
2020-10-05 03:55:41 -04:00
Joran Dirk Greef
e9ba12f456
Test the range of user_data bits
2020-10-05 09:36:07 +02:00
Andrew Kelley
55ac973953
fix each-lib-rpath functionality
...
It was regressed in 2 ways from the merge of #6250 :
* it was not being enabled by default when the target OS is native.
* we were testing the libfoo.so file path existence with bogus format
string ('{}' instead of '{s}') and so it ended up being something
like "libstd.HashMap(K,V,...).Entry.so" instead of "libfoo.so". Using
{} rather than {s} is a footgun, be careful!
Previous functionality is now restored.
closes #6523
2020-10-04 23:16:46 -07:00
Andrew Kelley
d5d48c6f4e
Merge pull request #6496 from xackus/rlimit
...
std: implement {get, set}rlimit for linux
2020-10-05 01:54:38 -04:00
Andrew Kelley
682a29aefd
ci: stop testing mingw builds
...
Zig supports both Linux and Windows natively. Those are the main use
cases we are focusing on. Happy to accept mingw patches if they are
non-invasive, but we will not be hampering progress on the main use
cases with failing mingw CI builds.
2020-10-04 21:51:41 -07:00
Timon Kruiper
e94a06ac29
Build.zig: Skip copying files that are used internally by the compiler
...
Before this it was trying to copy all the files from the zig-cache dir
to the output dir, but in the current compiler architecture the cache
dir is also used for internal compiler files.
2020-10-05 00:31:21 -04:00
Felix (xq) Queißner
dce74c31cc
Depending on system libs only enforces libraries to require dynamic linking, but neither static libs nor object files.
2020-10-05 00:27:42 -04:00
Andrew Kelley
33bc1ebe37
build system: implement computeOutFilenames using std.zig.binNameAlloc
...
See #6552 #6553 #6483
Also fixes a regression introduced in
1d777e9958 of not converting an integer to
a string for a command line parameter.
2020-10-04 20:10:47 -07:00
Jan200101
d0a4110d34
Allow specifying build version using cmake
2020-10-04 21:40:48 -04:00
Alexandros Naskos
65991092f7
Correctly set uid and gid to void instead of null on wasi
2020-10-04 21:21:25 -04:00
Andrew Kelley
1d777e9958
add --image-base support
...
Based on #6121 by Jay Petacat.
2020-10-04 17:59:44 -07:00
Andrew Kelley
da596b7e4f
Merge pull request #6255 from joachimschmidt557/stage2-arm
...
stage2 ARM: more instructions, return values, parameters
2020-10-04 19:49:18 -04:00
Andrew Kelley
6aa668e020
Merge pull request #6476 from kubkon/macho-exe
...
Link basic MachO executables with stage2
2020-10-04 19:05:45 -04:00
Andrew Kelley
302a69f127
Merge pull request #6295 from Vexu/stage2
...
Stage2: basic imports
2020-10-04 18:00:21 -04:00
xackus
1b4296831a
simplify api and add smoke test
2020-10-04 23:57:49 +02:00
xackus
4ec26be424
implement {get, set}rlimit for linux
2020-10-04 23:56:10 +02:00
Joran Dirk Greef
9be2941091
Split openat/close test into two separate tests
...
If an older kernel fails the `openat` test because of `AT_FDCWD`
then we don't want to skip the `close` test.
2020-10-04 17:48:05 +02:00
Joran Dirk Greef
958ff087f2
Use const wherever possible
2020-10-04 16:57:04 +02:00
Joran Dirk Greef
72bdfa5bdd
Skip openat test only for older kernels that do not fully support AT_FDCWD
2020-10-04 16:05:52 +02:00
Jakub Konka
c4054f8e0a
Refactor flushing of MachO exe
...
This commit refactors free space analysis (and VM analysis) somewhat.
This is still far from perfect, but at least it's not using any
hardcoded values.
This commit also reorganizes different flushing bits here and there,
so that bit common to Exe and Obj are put in the common path, while
Exe-specific are behind an appropriate switch/if statement.
2020-10-04 15:31:47 +02:00
Jakub Konka
737a8bf204
Redo local symbols and offsets tracking to match Elf's approach
2020-10-04 15:31:47 +02:00
Jakub Konka
2ba23abd9d
Add missing ensureCapacity call in codegen
2020-10-04 15:31:47 +02:00
Jakub Konka
f8dd48bcd2
Fix after rebase and enable stage2 tests for macOS
...
Also, rewrites codegen section to store symbol address in a register
to then later invoke `callq` on the register.
2020-10-04 15:31:47 +02:00
Jakub Konka
5a7105401c
First hacked together, working MachO exe!
2020-10-04 15:31:47 +02:00
Jakub Konka
635984abc7
Move writing symbol table and export trie into functions
2020-10-04 15:31:47 +02:00
Jakub Konka
ccf9bba61f
Write out LC_DYSYMTAB together with dyld_stub_binder undef symbol
2020-10-04 15:31:47 +02:00
Jakub Konka
a927f24201
Generate more MachO exe boilerplate
...
* Convert draft to generate all relevant segments and sections in right places
* Do not prealloc space in text blocks until we can NOP
* Write out LC_LOAD_DYLINKER command
* Add LC_LOAD_DYLIB command in order to specify to load libSystem
* Redo update decl exports (similar to Elf globals, globals need to be contiguous in
memory)
2020-10-04 15:31:47 +02:00
Jakub Konka
57a81bb559
Re-draft required elements for minimal MachO binary
2020-10-04 15:31:47 +02:00
Joran Dirk Greef
9091fcbe9d
Improve openat/accept test debugging
2020-10-04 15:11:09 +02:00
Joran Dirk Greef
6a53f4be4b
Add openat(), close(), connect(), send(), recv(), as well as tests
...
Removes non-essential .hardlink_with_next_sqe() and .drain_previous_sqes().
2020-10-04 13:15:39 +02:00
Joran Dirk Greef
3d2de6cfba
Use load relaxed semantics when reading the SQPOLL wakeup flag
2020-10-04 13:14:57 +02:00
Joran Dirk Greef
69a55fc560
Allow for advanced non-sequential SQE allocation schemes
...
Decouples SQE queueing and SQE prepping methods to allow for non-sequential
SQE allocation schemes as suggested by @daurnimator.
Adds essential SQE prepping methods from liburing to reduce boilerplate.
Removes non-essential .link_with_next_sqe() and .use_registered_fd().
2020-10-04 13:01:41 +02:00
Joran Dirk Greef
e32c7d06e5
Limit entries to u12, add errors for invalid entries, use mem.zeroInit
2020-10-04 12:49:48 +02:00
Joran Dirk Greef
61ec6cb6d3
Expose available kernel features
2020-10-04 12:48:08 +02:00
Jakub Konka
0e2d858d69
Revert back to original Win CI install script
...
Since msys2/MSYS2-packages#2050 was fixed, we can now revert back to the
original install script.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-10-04 11:53:07 +02:00
Alexandros Naskos
23cd3b3331
Merge branch 'master' of https://github.com/ziglang/zig into add_some_frees
2020-10-04 10:39:26 +03:00
Andrew Kelley
8170a3d574
Merge pull request #6463 from jedisct1/ghash
...
std/crypto: add GHASH implementation
2020-10-04 02:46:36 -04:00
Andrew Kelley
5fda4fe4c8
Merge pull request #6454 from jedisct1/hkdf
...
std/crypto: implement the HKDF construction
2020-10-04 02:45:54 -04:00
LemonBoy
538d485782
std: Add pow(a,b) for big ints
...
Implemented following Knuth's "Evaluation of Powers" chapter in TAOCP,
some extra complexity is needed to make sure there's no aliasing and
avoid allocating too many limbs.
A brief example to illustrate why the last point is important:
consider 10^123, since 10 is well within the limits of a single limb we
can safely say that the result will surely fit in:
⌈log2(10)⌉ bit * 123 = 492 bits = 7 limbs
A naive calculation using only the number of limbs yields:
1 limb * 123 = 123 limbs
The space savings are noticeable.
2020-10-04 02:24:40 -04:00
Andrew Kelley
2de53592a1
stage1: better value for builtin.link_mode
...
Now it is Dynamic unless -DZIG_STATIC=on is passed to cmake.
This partially addresses #6469 .
2020-10-03 23:15:45 -07:00
John Sullivan
ab7ea53541
cmake: add option to use llvm-config to find cross-target llvm deps
2020-10-04 00:41:32 -04:00
Alexandros Naskos
52ba2c3a43
Reintroduce progress bar when compiling C files
2020-10-03 22:11:29 -04:00
Tadeo Kondrak
9917b0576a
stage0: check for some more required parameters
2020-10-03 21:32:32 -04:00
Tadeo Kondrak
cbdd825056
stage1: delete unused os code
2020-10-03 21:31:08 -04:00
Tadeo Kondrak
26546af1b8
Revert "Include dbg.h to third-party libs"
...
This reverts commit c8b4cc2ff9 .
This includes many C++ standard library headers:
#include <algorithm>
#include <chrono>
#include <ctime>
#include <iomanip>
#include <ios>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <vector>
which adds more than a second of compile time for each file that
includes the header:
ir.cpp before: 8.041s
ir.cpp after: 6.847s
2020-10-03 21:29:29 -04:00
Andrew Kelley
d1e779cea8
ci: update azure msys base installer
...
hopefully resolves the CI failures
2020-10-03 17:33:51 -07:00
Andrew Kelley
b306149b22
zig run foo.c is perfectly valid
2020-10-03 17:27:09 -07:00
Andrew Kelley
a2b86777b5
fix alignment in CLI usage text
2020-10-03 17:21:45 -07:00
Andrew Kelley
0e7523c7d7
stage1 main(): catch unreachable in debug builds for easier troubleshooting
...
Fixup to 2a3393eff8
2020-10-03 17:16:19 -07:00
Andrew Kelley
70f3767903
revert adding std.event.Loop.runDetached
...
I'd like to discuss this before adding it. I think this is the wrong
direction to go with this API.
2020-10-03 17:13:22 -07:00
Alexandros Naskos
f3397fad68
Merge pull request #6519 from LemonBoy/fix-6497
...
stage2: Build libunwind for non-msvc Windows targets
2020-10-04 01:23:35 +03:00
LemonBoy
3b40b68210
stage2: Build libunwind for non-msvc Windows targets
...
Closes #6497
2020-10-03 20:47:06 +02:00
LemonBoy
8b4f5f039d
Alternative strategy to avoid calling stat()
...
This is an optimization as it avoids an extra syscall, but it's also a
workaround for fstat being not available on Windows.
2020-10-03 19:51:22 +02:00
Joran Dirk Greef
c5b4fcaa1c
Add IORING_FEAT_POLL_32BITS
2020-10-03 17:43:08 +02:00
Alexandros Naskos
4396373ccb
Merge pull request #6503 from kristoff-it/fix-darwin-symlink-exe
...
fix symlink path not being resolved in darwin
2020-10-03 18:29:44 +03:00
Joran Dirk Greef
a9b107045f
Use load acquire semantics when reading the SQPOLL wakeup flag
...
Ensures that the wakeup flag is read after the tail pointer has been
written. It's important to use memory load acquire semantics for the
flags read, otherwise the application and the kernel might not agree on
the consistency of the wakeup flag, leading to I/O starvation.
Refs: 6768ddcc56
Refs: https://github.com/axboe/liburing/issues/219
2020-10-03 14:34:42 +02:00
Joran Dirk Greef
95def89c23
Handle EBADFD (ring fd in bad state) in enter()
2020-10-03 14:34:01 +02:00
joachimschmidt557
fb58fb2d8d
stage2 ARM: add testcases for non-leaf fns, parameters, return values
2020-10-03 12:52:04 +02:00
LemonBoy
0f248e0988
std: Make file copy ops use zero-copy mechanisms
...
Use copy_file_range on Linux (if available), fcopyfile on Darwin,
sendfile on *BSDs (and on Linux kernels without copy_file_range).
2020-10-03 12:31:17 +02:00
Loris Cro
276598346a
provide the full buffer length to _NSGetExecutablePath
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-10-03 12:03:22 +02:00
Alexandros Naskos
e31cc80130
Merge pull request #6427 from tadeokondrak/enums-explicit-tag-type-extern-allowed
...
Allow enums with explicit extern-allowed tag types in extern types
2020-10-03 12:51:39 +03:00
Alexandros Naskos
b5034bd776
Merge pull request #6506 from FireFox317/stage2-cli
...
Print error when running `zig test/run` without a source file
2020-10-03 12:47:49 +03:00
Timon Kruiper
539e90e26d
Print error when running zig test/run without a source file
...
Closes #6498
2020-10-02 19:59:00 +02:00
joachimschmidt557
cfe486e388
stage2 ARM: Add push, pop alias instructions; non-leaf functions
...
Non-leaf functions now work. Combined with simple parameters and return
types, this allows more complicated programs than Hello World to be
correctly compiled.
2020-10-02 19:39:17 +02:00
joachimschmidt557
35b228630c
stage2 ARM: Add stm, ldm variants and misc. additions
2020-10-02 19:39:17 +02:00
joachimschmidt557
0a54f04dbc
stage2 ARM: start adding more instructions, return values, parameters
2020-10-02 19:39:17 +02:00
Loris Cro
f841ea77e2
make symlink buffer null-terminated
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-10-02 19:33:14 +02:00
Loris Cro
a2074c1ec3
fix symlink path not being resolved in darwin
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-10-02 17:06:29 +02:00
Alexandros Naskos
e9434ff8f4
Merge pull request #6430 from jedisct1/llvm-config
...
Print the llvm-config path on configuration error
2020-10-02 17:02:08 +03:00
Alexandros Naskos
55eb7c16c0
Merge pull request #6494 from IridescentRose/emit-reloc-patch
...
Emit reloc patch
2020-10-02 17:00:47 +03:00
Alexandros Naskos
cd4c1ea790
Merge pull request #6491 from markfirmware/patch-2
...
Fixes --linker-script unrecognized
2020-10-02 17:00:22 +03:00
Alexandros Naskos
006b780d44
Merge pull request #6484 from LemonBoy/winshit
...
Some windows fixes
2020-10-02 15:05:44 +03:00
Alexandros Naskos
e207031837
Merge pull request #6402 from tadeokondrak/@Type(.Fn)
...
Implement @Type for Fn
2020-10-02 09:44:27 +03:00
Tadeo Kondrak
65016dff32
Add test for implicit extern-allowed enum tag type in extern struct
2020-10-01 18:10:20 -06:00
Tadeo Kondrak
cae49b1b9d
Add tests for enums with explicit extern-allowed tag types in extern types
2020-10-01 18:09:47 -06:00
Tadeo Kondrak
61ce72a38c
Allow enums with explicit extern-allowed tag types in extern types
...
Closes https://github.com/ziglang/zig/issues/1467
2020-10-01 18:09:15 -06:00
Tadeo Kondrak
183d1d4ba1
Switch TypeInfo.Fn.alignment to comptime_int from u29
...
All integers in TypeInfo are intentionally comptime_int:
https://github.com/ziglang/zig/issues/1683
2020-10-01 18:01:41 -06:00
Tadeo Kondrak
96a151d4b8
Skip @Type/@typeInfo Fn/BoundFn tests on wasm32/wasm64
2020-10-01 18:01:40 -06:00
Tadeo Kondrak
e18fdc12b0
stage1: Implement @Type for Fn and BoundFn
2020-10-01 18:01:38 -06:00
Tadeo Kondrak
97ab720d84
stage1: Add alignment to TypeInfo.Fn
2020-10-01 17:59:42 -06:00
Alexandros Naskos
0228887b94
Merge pull request #6428 from tadeokondrak/alignment-typeinfo-struct-union
...
Add alignment field to TypeInfo.UnionField and TypeInfo.StructField
2020-10-02 02:56:18 +03:00
Nathan
84b6d2a80a
Resolved additional formatting issues.
2020-10-01 18:03:34 -04:00
Nathan
5e3ce11b18
Resolve name and format issues.
2020-10-01 17:47:32 -04:00
Alexandros Naskos
a4fe438d39
std.fmt.comptimePrint: bufPrint cannot return an error
2020-10-02 00:39:19 +03:00
Alexandros Naskos
49c0cd6e8e
Merge pull request #6481 from MasterQ32/stage1_error_return_trace
...
Adds error return trace printing to stage1
2020-10-02 00:22:24 +03:00
Tadeo Kondrak
362c87f1aa
Update std.meta.ArgsTuple for alignment in StructField/UnionField
2020-10-01 15:06:24 -06:00
Tadeo Kondrak
ec8f0777f2
Update std.meta.Tuple for alignment in StructField/UnionField
2020-10-01 15:06:23 -06:00
Tadeo Kondrak
e187ac09cb
Update compile error tests for alignment in StructField/UnionField
2020-10-01 15:06:21 -06:00
Nathan
1bc197bc02
Merge
2020-10-01 17:06:15 -04:00
Nathan Bourgeois
4566b27373
Patch in emit relocs support
2020-10-01 17:04:04 -04:00
Tadeo Kondrak
a12203d2be
Switch TypeInfo alignment fields from u29 to comptime_int
2020-10-01 15:01:28 -06:00
Tadeo Kondrak
70c507911a
Update @Type tests for alignment field in UnionField and StructFIeld
2020-10-01 15:01:27 -06:00
Tadeo Kondrak
c2ee66108c
Add tests for alignment field in UnionField and StructFIeld
2020-10-01 15:01:26 -06:00
Tadeo Kondrak
d81648ce8c
Add alignment field to TypeInfo.UnionField and TypeInfo.StructField
...
Closes https://github.com/ziglang/zig/issues/6122
2020-10-01 15:01:25 -06:00
Tadeo Kondrak
77df5dae7f
Make builtin.TypeInfo.Pointer.alignment u29 instead of comptime_int
2020-10-01 15:01:24 -06:00
Alexandros Naskos
5acf2a5068
Merge pull request #6419 from tadeokondrak/std.fmt.comptimePrint
...
std.fmt: add comptimePrint
2020-10-01 23:59:00 +03:00
Nathan Bourgeois
5c84f9dad4
Patch in emit relocs support
2020-10-01 15:57:19 -04:00
markfirmware
1296e4a857
Update build.zig
2020-10-01 15:27:08 -04:00
markfirmware
8acfcf4e0d
Update build.zig
...
Fixes #6477
2020-10-01 13:15:35 -04:00
Alexandros Naskos
bf0afaa876
std.event.Loop.runDetached should be pub
2020-10-01 16:50:05 +03:00
Alexandros Naskos
beda6f2299
Merge pull request #6455 from kristoff-it/event-loop-go
...
add runDetached to event loop
2020-10-01 15:57:02 +03:00
LemonBoy
212171643c
stage2: Add missing defines for building dllcrt2.o
...
Closes #6482
2020-10-01 11:39:22 +02:00
LemonBoy
1b2d50737a
mingw: Add user32.def for 32bit Windows
...
Closes #6479
2020-10-01 11:27:59 +02:00
Alexandros Naskos
b358c28171
Merge pull request #6461 from tadeokondrak/type-enum-invalid-tag-type
...
stage1: Fix @Type(.Enum) with invalid tag_type
2020-10-01 11:19:02 +03:00
Felix (xq) Queißner
2a3393eff8
Adds error return trace printing to stage1.
2020-10-01 09:40:03 +02:00
Frank Denis
97fd0974b9
ghash: add pclmul support on x86_64
2020-10-01 02:05:11 +02:00
Frank Denis
8161de7fa4
Implement ghash aggregated reduction
...
Performance increases from ~400 MiB/s to 450 MiB/s at the expense of
extra code. Thus, aggregation is disabled on ReleaseSmall.
Since the multiplication cost is significant compared to the reduction,
aggregating more than 2 blocks is probably not worth it.
2020-10-01 02:05:07 +02:00
Frank Denis
f1ad94437b
ghash & poly1305: use pointer to slices for keys and output
2020-10-01 02:04:30 +02:00
Frank Denis
58873ed3f9
std/crypto: add GHASH implementation
...
GHASH is required to implement AES-GCM.
Optimized implementations for CPUs with instructions for carry-less
multiplication will be added next.
2020-10-01 02:04:30 +02:00
Alexandros Naskos
4eb390b157
Merge pull request #6457 from Snektron/fix-arraylistunmanaged
...
Fix std.ArrayListUnmanaged + improve test coverage
2020-10-01 00:09:45 +03:00
Andrew Kelley
718a659773
std: skip some tests that stage1 leaks too much memory with
...
We can restore these when we have self-hosted available.
This is intended to address #6467
2020-09-30 12:37:00 -07:00
Alexandros Naskos
82f0ede3ad
Added some c_allocator.deallocate calls
2020-09-30 19:59:49 +03:00
Vexu
6d3858dc8a
stage2: use directory handles for imports
2020-09-30 18:03:10 +03:00
Alexandros Naskos
cb5d290f33
Added a few ZigList deinit calls
2020-09-30 17:09:18 +03:00
Vexu
d819da4350
stage2: support multiple files in tests
2020-09-30 17:00:57 +03:00
Vexu
e246fe0f5b
stage2: detect changes in imported files
2020-09-30 17:00:55 +03:00
Vexu
e2cf2e015b
stage2: struct type field access
2020-09-30 16:59:09 +03:00
Vexu
7d910b024b
stage2: very basic imports
2020-09-30 16:59:08 +03:00
Vexu
20ae15917c
stage2: add import builtin stub
2020-09-30 16:56:45 +03:00
Tadeo Kondrak
e903b00eec
stage1: Fix @Type(.Enum) with invalid tag_type
...
Fixes https://github.com/ziglang/zig/issues/6459
2020-09-30 07:02:38 -06:00
Andrew Kelley
7067764ed3
Merge remote-tracking branch 'origin/master' into llvm11
...
The changes to install_files.h needed to put into src/libcxx.zig
2020-09-30 02:55:41 -07:00
Andrew Kelley
fe117d9961
Merge pull request #6250 from ziglang/stage2-zig-cc
...
move `zig cc`, `zig translate-c`, `zig libc`, main(), and linking from stage1 to stage2
2020-09-30 04:28:19 -04:00
Andrew Kelley
3249e5d952
MachO: add the same workaround for no -r LLD flag support
...
This is the MachO equivalent for the code added to COFF for doing the
file copy when the input and output are both just one object file.
2020-09-30 01:04:30 -07:00
Andrew Kelley
2a893efae1
fix incorrect dylib filename pattern in the previous commit
2020-09-30 00:53:55 -07:00
Andrew Kelley
870af49074
std.zig.binNameAlloc: take into account version for macos dylibs
2020-09-30 00:36:20 -07:00
Ryan Liptak
bd449b184a
Add deleteDir test with exception for not-empty directory on Windows
...
Re-adds the test that was added and then reverted in https://github.com/ziglang/zig/pull/6397 , but with the test for https://github.com/ziglang/zig/issues/5537 skipped for now since that issue is no longer fixed.
2020-09-30 02:35:17 -04:00
Andrew Kelley
14d6d07af2
fix the cli test expected string to support native path separators
2020-09-30 01:31:08 -04:00
Andrew Kelley
839bdfdc93
link.Coff: skip redundant (and invalid) copy to same path
2020-09-29 21:48:50 -07:00
Andrew Kelley
7bffa6f1fb
clean up call to std.fs.rename
...
Thanks Ryan Liptak!
2020-09-29 21:47:37 -07:00
Andrew Kelley
1572cd4d76
different strategy to fix compiler_rt.zig and c.zig
...
with respect to std.builtin.link_libc.
The commit 27e008eb29 did not solve the
problem because although it got std.builtin.link_libc to be true for
compiler_rt.zig and c.zig, it had other unintentional side effects which
broke the build for -lc -target foo-linux-musl.
This commit introduces a new flag to Compilation to allow setting this
comptime flag to true without introducing other side effects to
compilation and linking.
2020-09-29 18:32:41 -07:00
Ryan Liptak
254ee89def
Windows: Handle ACCESS_DENIED in DeviceIoControl
...
This was causing the Dir.readLink test to fail for me locally with error.Unexpected NTSTATUS=0xc0000022. Not sure if PRIVILEGE_NOT_HELD is actually possible or not.
2020-09-29 20:54:45 -04:00
Andrew Kelley
402f967ed5
move std.http to the standard library orphanage
...
I want to take the design of this in a different direction. I think this
abstraction is too high level. I want to start bottom-up.
std-lib-orphanage commit 179ae67d61455758d71037434704fd4a17a635a9
2020-09-29 17:40:37 -07:00
Andrew Kelley
af64fd2f42
Merge remote-tracking branch 'origin/master' into stage2-zig-cc
...
This merges in the revert that fixes the broken Windows build of master
branch.
2020-09-29 17:26:09 -07:00
Andrew Kelley
27e008eb29
fix not passing std.builtin.link_libc to compiler_rt.zig and c.zig
...
comment reproduced here:
This is so that compiler_rt and libc.zig libraries know whether they
will eventually be linked with libc. They make different decisions
about what to export depending on whether another libc will be linked
in. For example, compiler_rt will not export the __chkstk symbol if it
knows libc will provide it, and likewise c.zig will not export memcpy.
2020-09-29 17:24:21 -07:00
Andrew Kelley
f69650a478
update wasm to use ".o.wasm" extension for objects
...
This is convenient for debugging purposes, as well as simplifying the
caching system since executable basenames will not conflict with their
corresponding object files.
2020-09-29 17:01:05 -07:00
Frank Denis
d75d6e7f77
Remove unused var, sort std.crypto.*
2020-09-30 01:39:55 +02:00
Frank Denis
6eaba61ef5
std/crypto: implement the HKDF construction
2020-09-30 01:39:55 +02:00
Andrew Kelley
d1cea16f5c
move std.BloomFilter to the standard library orphanage
2020-09-29 16:39:05 -07:00
Jakub Konka
bb636cb3bf
Revert "Fix for Windows: std.os.windows.DeleteFile()"
2020-09-29 19:35:44 -04:00
Andrew Kelley
63685190da
move std.rb to the standard library orphanage
...
https://github.com/ziglang/std-lib-orphanage/
This code is not used by anything else in the standard library or by the
compiler or any of its tools and therefore it's a great candidate
to be maintained by a third party.
2020-09-29 16:01:51 -07:00
Andrew Kelley
b811a99af9
Merge remote-tracking branch 'origin/master' into stage2-zig-cc
2020-09-29 14:53:48 -07:00
Andrew Kelley
0da7c4b0c8
improve stage2 COFF LLD linking
...
* change some {} to be {s} to gain type safety
* fix libraries being libfoo.lib instead of foo.lib for COFF
* when linking mingw-w64, add the "always link" libs so that we
generate DLL import .lib files for them as the linker code relies on.
* COFF LLD linker does not support -r so we do a file copy as an
alternative to the -r thing that ELF linking does.
I will file an issue for the corresponding TODO upon merging this
branch, to look into an optimization that possibly elides this copy
when the source and destination are both cache directories.
* add a CLI error message when trying to link multiple objects into one
and using COFF object format.
2020-09-29 14:48:12 -07:00
Andrew Kelley
56c5b665a1
Merge pull request #6448 from LemonBoy/some-vec-fixes
...
Some vector fixes
2020-09-29 15:19:09 -04:00
Andrew Kelley
a1ae3f92c1
Merge pull request #6442 from jedisct1/aegis
...
std/crypto: add the AEGIS AEADs
2020-09-29 15:18:06 -04:00
Andrew Kelley
65b03092e3
Merge pull request #6450 from jedisct1/gimli-opt
...
std/crypto: make Gimli 60% faster
2020-09-29 15:16:52 -04:00
Andrew Kelley
7c0ee42385
CI: TERM=dumb to source hut
2020-09-29 12:10:38 -07:00
Andrew Kelley
d8fa8b5455
use Allocator.allocSentinel now that the stage1 bug is fixed
...
Thanks @LemonBoy!
2020-09-29 12:06:35 -07:00
Robin Voetter
4102ba37dd
Fix std.ArrayListUnmanaged + improve test coverage
2020-09-29 19:49:13 +02:00
Alexandros Naskos
3b478631fb
Merge pull request #6415 from MasterQ32/args-tuple
...
Implements std.meta.ArgsTuple.
2020-09-29 20:28:56 +03:00
Frank Denis
8d67f15d36
aegis: add test vectors, and link to the latest version of the spec
2020-09-29 17:10:04 +02:00
Frank Denis
bb1c6bc376
Add AEGIS-256 as well
2020-09-29 17:10:04 +02:00
Frank Denis
9f274e1f7d
std/crypto: add the AEGIS128L AEAD
...
Showcase that Zig can be a great option for high performance cryptography.
The AEGIS family of authenticated encryption algorithms was selected for
high-performance applications in the final portfolio of the CAESAR
competition.
They reuse the AES core function, but are substantially faster than the
CCM, GCM and OCB modes while offering a high level of security.
AEGIS algorithms are especially fast on CPUs with built-in AES support, and
the 128L variant fully takes advantage of the pipeline in modern Intel CPUs.
Performance of the Zig implementation is on par with libsodium.
2020-09-29 17:10:04 +02:00
Alexandros Naskos
d27a34f05c
Merge branch 'master' into args-tuple
2020-09-29 16:19:44 +03:00
Alexandros Naskos
3342e28784
Merge pull request #6416 from MasterQ32/meta-tuple
...
Implements std.meta.Tuple(), implements #4607 in userland.
2020-09-29 15:59:27 +03:00
Alexandros Naskos
c98d55626d
Merge pull request #6453 from kristoff-it/fix-futures
...
Fix std.event.Future
2020-09-29 15:56:21 +03:00
Loris Cro
16f0419700
add runDetached to event loop
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-29 14:53:36 +02:00
Frank Denis
56d820087d
gimli: make permute a constant, remove leading underscore
2020-09-29 14:01:08 +02:00
Frank Denis
4194714965
Don't unroll the gimli permutation on release-small
2020-09-29 13:23:04 +02:00
Loris Cro
a45a4230bc
Fix std.event.Future
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-29 11:18:35 +02:00
Andrew Kelley
3efdd7b2ad
don't try to build musl crti.o crtn.o when it's not needed
...
such as on RISC-V
2020-09-29 01:30:35 -07:00
Frank Denis
613f8fe83f
Use mem.copy() instead of manual iterations
2020-09-29 10:23:00 +02:00
Andrew Kelley
d3a99c7bd5
add CLI options for darwin frameworks and -ffunction-sections
...
and add missing usage help text
2020-09-29 00:50:20 -07:00
Andrew Kelley
cfbcb41160
stage2: add CLI option for -fstack-report
2020-09-29 00:34:53 -07:00
Andrew Kelley
750b00c642
Merge remote-tracking branch 'origin/master' into stage2-zig-cc
2020-09-29 00:27:48 -07:00
Andrew Kelley
fa6d150441
stage2: MachO LLD Linking
2020-09-29 00:26:18 -07:00
Andrew Kelley
41f6627521
stage2: infer --strip on wasm builds
2020-09-29 00:25:48 -07:00
Andrew Kelley
af6c3a3934
mingw: better -D arg for processing def.in files
...
Thanks @LemonBoy
2020-09-29 00:24:54 -07:00
Andrew Kelley
9d0da1612e
langref: use general purpose allocator in the wasi example
2020-09-29 00:24:17 -07:00
Andrew Kelley
ed06a78f35
stage2: WASM LLD linking
2020-09-28 23:20:14 -07:00
Andrew Kelley
73167e80f8
stage2: fix Cache not calling ftruncate in writeManifest
...
this led to a corrupt cache when the number of files got smaller. it is
now fixed.
2020-09-28 22:40:50 -07:00
Andrew Kelley
ef9582a1ec
zig test and zig run do not try to run foreign binaries
2020-09-28 22:19:00 -07:00
Andrew Kelley
29fd130093
std.ChildProcess: bypass libc exit() in fork child error case
...
Comment reproduced here:
If we're linking libc, some naughty applications may have
registered atexit handlers which we really do not want to
run in the fork child. I caught LLVM doing this and it
caused a deadlock instead of doing an exit syscall. In
the words of Avril Lavigne, "Why'd you have to go and
make things so complicated?"
2020-09-28 22:17:50 -07:00
Andrew Kelley
5fed42d70a
the stage1 backend cache stores inferred link libs
...
So that we properly learn about extern "foo" functions called even when
we get a stage1 cache hit.
2020-09-28 20:55:52 -07:00
Andrew Kelley
ada19c498d
stage2: building DLL import lib files
2020-09-28 19:20:58 -07:00
Andrew Kelley
412a2f966e
store stage1 flags in a trailing byte in the hash id symlink
...
When we get a cache hit for a stage1 compilation, we need to know about
some of the flags such as have_winmain or have_dllmain to know which
subsystem to infer during linking.
To do this, we append a hex-encoded byte into the intentionally-dangling
symlink which contains the cache hash digest rather than a filename. The
hex-encoded byte contains the flags we need to infer the subsystem
during linking.
2020-09-28 15:42:09 -07:00
Frank Denis
868a46eb43
std/crypto: make gimli slightly faster
...
Before:
gimli-hash: 120 MiB/s
gimli-aead: 130 MiB/s
After:
gimli-hash: 195 MiB/s
gimli-aead: 208 MiB/s
Also fixes in-place decryption by the way.
If the input & output buffers were the same, decryption used to fail.
Return on decryption error in the benchmark to detect similar issues
in future AEADs even in non release-fast mode.
2020-09-29 00:29:20 +02:00
Andrew Kelley
a0c0f9ead5
Merge pull request #6441 from kprotty/lock
...
New std.event.Lock implementation
2020-09-28 17:30:36 -04:00
LemonBoy
5c6cd5e2c9
stage{1,2}: Fix parsing of range literals
...
stage1 was unable to parse ranges whose starting point was written in
binary/octal as the first dot in '...' was incorrectly interpreted as
decimal point.
stage2 forgot to reset the literal type to IntegerLiteral when it
discovered the dot was not a decimal point.
I've only stumbled across this bug because zig fmt keeps formatting the
ranges without any space around the ...
2020-09-28 14:16:26 -04:00
LemonBoy
cbbcf60968
stage1: Allow comparison with comptime-known vectors
...
Since comptime_{int,float} vectors are not allowed (thanks $DEITY) we
can use the element type infos to determine the minimum operand size.
2020-09-28 17:16:57 +02:00
LemonBoy
56b52dd0a3
stage1: Detect OOB access of vector value
...
Fixes #5710
2020-09-28 17:16:12 +02:00
kprotty
468a4bf0b4
address some review changes
2020-09-28 07:25:51 -05:00
Felix (xq) Queißner
c2d60bc5b5
Follows @tadeokondrak remark about taking []const type.
2020-09-28 12:24:22 +02:00
Felix (xq) Queißner
55dfe729b4
Changes comptime block to test.
2020-09-28 11:44:55 +02:00
Felix (xq) Queißner
9331466998
Changes comptime block to test.
2020-09-28 11:42:39 +02:00
Andrew Kelley
91a73a177b
stage2: building mingw-w64 and COFF LDD linking
...
still TODO is the task of creating import .lib files for DLLs on the fly
both for -lfoo and for e.g. `extern "kernel32"`
2020-09-28 00:06:06 -07:00
Jakub Konka
e60939bfaa
Merge pull request #6397 from suirad/fix-5537
...
Fix for Windows: std.os.windows.DeleteFile()
2020-09-27 21:59:29 +02:00
kprotty
a31d9f92f2
new std.event.Lock implementation
2020-09-27 14:05:38 -05:00
Andrew Kelley
8794ce6f79
Merge pull request #6293 from LakeByTheWoods/fmt_fixes
...
zig fmt fixes
2020-09-27 05:49:38 -04:00
Ian Simonson
eab51b7785
Make LinearFifo not crash when discarding from empty buffer
...
Previously if a LinearFifo was empty and discard was called
an unsigned overflow would occur. However it is safe to perform
this overflow as a bitwise & operation with 0xFFFFFFFFFFFFFF is a noop
2020-09-27 05:46:39 -04:00
Woze Parrrot
ed357f9897
uefi system_table
2020-09-27 03:15:18 -04:00
Andrew Kelley
a9082b4ec5
stage2: add CLI support for --subsystem
2020-09-26 22:37:19 -07:00
Andrew Kelley
4b403c7eac
fix non-ELF linkAsArchive
2020-09-26 21:23:12 -07:00
Andrew Kelley
b6556c944b
fix another round of regressions in this branch
...
* std.log: still print error messages in ReleaseSmall builds.
- when start code gets an error code from main, it uses std.log.err
to report the error. this resulted in a test failure because
ReleaseSmall wasn't printing `error: TheErrorCode` when an error
was returned from main. But that seems like it should keep working.
So I changed the std.log defaults. I plan to follow this up with a
proposal to change the names of and reduce the quantity of the
log levels.
* warning emitted when using -femit-h when using stage1 backend; fatal
log message when using -femit-h with self-hosted backend (because the
feature is not yet available)
* fix double `test-cli` build steps in zig's build.zig
* update docgen to use new CLI
* translate-c uses `-x c` and generates a temporary basename with a
`.h` extension. Otherwise clang reports an error.
* --show-builtin implies -fno-emit-bin
* restore the compile error for using an extern "c" function without
putting -lc on the build line. we have to know about the libc
dependency up front.
* Fix ReleaseFast and ReleaseSmall getting swapped when passing the
value to the stage1 backend.
* correct the zig0 CLI usage text.
* update test harness code to the new CLI.
2020-09-26 21:03:38 -07:00
Andrew Kelley
fe4c348f57
stage2: zig translate-c supports --enable-cache
...
This matches master branch behavior and makes the test-translate-c tests
pass.
2020-09-26 16:48:02 -07:00
Andrew Kelley
26f2f9bf1c
stage2: implement -fno-emit-bin
...
we are now passing the cli tests
2020-09-26 12:42:07 -07:00
Andrew Kelley
9b83112a1f
fix _fbsd suffix appended to lld LDM option twice
2020-09-26 11:26:46 -07:00
Frank Denis
99c5d2d590
Print the llvm-config path on configuration error
...
This is helpful on systems with multiple LLVM installations.
For example, OpenBSD ships with LLVM in the base system, but without
support for extra targets.
A full LLVM version can be installed using the ports system, but even
when it is, `cmake` is not going to pick it up unless `/usr/local` is
explicitly added to the `cmake` search paths.
Having the full `llvm-config` path printed on error is helpful to
understand that the detected LLVM version was not the expected one.
2020-09-26 17:10:33 +02:00
Andrew Kelley
a23b1b4254
stage2: building musl: fix typo in replacing path separators
2020-09-26 02:34:57 -07:00
Andrew Kelley
1337f0bc6a
move to stage1-specific cache manifest emission of extra stuff
2020-09-26 02:34:18 -07:00
Andrew Kelley
56086d11a4
stage0: update CLI to match stage2
2020-09-26 02:16:10 -07:00
Andrew Kelley
819625d274
fix logic for choosing when dynamic linking is required
...
When building object files or static libraries, link_mode can still be
static even if the OS needs libc for syscalls.
2020-09-26 01:58:16 -07:00
Andrew Kelley
6af2990549
implement -femit-asm, -femit-docs, -femit-llvm-ir, etc
...
These CLI options are now forwarded to the stage1 backend.
We're not going to support the -mllvm CLI option any longer. As a
compromise, we unconditionally tell LLVM to output intel x86 syntax when
using -femit-asm.
Simplify stage1 logic; it no longer has the concept of an output
directory. --output-dir is no longer a valid CLI option. cmake uses
the `-femit-bin=[path]` option.
Note the changes to test/cli.zig. This breaks the CLI API that Godbolt
is using so we're going to want to open a PR to help them upgrade to the
new CLI for the upcoming Zig 0.7.0 release.
2020-09-26 01:47:27 -07:00
Andrew Kelley
a337046832
stage2: properly handle zig cc used as a preprocessor
...
This cleans up how the CLI parses and handles -E, -S, and -c.
Compilation explicitly acknowledges when it is being used to do C
preprocessing.
-S is properly translated to -fno-emit-bin -femit-asm but Compilation
does not yet handle -femit-asm.
There is not yet a mechanism for skipping the linking step when there is
only a single object file, and so to make this work we have to do a file
copy in link.flush() to copy the file from zig-cache into the output
directory.
2020-09-25 20:52:02 -07:00
Andrew Kelley
aded86e690
std.ArrayHashMap: count and iterator are not deprecated
...
These APIs allow one to write code that is agnostic of whether it is
using an ArrayHashMap or a HashMap, which can be valuable. Specify
intent precisely: if you only need the count of the items, it makes
sense to have a function for that.
2020-09-25 20:50:40 -07:00
Andrew Kelley
21b407b17f
update test case for init-exe with respect to new template
...
Now it uses std.log.info instead of std.debug.print
2020-09-25 18:21:21 -07:00
Andrew Kelley
70d7d7e919
stage2: disable lld caching when output dir is owned by user
...
Normally when using LLD to link, Zig uses a file named "lld.id" in the
same directory as the output binary which contains the hash of the link
operation, allowing Zig to skip linking when the hash would be unchanged.
In the case that the output binary is being emitted into a directory which
is externally modified - essentially anything other than zig-cache - then
this flag would be set to disable this machinery to avoid false positives.
* Better defaults when using -fno-LLVM
* Fix compiler_rt and libc static libraries were getting a .zig
extension instead of .a extension.
* when using the stage1 backend, put the object file next to the
stage1.id file in the cache directory. this prevents an object file
from polluting the cwd when using zig from the CLI.
2020-09-25 18:01:35 -07:00
Suirad
43cd9eb110
Add clarification comment
2020-09-25 18:11:31 -05:00
Suirad
f78652484a
Stdlib fix for os.windows.deleteFile to fail with
...
a proper error when attempting to delete a directory that isnt empty
2020-09-25 18:09:05 -05:00
Andrew Kelley
670e7d456c
add some tracy calls
2020-09-25 14:47:09 -07:00
Andrew Kelley
a502604702
Merge pull request #6412 from kristoff-it/generalize-event-loop
...
Make os.zig not depend on the event loop
2020-09-25 17:26:44 -04:00
Loris Cro
dc01ef7388
Remove noop check
...
Co-authored-by: Andrew Kelley <andrew@ziglang.org >
2020-09-25 23:21:20 +02:00
Andrew Kelley
812e482bef
ELF linking supports root src directory to be cwd
2020-09-25 13:37:10 -07:00
Tadeo Kondrak
236af776fd
std.fmt: add comptimePrint
2020-09-25 12:53:35 -06:00
Alexandros Naskos
288198e51d
Merge pull request #6413 from LemonBoy/fix-5116
...
Make ArenaAllocator try to resize first
2020-09-25 19:47:50 +03:00
Loris Cro
8d01133bd0
update doc comments
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-25 18:42:24 +02:00
LemonBoy
bd9003ed5b
std: ArenaAllocator tries to resize before allocating
...
Closes #5116
2020-09-25 10:58:07 +02:00
Felix (xq) Queißner
7f68b14377
Implements std.meta.Tuple(), implements #4607 in userland.
2020-09-25 09:27:00 +02:00
Felix (xq) Queißner
93291cc472
Implements std.meta.ArgsTuple.
2020-09-25 09:16:43 +02:00
Andrew Kelley
495d18a205
std.log: better default for printing logs
...
* prefix with the message level
* if the scope is not default, also prefix with the scope
This makes the stack trace test pass, with no changes to the
test case, because errors returned from main() now print
`error: Foo` just like they do in master branch.
2020-09-25 00:02:52 -07:00
Andrew Kelley
30dfdfdbd0
fix a round of regressions in this branch
...
* Don't try to generate C header files yet since it will only cause a
crash saying the feature is unimplemented.
* Rename the CLI options for release modes to use the `-O` prefix to
match C compiler precedent. Options are now `-ODebug`,
`-OReleaseFast`, `-OReleaseSafe`, `-OReleaseSmall`. The optimization
mode matches the enum tags of std.builtin.Mode. It is planned to, at
some point, rename std.builtin.Mode to std.builtin.OptimizationMode
and modify the tags to be lower case to match the style convention.
- Update build.zig code to support this new CLI.
* update std.zig.binNameAlloc to support an optional Version and update
the implementation to correctly deal with dynamic library version
suffixes.
2020-09-24 23:50:15 -07:00
Andrew Kelley
f8b3543cab
I think this test is still flakey
...
re-opens #4922
2020-09-24 22:57:03 -07:00
Josh Wolfe
1a8669eada
build.zig: addBuildOptionArtifact
2020-09-25 01:53:38 -04:00
Andrew Kelley
7964341c76
zig build: update to use new --version flag instead of legacy flags
2020-09-24 22:18:53 -07:00
Andrew Kelley
5440ca8eb7
--main-pkg-path properly resolves the relative root src file path
2020-09-24 22:15:40 -07:00
Andrew Kelley
67463c4357
correct @cImport caching to handle "unhit" case
...
if you hit() you have to unhit() to get the same digest if you don't
end up treating it as a hit.
2020-09-24 21:52:37 -07:00
Andrew Kelley
4f0850fe28
don't delete C import .c source from zig-cache
...
preventing CacheUnavailable error when doing `@cImport`
2020-09-24 21:13:01 -07:00
Andrew Kelley
054fafd7d9
stage2: implement @cImport
...
Also rename Cache.CacheHash to Cache.Manifest
2020-09-24 16:22:45 -07:00
Loris Cro
c196c27af8
recvfrom
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 22:06:41 +02:00
Loris Cro
419aea54cb
sendto
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 22:06:41 +02:00
Loris Cro
7fec5b3def
pwritev
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 22:06:41 +02:00
Loris Cro
7a07c62a07
pwrite
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 22:06:21 +02:00
Loris Cro
18f6629bd8
writev
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 22:06:03 +02:00
Loris Cro
9075f8e5a1
write
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 22:05:41 +02:00
Loris Cro
59ecdaea12
preadv
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 22:04:43 +02:00
Loris Cro
bd9f2369d5
pread
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 22:04:05 +02:00
Loris Cro
bc35435ca6
readv
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 22:03:12 +02:00
Loris Cro
08364ac773
read
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 22:00:55 +02:00
Loris Cro
730428bfd6
connect
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 21:56:27 +02:00
Loris Cro
e85c89630e
accept
...
Signed-off-by: Loris Cro <kappaloris@gmail.com >
2020-09-24 21:56:27 +02:00
Frank Denis
bd89bd6fdb
Revamp crypto/aes
...
* Reorganize crypto/aes in order to separate parameters, implementations and
modes.
* Add a zero-cost abstraction over the internal representation of a block,
so that blocks can be kept in vector registers in optimized implementations.
* Add architecture-independent aesenc/aesdec/aesenclast/aesdeclast operations,
so that any AES-based primitive can be implemented, including these that don't
use the original key schedule (AES-PRF, AEGIS, MeowHash...)
* Add support for parallelization/wide blocks to take advantage of hardware
implementations.
* Align T-tables to cache lines in the software implementations to slightly
reduce side channels.
* Add an optimized implementation for modern Intel CPUs with AES-NI.
* Add new tests (AES256 key expansion).
* Reimplement the counter mode to work with any block cipher, any endianness
and to take advantage of wide blocks.
* Add benchmarks for AES.
2020-09-24 13:16:00 -04:00
Ogromny
bba4576281
Fix typo in documentation
2020-09-24 13:14:03 -04:00
Andrew Kelley
1123c90987
stage2: print the test command after it fails
2020-09-23 23:13:18 -07:00
Frank Denis
c8cd6145ac
Move PBKDF2 to a pwhash category, clarify what that category is
...
Password hashing functions are not general-purpose KDFs, and KDFs
don't have to satisfy the same properties as a PHF.
This will allow fast KDFs such as the HKDF construction to be in a
category of their own, while clarifying what functions are suitable
for using passwords as inputs.
2020-09-24 00:02:31 -04:00
Isaac Freund
72f4cdb2b4
docs: update implementation status for @Type()
2020-09-24 00:01:57 -04:00
Andrew Kelley
0f3111379b
Merge pull request #6399 from FireFox317/async-fix
...
Eventloop: Fix deadlock in linux event loop implementation
2020-09-24 00:01:22 -04:00
Andrew Kelley
7bbd152dcc
nobody likes my std.process.cleanExit idea
...
it's appropriate for the self-hosted compiler though, so this commit
moves it from std lib to stage2 src code.
2020-09-23 20:52:33 -07:00
Andrew Kelley
b08fd0e8fc
stage2: building musl libc from source
2020-09-23 20:48:47 -07:00
Frank Denis
274c55b780
ZIG_WORKAROUND_4799 is not required with LLVM 10.0.1
...
That paragraph used to contradict the following one.
2020-09-23 22:05:43 -04:00
Andrew Kelley
64deb46859
stage2: capture LLD stderr into a buffer
2020-09-23 15:21:40 -07:00
Andrew Kelley
90b320d0e9
use ascii range for the --watch REPL prompt
2020-09-23 14:50:52 -07:00
Jakub Konka
0fcee6e11c
Merge pull request #6373 from notCalle/workaround-6087
...
Workaround MacOS build failure due to #6087
2020-09-23 20:59:09 +02:00
Andrew Kelley
b183b612c9
stage2: don't build libunwind on OS's that don't need it
2020-09-23 11:15:27 -07:00
Andrew Kelley
f4dde4d109
test_runner: fix missing newline in log
2020-09-23 11:15:10 -07:00
Andrew Kelley
02886a8b93
stage2: support rpaths
2020-09-23 11:01:15 -07:00
Andrew Kelley
c0b774fbc6
stage2: support passing extra C flags to C source files
...
closes #3508
2020-09-23 10:22:44 -07:00
Andrew Kelley
d03fcc73fc
stage2: implement --main-pkg-path
2020-09-23 09:56:30 -07:00
Andrew Kelley
15b2bae517
fix trying to link libc for static libs and objects
2020-09-23 09:41:55 -07:00
Timon Kruiper
bbff6bd675
Eventloop: Enable basic event loop test, fixed by previous commit
...
Closes #4922
2020-09-23 18:38:28 +02:00
Calle Englund
94024a9fae
Update macOS build instructions with workaround
2020-09-23 16:26:35 +02:00
Timon Kruiper
0eed7ec9d5
Eventloop: Fix deadlock in linux event loop implementation
...
A simple empty main with evented-io would not quit, because some
threads were still waiting to be resumed (by the os). The os.write to
the eventfd only wakes up one thread and thus there are multiple writes
needed to wake up all the other threads.
2020-09-23 11:41:31 +02:00
Andrew Kelley
800a4a6ceb
eliminate dependency of libzigcpp.a on libzigstage1.a
...
This allows us to create a build of self-hosted with LLVM extensions
enabled but without the stage1 backend.
2020-09-23 00:00:24 -07:00
Andrew Kelley
fc88d36dae
stage2: link_libc=true on OS's that require it for syscalls
2020-09-22 23:31:32 -07:00
Andrew Kelley
0638a020cf
stage2: implement --pkg-begin and --pkg-end CLI args
2020-09-22 23:00:33 -07:00
Andrew Kelley
c2b1cd7c45
stage2: implement zig build
...
As part of this:
* add std.process.cleanExit. closes #6395
- use it in several places
* adjust the alignment of text in `zig build --help` menu
* Cache: support the concept of "unhit" so that we properly keep track
of the cache when we find out using the secondary hash that the cache
"hit" was actually a miss. Use this to fix false negatives of caching
of stage1 build artifacts.
* fix not deleting the symlink hash for stage1 build artifacts causing
false positives.
* implement support for Package arguments in stage1 build artifacts
* update and add missing usage text
* add --override-lib-dir and --enable-cache CLI options
- `--enable-cache` takes the place of `--cache on`
* CLI supports -femit-bin=foo combined with --enable-cache to do an
"update file" operation. --enable-cache without that argument
will build the output into a cache directory and then print the path
to stdout (matching master branch behavior).
* errors surfacing from main() now print "error: Foo" instead of
"error: error.Foo".
2020-09-22 22:18:19 -07:00
Andrew Kelley
250664bea4
build runner: allow for a bit longer -D options
...
so they can display in the --help menu without getting squished.
2020-09-22 14:56:52 -07:00
Andrew Kelley
dacd36ca9b
stage2: implement using the global cache dir
2020-09-22 14:08:08 -07:00
Andrew Kelley
e2d1f9874d
Merge remote-tracking branch 'origin/master' into llvm11
2020-09-22 11:41:21 -07:00
Bhargav Srinivasan
84406d98e4
removing redundant assert
2020-09-22 05:12:21 -07:00
Bhargav Srinivasan
778bb4b324
return not found error correctly
2020-09-22 03:50:28 -07:00
Bhargav Srinivasan
983830a4ae
replace linearSearch with mem.indexOfScalar, return not found error, factor out siftUp from addUnchecked, use compareFn to decide siftUp/siftDown
2020-09-22 03:46:13 -07:00
Bhargav Srinivasan
a5140cc902
implemented efficient heapreplace
2020-09-22 02:12:35 -07:00
Bhargav Srinivasan
1345f87f4e
items are not sorted, using linear search
2020-09-22 01:50:22 -07:00
Bhargav Srinivasan
69f0fc513a
sorry, local compiler using different version of zig
2020-09-22 01:36:41 -07:00
Bhargav Srinivasan
f083ea88d8
using binary search function from std.sort
2020-09-22 01:05:33 -07:00
Andrew Kelley
bf9a16a037
stage2: implement zig init-lib and zig init-exe
2020-09-21 23:28:34 -07:00
Bhargav Srinivasan
26de64be13
adding a function to update the priority of an element
2020-09-21 23:09:22 -07:00
Andrew Kelley
877e4248fc
stage2: implement building & linking against libcxx and libcxxabi
2020-09-21 22:38:45 -07:00
Andrew Kelley
974333faaf
stage2: fix linking libc trying to depend on itself
2020-09-21 21:42:27 -07:00
Andrew Kelley
0c70bb4fce
Merge remote-tracking branch 'origin/master' into stage2-zig-cc
2020-09-21 21:16:46 -07:00
Andrew Kelley
afac5d2895
fix regressed stage2 test harness
2020-09-21 21:14:01 -07:00
Andrew Kelley
ead50ea665
stage2: implement zig run and zig test
2020-09-21 21:01:04 -07:00
Andrew Kelley
528832bd3a
rename src-self-hosted/ to src/
2020-09-21 18:38:55 -07:00
Andrew Kelley
b9f61d4015
stage1: resolve builtin.zig path when bootstrapping
2020-09-21 18:26:24 -07:00
Andrew Kelley
61c54b2d49
Cache integration for stage1 zig code compilation
2020-09-21 18:21:49 -07:00
Andrew Kelley
b8861a94dd
stage2: building compiler_rt and libc static archive with stage1
...
* add CLI support for verbose debugging options
* implement building compiler_rt and libc static archive using stage1
C++ backend
* add function_sections and link_libcpp to root cache hash.
* cleanups to use the new Directory.join method.
* Package supports being initialized directly and cleaned up create()
method.
* fix classifyFileExt incorrectly saying .zir is .zig. Thanks
@Rocknest!
* unify updateSubCompilation implementations
2020-09-21 16:33:29 -07:00
Andrew Kelley
bd1465a3fe
cmake: output better message when building self-hosted
...
Thanks @bfredl!
2020-09-21 16:32:56 -07:00
Andrew Kelley
561ed38f12
ci: drop the cmake patch for linux
...
hopefully they've solved the polly plugin thing by now on apt.llvm.org.
2020-09-21 12:40:19 -07:00
Vexu
ced061fcbf
stage2: update uses of DepTokenizer
2020-09-21 15:23:41 -04:00
Vexu
b759308fb3
stage2: DepTokenizer print errors
2020-09-21 15:23:41 -04:00
Vexu
f27bc79121
stage2: DepTokenizer add target resolver
2020-09-21 15:23:41 -04:00
Vexu
302e156523
stage2: make DepTokenizer non-allocating
2020-09-21 15:23:41 -04:00
Joran Dirk Greef
5f99d2c240
Define SPLICE, PROVIDE_BUFFERS, REMOVE_BUFFERS and TEE opcodes and flags
2020-09-21 20:15:14 +02:00
Joran Dirk Greef
2d8df2b745
Use @intCast instead of @truncate
2020-09-21 12:03:52 +02:00
Joran Dirk Greef
7719abbf54
Add flags to queue_fsync() signature as per liburing
2020-09-21 11:09:37 +02:00
Joran Dirk Greef
57603fd26d
Use @intCast instead of @truncate on io_uring_enter() result
2020-09-21 11:09:09 +02:00
Joran Dirk Greef
575ed941d7
Cache mask instead of dereferencing mask pointer
2020-09-21 11:07:11 +02:00
Joran Dirk Greef
843c104fc9
Add io_uring syscalls to os.bits.linux.mips.SYS
...
As per lib/libc/musl/arch/mips/bits/syscall.h.in:
```c
```
2020-09-21 10:39:58 +02:00
Joran Dirk Greef
a853f00410
Add IORING_FEAT_FAST_POLL
2020-09-20 19:51:23 +02:00
Joran Dirk Greef
77903f8d4e
Test structs and offsets
2020-09-20 18:45:44 +02:00
Joran Dirk Greef
e51728a1b4
Make enter(), flush_sq(), sq_ring_needs_enter(), cq_ring_needs_flush() public
...
These will also be needed by any custom helpers
2020-09-20 15:54:31 +02:00
Joran Dirk Greef
40293a0643
Add safety checks
2020-09-20 15:41:22 +02:00
Joran Dirk Greef
f22eea82c4
Fix opcode support detection for read/write test
2020-09-20 15:33:48 +02:00
Joran Dirk Greef
b672dc7abf
Use os.fd_t instead of i32 and assert against c_int for syscall safety
2020-09-20 14:59:40 +02:00
Joran Dirk Greef
abebacda32
Handle all possible syscall errors and bring errors in line with os.zig
2020-09-20 14:21:44 +02:00
LemonBoy
58ee5f4e61
std: Fix metadata corruption in HeapAllocator
...
HeapAllocator stores the pointer returned by HeapAlloc right after the
data block and, after the recent allocator refactoring, the space for
this pointer was not taken into account in the calculation of the final
block size.
Fixes #5830
2020-09-20 01:21:29 -04:00
Joran Dirk Greef
4bc1b7a7ac
Fix io_uring_sqe to use the names of the first member of each union
...
Now we're really future-proof... no more `opflags` creeping in.
When anonymous unions land, we can start using `accept_flags` etc.
Until then, code using this struct won't break when the kernel adds features.
Refs: https://github.com/ziglang/zig/issues/6349
Refs: https://github.com/ziglang/zig/issues/985
2020-09-19 18:50:24 +02:00
Joran Dirk Greef
92407bfcd7
Upgrade check_errno() to an exhaustive switch (safer)
2020-09-19 18:29:50 +02:00
Joran Dirk Greef
ba18420b27
Zero the SQE slot and assign, instead of initializing with default values
2020-09-19 18:17:06 +02:00
Joran Dirk Greef
e7ae6f2fad
Remove default values from io_uring_sqe struct
2020-09-19 18:14:41 +02:00
Joran Dirk Greef
f4df2f091a
Allow the kernel to drive feature detection
2020-09-19 17:31:39 +02:00
Joran Dirk Greef
64ae9a6a87
Rename to error.SubmissionQueueFull
2020-09-19 16:54:44 +02:00
Joran Dirk Greef
c1f9d10b6a
Remove unused import aliases
2020-09-19 16:51:35 +02:00
Joran Dirk Greef
9fabae2a28
Return error.UnsupportedKernel for ENOSYS
2020-09-19 16:47:05 +02:00
Joran Dirk Greef
0d8c6a960f
Remove dangling @import from std
2020-09-19 16:45:52 +02:00
Joran Dirk Greef
cb591285d7
Use linux.IORING_SQ_CQ_OVERFLOW
2020-09-19 16:20:21 +02:00
Joran Dirk Greef
31533eb743
Move to std/os/linux
2020-09-19 16:18:04 +02:00
Joran Dirk Greef
873d1c80b3
Add splice_fd_in to io_uring_sqe and future-proof for anonymous unions
2020-09-19 16:15:17 +02:00
Joran Dirk Greef
09f2f4aeb3
Fix std @import
2020-09-19 15:14:47 +02:00
Joran Dirk Greef
b2a54b9581
Test IORING_REGISTER_FILES but avoid sparse fd sets
2020-09-19 15:07:10 +02:00
Joran Dirk Greef
5df0d284d0
Do not register /dev/zero as an fd when testing queue_readv()
2020-09-19 14:29:23 +02:00
Joran Dirk Greef
ee5931908e
@ptrCast fds.ptr to *const c_void for io_uring_register()
2020-09-19 13:25:59 +02:00
Andrew Kelley
2ef68631cb
stage2 now supports using stage1 as a backend for compiling zig code
...
* move stage2.cpp code into zig0.cpp for simplicity
* add -ftime-report and some more CLI options to stage2
* stage2 compites the llvm cpu features string
* classifyFileExt understands more file extensions
* correction to generateBuiltinZigSource using the wrong allocator
(thanks dbandstra!)
* stage2 is now able to build hello.zig into hello.o using stage1 as a
library however it fails linking due to missing compiler-rt
* remove dead code
* simplify zig0 builtin.zig source
* fix not resolving builtin.zig source path causing duplicate imports
* fix stage1.h not being valid C code
* fix stage2.h not being valid C code
2020-09-18 22:48:28 -07:00
LemonBoy
f92d01c8a8
stage1: Fix edge case in casting between optional types
...
Closes #6370
2020-09-18 22:12:22 -04:00
zenith391
4fbf9f7f79
Add "emit_docs" field to LibExeObjStep.
2020-09-19 00:39:43 +03:00
Calle Englund
d08842887f
Workaround MacOS build failure due to #6087
2020-09-18 17:03:50 +02:00
Lachlan Easton
4496a6c9cc
zig fmt: Special case un-indent comma after multiline string in param list
2020-09-18 20:34:00 +10:00
Lachlan Easton
1aacedf6e1
zig fmt: Fix regression in ArrayInitializers
2020-09-18 20:34:00 +10:00
Lachlan Easton
40b6e86a99
zig fmt: fix #6171
2020-09-18 20:34:00 +10:00
Lachlan Easton
c06674e701
zig fmt: Small cleanup
2020-09-18 20:34:00 +10:00
Lachlan Easton
206a8cf670
zig fmt: fix comments and multiline literals in function args
2020-09-18 20:34:00 +10:00
Lachlan Easton
291482a031
zig fmt: Don't consider width of expressions containing multiline string literals when calculating padding for array initializers. fixes #3739
...
Changes some of the special casing for multiline string literals.
2020-09-18 20:34:00 +10:00
Lachlan Easton
e1bd271192
zig fmt: Allow trailing comments to do manual array formatting. close #5948
2020-09-18 20:34:00 +10:00
Lachlan Easton
9f0821e688
zig fmt: Fix erroneously commented out code, add passing test case to close #5722
2020-09-18 20:34:00 +10:00
Lachlan Easton
ea6181aaf6
zig fmt: Add test for nesting if expressions
2020-09-18 20:34:00 +10:00
Andrew Kelley
333b12a8f9
std: start: use std.log instead of stderr
...
When main returns an error code.
2020-09-18 01:58:16 -07:00
Andrew Kelley
dc79651e6a
stage2: add CLI for zig translate-c
2020-09-18 01:33:32 -07:00
Andrew Kelley
a9b18023a4
stage2: implement --show-builtin
...
This takes the place of `zig builtin`. This is an improvement over the
command because now the generated source will correctly show LinkMode
and OutputMode, whereas before it was always stuck as Static and Obj,
respectively.
2020-09-17 23:27:24 -07:00
Andrew Kelley
dc478687d9
delete all stage1 c++ code not directly related to compiling stage2
...
Deleted 16,000+ lines of c++ code, including:
* an implementation of blake hashing
* the cache hash system
* compiler.cpp
* all the linking code, and everything having to do with building
glibc, musl, and mingw-w64
* much of the stage1 compiler internals got slimmed down since it
now assumes it is always outputting an object file.
More stuff:
* stage1 is now built with a different strategy: we have a tiny
zig0.cpp which is a slimmed down version of what stage1 main.cpp used
to be. Its only purpose is to build stage2 zig code into an object
file, which is then linked by the host build system (cmake) into
stage1. zig0.cpp uses the same C API that stage2 now has access to,
so that stage2 zig code can call into stage1 c++ code.
- stage1.h is
- stage2.h is
- stage1.zig is the main entry point for the Zig/C++
hybrid compiler. It has the functions exported from Zig, called
in C++, and bindings for the functions exported from C++, called
from Zig.
* removed the memory profiling instrumentation from stage1.
Abandon ship!
* Re-added the sections to the README about how to build stage2 and
stage3.
* stage2 now knows as a comptime boolean whether it is being compiled
as part of stage1 or as stage2.
- TODO use this flag to call into stage1 for compiling zig code.
* introduce -fdll-export-fns and -fno-dll-export-fns and clarify
its relationship to link_mode (static/dynamic)
* implement depending on LLVM to detect native target cpu features when
LLVM extensions are enabled and zig lacks CPU feature detection for
that target architecture.
* C importing is broken, will need some stage2 support to function
again.
2020-09-17 18:29:38 -07:00
Ryan Liptak
fbde15fdf4
Fix compile error in os.renameatW
...
Introduced in 5e3fa0e94f
Whoops!
2020-09-17 18:49:06 -04:00
Andrew Kelley
f125288c9b
Merge pull request #6336 from Rocknest/pbkdf2
...
Some changes to #6326 (pbkdf2)
2020-09-17 17:31:58 -04:00
Ryan Liptak
5e3fa0e94f
Add rename to std.fs API
...
- Moves fs.rename functions to fs.renameAbsolute to match other functions outside of fs.Dir
- Adds fs.Dir.rename that takes two paths relative to the given Dir
- Adds fs.rename that takes two separate Dir's that the given paths are relative to (for renaming across directories without having to make the second path relative to a single directory)
- Fixes FileNotFound error return in std.os.windows.MoveFileExW
- Returns error.RenameAcrossMountPoints from renameatW
+ Matches the RenameAcrossMountPoints error return in renameatWasi/renameatZ
2020-09-17 17:22:26 -04:00
Andrew Kelley
3672a18799
Merge pull request #6360 from LemonBoy/some-fmt-fixes
...
Two std.fmt fixes
2020-09-17 16:17:15 -04:00
Joran Dirk Greef
8b030a6599
Use x.y for C-style x->y instead of x.*.y
2020-09-17 20:29:56 +02:00
Joran Dirk Greef
e33c466daf
Use std.builtin
2020-09-17 19:56:57 +02:00
Joran Dirk Greef
d966fe6319
Add IORING_SQ_CQ_OVERFLOW to std/os/bits/linux.zig
2020-09-17 19:53:34 +02:00
Joran Dirk Greef
21c81360ba
Remove comment
2020-09-17 19:44:53 +02:00
Joran Dirk Greef
ac1d9f716a
Use != 0 for bitwise flag conditions
2020-09-17 19:37:17 +02:00
LemonBoy
b7f9f779af
translate-c: Fix formatting of non-printable chars
...
The two octets in hex notation must be aligned to the right and padded
on the left, not the other way around.
2020-09-17 09:27:24 +02:00
Andrew Kelley
bc01887376
stage2: verify -Wl zig cc behavior
2020-09-16 20:28:51 -07:00
Andrew Kelley
01a7affb87
stage2: ask for a higher open fd limit
...
Here's the doc comment from the commit:
For one example of why this is handy, consider the case of building musl libc.
We keep a lock open for each of the object files in the form of a file descriptor
until they are finally put into an archive file. This is to allow a zig-cache
garbage collector to run concurrently to zig processes, and to allow multiple
zig processes to run concurrently with each other, without clobbering each other.
This code is disabled until #6361 is implemented (getrlimit/setrlimit
are not yet added to the standard library).
2020-09-16 20:18:06 -07:00
Andrew Kelley
07eb2c65f6
stage2: don't add unused args to assembly compilations
2020-09-16 19:24:09 -07:00
Andrew Kelley
17d40ecb49
stage2: building libunwind.a
...
and put glibc shared objects on the elf linker line
2020-09-16 17:18:13 -07:00
LemonBoy
27adb82fda
std: Respect user-specified alignment when formatting ints
...
This implementation tries to do the right thing (TM) by treating the
sign as part of the number itself, therefore the alignment parameter
applies to both the sign and the digits.
In other words the format string `{:>4}` with -1 as input will not
output `- 1` but ` -1`.
And let's default to right alignment for everything as that's what users
want, especially when printing numbers. Many implementations use
different defaults for numeric vs non-numeric types, let's strive for a
consistent behaviour here.
2020-09-17 00:53:08 +02:00
Andrew Kelley
17f094ec5b
stage2: build glibc shared objects using assembly files
...
closes #6358
2020-09-16 14:33:13 -07:00
Andrew Kelley
3256b3c485
stage2: glibc shared objects use ok file to detect cache hits
2020-09-16 13:41:53 -07:00
Andrew Kelley
670260aab6
stage2: std.log.err is an error not a warning
2020-09-16 13:41:28 -07:00
Andrew Kelley
883dcb8b18
stage2 Cache: use hex instead of base64 for file paths
2020-09-16 12:31:42 -07:00
Andrew Kelley
a863d899e1
ci: undo mangled autocrlf files before building
2020-09-16 11:58:26 -07:00
Andrew Kelley
80d8515e3a
ci: disable git autocrlf
...
See also commit
2c8495b4bb
2020-09-16 10:49:43 -07:00
Joran Dirk Greef
491a434b01
Check kernel support for single_mmap, accept, and read/write
2020-09-16 19:36:29 +02:00
Tadeo Kondrak
2962be8135
stage1: fix @Type(.Union) not resolving its tag type
...
Fixes https://github.com/ziglang/zig/issues/6339
2020-09-16 20:34:01 +03:00
Joran Dirk Greef
6f09796ff2
Add short license and copyright notice
2020-09-16 18:51:21 +02:00
Joran Dirk Greef
b340bbfc1d
std: add io_uring library
...
This brings io_uring helper methods to Zig for kernels >= 5.4.
We follow liburing's design decisions so that anyone who is comfortable with
liburing (https://unixism.net/loti/ref-liburing/index.html ) will feel at home.
Thanks to @daurnimator for the first draft.
Refs: https://github.com/ziglang/zig/pull/3083
Signed-off-by: Joran Dirk Greef <joran@coil.com >
2020-09-16 15:07:13 +02:00
LemonBoy
bb9a4ad6e9
std: Fix {*} printing of non-pointer types
...
Fixes a regression introduced in #6246 .
Adds a test to make sure this won't happen again.
2020-09-16 13:45:54 +02:00
Andrew Kelley
95941c4e70
stage2: building glibc shared objects
...
* caching system: use 16 bytes siphash final(), there was a bug in the
std lib that wasn't catching undefined values for 18 bytes. fixed in
master branch.
* fix caching system unit test logic to not cause error.TextBusy on windows
* port the logic from stage1 for building glibc shared objects
* add is_native_os to the base cache hash
* fix incorrectly freeing crt_files key (which is always a reference to
global static constant data)
* fix 2 use-after-free in loading glibc metadata
* fix memory leak in buildCRTFile (errdefer instead of defer on arena)
2020-09-16 03:02:46 -07:00
Andrew Kelley
281fc10ec5
std.crypto siphash: fix assertion on the size of output buffer
...
the logic was backwards
2020-09-16 02:24:36 -07:00
Nathan Michaels
7801a6d17f
Fix a typo.
2020-09-15 22:49:53 -04:00
Andrew Kelley
da0fde59b6
stage2: update to new LibCInstallation API
2020-09-15 18:08:52 -07:00
Andrew Kelley
16bd0c63b4
Merge remote-tracking branch 'origin/master' into stage2-zig-cc
...
Pulling in the changes to libc_installation.zig
2020-09-15 18:04:37 -07:00
Andrew Kelley
99a2fc2cde
stage2: implement .d file parsing for C objects
2020-09-15 18:02:42 -07:00
Rocknest
c35703825f
Add an error set
2020-09-16 01:58:48 +03:00
Andrew Kelley
a0b43ff3b3
stage2: eliminate one failure path in building c object
2020-09-15 15:24:34 -07:00
Andrew Kelley
f82b1831f7
std: handle sharing violation when deleting a file on windows
2020-09-15 15:24:13 -07:00
Andrew Kelley
7ccfb08a93
ci: update the on_master_success secret to lavatech
2020-09-15 15:08:35 -07:00
Samrat Man Singh
ca85e367f4
Use std.log in LibcInstallation parse instead of taking stderr
2020-09-15 18:03:55 -04:00
Andrew Kelley
c803d334d0
update the zen of zig
2020-09-15 13:40:01 -07:00
Andrew Kelley
b2860aa3e4
stage2: add missing import to libc_installation.zig
2020-09-15 12:52:58 -07:00
Andrew Kelley
b3cc36857e
Merge pull request #6340 from Vexu/fix
...
Fixes
2020-09-15 14:28:16 -04:00
LemonBoy
c1c3212500
std: Fix typo in ELF section header iterator
...
The code accidentally used the phdr offset instead of the shdr one while
iterating over the section headers.
Fixes #6338
2020-09-15 18:14:06 +03:00
Andrew Kelley
1da9e0fcaf
stage2: building glibc libc_nonshared.a CRT file
2020-09-15 00:41:02 -07:00
Andrew Kelley
4fa8cc7369
stage2: don't depend on windows SDK C++ code when unavailable
2020-09-15 00:40:33 -07:00
Andrew Kelley
6e9396e32b
integrate target features into building assembly code
...
This brings us up to par from what stage1 does. There will still be an
open issue for completing this.
2020-09-14 23:03:13 -07:00
Andrew Kelley
1ad60c4386
integrate target features into building C source files
2020-09-14 22:57:08 -07:00
Andrew Kelley
5d8fec3d4c
Merge remote-tracking branch 'origin/master' into stage2-zig-cc
2020-09-14 21:57:01 -07:00
Andrew Kelley
6acd903a95
stage2: support for machine code model CLI
2020-09-14 21:22:11 -07:00
Andrew Kelley
5e39ab4600
ci: disable some freebsd tests to save time
2020-09-14 21:11:34 -07:00
Andrew Kelley
0e94530c51
stage2: refactor 2 CObject fields to use CSourceFile
2020-09-14 19:52:36 -07:00
Andrew Kelley
29d9743f9d
Revert "disable sourcehut freebsd CI checks"
...
This reverts commit 40cb712d13 .
Thanks to Ava & Luna of Lavatech, we don't need to resort to this, they
have graciously given zig a SourceHut instance to use that gives us 8GB
RAM.
2020-09-14 19:43:26 -07:00
Andrew Kelley
a8ae324130
Merge branch 'ci-freebsd'
...
Thanks to Ave & Luna for providing this service that lets us have enough
ram to properly test FreeBSD.
2020-09-14 19:38:36 -07:00
Andrew Kelley
44ef270de1
ci: use hut.lavatech.top for updating the download page
2020-09-14 19:37:59 -07:00
Andrew Kelley
558e22b2d0
ci: update freebsd to use hut.lavatech.top instead of sr.ht
2020-09-14 18:45:30 -07:00
Andrew Kelley
01c24c4509
ci: enable std lib tests for freebsd
2020-09-14 18:22:16 -07:00
Andrew Kelley
dffdb2844e
track all TODO comments in BRANCH_TODO file
...
Before merging, do this for every item in the file:
* solve the issue, or
* convert the task to a github issue and update the comment
to link to the issue (and remove "TODO" text from the comment).
Then delete the file.
Related: #363
2020-09-14 18:06:19 -07:00
Andrew Kelley
26798018b7
stage2: implement writing archive files
2020-09-14 15:28:09 -07:00
Vexu
a3624e94f8
translate-c: determine sizeof using std.meta.sizeof
2020-09-14 23:53:38 +03:00
Vexu
29fd0c6d61
fix meta.cast behavior; add exhaustive tests
2020-09-14 23:21:26 +03:00
Andrew Kelley
40cb712d13
disable sourcehut freebsd CI checks
...
Drew won't give us enough RAM for stage1 to build stage2. We'll still
have freebsd builds available on releases but we're going to lose
freebsd CI testing for master branch builds until we fully switch over
to stage2 (and have lower memory usage).
Let me know if anyone wants to run a SourceHut instance and give zig
access to run on slightly more powerful machines. We need about 8 GiB
RAM to run the CI test suite for now.
After we're fully self hosted I expect to re-enable this.
2020-09-14 11:10:38 -07:00
Andrew Kelley
778bb4bc9c
move std.cache_hash from std to stage2
...
The API is pretty specific to the implementationt details of the
self-hosted compiler. I don't want to have to independently support
and maintain this as part of the standard library, and be obligated
to not make breaking changes to it with changes to the implementation of
stage2.
2020-09-14 11:05:51 -07:00
Andrew Kelley
04f6a26955
fix stage1 regressions in this branch
...
also prepare for supporting linking into archives
2020-09-14 10:42:29 -07:00
Andrew Kelley
c58e9951ef
revert bogus enum keywords in zig_llvm.h
2020-09-14 10:31:34 -07:00
Veikka Tuominen
d073836894
Merge pull request #6172 from tadeokondrak/@Type(.Union)
...
Implement @Type for Union
2020-09-14 16:43:49 +03:00
Andrew Kelley
c49435f76b
Merge pull request #6331 from mattnite/bpf-helper-defs
...
BPF: helper definitions
2020-09-14 04:00:00 -04:00
Andrew Kelley
f2e380380e
stage2: building glibc Scrt1.o
2020-09-14 00:24:03 -07:00
Andrew Kelley
060c91b97f
stage2: namespace cache dir with C source path
...
This is not strictly necessary but it increases the likelihood of cache
hits because foo.c and bar.c now will have different cache directories
and can be updated independently without clobbering each other's cache
data.
2020-09-13 23:28:28 -07:00
Andrew Kelley
0379d7b431
stage2: don't bother building glibc when only doing build-obj
2020-09-13 23:04:15 -07:00
Andrew Kelley
e5aef96293
stage2: CRT files retain locks on the build artifacts
2020-09-13 22:54:16 -07:00
Andrew Kelley
97ea5da18d
stage2: fix bad include path for glibc abi-note.S
2020-09-13 22:38:50 -07:00
Andrew Kelley
2627778b25
stage2: don't create empty object files when no zig source
2020-09-13 22:15:03 -07:00
Andrew Kelley
046dce9cef
stage2: fix not creating cache o dir before writing to it
...
also remove non-working debug CLI options
2020-09-13 21:13:24 -07:00
Andrew Kelley
2456df5f4e
stage2: rename ZigModule to Module
2020-09-13 19:56:35 -07:00
Andrew Kelley
4d59f77528
stage2: rename Module to Compilation
2020-09-13 19:49:52 -07:00
Andrew Kelley
2a8fc1a18e
stage2: caching system integration & Module/Compilation splitting
...
* update to the new cache hash API
* std.Target defaultVersionRange moves to std.Target.Os.Tag
* std.Target.Os gains getVersionRange which returns a tagged union
* start the process of splitting Module into Compilation and "zig
module".
- The parts of Module having to do with only compiling zig code are
extracted into ZigModule.zig.
- Next step is to rename Module to Compilation.
- After that rename ZigModule back to Module.
* implement proper cache hash usage when compiling C objects, and
properly manage the file lock of the build artifacts.
* make versions optional to match recent changes to master branch.
* proper cache hash integration for compiling zig code
* proper cache hash integration for linking even when not compiling zig
code.
* ELF LLD linking integrates with the caching system. A comment from
the source code:
Here we want to determine whether we can save time by not invoking LLD when the
output is unchanged. None of the linker options or the object files that are being
linked are in the hash that namespaces the directory we are outputting to. Therefore,
we must hash those now, and the resulting digest will form the "id" of the linking
job we are about to perform.
After a successful link, we store the id in the metadata of a symlink named "id.txt" in
the artifact directory. So, now, we check if this symlink exists, and if it matches
our digest. If so, we can skip linking. Otherwise, we proceed with invoking LLD.
* implement disable_c_depfile option
* add tracy to a few more functions
2020-09-13 19:29:07 -07:00
Andrew Kelley
1baa56a25f
std.cache_hash: break up the API and improve implementation
...
into smaller exposed components and expose all of them. This makes it
more flexible.
`*const Cache` is now passed in with an open manifest dir handle which
the caller is responsible for managing.
Expose some of the base64 stuff.
Extract the hash helper functions into `HashHelper` and add some more
methods such as addOptional and addListOfFiles.
Add `CacheHash.toOwnedLock` so that you can deinitialize everything
except the open file handle which represents the file system lock on the
build artifacts.
Use ArrayListUnmanaged, saving space per allocated CacheHash.
Avoid 1 memory allocation in hit() with a static buffer.
hit() returns a bool; caller code is responsible for calling final() in
either case. This is a simpler and easier to use API.
writeManifest() is no longer called from deinit() with errors ignored.
2020-09-13 18:04:52 -07:00
Rocknest
988fc6f9d1
flip condition
2020-09-14 02:27:09 +03:00
Rocknest
73863cf72b
fix build
2020-09-13 23:59:36 +03:00
LemonBoy
61e9e82bdc
std: Make the CRC32 calculation slightly faster
...
Speed up a little the slicing-by-8 code path by replacing the
(load+shift+xor)*4 sequence with a single u32 load plus a xor.
Before:
```
iterative: 1018 MiB/s [000000006c3b110d]
small keys: 1075 MiB/s [0035bf3dcac00000]
```
After:
```
iterative: 1114 MiB/s [000000006c3b110d]
small keys: 1324 MiB/s [0035bf3dcac00000]
```
2020-09-13 16:32:21 -04:00
Rocknest
f6195be997
fix ref
2020-09-13 23:31:59 +03:00
LemonBoy
5e50d145d9
std: Limit the read/write size on Darwin
...
It turns out that the kernel won't read or write more than 0x7fffffff
bytes in a single call, failing with EINVAL when trying to do so.
Adjust the limit and curse whoever is responsible for this.
Closes #6332
2020-09-13 16:31:21 -04:00
Rocknest
d75cbb01db
Reference all crypto declarations
2020-09-13 23:00:33 +03:00
Rocknest
b6385870d0
Convert asserts to errors, make sure nothing overflows
2020-09-13 22:39:54 +03:00
Rocknest
a6d947191e
Merge pull request #2 from rnapier/pbkdf2
...
Pbkdf2
2020-09-13 22:09:45 +03:00
Matt Knight
88dacd3b70
changed to opaque
2020-09-13 09:53:20 -07:00
Matt Knight
1afbf4fb21
removed all those kern aliases
2020-09-13 09:43:49 -07:00
Rob Napier
85366771ea
pbkdf2 offset into dk should be usize, not u64.
2020-09-13 12:36:32 -04:00
Matt Knight
cb5f76bb1c
got booleans wrong
2020-09-13 09:24:56 -07:00
Rocknest
dcd229be92
Merge pull request #1 from rnapier/pbkdf2
...
Pbkdf2
2020-09-13 19:11:29 +03:00
Rob Napier
2f9c9662ba
Use comptime to expose public method to doc system
2020-09-13 11:17:58 -04:00
Rob Napier
8a1a40276f
Extract kdf.zig to provide namespace documentation
2020-09-13 11:08:06 -04:00
Rob Napier
257c5b5348
Explicitly reference std.crypto.kdf in test case
2020-09-13 10:50:46 -04:00
Rob Napier
0f85b85acb
Improve doc text
2020-09-13 09:59:36 -04:00
Matt Knight
b043a31889
added helper definitions
2020-09-12 23:45:35 -07:00
Rob Napier
17156e1775
pbkdf2 "very large dklen test" should just check for crashes
2020-09-12 18:33:53 -04:00
Rob Napier
3f450b7e93
Replace Hash function with Prf. Correct offset bit-width.
2020-09-12 18:17:04 -04:00
Rob Napier
37db93e426
Review comments from pbkdf2.zig
...
Move block definitions inside while loop.
Use usize for offset. (This still crashes on overflow)
Remove unneeded slice syntax.
Add slow test for Very large dkLen
2020-09-12 15:03:42 -04:00
Andrew Kelley
af4cc20ce2
Merge remote-tracking branch 'origin/master' into stage2-zig-cc
...
Master branch added in the concept of library versioning being optional
to main.cpp. It will need to be re-added into this branch before merging
back into master.
2020-09-12 10:48:38 -07:00
Andrew Kelley
03a23418ff
stage2: linking with LLD and building glibc static CRT files
...
* implement --debug-cc and --debug-link
* implement C source files having extra flags
- TODO a way to pass them on the CLI
* introduce the Directory abstraction which contains both an open file
descriptor and a file path name. The former is preferred but the
latter is needed when communicating paths over a command line (e.g.
to Clang or LLD).
* use the cache hash to choose an artifact directory
- TODO: use separate cache hash instances for the zig module and
each C object
* Module: introduce the crt_files table for keeping track of built libc
artifacts for linking.
* Add the ability to build 4/6 of the glibc static CRT lib files.
* The zig-cache directory is now passed as a parameter to Module.
* Implement the CLI logic of -femit-bin and -femit-h
- TODO: respect -fno-emit-bin
- TODO: the emit .h feature
* Add the -fvalgrind, -fstack-check, and --single-threaded CLI options.
* Implement the logic for auto detecting whether to enable PIC,
sanitize-C, stack-check, valgrind, and single-threaded.
* Properly add PIC args (or not) to clang argv.
* Implement renaming clang-compiled object files into their proper
place within the cache artifact directory.
- TODO: std lib needs a proper higher level abstraction for
std.os.renameat.
* Package is cleaned up to use the "Unmanaged" StringHashMap and use the
new Directory abstraction.
* Clean up zig lib directory detection to make proper use of directory
handles.
* Linker code invokes LLD.
- TODO properly deal with the stdout and stderr that we get from it
and expose diagnostics from the Module API that match the expected
error message format.
* Delete the bitrotted LLVM C ABI bindings. We'll resurrect just the
functions we need as we introduce dependencies on them. So far it
only has ZigLLDLink in it.
* Remove dead timer code.
* `zig env` now prints the path to the zig executable as well.
2020-09-12 00:51:06 -07:00
Andrew Kelley
8374be1a1c
std.cache_hash: bump up the base64 digest len to avoid '=='
2020-09-12 00:50:37 -07:00
Andrew Kelley
c903dad915
fix zig_llvm.h not complying with C
2020-09-12 00:50:17 -07:00
LemonBoy
9fe4c89230
std: Add a gzip decoder
2020-09-11 20:02:41 -04:00
Andrew Kelley
1edf097871
Merge pull request #6323 from LemonBoy/fast-zlib
...
std: Make the DEFLATE decompression routine 3x faster
2020-09-11 17:25:18 -04:00
Rob Napier
c2b02d01d5
Add crypto.kdf.pbkdf2
2020-09-11 17:10:27 -04:00
Andrew Kelley
1eaf0691f9
Merge pull request #6320 from ifreund/prctl
...
std: add prctl and securebits definitions for linux/C
2020-09-11 16:33:57 -04:00
Isaac Freund
1078810cef
std: add prctl definition when linking libc
2020-09-11 22:32:23 +02:00
Isaac Freund
b6f4601545
std: add securebits definitions for linux
2020-09-11 22:32:23 +02:00
Isaac Freund
744b73ab46
std: add prctl wrapper to std.os
2020-09-11 22:32:23 +02:00
Isaac Freund
7b961a876b
std: add prctl definition for linux
2020-09-11 22:32:22 +02:00
Andrew Kelley
42c32dbc7b
Merge pull request #6315 from ifreund/optional-shlib-version
...
std, stage1: make shared library versioning optional
2020-09-11 16:07:13 -04:00
LemonBoy
4b851c7255
Re-enable a compression test
...
It somehow got commented out...
2020-09-11 21:04:08 +02:00
LemonBoy
41f244bd2f
std: Make the DEFLATE decompression routine 3x faster
...
A profiler run showed that the main bottleneck was the naive decoding of
the Huffman codes, replacing it with a nice trick borrowed by Zlib gave
a substantial speedup.
Replacing a `%` with a `and (mask-1)` gave another significant
improvement (yay for low hanging fruits).
A few numbers obtained by decompressing a 22M file:
Before:
```
./decompress 2,39s user 0,00s system 99% cpu 2,400 total
```
After:
```
./decompress 0,79s user 0,00s system 99% cpu 0,798 total
````
2020-09-11 21:00:15 +02:00
Andrew Kelley
bee34f5d03
add a manifesto to the readme
2020-09-11 11:30:21 -07:00
Isaac Freund
0a76a9bd73
std, stage1: make shared library versioning optional
...
This commit changes the behavior of stage1 to emit libfoo.so instead
of libfoo.so.0.0.0 when none of the --ver-major, --ver-minor, or
--ver-patch flags are set.
It also makes it possible to create unversioned shared libraries
using the zig build system, changing the version parameter of
addSharedLibrary() to a tagged union.
2020-09-11 10:46:37 +02:00
Isaac Freund
68bf29c31e
std: allow overriding install dir of artifacts
...
This is necessary when, for example, writing a PAM module which should
be installed to lib/security/module_name.so.
2020-09-11 04:32:36 -04:00
Andrew Kelley
8cf40f3445
stage2: loading glibc metadata
2020-09-10 22:24:27 -07:00
Andrew Kelley
98583be6e1
stage1: fix crash with slice type
2020-09-10 22:22:42 -07:00
Andrew Kelley
c41cd3e13a
std.fs.File: fix typo in writeFileAll
2020-09-10 18:53:20 -07:00
Andrew Kelley
800c5de2ae
update the stack trace test case for lines added to start.zig
2020-09-10 14:40:33 -07:00
Andrew Kelley
2315331d23
Merge pull request #5527 from shawnanastasio/ppc64le
...
Implement support for powerpc64{,le}
2020-09-10 15:56:27 -04:00
Christian Wesselhoeft
ea9b38c93c
fs/file.zig: Update reader to use type alias
...
This is a minor cosmetic change which updates `reader` and `inStream`
to match `writer` and `outStream` below.
2020-09-10 15:42:24 -04:00
Isaac Freund
13b8c63834
std: complete C definitions for uid/gid setters
...
Also:
- correct the definition of setgid
- update the existing definitions to use the uid_t/gid_t types
2020-09-10 15:41:52 -04:00
Isaac Freund
bb9773f695
std: fix errorset of std.os.seteuid/setegid
2020-09-10 15:41:21 -04:00
Isaac Freund
486a774e5f
std: add option to use single-threaded event loop
...
std.event.Loop does not yet work in single threaded builds. However,
using evented io on a single thread can be very convenient. This commit
allows settind @import("root").event_loop_mode to .single_threaded
in order to allow this without reimplementing the startup code in
start.zig
2020-09-10 15:40:38 -04:00
Isaac Freund
4170f3f77f
std: fix bitrot in process.posixGetUserInfo()
2020-09-10 14:30:07 -04:00
Bas van den Berg
127fa80090
implement poll for windows with WSAPoll (only available on vista and higher)
2020-09-10 20:20:27 +02:00
Vexu
0833c8d06b
translate-c: support sizeof and _Alignof in macros
...
Closes #6301
2020-09-10 13:04:03 +03:00
Literally Void
78baa16da0
Fix issue #6303 : iterating empty PriorityQueue crashes
2020-09-10 12:00:53 +03:00
Andrew Kelley
e05ecbf165
stage2: progress towards LLD linking
...
* add `zig libc` command
* add `--libc` CLI and integrate it with Module and linker code
* implement libc detection and paths resolution
* port LLD ELF linker line construction to stage2
* integrate dynamic linker option into Module and linker code
* implement default link_mode detection and error handling if
user requests static when it cannot be fulfilled
* integrate more linker options
* implement detection of .so.X.Y.Z file extension as a shared object
file. nice try, you can't fool me.
* correct usage text for -dynamic and -static
2020-09-09 22:29:41 -07:00
Andrew Kelley
5746a8658e
stage1: link: fix incorrect LDM option for mips64
2020-09-09 22:23:59 -07:00
Andrew Kelley
b37955f273
stage2 linker code supports opening an intermediate object file
...
For when linking with LLD, we always create an object rather than going
straight to the executable. Next step is putting this object on the LLD
linker line.
2020-09-09 10:54:40 -07:00
Bas van den Berg
f5b9e445aa
Handle some WSA errors
2020-09-09 18:55:45 +02:00
Andrew Kelley
193ad413f0
stage2: compiling C objects with clang
...
* add target_util.zig which has ported code from src/target.cpp
* Module gains an arena that owns memory used during initialization
that has the same lifetime as the Module. Useful for constructing
file paths and lists of strings that have mixed lifetimes.
- The Module memory itself is allocated in this arena. init/deinit
are modified to be create/destroy.
- root_name moves to the arena and no longer needs manual free
* implement the ability to invoke `zig clang` as a subprocess
- there are lots of TODOs that should be solved before merging
* Module now requires a Random object and zig_lib_dir
* Module now requires a path to its own executable or any zig
executable that can do `zig clang`.
* Wire up more CLI options.
* Module creates "zig-cache" directory and "tmp" and "o" subdirectories
("h" is created by the cache_hash)
* stubbed out some of the things linker code needs to do with TODO
prints
* delete dead code for computing compiler id. the previous commit
eliminated the need for it.
* add `zig translate-c` CLI option but it's not fully hooked up yet.
It should be possible for this to be fully wired up before merging
this branch.
* `zig targets` now uses canonical data for available_libcs
2020-09-09 09:28:05 -07:00
Andrew Kelley
c99e34a00e
stage2: eliminate the "compiler id" concept
...
Instead, append a "dirty suffix" to the version string when there are
dirty git changes and use the version string as the compiler id.
This avoids a dependency on the cache hash system, and saves time on
first invocation of the compiler since it does not have to compute its
compiler id. It also saves time by not having to check the cache for a
saved compiler id.
2020-09-09 09:28:05 -07:00
Andrew Kelley
35f334ae0f
organize some TODO comments
2020-09-09 09:28:05 -07:00
Andrew Kelley
4056bb92e6
stage2: more progress moving zig cc to stage2
...
* std.cache_hash exposes Hasher type
* std.cache_hash makes hasher_init a global const
* std.cache_hash supports cloning so that clones can share the same
open manifest dir handle as well as fork from shared hasher state
* start to populate the cache_hash for stage2 builds
* remove a footgun from std.cache_hash add function
* get rid of std.Target.ObjectFormat.unknown
* rework stage2 logic for resolving output artifact names by adding
object_format as an optional parameter to std.zig.binNameAlloc
* support -Denable-llvm in stage2 tests
* Module supports the use case when there are no .zig files
* introduce c_object_table and failed_c_objects to Module
* propagate many new kinds of data from CLI into Module and into
linker.Options
* introduce -fLLVM, -fLLD, -fClang and their -fno- counterparts.
closes #6251 .
- add logic for choosing when to use LLD or zig's self-hosted linker
* stub code for implementing invoking Clang to build C objects
* add -femit-h, -femit-h=foo, and -fno-emit-h CLI options
2020-09-09 09:28:05 -07:00
Andrew Kelley
472ee18486
stage2: infer --name in more ways
2020-09-09 09:28:05 -07:00
Andrew Kelley
f064f0564f
stage2: improve log message format
2020-09-09 09:28:05 -07:00
Andrew Kelley
71687b30a2
work around stage1 invalid LLVM IR
2020-09-09 09:28:05 -07:00
Andrew Kelley
503ba7b27c
start moving zig cc to stage2
...
* build.zig: repair the ability to link against llvm, clang, and lld
* move the zig cc arg parsing logic to stage2
- the preprocessor flag is still TODO
- the clang arg iterator code is improved to use slices instead of
raw pointers because it no longer has to deal with an extern
struct.
* clean up error printing with a `fatal` function and use log API
for messages rather than std.debug.print
* add support for more CLI options to stage2 & update usage text
- hooking up most of these new options is TODO
* clean up the way libc and libc++ are detected via command line
options. target information is used to determine if any of the libc
candidate names are chosen.
* add native library directory detection
* implement the ability to invoke clang from stage2
* introduce a build_options.have_llvm so we can comptime branch
on whether LLVM is linked in or not.
2020-09-09 09:28:05 -07:00
Vexu
749417a1f3
translate-c: check for builtin typedef macro identifiers
...
Closes #6292
2020-09-09 16:29:16 +03:00
Lachlan Easton
601331833a
Add passing test. close #5343
2020-09-09 21:54:42 +10:00
Lachlan Easton
283d441c19
zig fmt: fix #3978 , fix #2748
2020-09-09 21:54:42 +10:00
Jakub Konka
7d487a4162
Merge pull request #6289 from kubkon/macho
...
macho: fix bug where __text section would get overwritten
2020-09-09 09:00:24 +02:00
Zachary Meadows
edc40157eb
Switch type of HashMap's count from usize to u32 ( #6262 )
2020-09-09 00:33:14 -04:00
Jakub Konka
edbfd04ec1
Do not pad out text blocks
...
It seems MachO does not like padding between text block in __text
section. Unlike in Elf, there is no size information in symbol
struct `nlist_64`.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-09-08 22:00:31 +02:00
Jakub Konka
9306dbd619
Fix bug where __text section would get overwritten
...
Fixes a bug where the last written load command would accidentally
override the beginning of the __text section. Also defines missing
MachO constants and relocation structs/enums.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-09-08 20:55:06 +02:00
Mark Barbone
42b1b6be90
Add resize for arena allocator
2020-09-08 13:04:14 -04:00
Jens Goldberg
5bf3e54018
Add the Linux TCP socket options
2020-09-08 13:00:07 -04:00
Andrew Kelley
f6f0e09456
Merge pull request #6267 from mattnite/btf
...
BPF: add BTF
2020-09-08 12:59:31 -04:00
xackus
b8b68cb279
std: clean up bitrotten imports in crypto
2020-09-08 12:54:28 -04:00
Andrew Kelley
8716fde7bc
ci: skip non native builds on windows to save time
2020-09-08 09:53:41 -07:00
Timon Kruiper
61cd9099e2
Zlib: Make deinit function public
2020-09-08 12:21:49 -04:00
Bas van den Berg
44f877d18b
change socklen_t to u32 and add appropriate casts when calling WSA
2020-09-08 12:24:39 +02:00
Bas van den Berg
857613fb65
add unreachable
2020-09-08 12:16:03 +02:00
Bas van den Berg
9094d6cbb8
fix identation with zig-fmt
2020-09-08 12:15:44 +02:00
Bas
4a6ca735d9
Merge branch 'master' into improve-windows-networking
2020-09-08 11:56:59 +02:00
Andrew Kelley
389c260252
Merge branch 'LemonBoy-zlib-cool'
...
closes #6277
closes #213
2020-09-07 15:16:32 -07:00
Andrew Kelley
c15f39212e
build.zig: ignore the compression test files
2020-09-07 15:15:48 -07:00
LemonBoy
2328f40b7a
std: Add DEFLATE and zlib decompressors
2020-09-07 14:59:46 -07:00
Matt Knight
a496f94be9
added map create, update, delete, and prog load
2020-09-07 15:42:41 -04:00
Matthew Knight
db7a238297
BPF: add some more documentation ( #6268 )
...
* added documentation for ringbuffers, which context type maps to which program type, and added some formatting
2020-09-07 15:41:29 -04:00
Andrew Kelley
f96f3265b5
Merge pull request #6265 from mattnite/bpf-finish-insns
...
BPF: Implement rest of pseudo instructions
2020-09-07 15:39:42 -04:00
Matt Knight
b878a64a5f
added license comments
2020-09-07 12:26:41 -07:00
Andrew Kelley
52b8239a22
Merge remote-tracking branch 'origin/master' into llvm11
2020-09-07 11:17:42 -07:00
Vincent Rischmann
533bfc68bf
big int: fix Managed.dump()
2020-09-07 20:44:01 +03:00
Peter Spiess-Knafl
eca20b5e03
Fix compile when using EFI target ( Fixes #6275 )
2020-09-07 20:40:11 +03:00
Matt Knight
cf3194804e
changed enums to lower case
2020-09-07 07:17:21 -07:00
Tadeo Kondrak
acdf1f0bde
@Type for union fixes
2020-09-07 06:23:50 -06:00
Tadeo Kondrak
771f35c593
Use less inefficient method of replacing TypeInfo.UnionField.enum_field
2020-09-07 06:23:27 -06:00
Tadeo Kondrak
ac19ccf595
Update standard library for removal of TypeInfo.UnionField.enum_field
2020-09-07 06:23:26 -06:00
Tadeo Kondrak
ff2ed966bb
Implement @Type for Union
...
This removes TypeInfo.UnionField.enum_field, which is redundant with
TypeInfo.Union.tag_type.
2020-09-07 06:23:24 -06:00
Matt Knight
e7547eeefa
fixed missing 'packed' keyword
2020-09-06 22:31:35 -07:00
Matt Knight
caaa9ad2af
added btf
2020-09-06 21:44:16 -07:00
Matt Knight
67817b230f
fixed improper builtin import
2020-09-06 17:09:25 -07:00
Matt Knight
cf06817768
improved compile error message
2020-09-06 16:21:05 -07:00
Andrew Kelley
d7268cbb24
Merge pull request #6232 from LemonBoy/fix-readall
...
std: Don't trust stat() size in readAllAlloc fns
2020-09-06 19:19:57 -04:00
Matt Knight
a993c7dd1b
removed redundant pseudo insn
2020-09-06 16:19:49 -07:00
Matt Knight
295f09eadc
implemented and testing op codes for instructions documented in the unofficial bpf insn reference
2020-09-06 16:12:27 -07:00
Daniel Ludwig
a8a806e925
std.ChildProcess: use "\Device\Null" on Windows
2020-09-06 18:25:33 -04:00
dec05eba
ff58f09b68
Use better haystack size and needle size for cutoff between linear and BMH
2020-09-06 16:23:18 +02:00
Andrew Kelley
32a77a6047
Merge pull request #6239 from pfgithub/patch-1
...
Support allocating 0 bit types
2020-09-06 01:16:33 -04:00
dec05eba
8af1f8ba1a
Add comment to clearify why the first/last element in preprocess is
...
skipped
2020-09-05 21:15:44 +02:00
dec05eba
0a016e8fc2
Fix indexOf and lastIndexOf with empty needle
2020-09-05 16:55:32 +02:00
dec05eba
f93498d2d8
Fix start index if @sizeOf(T) > 1
2020-09-05 15:31:22 +02:00
dec05eba
3a6e6bd538
Check if the type has unique bit representation to see if it can be compared byte-wise
2020-09-05 15:20:48 +02:00
dec05eba
db51821a97
Remove type size check, looks like its not needed
...
Add check if the type is float. Float byte comparison doesn't work
because +0.0 and -0.0 are considered equal but their byte
representations are not equal.
2020-09-05 14:56:59 +02:00
dec05eba
997451da03
Make preprocess function take comptime sized slice
2020-09-05 14:25:44 +02:00
dec05eba
a394a6300c
Fix lastIndexOf and add tests that do not fallback to linear search
...
Use sliceAsBytes to convert []const T to []const u8.
Cleanup.
2020-09-05 14:17:38 +02:00
Veikka Tuominen
41bbadbb9a
Merge pull request #6246 from Vexu/field
...
Remove deprecated fields on `type`
2020-09-05 13:58:02 +03:00
dec05eba
f65f3d24f8
Only use boyer-moore-horsepool for types that are power of 2
2020-09-05 12:57:05 +02:00
dec05eba
d012507a8f
Use boyer-moore-horspool with all types of T
2020-09-05 12:02:18 +02:00
dec05eba
e297b4815c
Create skipping table
...
Also fallback to naive implementation if haystack is small
or if the needle is small or if sizeof type is not 1.
2020-09-05 11:24:05 +02:00
dec05eba
50c52e0135
Use boyer-moore-horspool algorithm for indexOfPos and lastIndexOf
2020-09-05 11:22:12 +02:00
Andrew Kelley
cff14dc2c6
Merge pull request #6247 from alexnask/stage2_pe
...
Added a basic Portable Executable linker to stage2
2020-09-04 16:05:58 -04:00
Andrew Kelley
209a3da4f7
provide default implementation of std.log on freestanding
...
closes #6252
2020-09-04 13:00:10 -07:00
Vexu
09c861b829
update rest of tests
2020-09-04 22:49:14 +03:00
yettinmoor
0c43b6ef5c
document how to escape curly braces in fmt.format
2020-09-04 22:11:09 +03:00
Vexu
6b2f4fd20d
langref: atomic ops are allowed on pointers
...
Closes #6217
2020-09-04 22:02:39 +03:00
LemonBoy
3c8e1bc25b
std: Fix for 32bit systems
2020-09-04 12:48:36 +02:00
LemonBoy
90743881cf
std: Minor changes to the fs module
...
* Add a size_hint parameter to the read{toEnd,File}AllocOptions fns
* Rename readAllAlloc{,Options} to readToEndAlloc{,Options} as they
don't rewind the file before reading
* Fix missing rewind in test case
2020-09-04 10:17:00 +02:00
Andrew Kelley
338f155a02
Merge remote-tracking branch 'origin/master' into llvm11
2020-09-03 23:52:19 -07:00
Alexandros Naskos
e9807418e7
Added .pe ObjectFormat
...
MachO linker no longer collects unused dwarf debug information
2020-09-04 05:22:26 +03:00
Alexandros Naskos
e9b137f23a
Completed basic PE linker for stage2
...
Added std.coff.MachineType
Added image characteristic and section flag valued to std.coff
Added std.Target.Cpu.Arch.toCoffMachine
Fixed stage2 --watch flag on windows
2020-09-04 05:15:03 +03:00
Alexandros Naskos
fe0ad8d6e9
Write PE section table
2020-09-04 05:12:27 +03:00
Alexandros Naskos
fac9a4e286
Start working on PE/COFF linking.
2020-09-04 05:12:26 +03:00
pfg
abe672956e
Test 0 bit allocation
2020-09-03 16:33:47 -07:00
Felix (xq) Queißner
88724b2a89
Introduces a space after the ellipsis for test and progress.
2020-09-03 18:07:30 -04:00
Andrew Kelley
1034459170
Merge pull request #6243 from ifreund/uid-gid-cleanup
...
std: clean up usage of uid_t/gid_t, add seteuid/setegid to std.os
2020-09-03 18:05:59 -04:00
Andrew Kelley
17f36566de
stage2: upgrade Scope.Container decls from ArrayList to HashMap
2020-09-03 15:02:38 -07:00
Andrew Kelley
f2bbd8a548
Merge pull request #6242 from Vexu/stage2
...
Stage2: slicing and split container scope from file scope
2020-09-03 17:22:57 -04:00
Jakub Konka
dac1cd7750
Write out simple Mach-O object file
...
This commit adds enough Mach-O linker implementation to write out simple
Mach-O object file. Be warned however, the object file is largely incomplete:
misses relocation info, debug symbols, etc. However, it seemed like a
good starting to get the basic understanding right.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-09-03 16:43:47 -04:00
Lachlan Easton
2a58e30bd5
std meta: fix use of alignOf in meta.cast
2020-09-03 14:11:04 -04:00
Andrew Kelley
39a80cf59e
Merge pull request #6238 from Aransentin/master
...
Add the "sync" family of functions
2020-09-03 14:07:36 -04:00
Kenta Iwasaki
50e3906951
os: return error.SocketNotListening for EINVAL on accept ( #6226 )
2020-09-03 13:57:08 -04:00
LemonBoy
969547902b
std: Fix silent overflow in float parsing code
...
A u64 can only hold 19 decimal digits, adjust the limit.
2020-09-03 18:14:19 +03:00
Vexu
1df0f3ac24
update uses of deprecated type field access
2020-09-03 18:10:40 +03:00
Vexu
4eeeda0f52
remove deprecated fields from types
2020-09-03 16:49:20 +03:00
Isaac Freund
d0d6647fdb
std: add seteuid/setegid to std.os
...
Currently these are only implemented for linux.
2020-09-03 15:22:43 +02:00
Isaac Freund
01a365f1b0
std: ensure seteuid/setegid do not change saved id
2020-09-03 15:16:26 +02:00
Isaac Freund
e8a2aecd2f
std: fix linux uid_t, use uid_t/gid_t in std.os
...
- correct uid_t from i32 to u32 on linux
- define uid_t and gid_t for OSes missing definitions
- use uid_t/gid_t instead of plain u32s throughout std.os
2020-09-03 15:08:37 +02:00
Vexu
6f0126e957
stage2: split Scope.Container from Scope.File
2020-09-03 15:06:45 +03:00
Vexu
1174cb1517
stage2: fix tokenizer float bug
2020-09-03 15:05:47 +03:00
Vexu
6ab0ac161e
stage2: slice return type analysis
2020-09-03 15:05:47 +03:00
Vexu
2a628fd401
stage2: astgen slice
2020-09-03 15:05:46 +03:00
Vexu
ff7c6e1e3c
stage2: astgen orelse
2020-09-03 15:05:43 +03:00
Vexu
9a59cdcd41
stage2: various small type fixes
2020-09-03 15:05:10 +03:00
Bas van den Berg
0a40a61548
os.send(to) and os.recv(from) functions made to work on windows.
2020-09-03 13:23:48 +02:00
Jens Goldberg
68818983ae
Split the sync tests into sync and fsync
2020-09-03 09:52:26 +00:00
Jens Goldberg
e747d2ba17
Add C declarations and tests for the sync functions
2020-09-03 07:49:18 +00:00
pfg
bf1d83482b
"Support" allocating 0 bit types
2020-09-02 22:28:37 -07:00
daurnimator
fb3c5b84ed
std: add fmt option to escape non-printable characters
2020-09-02 19:18:36 -04:00
Andrew Kelley
c86108dd63
Merge pull request #6229 from LemonBoy/fix-6054
...
ir: Typecheck the sentinel value in *[N:S1]T to [S2]T casts
2020-09-02 19:13:21 -04:00
Aransentin
25f6663304
Add the sync functions
2020-09-02 22:16:40 +00:00
Andrew Kelley
405c7215a8
Merge pull request #6194 from LakeByTheWoods/fmt_indentation
...
Refactor zig fmt indentation. Remove indent from rendering code
2020-09-02 18:14:28 -04:00
Bas van den Berg
d80554cedf
Made some changes and additions to the networking to make it work on windows.
2020-09-02 23:53:29 +02:00
Lachlan Easton
bb848dbeee
zig fmt: Patch rename stream to ais (auto indenting stream) & other small refactors
2020-09-02 20:16:28 +10:00
LemonBoy
5f31d54064
std: ArrayList.initCapacity now respects the specified cap
...
Don't use the user-supplied cap as starting point for a resize. Doing so
overallocates memory and thus negates the whole point of specifying a
precise cap value.
2020-09-02 11:11:57 +02:00
LemonBoy
73a8c9beaa
std: Don't trust stat() size in readAllAlloc fns
...
Some files such as the ones in /proc report a st_size of zero, try to
read the file anyway if we hit that case.
2020-09-02 11:11:57 +02:00
Andrew Kelley
12ce6eb8f6
stage2: support dbg_stmt at comptime
2020-09-02 00:09:24 -07:00
Sahnvour
90ace40e07
Merge pull request #5999 from Sahnvour/hashmap
...
New hashmap implementation
2020-09-02 08:52:32 +02:00
Tadeo Kondrak
1b2154dfe2
builtin: Add TypeInfo.StructField.is_comptime
2020-09-02 00:17:59 -04:00
Sahnvour
575fbd5e35
hash_map: rename to ArrayHashMap and add new HashMap implementation
2020-09-02 00:17:50 +02:00
Andrew Kelley
3f7cb14b26
Merge pull request #6225 from ziglang/stage2-comptime
...
stage2: introduce the ability for Scope.Block to be comptime
2020-09-01 15:44:45 -04:00
Andrew Kelley
4c13d020db
stage2: proper split of requireRuntimeBlock and requireFunctionBlock
...
* improve the ZIR generated of variable decls
- utilize the same ZIR for the type and init value when possible
- init value gets a result location with the variable type.
no manual coercion is required.
* no longer use return instructions to extract values out of comptime
blocks. Instead run the analysis and then look at the corresponding
analyzed instruction, relying on the comptime mechanism to report
errors when something could not be comptime evaluated.
2020-09-01 12:39:47 -07:00
pwzk
baa734c42a
Fixing dylib search path
2020-09-01 13:53:12 -04:00
LemonBoy
dd4994a4e4
std: Fix C-string with missing NUL terminator
...
Spotted thanks to the stricter conversion rules.
2020-09-01 18:45:35 +02:00
LemonBoy
c51b871c45
ir: Typecheck the sentinel value in *[N:S1]T to [S2]T casts
...
Closes #6054
2020-09-01 17:29:10 +02:00
Lachlan Easton
7841c9b7d1
zig fmt: Fix merge errors
2020-09-01 21:59:27 +10:00
Lachlan Easton
671b3abe5d
Merge remote-tracking branch 'ziglang/master' into fmt_indentation
2020-09-01 18:41:23 +10:00
Andrew Kelley
717b0e8275
stage2: introduce the ability for Scope.Block to be comptime
...
This gives zir_sema analysis the ability to check if the current scope
is expected to be comptime.
2020-08-31 23:34:58 -07:00
Lachlan Easton
bc24b86d82
zig fmt: Fix regression not covered by testing
2020-09-01 13:19:34 +10:00
Andrew Kelley
c354f074fa
Merge remote-tracking branch 'origin/master' into llvm11
2020-08-31 15:49:44 -07:00
Andrew Kelley
26140678a5
ci: skip compile error tests on Windows
...
We're up against the 6 hour limit so this is a time-saving workaround.
Compile error tests are generally not OS-specific so the coverage from
the other platforms should be sufficient.
2020-08-31 14:54:05 -07:00
Jan200101
2148336a81
follow filesystem hierarchy standard when adding lib directories
2020-08-31 17:44:43 -04:00
Andrew Kelley
8dc58a4e94
Merge pull request #6208 from tadeokondrak/remove-@OpaqueType
...
Remove @OpaqueType
2020-08-31 17:44:03 -04:00
Andrew Kelley
4e97cf50d2
readme: link to wiki page for installing from a package manager
2020-08-31 14:41:01 -07:00
Andrew Kelley
212fe21d68
zen of zig: reword the last one a little bit
2020-08-31 14:40:08 -07:00
Andrew Kelley
0d94cb932f
Merge pull request #6197 from LemonBoy/fix-6049
...
gpa: Fix bookkeeping logic
2020-08-31 17:38:17 -04:00
Tadeo Kondrak
82273f1a2a
translate_c: fix shadowing on nested blocks
2020-08-31 20:29:57 +03:00
Lachlan Easton
029ec456bc
zig fmt: Set indent_delta to 2 when rendering inline asm
2020-08-31 23:39:50 +10:00
Lachlan Easton
5aca3baea6
zig fmt: Remove dynamic stack from auto-indenting-stream
2020-08-31 23:39:50 +10:00
LemonBoy
29de809a92
gpa: Don't leak memory when the upper bound is hit
2020-08-31 12:35:25 +02:00
Andrew Kelley
400d8d0b82
Merge pull request #6212 from ziglang/update-glibc
...
Update to glibc 2.32
2020-08-31 03:32:21 -04:00
Tadeo Kondrak
96e46cdd6e
std.zig.render: specify when rewrite should be removed
2020-08-30 23:45:47 -06:00
Tadeo Kondrak
c51de3c266
std.zig.render: rewrite @OpaqueType() to @Type(.Opaque)
2020-08-30 23:41:40 -06:00
Andrew Kelley
43ac5e5dac
Merge pull request #6184 from tadeokondrak/TrailerFlags-update
...
std.meta.TrailerFlags: use @Type to improve API
2020-08-31 01:00:23 -04:00
Andrew Kelley
19d5dfba5f
update glibc ABI files to 2.32
2020-08-30 21:28:11 -07:00
Andrew Kelley
dd8cc6b0f1
update glibc headers to 2.32
2020-08-30 21:27:30 -07:00
Andrew Kelley
eeadd55d15
fix tools/process_headers.zig regression
...
When upgrading to the new std lib HashMap API, the process_headers code
regressed because something that was supposed to be a pointer ended up
being a copy of a value. This resulted in the modification of a field
not being picked up.
Also switch from Sha256 to Blake3 while we're at it.
2020-08-30 21:24:41 -07:00
Tadeo Kondrak
a2c47d2b0b
Remove @OpaqueType
2020-08-30 19:02:23 -06:00
Tadeo Kondrak
d3e5105ecc
std.zig.ast: make getTrailer/setTrailer private and add getters/setters
2020-08-30 17:18:25 -06:00
daurnimator
1bb30c5e22
std.ChildProcess: pass CLOEXEC when creating error pipe
2020-08-30 14:21:14 -04:00
Jakub Konka
04361dd461
Add more missing MachO constants and structs
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-30 09:47:36 +02:00
Andrew Kelley
427e2d689d
Merge pull request #6189 from katesuyu/div-ceil
...
std: Add std.math.divCeil
2020-08-30 01:09:39 -04:00
Sahnvour
ac85befbb4
handle lack of privilege to create symbolic links on windows
2020-08-30 06:52:53 +02:00
LemonBoy
e355bcce36
compiler-rt: Add missing floatdisf routine
...
Add __floatdisf and __aeabi_l2f
Closes #6188
2020-08-30 00:28:18 -04:00
LemonBoy
ff4fde767f
std: Open the eventfd fd with CLOEXEC flag
...
Make sure the fd we use to communicate with the parent process is not
leaked to the child process.
Closes #5966
2020-08-30 00:22:54 -04:00
Lachlan Easton
50c8a53188
Use ArrayList instead of fixed array for auto_indenting_stream
2020-08-30 10:32:21 +10:00
Lachlan Easton
7d950210a6
zig fmt review comments
2020-08-30 10:28:17 +10:00
LemonBoy
f20305d249
gpa: Fix bookkeeping logic
...
The backing allocator may return a block that's actually bigger than the
one required by the user, use the correct quantity when keeping track of
the allocation ceiling.
Closes #6049
2020-08-29 20:51:30 +02:00
wozeparrot
00301bbdd3
fix SimpleTextInputProtocol
2020-08-29 20:24:59 +03:00
Kate Tsuyu
e496485af4
std.math.divCeil: fix expectEqual argument order
2020-08-29 03:07:36 -04:00
Kate Tsuyu
552e2bf758
std.math.divCeil: use expectEqual for tests
2020-08-29 02:32:54 -04:00
Kate Tsuyu
340871f061
std.math.divCeil: move compile error back down
2020-08-29 00:37:10 -04:00
Kate Tsuyu
49e67ce0e8
std.math.divCeil: move compile error to top
2020-08-29 00:31:49 -04:00
Kate Tsuyu
933bfcff64
std.math.divCeil: support comptime_int/float
2020-08-29 00:21:17 -04:00
Lachlan Easton
a72b9d403d
Refactor zig fmt indentation. Remove indent from rendering code and have a stream handle automatic indentation
2020-08-29 13:35:00 +10:00
joachimschmidt557
3750cc06fd
Improve io.Reader.skipBytes and add tests
2020-08-28 19:42:36 +02:00
Kate Tsuyu
f577d12fbc
std.math.divCeil: conform to more test cases
2020-08-28 11:20:42 -04:00
Kate Tsuyu
14b6fb88fb
std.math.divCeil: handle floats correctlier
2020-08-28 09:55:50 -04:00
Kate Tsuyu
aacfef17d5
std.math.divCeil: handle floats correctly
2020-08-28 09:48:40 -04:00
Kate Tsuyu
9dfb917c20
std: Add std.math.divCeil
2020-08-28 08:58:51 -04:00
Tadeo Kondrak
e4b61aa527
std.meta.TrailerFlags fixes
2020-08-27 16:02:00 -06:00
Tadeo Kondrak
3c87872dc5
stage2: Update to new std.meta.TrailerFlags API
2020-08-27 15:21:19 -06:00
Tadeo Kondrak
ce8a3ef2de
std.zig: Update to new std.meta.TrailerFlags API
2020-08-27 15:21:18 -06:00
Tadeo Kondrak
f94583076e
std.meta.TrailerFlags: use @Type to improve API
...
- Use an enum of all field names instead of string literals
- Create a struct type with all fields optional instead of relying on
anonymous struct literals
This should provide better type inference, compile errors, and a
(subjectively) cleaner API.
2020-08-27 15:11:33 -06:00
Veikka Tuominen
f6cedfaaca
Merge pull request #6160 from extrasharp/keyword-documentation
...
Add Keyword Reference section
2020-08-27 16:12:18 +03:00
Asherah Connor
dc7608da97
ensure main return type is not i8
...
Avoids a compile error from start.zig:
/home/kivikakk/zig/build/lib/zig/std/start.zig:265:28: error:
expected type 'u8', found 'i8'
return result;
^
/home/kivikakk/zig/build/lib/zig/std/start.zig:265:28: note:
unsigned 8-bit int cannot represent all possible signed 8-bit
values
return result;
2020-08-27 15:03:56 +03:00
Cléo Rebert
fc001110b4
Added edge case test to mem.count
...
Some implementations break on this edge case. Thought relevant to add it.
2020-08-27 04:12:28 -04:00
Andrew Kelley
5fed721290
Merge branch 'Vexu-stage2'
...
closes #6175
2020-08-26 19:53:49 -07:00
Andrew Kelley
b0995cb9f9
stage2: correct logic for analyzeIsNull
2020-08-26 19:53:36 -07:00
Vexu
cc26cb9b23
stage2: codegen needed for basic for loop
2020-08-26 19:50:56 -07:00
Vexu
fb28349349
stage2: astgen catch
2020-08-26 19:50:56 -07:00
Vexu
bf014d529a
stage2: array access astgen
2020-08-26 19:50:56 -07:00
Vexu
bcd04089eb
stage2: add helpful error message for invalid for operands
2020-08-26 19:50:56 -07:00
Vexu
b1aa2857ff
stage2: astgen for loops
2020-08-26 19:50:56 -07:00
Sobeston
7d0bb0774e
std.mem.count
2020-08-26 17:37:05 -04:00
Andrew Kelley
091d693c53
Merge pull request #6164 from jedisct1/cryptobench
...
Improve crypto benchmarks
2020-08-26 17:30:31 -04:00
Frank Denis
ad18078d53
forceEval() -> doNotOptimizeAway()
2020-08-26 10:50:34 +02:00
Frank Denis
0bd53dd203
Rename blackBox, move it to std.mem.forceEval()
2020-08-26 10:50:34 +02:00
Frank Denis
ff2e82f382
Rename at to tag in AEADs
2020-08-26 10:50:34 +02:00
Frank Denis
b8729ca1a0
Improve crypto benchmarks
...
- 1MiB objects on the stack doesn't play well with wasmtime.
Reduce these to 512KiB so that the webassembly benchmarks can run.
- Pass expected results to a blackBox() function. Without this, in
release-fast mode, the compiler could detected unused return values,
and would produce results that didn't make sense for siphash.
- Add AEAD constructions to the benchmarks.
- Inline chacha20Core() makes it 4 times faster.
- benchmarkSignatures() -> benchmarkSignature() for consistency.
2020-08-26 10:50:34 +02:00
Andrew Kelley
3abf9e1457
Merge pull request #6163 from ziglang/stage2-condbr
...
stage2: codegen for conditional branching
2020-08-26 04:02:43 -04:00
Andrew Kelley
0c5faa61ae
stage2: codegen: fix reuseOperand not doing death bookkeeping
2020-08-26 01:00:04 -07:00
Andrew Kelley
237d9a105d
stage2: support debug dumping zir as a build option
...
So that it's not needed to manually comment and uncomment the debug
code.
2020-08-25 22:44:18 -07:00
Andrew Kelley
e97157f71c
stage2: codegen for conditional branching
...
* Move branch-local register and stack allocation metadata to the
function-local struct. Conditional branches clone this data in order
to restore it after generating machine code for a branch.
Branch-local data is now only the instruction table mapping *ir.Inst
to MCValue.
* Implement conditional branching
- Process operand deaths
- Handle register and stack allocation metadata
* Avoid storing unreferenced or void typed instructions into
the branch-local instruction table.
* Fix integer types reporting the wrong value for hasCodeGenBits.
* Remove the codegen optimization for eliding length-0 jumps. I need to
reexamine how this works because it was causing invalid jumps to be
emitted.
2020-08-25 22:44:18 -07:00
Andrew Kelley
b68fa9970b
stage2 codegen: Rework genCondBr
...
so that the arch-independent logic isn't buried and duplicated.
2020-08-25 22:44:18 -07:00
Jakub Konka
982ab7df6c
Merge pull request #6161 from kubkon/macho-text
...
Add (empty) __TEXT segment load command
2020-08-26 07:03:58 +02:00
Jakub Konka
55dc81ba2a
Hardcode runtime (libSystem) version to minimum possible
...
While we try to work out what the correlation between the OS and runtime
versions is, this commit hardcodes the latter to the minimum (compat)
version of 1.0.0.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-26 06:30:54 +02:00
Andrew Kelley
4971400bdc
Merge remote-tracking branch 'origin/master' into llvm11
2020-08-25 20:00:57 -07:00
Andrew Kelley
3e24e95892
std.rand: promote normal comments to doc comments
2020-08-25 19:51:40 -07:00
Andrew Kelley
b498eebfd4
std.math.big: fix use-after-free
...
When there is parameter aliasing, the ensureCapacity calls can cause the
Const parameters to become dangling pointers.
See #6167
2020-08-25 19:49:40 -07:00
Andrew Kelley
973e6c978c
std: clean up GeneralPurposeAllocator memset code
...
The freeSlot function was only called once so I inlined the logic and
utilized some of the other locals that were in scope.
2020-08-25 19:48:39 -07:00
Andrew Kelley
96368b9f39
update libunwind to llvm 11rc2
2020-08-25 14:13:14 -07:00
Andrew Kelley
a8f0f37adb
Merge remote-tracking branch 'origin/master' into llvm11
2020-08-25 14:12:48 -07:00
Andrew Kelley
6fb105fdd7
std: GeneralPurposeAllocator: set freed bytes to undefined
...
Helps catch use-after-free. Caught a couple issues in the self-hosted
compiler.
2020-08-25 13:36:40 -07:00
Andrew Kelley
ea6a076065
stage2: fix use-after-free in elf linker code
2020-08-25 13:36:15 -07:00
Andrew Kelley
84d50c892d
stage2: astgen: kill the "lvalue" ResultLoc tag
2020-08-24 16:13:10 -07:00
Andrew Kelley
b30c538076
Merge branch 'Vexu-stage2'
...
closes #6148
2020-08-24 15:42:30 -07:00
Andrew Kelley
16d54c70eb
stage2: getErrorValue takes advantage of HashMap getOrPut API
2020-08-24 15:41:59 -07:00
Vexu
5de9aac749
stage2: error set types
2020-08-24 15:36:42 -07:00
Vexu
bc1d55a1d1
stage2: fix field access of array pointers
2020-08-24 15:36:42 -07:00
Vexu
1520e084cb
stage2: implement accessing error values
2020-08-24 15:36:42 -07:00
Vexu
e9b15ac9a0
stage2: error set declarations
2020-08-24 15:36:42 -07:00
Vexu
16d7db59ed
stage2: anyframe and error union types
2020-08-24 15:36:42 -07:00
Vexu
d62c12e077
stage2: astgen prefix ops
2020-08-24 15:36:42 -07:00
extrasharp
d4b1ed1bc9
Add "table-wrapper" div
2020-08-24 17:29:53 -05:00
Andrew Kelley
fd9f509d6d
Revert "Merge pull request #6137 from Jan200101/update/glibc-2.32"
...
This reverts commit bb9c3118ed , reversing
changes made to 7015d84e0c .
This is missing quite a few headers
2020-08-24 15:19:34 -07:00
Rocknest
140c599559
Fix & update windows version stuff ( #6157 )
...
* Update windows version constants
* Add docs
2020-08-24 16:47:44 -04:00
Jakub Konka
43b6d0e4b1
Add (empty) __TEXT segment load command
...
Also, link against `libSystem` by default when targeting macOS.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-24 21:18:27 +02:00
extrasharp
4d1710c899
Make changes
2020-08-24 13:12:23 -05:00
extrasharp
7d6ed1cd85
Add Keyword Reference section
2020-08-24 11:11:42 -05:00
Jakub Konka
9745e7b512
Clean up draft for merging into upstream
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-24 17:59:44 +02:00
Jakub Konka
1698e6d7a7
Link against libSystem when generating Mach-O exe
...
This is required when generating an exe on macOS.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-24 17:59:44 +02:00
Jakub Konka
2516db9645
Specify path to dyld in Mach-O
...
This is required since an exec on macOS always has to link against
libSystem.dylib.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-24 17:59:44 +02:00
Vexu
c1ee9efb7c
fix error note using invalid source node
...
Closes #6153
2020-08-24 15:24:00 +03:00
Vexu
9589dc4c95
add error checks to @Type
2020-08-24 11:13:43 +03:00
Andrew Kelley
4d7013f7d3
Merge pull request #6146 from daurnimator/no_ctty
...
Use O_NOCTTY open flag
2020-08-23 23:26:58 -04:00
Andrew Kelley
385786eedc
Merge pull request #6097 from joachimschmidt557/stage2-arm
...
Start working on stage2 ARM backend
2020-08-23 23:07:23 -04:00
LiterallyVoid
4bbea3422a
Fix unused argument error when formatting std.Target
2020-08-23 22:47:57 -04:00
Andrew Kelley
bb9c3118ed
Merge pull request #6137 from Jan200101/update/glibc-2.32
...
Update to glibc 2.32
2020-08-23 22:47:13 -04:00
Luna
7015d84e0c
remove licensing comments from init-exe/init-lib
2020-08-23 22:45:18 -04:00
joachimschmidt557
4f2618e75b
stage2: Add Hello World test for ARM backend
2020-08-23 23:13:41 +02:00
joachimschmidt557
b2254023e4
stage2: Implement setReg, call, ret, asm for ARM
...
These changes enable a Hello World example. However, all implemented
codegen is not yet feature-complete.
- asm only supports 'svc #0 ' at the moment
- call only supports leaf functions at the moment
- setReg uses a naive method at the moment
2020-08-23 22:33:47 +02:00
joachimschmidt557
1c53c07053
stage2: Implement genBreakpoint for ARM
2020-08-23 22:29:00 +02:00
joachimschmidt557
f31cee5393
Start working on stage2 ARM backend
...
- add codegen/arm.zig with some basic functionality (load/store,
data processing, branching, software interrupts)
2020-08-23 22:27:46 +02:00
daurnimator
129d3e274d
std: use O_NOCTTY flag
2020-08-24 02:28:31 +10:00
daurnimator
23a81b4396
std: refactor fs.openFileZ flag handling
2020-08-24 02:27:26 +10:00
Jan200101
53a2431713
update glibc abi list for 2.32
2020-08-22 22:43:01 +02:00
Jan200101
c61ea4cdb7
update glibc headers to 2.32
2020-08-22 22:42:58 +02:00
Andrew Kelley
4e63cae369
Merge branch 'pixelherodev-spu_ii'
...
closes #6096
2020-08-22 13:38:54 -07:00
Andrew Kelley
54f3b0a560
stage2: clean up SPU Mk II code
...
* move SPU code from std to self hosted compiler
* change std lib comments to be descriptive rather than prescriptive
* avoid usingnamespace
* fix case style of error codes
* remove duplication of producer_string
* generalize handling of less than 64 bit arch pointers
* clean up SPU II related test harness code
2020-08-22 13:36:08 -07:00
Noam Preil
24efbf5ddf
Codegen: Move REX assert to comptime
2020-08-22 12:45:29 -07:00
Noam Preil
ad9df43e49
Tests: limit SPU-II cycle count
2020-08-22 12:45:29 -07:00
Noam Preil
f448b518f8
SPU-II: use undefined1 as breakpoint
2020-08-22 12:45:29 -07:00
Noam Preil
222e23c678
Linker: make defaults read-only
2020-08-22 12:45:29 -07:00
Noam Preil
096c5d5e4b
Tests: implement SPU-II harness
2020-08-22 12:45:29 -07:00
Noam Preil
fa1d18a155
Linker: fix GOT production on 16-bit targets
2020-08-22 12:45:29 -07:00
Noam Preil
f2796239ba
SPU-II: Fix logging in interp, remove JIT-compat code
2020-08-22 12:45:29 -07:00
Noam Preil
3a9af0c88b
SPU-II: Ignore @breakpoint for now
2020-08-22 12:45:29 -07:00
Noam Preil
f2fef240a1
SPU-II: Test harness skeleton
2020-08-22 12:45:29 -07:00
Noam Preil
f18636fa58
SPU-II: Add common definitions
2020-08-22 12:45:29 -07:00
Noam Preil
8c321f0cf5
SPU-II: Fix linking
2020-08-22 12:45:29 -07:00
Noam Preil
cdefc6acba
SPU-II: Implement function calls
2020-08-22 12:45:29 -07:00
Noam Preil
d005ff16c6
SPU-II: undefined0 inline asm
2020-08-22 12:45:29 -07:00
Noam Preil
803a1025bb
Targets: add SPU Mark II architecture
2020-08-22 12:45:29 -07:00
Andrew Kelley
29051a0674
stage2: codegen: fix crash
...
I forgot to do -Denable-qemu -Denable-wasmtime when testing yesterday,
sorry about that.
In reuseOperand, the code assumed a re-used register would be tracked in
the register table but that is not always the case.
2020-08-22 12:44:45 -07:00
Frank Denis
2d402157d9
Improve documentation on siphash recommended parameters
2020-08-22 15:12:54 -04:00
Frank Denis
f540dc1b7e
cache_hash: hash function change
...
This makes the `cache_hash` hash function easier to replace.
BLAKE3 would be a natural fit for hashing large files, but:
- second preimage resistance is not necessary for the cache_hash use cases
- our BLAKE3 implementation is currently very slow
Switch to SipHash128, which gives us an immediate speed boost.
2020-08-22 15:10:33 -04:00
Matthew Knight
0fa3cfdb4a
Bpf: move under os/linux instead of bits ( #6126 )
...
* moved bpf syscall, added some bpf instructions and tests
* had to move bpf out of bits so that a freestanding target could import it
* removed line
* fixed imports
2020-08-22 15:08:01 -04:00
Jan200101
9605e5363b
update update_glibc and process_headers to latest zig
2020-08-22 16:38:03 +03:00
Jakub Konka
69de1a51cd
Add entry_point_command struct to Mach-O definitions
...
The `entry_point_command` is a replacement for `thread_command`, and
is used for main executables to specify the location of `main()`
entry point.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-22 04:14:27 -04:00
Andrew Kelley
55d7c399c1
Merge pull request #6119 from tadeokondrak/@Type(.Enum)
...
Implement @Type for Enum
2020-08-22 03:21:46 -04:00
Tadeo Kondrak
a049c31f21
Remove TypeInfo.Error.value
2020-08-22 03:20:12 -04:00
Frank Denis
e919744c7a
Promote hash/siphash to crypto/siphash
...
SipHash *is* a cryptographic function, with a 128-bit security level.
However, it is not a regular hash function: a secret key is required,
and knowledge of that key allows collisions to be quickly computed offline.
SipHash is therefore more suitable to be used as a MAC.
The same API as other MACs was implemented in addition to functions directly
returning an integer.
The benchmarks have been updated accordingly.
No changes to the SipHash implementation itself.
2020-08-22 02:47:50 -04:00
Isaac Freund
9ab4281856
std: remove init functions from linked list nodes
...
These functions are rather useless and redundant as initializing the
struct directly is just as easy:
var node = TailQueue(u32).Node{ .data = 42 };
2020-08-22 02:47:39 -04:00
Andrew Kelley
f18b92ef3a
stage2: implement spilling registers to the stack
2020-08-21 23:36:21 -07:00
Tadeo Kondrak
351701bcad
@Type for Enum fix: use correct decls_scope
2020-08-21 17:45:30 -06:00
Andrew Kelley
f9bd049c89
Merge remote-tracking branch 'origin/master' into llvm11
2020-08-21 14:50:37 -07:00
Tadeo Kondrak
c31e8701d7
Update compile-errors test for @Type(.Enum) changes
2020-08-21 15:00:23 -06:00
Andrew Kelley
dad7af0b37
Merge pull request #6116 from jedisct1/polyfast
...
Make poly1305 faster
2020-08-21 16:52:33 -04:00
Tadeo Kondrak
5a5956bd20
Implement @Type for Enum
2020-08-21 14:31:24 -06:00
Andrew Kelley
89b6c47e04
stage2: decouple codegen.zig from ELF
...
See #6113 for an alternate way of doing this that we didn't end up
following.
Closes #6079 .
I also took the opportunity here to extract C.zig and Elf.zig from
link.zig.
2020-08-21 13:25:59 -07:00
Isaac Freund
37ad9f38dc
std: sync TailQueue with new SinglyLinkedList API
...
The API of SinglyLinkedList was changed in 93384f7 , removing the init
function as well as the redundant allocation helper functions.
This commit makes parallel changes to the API of TailQueue in order to
keep the standard library consistent.
2020-08-21 15:59:50 -04:00
Andrew Kelley
a2f1f01e77
Merge branch 'mattnite-bpf-insn'
...
closes #6090
2020-08-21 11:41:25 -07:00
Matt Knight
80fabe1850
fixed bpf namespace
2020-08-21 11:40:35 -07:00
Matt Knight
bc1536f4bf
decided to split up loading of 64-bit immediates
2020-08-21 11:40:35 -07:00
Matt Knight
7f1378909b
moved bpf syscall, added some bpf instructions and tests
2020-08-21 11:40:35 -07:00
Frank Denis
0fe6677736
No need to keep a 128-bit carry around
2020-08-21 20:33:16 +02:00
Frank Denis
2fc2ebd920
Force myself to use unusual integer sizes a little bit more :)
2020-08-21 19:43:06 +02:00
Frank Denis
c9218f1719
Make poly1305 faster
2020-08-21 16:30:52 +02:00
Jakub Konka
243b5c7a88
Add macosx end-to-end smoke test
...
This test case will grow as the linker gets more functionality.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-21 09:41:05 +02:00
Andrew Kelley
e0a38f7f3e
stage2: make the cache dir if it doesn't already exist
2020-08-20 23:53:34 -07:00
Andrew Kelley
6bbb168f66
Merge branch 'Vexu-stage2'
...
closes #6107
2020-08-20 17:26:05 -07:00
Andrew Kelley
73d16d015e
stage2: reorganize tests
...
The main test cases are now in `test/stage2/test.zig` which can then
call addCases on other files if it wants to organize things differently.
2020-08-20 17:25:09 -07:00
Andrew Kelley
56ea04cb6d
stage2: don't test compile errors of ZIR
2020-08-20 17:19:26 -07:00
Andrew Kelley
7d6d4b1473
stage2: move all tests to compare_output.zig
2020-08-20 17:15:01 -07:00
Andrew Kelley
f54b2e2da6
add missing mutability check in simplePtrType
2020-08-20 17:08:01 -07:00
Vexu
6a053ffcc8
stage2: comptime decl
2020-08-20 16:42:48 -07:00
Vexu
d312d64c9a
stage2: slice types
2020-08-20 16:42:48 -07:00
Vexu
9568248450
stage2: complex pointer types
2020-08-20 16:42:48 -07:00
Vexu
ebfe723f3c
stage2: implement rest of simple pointer types
2020-08-20 16:42:48 -07:00
Frank Denis
eef111fe78
Fix missing init() update in std/build/write_file.zig
2020-08-20 19:21:10 -04:00
Andrew Kelley
21106b9c9f
Merge pull request #6095 from jedisct1/crypto-reorg
...
Breaking: sort std/crypto functions into categories
2020-08-20 19:01:22 -04:00
Frank Denis
3edace34d3
Update tools/process_headers.zig
2020-08-21 00:57:29 +02:00
Frank Denis
fc55cd458a
Hash functions now accept an option set
...
- This avoids having multiple `init()` functions for every combination
of optional parameters
- The API is consistent across all hash functions
- New options can be added later without breaking existing applications.
For example, this is going to come in handy if we implement parallelization
for BLAKE2 and BLAKE3.
- We don't have a mix of snake_case and camelCase functions any more, at
least in the public crypto API
Support for BLAKE2 salt and personalization (more commonly called context)
parameters have been implemented by the way to illustrate this.
2020-08-21 00:51:14 +02:00
Andrew Kelley
9cfcd0c296
Merge pull request #6103 from Vexu/extern
...
Disallow extern variables with initializers.
2020-08-20 18:35:31 -04:00
heidezomp
1ca49b92c6
add UTIME_NOW and UTIME_OMIT constants for use in utimensat/futimens
...
copied from lib/libc/include/generic-musl/sys/stat.h
2020-08-20 17:02:58 -04:00
Frank Denis
adf3d00e87
Remove explicit comptime
2020-08-20 23:02:10 +02:00
Frank Denis
446597bd3c
Remove the reset() function from hash functions
...
Justification:
- reset() is unnecessary; states that have to be reused can be copied
- reset() is error-prone. Copying a previous state prevents forgetting
struct members.
- reset() forces implementation to store sensitive data (key, initial state)
in memory even when they are not needed.
- reset() is confusing as it has a different meaning elsewhere in Zig.
2020-08-20 23:02:10 +02:00
Frank Denis
f92a5d7944
Repair crypto/benchmark; add BLAKE2b256
...
Some MACs have a 64-bit output
2020-08-20 23:02:10 +02:00
Frank Denis
3bed749b1c
Add truncated SHA512 variants
2020-08-20 23:02:10 +02:00
Frank Denis
6f9ea9eaef
Breaking: sort std/crypto functions into categories
...
Instead of having all primitives and constructions share the same namespace,
they are now organized by category and function family.
Types within the same category are expected to share the exact same API.
2020-08-20 23:02:05 +02:00
Andrew Kelley
776bfb0ee6
Merge pull request #6099 from tadeokondrak/@Type(.Struct)
...
Implement @Type for structs
2020-08-20 16:57:10 -04:00
Andrew Kelley
3aeeb21b82
update libunwind to llvm11rc2
2020-08-20 13:36:44 -07:00
Andrew Kelley
1a4059ed88
allow running the stage2 tests in release mode
2020-08-20 13:16:04 -07:00
Andrew Kelley
4a69b11e74
add license header to all std lib files
...
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Vexu
717e2a365d
correct llvm linkage conversion
...
when weakly exporting external declaration we need to pass LLVMExternalWeakLinkage
2020-08-20 17:12:26 +03:00
Vexu
d25674a51e
disallow extern variables with initializers
2020-08-20 11:35:33 +03:00
Vexu
a553947a51
translate-c: correctly put static and extern local variables in global scope
2020-08-20 10:45:55 +03:00
Jakub Konka
83b0e52079
Merge pull request #6102 from kubkon/macho-pagezero
...
Write page zero as first segment for Mach-O exes
2020-08-20 09:34:33 +02:00
Jakub Konka
ad79b80524
Apply suggestions from code review
...
Co-authored-by: Andrew Kelley <andrew@ziglang.org >
2020-08-20 09:14:37 +02:00
Vexu
adc5bce5e8
translate-c: correct translation of global variables
...
* externs with intializers are translated as exports
* non extern without explicit initialization are zero initalized
2020-08-20 10:08:27 +03:00
Jakub Konka
9164daaa39
Write page zero as first segment for Mach-O exes
...
According to the Mach-O file format reference, the first
load command should be a `__PAGEZERO` segment command. The
segment is located at virtual memory location 0, has no protection
rights, and causes acccesses to NULL to immediately crash.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-20 08:33:40 +02:00
Andrew Kelley
91de5c212f
Merge branch 'strangebug-fix/std-dbg-warn-hangs-windows'
...
closes #5407
2020-08-19 20:53:32 -07:00
Andrew Kelley
23c427b5fb
windows: match the same error code for EBADF
2020-08-19 20:51:06 -07:00
StrangeBug
59711becc7
Add handler for INVALID_HANDLE to prevent infinite loop when stderr is not available.
2020-08-19 20:49:25 -07:00
Andrew Kelley
b1c7334355
Merge pull request #5745 from lun-4/ebadf-error
...
map EBADF to error values for read and write
2020-08-19 23:46:22 -04:00
Andrew Kelley
a30950706f
Merge branch 'Vexu-stage2'
...
closes #6093
2020-08-19 17:59:37 -07:00
Andrew Kelley
9ec9c0f5e5
optimize the memory layout of Module.Fn and Module.Var
...
`is_pub` added to `Fn` would cost us an additional 8
bytes of memory per function, which is a real bummer
since it's only 1 bit of information.
If we wanted to really remove this, I suspect we could
make this a function isPub() which looks at the AST of
the corresponding Decl and finds if the FnProto AST node
has the pub token. However I saw an easier approach -
The data of whether something is pub or not is actually
a property of a Decl anyway, not a function, so we can
look at moving the field into Decl. Indeed, doing this,
we see that Decl already has deletion_flag: bool which
is hiding in the padding bytes between the enum (1 byte)
and the following u32 field (generation). So if we put
the is_pub bool there, it actually will take up no
additional space, with 1 byte of padding remaining.
This was an easy reworking of the code since any
func.is_pub could be changed simply to func.owner_decl.is_pub.
I also modified `Var` to make the init value non-optional
and moved the optional bit to a has_init: bool field. This is worse from
the perspective of control flow and safety, however it makes
`@sizeOf(Var)` go from 32 bytes to 24 bytes. The more code we can fit
into memory at once, the more justified we are in using the compiler as
a long-running process that does incremental updates.
2020-08-19 17:52:22 -07:00
Vexu
5fdcb1a792
stage2: emit zir variable fix, array type and enum literal support
2020-08-19 16:12:29 -07:00
Vexu
9801047bdb
stage2: handle var attributes
2020-08-19 16:12:29 -07:00
Vexu
ab8a9a6605
stage2: fix astgen of decl ref, add test for global consts
2020-08-19 16:12:29 -07:00
Vexu
338a495648
stage2: implement global variables
2020-08-19 16:12:29 -07:00
Tadeo Kondrak
8126421d07
Small fixes for @Type(.Struct)
2020-08-19 16:36:22 -06:00
Vincent Rischmann
b0846b6ecb
builder: implement integer options
2020-08-19 17:41:43 -04:00
Tadeo Kondrak
759485cc32
Update compile-errors test for @Type(.Struct)
2020-08-19 15:26:03 -06:00
Tadeo Kondrak
b46d764fd9
Implement @Type for structs without decls support
2020-08-19 14:55:42 -06:00
Tadeo Kondrak
0f677810ea
Remove offset field from TypeInfo.StructField
...
This isn't needed with @bitOffsetOf/@byteoffsetOf and complicates
@Type handling.
2020-08-19 14:55:40 -06:00
dbandstra
a237283d90
fixes and improvements for parseCharLiteral
2020-08-19 16:30:42 -04:00
Andrew Kelley
083c0f1ceb
stage2 codegen: proper abstraction for re-using dying operands
...
closes #6064
2020-08-18 23:11:56 -07:00
Andrew Kelley
dc35b8641b
stage2: Module enumerates the possible top level decls
2020-08-18 23:11:56 -07:00
Jakub Konka
5fe878cd42
Merge pull request #6085 from kubkon/macho-header
...
Write out Mach-O header
2020-08-19 07:50:11 +02:00
Jakub Konka
ffdeb6af91
Update src-self-hosted/link/MachO.zig
...
Co-authored-by: Andrew Kelley <andrew@ziglang.org >
2020-08-19 07:43:33 +02:00
Nathan Michaels
4237f1afc7
Change std.debug.warn to std.log.info in init-exe template. ( #5941 )
2020-08-18 22:47:38 -04:00
Andrew Kelley
771f40204e
Merge pull request #6086 from Vexu/stage2
...
Stage2: more astgen stuff
2020-08-18 22:02:55 -04:00
Andrew Kelley
626d94c2a1
Merge pull request #6088 from ifreund/s2-wasm-rework
...
stage2/wasm: do incremental compilation in-memory
2020-08-18 21:37:20 -04:00
Isaac Freund
6242ae35f3
stage2/wasm: implement function calls
...
During codegen we do not yet know the indexes that will be used for
called functions. Therefore, we store the offset into the in-memory
code where the index is needed with a pointer to the Decl and use this
data to insert the proper indexes while writing the binary in the flush
function.
2020-08-19 02:05:13 +02:00
Isaac Freund
fe3aa4ccd0
stage2/wasm: do incremental compilation in-memory
...
Before this commit the wasm backend worked similarly to elf. As
functions were generated they were written directly to the output file
and existing code was shifted around in the file as necessary. This
approach had several disadvantages:
- Large amounts of padding in the output were necessary to avoid
expensive copying of data within the file.
- Function/type/global/etc indexes were required to be known at the time
of preforming codegen, which severely limited the flexibility of where
code could be placed in the binary
- Significant complexity to track the state of the output file through
incremental updates
This commit takes things in a different direction. Code is incrementally
compiled into in-memory buffers and the entire binary is rewritten using
these buffers on flush. This has several advantages:
- Significantly smaller resulting binaries
- More performant resulting binaries due to lack of indirection
- Significantly simpler compiler code
- Indexes no longer need to be known before codegen. We can track where
Decls must be referenced by index insert the proper indexes while
writing the code in the flush() function. This is not yet implemented
but is planned for the next commit.
The main disadvantage is of course increased memory usage in order to
store these buffers of generated code.
2020-08-19 02:05:01 +02:00
Isaac Freund
741fb8d306
stage2/link: clarify comments on calling order
2020-08-18 19:47:20 -04:00
Andrew Kelley
1de2c647df
Merge remote-tracking branch 'origin/master' into llvm11
2020-08-18 15:32:42 -07:00
Andrew Kelley
15bcfcd368
stage2: fix use-after-free when printing ZIR
2020-08-18 15:25:01 -07:00
Andrew Kelley
31b58acdae
stage2: minor cleanup
2020-08-18 15:11:24 -07:00
Andrew Kelley
f950f5452b
test_runner: don't assume the GeneralPurposeAllocator config
...
This allows changing the config in only 1 location (std.testing)
2020-08-18 15:10:31 -07:00
Andrew Kelley
583b843803
std.heap.GeneralPurposeAllocator: add never_unmap config option
...
This is a temporary debugging trick you can use to turn segfaults into more helpful
logged error messages with stack trace details. The downside is that every allocation
will be leaked!
2020-08-18 15:09:48 -07:00
Andrew Kelley
5547abd2d1
build: -Dforce-link-libc now also applies to test-stage2
2020-08-18 15:08:43 -07:00
Jakub Konka
34e628a0a0
Fix compile error
...
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-18 23:35:31 +02:00
Jakub Konka
e4b3da2720
Write out Mach-O header
...
This commit write out Mach-O header in the linker's `flush`
method. The header currently only populates the magic number,
filetype, and cpu info.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-18 23:35:31 +02:00
Veikka Tuominen
d139e44cfa
Merge pull request #5495 from xackus/fix_5314
...
stage1: fix non-exhaustive enums with one field
2020-08-18 23:55:44 +03:00
Andrew Kelley
e2c741f1e7
std.cache_hash: additionally use file size to detect modifications
...
I have observed on Linux writing and reading the same file many times
without the mtime changing, despite the file system having nanosecond
granularity (and about 1 millisecond worth of nanoseconds passing between
modifications). I am calling this a Linux Kernel Bug and adding file
size to the cache hash manifest as a mitigation. As evidence, macOS does
not exhibit this behavior.
This means it is possible, on Linux, for a file to be added to the cache
hash, and, if it is updated with the same file size, same inode, within
about 1 millisecond, the cache system will give us a false positive,
saying it is unmodified. I don't see any way to improve this situation
without fixing the bug in the Linux kernel.
closes #6082
2020-08-18 12:44:00 -07:00
Vexu
e4aefc6d0f
stage2: split ref from lvalue and add compile error for invalid assignments
2020-08-18 22:42:35 +03:00
Vexu
2b45e23477
stage2: character literals and multiline strings
2020-08-18 20:10:18 +03:00
Andrew Kelley
bdb8c49418
stage1: update compile error tests
...
follow-up to 56c81c713f
2020-08-18 08:44:34 -07:00
Vexu
e0b01bd4a9
stage2: enum literals
2020-08-18 14:28:33 +03:00
Vexu
31d8efc6b3
stage2: validate param and variable types
2020-08-18 13:57:09 +03:00
Vexu
7c15c9428e
stage2: array types
2020-08-18 12:36:00 +03:00
Vexu
3eb8f7be10
stage2: astgen bool and/or
2020-08-18 11:38:56 +03:00
Andrew Kelley
c0517bf1f6
std.cache_hash: temporary workaround for mtime precision on linux
...
See #6082
2020-08-18 01:30:57 -07:00
Andrew Kelley
56c81c713f
stage1: let \r\n slide
2020-08-18 01:29:34 -07:00
Vexu
0977e41407
stage2: ensure discarded error union payload is void
2020-08-18 10:36:57 +03:00
Soren
60ea87340e
Fix opaque structs and C++ mangling
2020-08-18 00:31:29 -04:00
Frank Denis
8d60047697
ristretto255: add uniform string->element map & fast equivalence check
2020-08-18 00:31:02 -04:00
Eleanor Bartle
fa8935426b
Cleaned up RISC-V instruction creation, added 32-bit immediates ( #6077 )
...
* Implemented all R-type arithmetic/logical instructions
* Implemented all I-type arithmetic/logical instructions
* Implemented all load and store instructions
* Implemented all of RV64I except FENCE
2020-08-18 00:30:00 -04:00
Andrew Kelley
3cc1f8b624
Merge pull request #6056 from ifreund/wasm-backend
...
stage2: add a wasm backend
2020-08-18 00:28:05 -04:00
Andrew Kelley
ce8b9c0c5c
std.cache_hash: don't trust mtime granularity to be better than 1ms
...
I empirically observed mtime not changing when rapidly writing the same
file name within the same millisecond of wall clock time, despite the
mtime field having nanosecond precision.
I believe this fixes the CI test failures.
2020-08-17 21:26:33 -07:00
Ashish Shekar
27cb23cbc5
Handle singular param count word in error messages ( #6073 )
2020-08-17 22:18:29 -04:00
Matthew Knight
d605af511a
added bpf() syscall and some supporting structs ( #6061 )
...
* added bpf syscall and some supporting structs
* moved bpf to bits and added flags
2020-08-17 22:17:04 -04:00
Andrew Kelley
e26dda5308
Merge branch 'Sergeeeek-master'
...
closes #5394
closes #4427
2020-08-17 18:57:34 -07:00
Andrew Kelley
4462c60639
stage2: implement compiler id hash and add it to zig env
2020-08-17 18:56:27 -07:00
Andrew Kelley
a916f63940
std.cache_hash: fix bug parsing inode
...
This resulted in false negatives cache misses.
2020-08-17 18:49:33 -07:00
Andrew Kelley
18ac998767
zig env: add global_cache_dir field
2020-08-17 17:52:13 -07:00
Andrew Kelley
502d413621
simplify zig info and rename it to zig env
...
also add version to it
2020-08-17 17:06:43 -07:00
Isaac Freund
9f44284ad5
stage2/wasm: add basic test cases
2020-08-18 01:47:03 +02:00
Sergey Poznyak
80e70735fb
add zig info command
2020-08-17 16:35:32 -07:00
Andrew Kelley
044e3ca592
Merge branch 'lun-4-signalfd-libc'
...
closes #6071
2020-08-17 16:20:23 -07:00
Andrew Kelley
ae2c88754d
std: signalfd: fix the types of things; add test
2020-08-17 16:19:57 -07:00
Luna
293b07df12
add signalfd to std.c.linux
2020-08-17 16:05:35 -07:00
Luna
2deb07a001
rename signalfd4 to signalfd
2020-08-17 16:05:35 -07:00
Isaac Freund
f9963909a1
stage2/wasm: only free types after func overwrite
...
Functions which are free'd are not immediately removed from the binary
as this would cause a shifting of function indexes. Instead, they hang
around until they can be overwritten by a new function. This means that
the types associated with these dead functions must also remain until
the function is overwritten to avoid a type mismatch.
2020-08-18 01:01:13 +02:00
Isaac Freund
60fb50ee5a
stage2/wasm: write exports on flush, cleanup
...
Exports now have a dirty flag and are rewritten on flush if this flag
has been set.
A couple other minor changes have been made based on Andrew's review.
2020-08-18 01:01:13 +02:00
Isaac Freund
97300896ed
stage2/wasm: implement trivial codegen
...
We now generate code for returning constants of any of the basic types.
2020-08-18 01:01:04 +02:00
Isaac Freund
3370b5f109
stage2/wasm: implement basic container generation
...
Thus far, we only generate the type, function, export, and code
sections. These are sufficient to generate and export simple functions.
Codegen is currently hardcoded to `i32.const 42`, the main goal of this
commit is to create infrastructure for the container format which will
work with incremental compilation.
2020-08-18 00:32:58 +02:00
Andrew Kelley
96a27557e2
stage2 test harness: at least build all compare output tests
...
This should have been removed with an earlier commit that improved the
test harness.
2020-08-17 15:27:41 -07:00
Veikka Tuominen
d8fb377e2a
Merge pull request #6060 from Vexu/stage2
...
Stage2: more optionals stuff
2020-08-18 00:15:36 +03:00
Andrew Kelley
624e643872
Merge pull request #6046 from heidezomp/std-log-scoped-part2
...
std.log: (breaking) remove scope parameter from logging functions
2020-08-17 16:59:27 -04:00
Andrew Kelley
c00d3d47f0
Merge branch 'jedisct1-xchacha20'
...
closes #6074
2020-08-17 13:56:13 -07:00
Frank Denis
5fabb44aeb
Export crypto.aead
2020-08-17 13:55:40 -07:00
Frank Denis
cd591a9b25
No need for an explicit deref
2020-08-17 13:54:01 -07:00
Frank Denis
795033c35f
std/crypto: XChaCha20, detached modes and standard AEAD API
...
* Factor redundant code in std/crypto/chacha20
* Add support for XChaCha20, and the XChaCha20-Poly1305 construction.
XChaCha20 is a 24-byte version of ChaCha20, is widely implemented
and is on the standards track:
https://tools.ietf.org/html/draft-irtf-cfrg-xchacha-03
* Add support for encryption/decryption with the authentication tag
detached from the ciphertext
* Add wrappers with an API similar to the Gimli AEAD type, so that
we can use and benchmark AEADs with a common API.
2020-08-17 13:54:01 -07:00
Vexu
2948f2d262
fix cast from invalid non-exhaustive enum to union
2020-08-17 20:48:22 +03:00
Vexu
1e835e0fcc
disallow '_' prong when switching on non-exhaustive tagged union
...
A tagged union cannot legally be initiated to an invalid enumeration
2020-08-17 20:47:31 +03:00
xackus
65185016f1
stage1: fix non-exhaustive enums with one field
2020-08-17 20:45:34 +03:00
Vexu
13b2f1e90b
address review feedback
2020-08-17 19:21:03 +03:00
Jakub Konka
5cb96681d9
Move Mach-O to link/MachO.zig submodule
...
Remove `ptrWidth` since as of Catalina, all apps are 64bits only.
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-17 18:16:29 +02:00
Jakub Konka
e23fc3905f
Add skeleton for MachO support in stage2
...
This commit adds an empty skeleton for MachO format support in stage2.
2020-08-17 18:16:29 +02:00
Vexu
ece4a2fc51
stage2: astgen for if and while with error unions
2020-08-17 14:28:04 +03:00
Vexu
db77b6b4e7
stage2: astgen for if and while with optionals
2020-08-17 14:28:04 +03:00
Vexu
012fac255f
stage2: fix optimization causing wrong optional child types
2020-08-17 14:26:32 +03:00
Vexu
c52513e25b
stage2: astgen for ptr types and address of
2020-08-17 14:24:56 +03:00
Andrew Kelley
6b141620a6
Merge pull request #6048 from pixelherodev/cleanup
...
Some minor cleanup and error handling
2020-08-17 01:41:52 -04:00
Isaac Freund
fc850aad61
stage2: fix signed <-> unsigned Value casts
2020-08-17 01:40:46 -04:00
Andrew Kelley
addeff889a
Merge branch 'jedisct1-25519'
...
closes #6050
2020-08-16 22:35:39 -07:00
Frank Denis
7f9a227abf
deinline edwards25519.{add,dbl}
2020-08-16 22:35:28 -07:00
Frank Denis
37ae246405
Inline Fe.{sub,mul,sq} for a performance boost in release-safe mode
2020-08-16 22:35:28 -07:00
Frank Denis
ab6ffa8a3c
Work around sqrtRatioM1() issue in release-safe mode
2020-08-16 22:35:28 -07:00
Frank Denis
08dfbee961
Benchmark signatures
2020-08-16 22:35:27 -07:00
Frank Denis
5ab69633b7
Constify the ladder
2020-08-16 22:35:27 -07:00
Frank Denis
d86cde5752
Add comment, use @truncate
2020-08-16 22:35:27 -07:00
Frank Denis
bcef123d90
Address more review issues
2020-08-16 22:35:27 -07:00
Frank Denis
263c444738
Move loop decrements into continuations
...
Suggested by @daurnimator
2020-08-16 22:35:27 -07:00
Frank Denis
ed558bfbaa
Address @daurnimator feedback
2020-08-16 22:35:27 -07:00
Frank Denis
dd8f7b396c
Rename the field and scalar modules
...
Suggested by @kubkon
2020-08-16 22:35:27 -07:00
Frank Denis
c483bf4f97
Update lib/std/crypto/25519/ristretto255.zig
...
Co-authored-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-16 22:35:27 -07:00
Frank Denis
739b68938c
Update lib/std/crypto/25519/field25519.zig
...
Co-authored-by: Jakub Konka <kubkon@jakubkonka.com >
2020-08-16 22:35:27 -07:00
Frank Denis
6af9bc8c68
Initialize structures directly
...
Suggested by @kubkon, thanks!
2020-08-16 22:35:27 -07:00
Frank Denis
5f9953f41f
Remove mem.timingSafeEqual() for now
...
This requires assembly implementations, and is not needed for
signature verification.
Thanks @daurnimator
2020-08-16 22:35:27 -07:00
Frank Denis
3f0d80f25e
Improve curve25519-based crypto
...
This is a rewrite of the x25519 code, that generalizes support for
common primitives based on the same finite field.
- Low-level operations can now be performed over the curve25519 and
edwards25519 curves, as well as the ristretto255 group.
- Ed25519 signatures have been implemented.
- X25519 is now about twice as fast.
- mem.timingSafeEqual() has been added for constant-time comparison.
Domains have been clearly separated, making it easier to later add
platform-specific implementations.
2020-08-16 22:35:27 -07:00
Frank Denis
f46e375bbe
std/crypto: gimli.Aead.decrypt()'s ad should be const
2020-08-17 07:16:06 +02:00
Noam Preil
3ca8c42e7a
Astgen: further cleanup
2020-08-16 20:36:33 -04:00
Noam Preil
93619a5e4e
Module: panic when encountering unimplemented node
2020-08-16 20:32:51 -04:00
Noam Preil
34923e071e
CBE: minor doc change
2020-08-16 20:32:50 -04:00
Noam Preil
692f38c250
astgen: minor cleanup
2020-08-16 20:32:50 -04:00
Andrew Kelley
8d8d568854
stage2: implement zig version
2020-08-15 20:04:08 -04:00
Andrew Kelley
66d76cc4f9
stage2: codegen for labeled blocks
2020-08-15 17:03:05 -07:00
Andrew Kelley
2cd19c05d0
stage1: remove buggy "unable to inline function" compile error
...
We still want this compile error but I'm giving up on implementing it
correctly in stage1. It's been buggy and has false positives sometimes.
I left the test cases there, but commented out, so that when we go
through the stage1 compile error cases and get coverage for them in
stage2 we can reactivate the test cases.
closes #2154
2020-08-15 09:53:39 -07:00
Andrew Kelley
0f3f96c850
stage2: astgen for labeled blocks and labeled breaks
2020-08-15 00:52:25 -07:00
Andrew Kelley
f356cba704
stage2: populate some of the astgen switch possibilities
...
Idea here is simply to entice people to contribute astgen code :)
2020-08-14 22:50:00 -04:00
Andrew Kelley
b49d3672f3
stage2 astgen for LabeledBlock
2020-08-14 22:50:00 -04:00
Andrew Kelley
9a5a1013a8
std.zig.ast: extract out Node.LabeledBlock from Node.Block
...
This is part of an ongoing effort to reduce size of in-memory AST. This
enum flattening pattern is widespread throughout the self-hosted
compiler.
This is a API breaking change for consumers of the self-hosted parser.
2020-08-14 22:50:00 -04:00
Michael Dusan
c12a262503
Merge pull request #6051 from mikdusan/qemu
...
ci linux: bump qemu-5.1.0
2020-08-14 17:54:22 -04:00
Andrew Kelley
7a39a038db
stage2: proper semantic analysis of improper returning of implicit void
2020-08-14 13:08:55 -07:00
Michael Dusan
05f80311bc
ci linux: bump qemu-5.1.0
2020-08-14 14:38:54 -04:00
Andrew Kelley
5f7c7191ab
stage2: astgen for non-labeled blocks
2020-08-14 11:28:40 -07:00
Andrew Kelley
4adc052f0b
langref: fix html error
...
thanks tidy
2020-08-14 09:33:45 -07:00
Andrew Kelley
28a9da8bfc
stage2: implement while loops (bool condition)
...
* introduce a dump() function on Module.Fn which helpfully prints to
stderr the ZIR representation of a function (can be called before
attempting to codegen it). This is a debugging tool.
* implement x86 codegen for loops
* liveness: fix analysis of conditional branches. The logic was buggy
in a couple ways:
- it never actually saved the results into the IR instruction (fixed now)
- it incorrectly labeled operands as dying when their true death was
after the conditional branch ended (fixed now)
* zir rendering is enhanced to show liveness analysis results. this
helps when debugging liveness analysis.
* fix bug in zir rendering not numbering instructions correctly
closes #6021
2020-08-13 20:32:32 -07:00
Andrew Kelley
576581bd7b
stage1: fix enums having wrong debug info
...
It wasn't wrong info, but e.g. GDB couldn't handle non-power-of-two
enum tags. Now we tell debug info that enum tags are always power of two
size.
closes #4526
closes #5432
2020-08-13 20:32:32 -07:00
Andrew Kelley
fc402bdbbb
stage2: zir_sema for loops
...
Also remove the "repeat" instruction and make it implied to be at the
end of a Loop body.
2020-08-13 20:32:32 -07:00
Dmitry Atamanov
a9590f3bf8
Support tuples in mem.len and trait.isIndexable ( #5897 )
2020-08-14 01:14:32 +03:00
Veikka Tuominen
f5b99abc93
Merge pull request #6045 from Vexu/block
...
Add error for unused/duplicate labels.
2020-08-14 01:04:05 +03:00
Maks S
50139aa232
langref: explain why comptime_float cannot be divided by comptime_int
...
Co-authored-by: Andrew Kelley <andrew@ziglang.org >
Co-authored-by: Veikka Tuominen <git@vexu.eu >
2020-08-13 22:08:37 +03:00
Andrew Kelley
6e0fb06010
Merge branch 'Vexu-stage2'
...
closes #6042
2020-08-13 10:05:20 -07:00
Andrew Kelley
ec4953504a
stage2: implement safety checks at the zir_sema level
2020-08-13 10:04:46 -07:00
Vexu
13e472aa2a
translate-c: add return if one is needed
2020-08-13 18:40:14 +03:00
heidezomp
16d118a8d9
update std and src-self-hosted for std.log breaking change
2020-08-13 17:14:15 +02:00
Vexu
6b2ce9d1e9
stage2: split unwrap_optional to safe and unsafe verions
2020-08-13 08:12:17 -07:00
Vexu
4a40282391
stage2: implement unwrap optional
2020-08-13 08:12:17 -07:00
Vexu
5c1fe58613
stage2: gen optional types
2020-08-13 08:12:17 -07:00
Vexu
75eaf15740
stage2: add optional types
2020-08-13 08:12:17 -07:00
heidezomp
2439f67061
std.log: update documentation and example for scoped logging
2020-08-13 17:12:16 +02:00
heidezomp
a8e0f667c6
std.log: (breaking) remove scope parameter from logging functions
...
The logging functions in std.log don't take a scope parameter anymore,
but use the .default scope. To provide your own scope, use the logging
functions in std.log.scoped(.some_other_scope).
As per nmichaels' suggestion: https://github.com/ziglang/zig/pull/6039#issuecomment-673148971
2020-08-13 16:50:38 +02:00
Vexu
c5368ba20c
translate-c: ensure generated labels are unique
2020-08-13 15:27:29 +03:00
Koakuma
cb06d62603
Add "ppc" prefix to number-modeled CPUs ( #6006 )
...
This is to prevent "expected token 'Symbol', found 'IntLiteral'" errors
when building zig files.
2020-08-13 14:30:38 +03:00
Jakub Konka
3e2e6baee5
Add std.os.getFdPath and std.fs.Dir.realpath
...
`std.os.getFdPath` is very platform-specific and can be used to query
the OS for a canonical path to a file handle. Currently supported hosts
are Linux, macOS and Windows.
`std.fs.Dir.realpath` (and null-terminated, plus WTF16 versions) are
similar to `std.os.realpath`, however, they resolve a path wrt to this
`Dir` instance.
If the input pathname argument turns out to be an absolute path, this
function reverts to calling `realpath` on that pathname completely
ignoring this `Dir`.
2020-08-13 07:08:39 +02:00
Andrew Kelley
e043396b24
Merge branch 'pixelherodev-cbe'
...
closes #6007
2020-08-12 22:00:14 -07:00
Andrew Kelley
eec53d67ab
stage2: anyerror -> explicit error set
2020-08-12 21:59:40 -07:00
Noam Preil
1eb5aaa4b5
CBE: renderValue pays attention to Type, not Tag
2020-08-12 21:58:21 -07:00
Noam Preil
5a166cead8
CBE: fix handling of IR dependencies
2020-08-12 21:58:21 -07:00
Noam Preil
dbd1e42ef2
CBE: Sorta working intcasts?
2020-08-12 21:58:21 -07:00
Noam Preil
78fe86dcd2
CBE: support unreachable on GCC
2020-08-12 21:58:21 -07:00
Noam Preil
d3eec7d46b
CBE: working parameters
2020-08-12 21:58:21 -07:00
Noam Preil
4d778e630a
Tests: print generated C on test failure
2020-08-12 21:58:21 -07:00
Noam Preil
dd1f1487e4
CBE: Use zig_noreturn instead of noreturn to avoid namespace conflict
2020-08-12 21:58:21 -07:00
Noam Preil
b59e2c1e00
CBE: improve noreturn definition, support noreturn on MSVC
2020-08-12 21:58:21 -07:00
Andrew Kelley
de4f3f11f7
stage2: astgen for while loops
...
See #6021
2020-08-12 21:13:16 -07:00
Andrew Kelley
30db5b1fb2
Merge pull request #6039 from heidezomp/std-log-scoped
...
std.log: add scoped logging struct
2020-08-12 18:26:35 -04:00
Vexu
3734881577
add error for unused/duplicate block labels
2020-08-13 01:13:17 +03:00
heidezomp
bf2ed0f571
std.log: don't state in docs that messages are logged to stderr
...
Since the logger implementation can be overridden, the messages might
not be logged to stderr at all.
2020-08-12 15:54:21 +02:00
heidezomp
25607079f0
std.log: add documentation for scoped logging
...
* Add short documentation to std.log.scoped and std.log.default
* Update the module documentation and example to explain the difference
between using explicit scopes, using a scoped logging namespace, and
using the default namespace
2020-08-12 15:37:56 +02:00
heidezomp
7db2c11537
std.log: add scoped logging struct
...
* Add a std.log.scoped function that returns a scoped logging struct
* Add a std.log.default struct that logs using the .default scope
Implementation of daurnimator's proposal:
https://github.com/ziglang/zig/issues/5943#issuecomment-669043489
Note that I named the function "scoped" instead of "scope" so as not to
clash with the scope parameter that is used everywhere; this seemed a
better solution to me than renaming the scope parameter to "s" or
"log_scope" or the like.
2020-08-12 14:03:02 +02:00
Josias
67d684d89a
docs: Fix reference to General Purpose Allocator
2020-08-12 05:08:41 -04:00
Andrew Kelley
8282f4271c
stage2: basic support for parameters .debug_info
...
see #6014
2020-08-11 22:23:32 -07:00
Andrew Kelley
a2a5cea286
stage2: emit DW_TAG_subprogram for function Decls
...
these have the virtual address range, return type, and name.
2020-08-11 19:02:21 -07:00
Andrew Kelley
7612931c80
stage2: set up per-Decl .debug_info
2020-08-11 14:07:06 -07:00
Andrew Kelley
60ce5edaf9
GeneralPurposeAllocator: default to store more stack frames in test mode
...
Now tests will by default store 8 stack frames per allocation rather
than the normal default of 4.
2020-08-11 14:05:28 -07:00
Andrew Kelley
3ccfd58bb6
std.mem.Allocator: fix not passing return_address
...
This makes collected stack traces omit less useful frames. For user
applications which only store a fixed number of stack frames this can
make a big difference.
2020-08-11 14:04:08 -07:00
Maciej Walczak
6febe7e977
copy_file_range linux syscall ( #6010 )
2020-08-11 15:49:43 -04:00
Vexu
2b28cebf64
translate-c: use mangled name when macro translation fails
...
Closes #6009
2020-08-11 12:24:45 +03:00
Vexu
cf5932b236
translate-c: convert int to bool if bool is expected
2020-08-11 12:24:45 +03:00
Vexu
dfcac3cd76
translate-c: always add extern token for functions without body
2020-08-11 12:24:45 +03:00
Andrew Kelley
20510d209b
GeneralPurposeAllocator: use std.log instead of std.debug.print
...
`std.builtin.StackTrace` gains a `format` function.
GeneralPurposeAllocator uses `std.log.err` instead of directly printing
to stderr. Some errors are recoverable.
The test runner is modified to fail the test run if any log messages of
"err" or worse severity are encountered.
self-hosted is modified to always print log messages of "err" severity
or worse even if they have not been explicitly enabled.
This makes GeneralPurposeAllocator available on the freestanding target.
2020-08-11 02:01:32 -04:00
joachimschmidt557
900a897e90
Update tools/process_headers.zig to latest zig
2020-08-10 21:09:23 -04:00
Andrew Kelley
6325d6a486
Merge pull request #5993 from kubkon/getpathnamebyhandle
...
Implement std.os.windows.GetPathNameByHandle using NT routines only
2020-08-10 20:09:45 -04:00
Andrew Kelley
bc176fb739
Merge pull request #6002 from MasterQ32/zig_fmt_align_fix
...
Fixes floating point alignment in std.fmt.format
2020-08-10 20:09:11 -04:00
Andrew Kelley
56e1080ba3
std: dwarf_bits correction
2020-08-10 17:05:39 -07:00
Jakub Konka
901bf0a2e2
Convert prefix from u8 to u16 programmatically
2020-08-10 20:44:22 +02:00
Jakub Konka
73b9f65746
Validate DOS path before returning
...
And some other minor refactors which address more review comments.
2020-08-10 16:39:02 +02:00
Felix Queißner
6701046cdd
Uses getWritten instead of .pos + slicing
...
Co-authored-by: Joachim Schmidt <joachim.schmidt557@outlook.com >
2020-08-09 17:40:58 +02:00
Felix (xq) Queißner
ada06e2996
Makes formatFloatValue not return error.NoSpaceLeft anymore.
2020-08-09 14:09:02 +02:00
Felix (xq) Queißner
06a1184c92
Fixes double alignment
2020-08-09 12:48:26 +02:00
Jakub Konka
cd8e6b66d0
Address some review comments
2020-08-09 10:47:52 +02:00
Andrew Kelley
fd47839064
stage2: fix crash on empty source file
2020-08-08 18:19:48 -07:00
Andrew Kelley
069a6f2432
Merge pull request #5998 from ziglang/general-purpose-allocator
...
std: introduce GeneralPurposeAllocator
2020-08-08 20:20:15 -04:00
Andrew Kelley
f98cffc615
std: general purpose allocator: use AutoHashMap
...
As pointed out by Sahnvour, AutoHashMap is both more convenient and will
have better performance in this case.
2020-08-08 15:59:03 -07:00
Andrew Kelley
5b57e35ce0
fix general purpose allocator test cases on Windows
...
The tests are cleverly testing some alignment stuff, but were getting
thwarted by Windows choosing to allocate 64K aligned pages.
2020-08-08 13:46:18 -07:00
Andrew Kelley
4d0f83e23e
GeneralPurposeAllocator: naming convention refactor
2020-08-08 13:05:04 -07:00
Andrew Kelley
a2f8c23a96
std.heap.page_allocator: Windows support for growing without remapping
2020-08-08 13:04:30 -07:00
Andrew Kelley
cb9405cdbd
don't collect stack trace frames in release safe mode by default
...
We don't pass no-omit-frame-pointer in release safe by default, so it
also makes sense to not try to collect stack trace frames by default in
release safe mode.
2020-08-08 12:04:19 -07:00
Andrew Kelley
051aadd781
std lib general purpose allocator: disable stack tracing on mips
...
Sadly, trying to collect stack frames goes into an infinite loop on
mips. This sets the default number of stack frames to collect to 0 on
mips.
2020-08-08 02:38:32 -07:00
Andrew Kelley
72b5ceed66
update langref in light of new general purpose allocator
2020-08-08 02:15:34 -07:00
Andrew Kelley
88ac0c1287
restore previous behavior of allowing std.testing.allocator
...
even outside of unit tests
2020-08-08 01:21:08 -07:00
Andrew Kelley
1b1921f0e2
stage1: deal with WebAssembly not supporting @returnAddress()
...
This makes `@returnAddress()` return 0 for WebAssembly (when not using
the Emscripten OS) and avoids trying to capture stack traces for the
general purpose allocator on that target.
2020-08-08 01:00:29 -07:00
Andrew Kelley
9f5a7d5922
utilize math.ceilPowerOfTwo
2020-08-08 00:39:46 -07:00
Andrew Kelley
cd6cdd0a75
std.mem.Allocator: add return_address to the interface
...
The high level Allocator interface API functions will now do a
`@returnAddress()` so that stack traces captured by allocator
implementations have a return address that does not include the
Allocator overhead functions. This makes `4` a more reasonable default
for how many stack frames to capture.
2020-08-08 00:34:13 -07:00
Andrew Kelley
0347df82e8
improvements & fixes for general purpose allocator integration
...
* std.Mutex API is improved to not have init() deinit(). This API is
designed to support static initialization and does not require any
resource cleanup. This also happens to work around some kind of
stage1 behavior that wasn't letting the new allocator mutex code
get compiled.
* the general purpose allocator now returns a bool from deinit()
which tells if there were any leaks. This value is used by the test
runner to fail the tests if there are any.
* self-hosted compiler is updated to use the general purpose allocator
when not linking against libc.
2020-08-07 23:26:58 -07:00
Andrew Kelley
cc17f84ccc
std: introduce GeneralPurposeAllocator
...
`std.GeneralPurposeAllocator` is now available. It is a function that
takes a configuration struct (with default field values) and returns an
allocator. There is a detailed description of this allocator in the
doc comments at the top of the new file.
The main feature of this allocator is that it is *safe*. It
prevents double-free, use-after-free, and detects leaks.
Some deprecation compile errors are removed.
The Allocator interface gains `old_align` as a new parameter to
`resizeFn`. This is useful to quickly look up allocations.
`std.heap.page_allocator` is improved to use mmap address hints to avoid
obtaining the same virtual address pages when unmapping and mapping
pages. The new general purpose allocator uses the page allocator as its
backing allocator by default.
`std.testing.allocator` is replaced with usage of this new allocator,
which does leak checking, and so the LeakCheckAllocator is retired.
stage1 is improved so that the `@typeInfo` of a pointer has a lazy value
for the alignment of the child type, to avoid false dependency loops
when dealing with pointers to async function frames.
The `std.mem.Allocator` interface is refactored to be in its own file.
`std.Mutex` now exposes the dummy mutex with `std.Mutex.Dummy`.
This allocator is great for debug mode, however it needs some work to
have better performance in release modes. The next step will be setting
up a series of tests in ziglang/gotta-go-fast and then making
improvements to the implementation.
2020-08-07 22:45:45 -07:00
Andrew Kelley
30bace66d4
refactor now that stage1 supports anon default struct field inits
2020-08-07 22:45:45 -07:00
Andrew Kelley
ab483281d3
stage1: elide @intToPtr alignment safety check for 1-byte alignment
2020-08-07 23:36:36 -04:00
Isaac Freund
2fc18b5278
stage2: make link data in Decl into unions
...
This will allow for implementation of non-Elf backends without wasting
memory.
2020-08-07 19:25:06 -04:00
Jakub Konka
310aa87198
Fix alignment issue
2020-08-07 23:21:06 +02:00
Jakub Konka
bdda8fa7a8
Redo GetFinalPathNameByHandle using DeviceIoControl
...
This commit reimagines `std.os.windows.GetFinalPathNameByHandle`
using `DeviceIoControl` to query the OS mount manager for the DOS
(symlink) paths for the given NT volume name. In particular,
it uses `IOCTL_MOUNTMGR_QUERY_POINTS` ioctl opcode to query the
manager for the available moount points.
2020-08-07 11:33:05 +02:00
Jakub Konka
e8abfef2aa
Add docs
2020-08-06 23:56:37 +02:00
Jakub Konka
2628a8846e
Use NtQueryInformationFile unless unavailable
...
Favour newer API which uses `NtQueryInformationFile` with class flags
`FileNormalizedNameInformation` and `FileVolumeNameInformation`
instead of lower-level `NtQueryObject`. `NtQueryObject` is still
used as a fallback in case the former are unavailable.
2020-08-06 23:56:37 +02:00
Jakub Konka
747d46f22c
Initial draft of GetFinalPathNameByHandle
...
This commit proposes an initial draft of `GetPathNameByHandle` function
which wraps NT syscalls and strives to emulate (currently only
partially) the `kernel32.GetFinalPathNameByHandleW` function.
2020-08-06 23:56:37 +02:00
Andrew Kelley
a2bb246db4
Revert "std.fmt.format: small optimization to avoid runtime bloat"
...
This reverts commit 11d38a7e52 .
The benefits of this commit are not enough to justify the compromise
that it made.
closes #5977
2020-08-05 13:30:43 -07:00
Andrew Kelley
c4b9f5e52f
Merge branch 'pixelherodev-elf-refactor'
...
closes #5976
2020-08-05 11:27:37 -07:00
Noam Preil
a85452b2c2
Codegen: 16-bit pointers
2020-08-05 11:25:43 -07:00
Noam Preil
a5b76d2474
Stage2: minor File.ELF refactor
2020-08-05 11:25:08 -07:00
Andrew Kelley
cf4936bcb0
std.os tests: improve robustness of "symlink with relative paths"
2020-08-04 23:45:53 -07:00
Andrew Kelley
d159ba9295
zig fmt
2020-08-04 23:04:20 -07:00
Andrew Kelley
f23fb3087b
zig build: fix addBuildOption for []const u8 and ?[]const u8
2020-08-04 22:55:45 -07:00
Andrew Kelley
2139697ce5
zig build: fix addBuildOption for []const u8 and ?[]const u8
2020-08-04 22:54:59 -07:00
Andrew Kelley
316b4bde6a
update target CPU features from llvm 10 to 11rc1
2020-08-04 21:46:49 -07:00
Andrew Kelley
8824491fc7
stage2: add missing newlines to cli error messages
2020-08-04 18:38:42 -07:00
Andrew Kelley
e2b9e2137e
update clang command line options data from 10 to 11rc1
2020-08-04 18:03:04 -07:00
Andrew Kelley
4269868d6a
update install files for LLVM 11rc1
2020-08-04 17:52:26 -07:00
Andrew Kelley
372062b4fe
libunwind: update from LLVM 10 to 11rc1
2020-08-04 17:39:29 -07:00
Andrew Kelley
42da1d385d
libcxxabi: upgrade from llvm 10 to 11rc1
2020-08-04 17:30:57 -07:00
Andrew Kelley
54b67c2025
libcxx: update from LLVM 10 to 11rc1
2020-08-04 17:26:02 -07:00
Andrew Kelley
16513fee6c
update C lib/include/ files from clang 10 to 11rc1
2020-08-04 17:17:48 -07:00
Andrew Kelley
c6e0df6213
Merge remote-tracking branch 'origin/master' into llvm11
2020-08-04 17:09:40 -07:00
Andrew Kelley
d61a9e37ae
stage2 tests: fix qemu logic
...
I made two mistakes in the previous commit; it was not actually using
the argv that we built, and also the qemu logic was unconditionally
skipping the test.
Now I have verified that when mangling the RISC-V "hello world" test and
then using -Denable-qemu, we get a test failure.
2020-08-04 15:39:59 -07:00
Andrew Kelley
e4eb4396c2
Merge branch 'pfgithub-stage2-testing-Copy-2'
2020-08-04 15:32:41 -07:00
Andrew Kelley
c594f8dc26
stage2 tests: support the -Denable-qemu options and friends
2020-08-04 15:32:16 -07:00
Andrew Kelley
02d09d1328
codegen: introduce toCanonicalReg to clean up x86-specific logic
2020-08-04 15:31:54 -07:00
pfg
ea3cc777cc
stage2: riscv test case
2020-08-04 14:38:33 -07:00
pfg
e3352db986
stage2: riscv correctly aligned functions
2020-08-04 14:38:33 -07:00
pfg
0b53a2d996
stage2: riscv 0 argument non-nested function calls
2020-08-04 14:38:33 -07:00
pfg
1fd99ed324
stage2: riscv hello world
2020-08-04 14:38:33 -07:00
pfg
52ae2b10aa
stage2: starting on a riscv64 backend
2020-08-04 14:38:33 -07:00
Andrew Kelley
952a397b0e
Merge pull request #5978 from ziglang/stage2-dwarf-incr
...
self-hosted: line number debug information
2020-08-04 20:53:47 +00:00
Andrew Kelley
331f6a07a9
stage2: fix ZIR support and C back end
2020-08-04 12:15:47 -07:00
Andrew Kelley
b7a883b7d1
stage2: link: fix not freeing debug line free list
2020-08-04 12:15:47 -07:00
Andrew Kelley
ca19c42b74
stage2: fix updating debug line info not resizing properly
2020-08-04 12:15:47 -07:00
Andrew Kelley
7d70774fde
stage2: fix memory leak with exported decl name
2020-08-04 12:15:47 -07:00
Andrew Kelley
0d696a48da
stage2 .debug_line: handle Decl line numbers changing
2020-08-04 00:22:11 -07:00
Andrew Kelley
30ee08dfc2
stage2: stop needlessly re-analyzing unchanged functions
2020-08-03 23:47:54 -07:00
Andrew Kelley
cb25d8e4bc
stage2 .debug_line: handle Decl deletes and updates
2020-08-03 23:13:54 -07:00
Andrew Kelley
9b3a70c8aa
stage2: move link.File.ELF.SrcFn field from Module.Fn to Module.Decl
...
SrcFn represents the function in the linked output file, if the
`Decl` is a function. This is stored here and not in `Fn` because `Decl`
survives across updates but `Fn` does not.
TODO Look into making `Fn` a longer lived structure and moving this field there
to save on memory usage.
2020-08-03 22:22:47 -07:00
Andrew Kelley
0c598100d8
stage2: fix use-after-free of export symbol name
2020-08-03 22:07:21 -07:00
Andrew Kelley
edfede575c
self-hosted: add build option for log scopes
...
Now you can enable a set of log scopes by passing -Dlog=<scope>
2020-08-03 21:56:21 -07:00
Andrew Kelley
a33efc74ed
stage2 codegen: revert the unneeded is_stmt stuff
2020-08-03 21:09:58 -07:00
Andrew Kelley
d624bf8059
stage2 .debug_line stepping with gdb is working
2020-08-03 21:01:06 -07:00
Andrew Kelley
ac10841fa9
stage2 .debug_line: simpler strategy for incremental compilation
...
See #5963
2020-08-03 19:14:09 -07:00
Vexu
4ab2f947f9
translate-c: recognize other type trait expressions
...
Closes #5979
2020-08-04 00:48:29 +03:00
Andrew Kelley
4e023c6fa8
stage2: dwarf: fix standard opcode length of LNS_fixed_advance_pc
2020-08-03 00:54:30 -07:00
Andrew Kelley
eccbb03063
downgrade .debug_info to DWARFv4
...
gdb, notice me senpai
2020-08-03 00:42:08 -07:00
Andrew Kelley
bf85d3db3f
downgrade .debug_line to DWARFv4
...
apparently gdb 8.3.1 which is still a commonly distributed version of gdb,
does not support v5.
2020-08-03 00:34:12 -07:00
Andrew Kelley
659603c621
codegen: emit .debug_line ops for IR instructions
2020-08-02 21:28:06 -07:00
Andrew Kelley
42d331b58a
.debug_line: avoid DW_FORM_strp to work around readelf/gdb
...
These tools do not support DWARFv5 yet apparently.
2020-08-02 20:22:41 -07:00
Andrew Kelley
1ce6e201aa
.debug_line: don't rely on header_length field
...
Empirically, debug info consumers do not respect this field, or otherwise
consider it to be an error when it does not point exactly to the end of the header.
Therefore we rely on the NOP jump at the beginning of the Line Number Program for
padding rather than this field.
llvm-dwarfdump says the line number data is fine; gdb and
binutils-readelf crap out.
2020-08-02 19:57:42 -07:00
Andrew Kelley
1a3f250f19
.debug_line incremental compilation initial support
...
Supports writing the first function. Still TODO is:
* handling the .debug_line header growing too large
* adding a new file to an existing compilation
* adding an additional function to an existing file
* handling incremental updates
* adding the main IR debug ops for IR instructions
There are also issues to work out:
* readelf --debug-dump=rawline is saying there is no .debug_str section
even though there is
* readelf --debug-dump=decodedline is saying the file index 0 is bad
and reporting some other kind of corruption.
2020-08-02 19:25:26 -07:00
Andrew Kelley
ba6e5cbfd2
stage2: add the .debug_line header and associated data types
...
* the .debug_line header is written properly
* link.File.Elf gains:
- SrcFn, which is now a field in Module.Fn
- SrcFile, which is now a field in Module.Scope.File
* link.File.Elf gets a whole *Package field rather than only
root_src_dir_path.
* the fields first_dbg_line_file and last_dbg_line_file tell where the
Line Number Program begins and ends, which alows moving files when
the header gets too big, and allows appending files to the end.
* codegen is passed a buffer for emitting .debug_line
Line Number Program opcodes for functions.
See #5963
There is some work-in-progress code here, but I need to go make some
experimental changes to changing how to represent source locations and I
want to do that in a separate commit.
2020-08-02 12:02:43 -07:00
Andrew Kelley
c0654d2db2
std.dwarf: add LNCT constants from DWARF v5
2020-08-02 11:09:39 -07:00
Andrew Kelley
d4bb2b1513
std: add function for writing fixed width ULEB128
2020-08-02 11:09:35 -07:00
Isaac Freund
6123201f06
stage2: move format-specific code to link.File.X
...
This makes the code outside of link.File.Elf less elf-specific and will
allow for easier implementation of other formats such as wasm.
2020-08-02 18:07:10 +00:00
S0urc3C0de
5ae88e919b
Add rdynamic option to build.zig
2020-08-02 17:50:06 +00:00
Vexu
6bba7c702b
add compile error for alignCasting zero sized types
2020-08-02 17:49:16 +00:00
Andrew Kelley
35391f1709
Merge pull request #5968 from haliucinas/blake2
...
Blake2 improvements
2020-08-02 17:47:06 +00:00
Andrew Kelley
6df35c5877
Merge pull request #5960 from kubkon/windows-dir-refactor
...
Refactor out file and dir creation routines in Windows
2020-08-02 17:41:47 +00:00
Jakub Konka
4b0ab0c186
Apply suggestions from code review
...
Co-authored-by: Andrew Kelley <andrew@ziglang.org >
2020-08-02 19:36:49 +02:00
Jay Petacat
cf15b4c269
elf: Iterate over headers w/o need for allocator
2020-08-01 16:01:48 +00:00
Mantas Jonytis
1df33936d6
remove unnecessary operations
2020-08-01 17:15:53 +03:00
Mantas Jonytis
8286cc77f8
implement keyed blake2
2020-08-01 16:56:11 +03:00
Mantas Jonytis
36ed4623a8
make blake2 public
2020-08-01 16:05:20 +03:00
Mantas Jonytis
42dd737c9e
compute blake2 at compile time
2020-08-01 16:00:22 +03:00
Mantas Jonytis
1ae40146e6
blake2b: off-by-one on update
2020-08-01 15:31:46 +03:00
Mantas Jonytis
eee9abe1b4
add more blake2b test cases
2020-08-01 15:31:36 +03:00
Mantas Jonytis
b1cf0196df
blake2s: off-by-one on update
2020-08-01 15:15:45 +03:00
Mantas Jonytis
fad87bef9a
add more blake2s tests
2020-08-01 15:15:04 +03:00
Jakub Konka
f6ae2505d9
Fix opening NUL device on Windows
2020-07-31 19:16:04 +02:00
Jakub Konka
4d9eff4bdb
Add prelim openW and openatW
...
Added POSIX functions targeting Windows pass `open` and `openat`
smoke tests.
2020-07-31 16:41:25 +02:00
Jakub Konka
a694f575ad
Add some os.open and os.openat smoke tests
2020-07-31 16:33:02 +02:00
Jakub Konka
390194431e
Use NtCreateFile directly in ReadLink
...
This shaves off one syscall (we use one instead of two if we were to
use `windows.OpenFile` wrapper). Clean up flag generation in `OpenFile`.
Hopefully, we're in a much better place to *almost* support `openW`
and `openatW`.
2020-07-31 16:32:21 +02:00
Jakub Konka
8981b18fee
Move delete file logic into windows.DeleteFile fn
...
This way, we can remove more `kernel32` calls such as `RemoveDirectoryW`
or `DeleteFileW`, and use `std.os.windows.DeleteFile` instead which
is purely NT-based.
2020-07-31 16:31:51 +02:00
Jakub Konka
66bbe4ec4c
Refactor internal Win routines to reuse OpenFile
...
This covers mainly `ReadLink` and `CreateSymolicLink` functions.
2020-07-31 16:31:44 +02:00
Jakub Konka
a89d5cfc3e
Remove CreateDirectoryW and CreateFileW calls
...
Replace them with `std.os.windows.OpenFile` instead. To allow
creation/opening of directories, `std.os.windows.OpenFileOptions`
now features a `.expect_dir: bool` member which is meant to emualate
POSIX's `O_DIRECTORY` flag.
2020-07-31 16:31:23 +02:00
Sam Tebbs
0d31877444
Print } as format argument in enum build option ( #5953 )
...
Co-authored-by: Veikka Tuominen <git@vexu.eu >
Co-authored-by: Joachim Schmidt <joachim.schmidt557@outlook.com >
2020-07-31 11:37:40 +03:00
Andrew Kelley
0962cc5a32
stage2: implement .debug_aranges DWARF
2020-07-31 01:16:34 -07:00
Andrew Kelley
9d0872a625
std.ArrayList: add appendNTimesAssumeCapacity
2020-07-31 01:16:17 -07:00
Andrew Kelley
acd0dabab2
stage2: add some tracy calls to link.zig functions
2020-07-30 23:51:14 -07:00
Andrew Kelley
f1c1b8c02d
stage2: add DWARF info for the main compilation unit
2020-07-31 06:48:17 +00:00
Vexu
f962315363
fix missing parser error for missing comma before eof
...
Closes #5952
2020-07-30 13:10:55 +03:00
Vexu
1f8f434b9c
compiler_rt: add floatditf
2020-07-29 18:03:44 +03:00
Jakub Konka
547e520359
Split DeviceIoControl path into two fn call paths
...
As discussed in the previous commit, it would be better to avoid
function pointers to syscalls and explicitly split the control
path into two function calls instead. This commit addresses that
for `std.os.windows.DeviceIoControl`.
2020-07-29 14:17:49 +02:00
Andrew Kelley
b3b00ec62f
Merge branch 'more-stage2-locals'
2020-07-29 02:29:46 -07:00
Andrew Kelley
8899e6e334
stage2: codegen: fix off-by-one stack variable offsets
2020-07-29 02:29:37 -07:00
Andrew Kelley
606f157a6b
stage2: register-aliasing-aware codegen
...
* unify duplicated register allocation codepath
* support the x86_64 concept of register aliasing
* slightly improved memset codegen, supports sizes 1, 2, 4, 8
2020-07-29 02:29:37 -07:00
Andrew Kelley
1bbfa36b76
stage2: improved codegen
...
* multiple returns jump to one canonical function exitlude. This is in
preparation for the defer feature.
* simple elision of trivial jump relocs.
* omit prelude/exitlude for naked calling convention functions.
* fix not switching on arch for prelude/exitlude
* fix swapped registers when setting stack mem from a register
2020-07-29 02:29:37 -07:00
Andrew Kelley
64a1a280ef
stage2: fix superfluous returnvoid ZIR
2020-07-29 02:29:37 -07:00
Andrew Kelley
4beff80b2f
stage2: codegen handles undefined values
...
* `optimize_mode` is passed to `link.File` and stored there
* improve the debugging function `Module.dumpInst`
* get rid of `Value.the_one_possible_value` in favor of a few more
specific values for different types. This is less buggy, one less
footgun.
* `Type.onePossibleValue` now returns a `?Value` instead of `bool`.
* codegen handles undefined values. `undef` is a new `MCValue` tag.
It uses 0xaa values depending on optimization mode. However
optimization mode does not yet support scope overrides.
* link.zig: move the `Options` field from `File.Elf` and `File.C` to
the base struct.
- fix the Tag enum to adhere to style conventions
* ZIR now supports emitting undefined values.
* Fix the logic of comptime math to properly compare against zero using
the `compareWithZero` function.
2020-07-29 02:29:37 -07:00
Andrew Kelley
2b8e7deeda
stage2: add ZIR emitType support for simple pointer types
2020-07-29 02:29:37 -07:00
Andrew Kelley
99d2d9bf64
stage2: fix format() of mutable pointer types
2020-07-29 02:29:37 -07:00
Andrew Kelley
cb3e8e323d
stage2: x86_64 codegen for movs to/from stack variables
2020-07-29 02:29:37 -07:00
Andrew Kelley
5ccee4c986
stage2: more progress towards mutable local variables
...
* implement sema for runtime deref, store pointer, coerce_to_ptr_elem,
and store
* identifiers support being lvalues, except for decls is still TODO
* codegen supports load, store, ref, alloc
* introduce more MCValue union tags to support pointers
* add load, ref, store typed IR instructions
* add Type.isVolatilePtr
2020-07-29 02:29:36 -07:00
Andrew Kelley
11d38a7e52
std.fmt.format: small optimization to avoid runtime bloat
...
When there are no format parameters, it simply calls `writeAll`. This
has the effect of no longer emitting a compile error for using `{}` and
not having any parameters, however, at this point in the development
process of Zig I think that tradeoff is worthwhile.
On the other hand, it might be OK to simply define formatting to work
this way. It's a common pattern to use the formatting function's format
string `"like this", .{}` instead of `"{}", .{"like this"}`, which can
lead to accidentally putting control characters in the formatting
string, however, with this change that works just fine.
2020-07-29 02:29:36 -07:00
Jakub Konka
4fdfaf69c8
Add Zig wrapper for kernel32.DeviceIoControl
...
This commit adds a Zig wrapper for `kernel32.DeviceIoControl` which
applies ReactOS logic for deciding whether to use
`ntdll.NtDeviceIoControlFile` or `ntdll.NtFsControlFile` based on the
value of passed `IO_CONTROL_CODE`. The decision logic is based on the
logic found in ReactOS found in the following [link].
Thanks to Daurnimator for finding this bit in ReactOS!
[link]: https://doxygen.reactos.org/d3/d74/deviceio_8c.html
2020-07-29 01:19:10 +00:00
Felix (xq) Queißner
606b6462ce
Fixes atomicSymLink looping when new_path already exists.
2020-07-28 17:04:46 +00:00
Andrew Kelley
d726c2a2d3
self-hosted: beginnings of stack allocation
...
Comment out non-x86_64 architectures for now in codegen.zig, because
they all have compile errors for their codepaths anyway, and it was
bloating the compilation speed and memory usage when stage1 tried to
build self-hosted. Here's the panic message:
"Backend architectures that don't have good support yet are commented
out, to improve compilation performance. If you are interested in one
of these other backends feel free to uncomment them. Eventually these
will be completed, but stage1 is slow and a memory hog."
This is a workaround to lower the time it takes to build self-hosted
with stage1 as well as use less memory. It should fix the CI.
Additionally:
* Add `single_mut_pointer` support to `Type`
* Trivial implementation of stack allocation in codegen.zig. It does
not deal with freeing yet, and it's missing the stack pointer
adjustment prologue.
* Add the `alloc` IR instruction and semantic analysis for `alloc` ZIR
instruction.
2020-07-28 01:43:04 -07:00
Andrew Kelley
c37f273cb0
stage1: hot path for resolving types of primitives
...
This is an attempt to save memory when building self-hosted.
before:
Total bytes allocated: 5.941 GiB, deallocated: 2.259 GiB, remaining: 3.681 GiB
after:
Total bytes allocated: 5.933 GiB, deallocated: 2.253 GiB, remaining: 3.680 GiB
2020-07-28 00:00:35 -07:00
Andrew Kelley
0965724e31
self-hosted: refactor some code out of Module.zig into zir_sema.zig
...
This makes sense from an organizational point of view, as explained by
this new doc comment at the top of the new file:
//! Semantic analysis of ZIR instructions.
//! This file operates on a `Module` instance, transforming untyped ZIR
//! instructions into semantically-analyzed IR instructions. It does type
//! checking, comptime control flow, and safety-check generation. This is the
//! the heart of the Zig compiler.
//! When deciding if something goes into this file or into Module, here is a
//! guiding principle: if it has to do with (untyped) ZIR instructions, it goes
//! here. If the analysis operates on typed IR instructions, it goes in Module.
Before:
4009 src-self-hosted/Module.zig
After:
2776 src-self-hosted/Module.zig
1128 src-self-hosted/zir_sema.zig
This should be sufficient to avoid the situation we have in stage1 where
ir.cpp is 32,516 lines.
2020-07-27 22:44:18 -07:00
Vexu
5f0bde6358
add helpful error note for when function cannot return an error
...
This has caused frequent confusion since it looks like you are handling
errors correctly with a try but you forgot to change your return type.
2020-07-28 04:24:52 +00:00
Andrew Kelley
b8e22d2002
stage2: implement integer return values
2020-07-27 18:59:13 -07:00
Andrew Kelley
3e0a46281c
stage2: fix function calls always having void return type
2020-07-27 18:59:13 -07:00
Jay Petacat
1c2e65fe1d
std.elf: Fix read functions for 32-bit targets
...
The buffer index was declared as `u64`, which overflows `usize` on a
32-bit target.
The following example program failed to compile for 32-bit targets:
```zig
const std = @import("std");
pub fn main() !void {
const alloc = std.testing.allocator;
const file = std.io.getStdIn();
_ = try std.elf.readAllHeaders(alloc, file);
}
```
```
lib/zig/std/elf.zig:543:36: error: expected type 'usize', found 'u64'
const len = file.pread(buf[i .. buf.len - i], offset + i) catch |err| switch (err) {
^
lib/zig/std/elf.zig:543:36: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values
const len = file.pread(buf[i .. buf.len - i], offset + i) catch |err| switch (err) {
^
lib/zig/std/elf.zig:543:35: note: referenced here
const len = file.pread(buf[i .. buf.len - i], offset + i) catch |err| switch (err) {
^
lib/zig/std/elf.zig:348:5: note: referenced here
try preadNoEof(file, &hdr_buf, 0);
^
lib/zig/std/elf.zig:392:19: note: referenced here
.header = try readHeader(file),
```
2020-07-28 01:36:26 +00:00
Andrew Kelley
488df7f1d1
stage2: astgen for all arithmetic and assignments
2020-07-27 17:09:47 -07:00
Andrew Kelley
bd9b3fe1e6
Merge pull request #5511 from jessrud/arraylist-replaceRange
...
add replaceRange() function to ArrayList
2020-07-27 20:04:19 +00:00
zigazeljko
bf273b7aec
Add comment explaining --stack-first option
2020-07-27 19:51:58 +00:00
Felix (xq) Queißner
fb9d5529da
Adds support for RunStep to use the result of a WriteFileStep.
2020-07-27 19:46:15 +00:00
Jakub Konka
f0ed2ed67f
Replace DeviceIoControl with FsControlFile
...
This commit replaces `windows.DeviceIoControl` with
`windows.FsControlFile` which is a wrapper around the NT-based
syscall `ntdll.NtFsControlFile`.
2020-07-27 19:45:23 +00:00
Ashok Gautham
d1755e7f16
Add meta viewport to fix mobile rendering, add missing <code> block
...
Co-authored-by: Vexu <git@vexu.eu >
2020-07-27 17:10:55 +03:00
frmdstryr
fa4a9ab51f
Use writer for LinearFifo instead of deprecated outStream
2020-07-27 17:05:39 +03:00
Vexu
e7007fa7bd
translate-c: use ArrayList for macro tokens
2020-07-27 15:38:56 +03:00
Henrik Laxhuber
9f6401c692
Fix a use of appendToken to appendIdentifier in translate-c
2020-07-27 13:43:49 +03:00
Henrik Laxhuber
442025481c
Fix parsing of unsigned in translate-c.
...
Previously, `unsigned` was parsed as the shorthand for `unsigned int`.
This commit introduces code to parse `unsigned short`, `unsigned int`,
`unsigned long`, and `unsigned long long`.
There is a comment in the code about std.c.parse` - Im not
familiar with zig internals, but it seems like this is a separate
C parsing implementation. In the long run, it probably makes
sense to merge both implementations, so this commit should be
regarded as a quick fix that doesn't address an apparently
underlying issue.
2020-07-27 13:43:49 +03:00
joachimschmidt557
616355807f
Fix bug in big.int.Mutable.toManaged() and add tests
...
Fixes #5918
2020-07-27 07:16:44 +00:00
Andrew Kelley
5139aa7ba4
Merge pull request #5932 from Sahnvour/hash
...
new trait `hasUniqueRepresentation` and hashmap speedup
2020-07-27 07:12:54 +00:00
Jonathan Marler
6cc72af03d
Provide Ip4Address and Ip6Address in addition to Address
2020-07-27 07:11:07 +00:00
Sahnvour
f67ce1e35f
make use of hasUniqueRepresentation to speed up hashing facilities, fastpath in getAutoHashFn is particularly important for hashmap performance
...
gives a 1.18x speedup on gotta-go-fast hashmap bench
2020-07-26 23:04:33 +02:00
Sahnvour
345cb3200c
improve autoHash type switch
...
floats shouldn't be autoHash'd as they have multiple representations for some values, preventing it by default is safer
2020-07-26 22:04:10 +02:00
Sahnvour
7ae1b3a6b3
add trait hasUniqueRepresentation
2020-07-26 22:01:33 +02:00
Andrew Kelley
c95091e5a5
run zig fmt on std.testing
2020-07-25 23:33:15 -07:00
Andrew Kelley
09b0ad494b
stage2: remove superfluous else => unreachable
2020-07-25 23:32:30 -07:00
Andrew Kelley
40d81a8364
Merge pull request #5678 from antlilja/float-testing
...
Add functions for testing floats with margins and epsilons to standard library
2020-07-26 05:54:30 +00:00
Andrew Kelley
a36772ee64
Merge pull request #5693 from antlilja/switch-unreachable-else
...
Add error message for unreachable else prong in switch
2020-07-26 05:46:18 +00:00
meme
f050150ffa
Add memory replacement routines
...
* Added `replace` for simple pre-allocated search-and-replace
* Added `replacementSize` for calculating ahead-of-time buffer sizes for
performing a safe search-and-replace
* Added `replaceOwned` for automatically allocating and performing
replacement
2020-07-26 05:42:38 +00:00
Andrew Kelley
9b75091fd4
ci: update msys2 installer
2020-07-25 22:21:52 -07:00
Andrew Kelley
41a8b6f57b
llvm11: link against libClangToolingCore
...
This is needed to successfully link against llvm, clang, and lld 11.
2020-07-24 17:08:39 -07:00
Andrew Kelley
2475f653fd
stage1: add missing math.h includes
2020-07-24 17:02:03 -07:00
Andrew Kelley
bd121f3af4
update clang drivers from llvm 10 to 11
2020-07-24 17:01:52 -07:00
Andrew Kelley
c8ea8cf5df
update LLVM C++ API wrappers from llvm 10 to 11
2020-07-24 16:49:57 -07:00
Andrew Kelley
cd91e17b73
update LLVM 10 version numbers to 11
2020-07-24 16:49:43 -07:00
Andrew Kelley
995fd7314c
Revert "Support taking extern pointers at comptime"
...
This reverts commit d3ebd42865 .
This caused a build failure on multiple targets.
2020-07-24 14:06:44 -07:00
daurnimator
978a38ee40
std: fix json parsing into unions
2020-07-24 20:35:47 +00:00
yvt
d3ebd42865
Support taking extern pointers at comptime
...
This commit makes it possible to obtain pointers to `extern` variables
at comptime.
- `ir_get_var_ptr` employs several checks to determine if the given
variable is eligible for obtaining its pointer at comptime. This
commit alters these checks to consider `extern` variables, which have
runtime values, as eligible.
- After this change, it's now possible for `render_const_val` to be
called for `extern` variables. This commit modifies
`render_const_val` to suppress the value generation for `extern`
variables.
- `do_code_gen` now creates `ZigValue::llvm_global` of `extern`
variables before iterating through module-level variables so that
other module-level variables can refer to them.
This solution is incomplete since there are several cases still
failing:
- `global_var.array[n..m]`
- `&global_var.array[i]`
- `&global_var.inner_struct.value`
- `&global_array[i]`
Closes #5349
2020-07-24 13:33:17 -07:00
Michael Dusan
3b26e50863
macOS: macho ld64.lld fixes
...
* bring `construct_linker_job_macho` to parity with
`construct_linker_job_elf`
* macho now sets `-error-limit`
* macho on macOS now sets `-macosx_version_min` and `-sdk_version`
to `10.13` when running `zig0`
* macho now detects when `-l` prefix is not needed
* macho on macOS detects system libraries in a case-insensitive manner
* macho now ads user-specified libraries to linker command-line args
when condition `is_native_os != true`
* re-ordered some macho args positions to match elf positions
closes #5059
closes #5067
2020-07-24 20:01:18 +00:00
Andrew Kelley
df1a2ecd3b
Merge pull request #5891 from Luukdegram/stage2-substraction
...
Stage2: Substraction support
2020-07-24 18:29:52 +00:00
Luuk de Gram
3019ab9391
Fix resolvepeertype() int signess and feedback improvements
2020-07-24 17:51:24 +02:00
Luuk de Gram
470264a4f5
Restructuring and f32/f64 support
2020-07-24 17:16:48 +02:00
Luuk de Gram
97e92d868e
Rebase and skeleton for float support
2020-07-24 17:16:48 +02:00
Luuk de Gram
ee7fbb9548
Restructured arithmetic operations
2020-07-24 17:16:48 +02:00
Luuk de Gram
198c09197b
Fixed test case
2020-07-24 17:16:48 +02:00
Luuk de Gram
9d79741fd0
Stage2: Add support for substraction
2020-07-24 17:16:48 +02:00
Jakub Konka
a1d72fad81
Use -c flag in all s3cmd occurrences on Win
2020-07-24 14:35:48 +02:00
Jakub Konka
937c02f185
Re-apply temp msys2 python fix
...
Tweak `windows_upload` script to manually specify the config path
to `s3cmd`.
2020-07-24 09:19:51 +02:00
Jakub Konka
b7353240c7
Refactor macOS build script in Azure
...
We don't really want to rebuild the cache in Azure...
2020-07-24 06:29:50 +00:00
Andrew Kelley
56a21b7ec3
ci: undo the recent changes. maybe upstream fixed it
2020-07-23 23:26:24 -07:00
Andrew Kelley
aac6e8c418
self-hosted: AST flattening, astgen improvements, result locations, and more
...
* AST: flatten ControlFlowExpression into Continue, Break, and Return.
* AST: unify identifiers and literals into the same AST type: OneToken
* AST: ControlFlowExpression uses TrailerFlags to optimize storage
space.
* astgen: support `var` as well as `const` locals, and support
explicitly typed locals. Corresponding Module and codegen code is not
implemented yet.
* astgen: support result locations.
* ZIR: add the following instructions (see the corresponding doc
comments for explanations of semantics):
- alloc
- alloc_inferred
- bitcast_result_ptr
- coerce_result_block_ptr
- coerce_result_ptr
- coerce_to_ptr_elem
- ensure_result_used
- ensure_result_non_error
- ret_ptr
- ret_type
- store
- param_type
* the skeleton structure for result locations is set up. It's looking
pretty clean so far.
* add compile error for unused result and compile error for discarding
errors.
* astgen: split builtin calls up to implemented manually, and implement
`@as`, `@bitCast` (and others) with respect to result locations.
* add CLI support for hex and raw object formats. They are not
supported by the self-hosted compiler yet, and emit errors.
* rename `--c` CLI to `-ofmt=[objectformat]` which can be any of the
object formats. Only ELF and C are supported so far. Also added missing
help to the help text.
* Remove hard tabs from C backend test cases. Shame on you Noam, you
are grounded, you should know better, etc. Bad boy.
* Delete C backend code and test case that relied on comptime_int
incorrectly making it all the way to codegen.
2020-07-23 23:05:26 -07:00
Andrew Kelley
b4d383a478
ci: looks like s3cmd wants a new path for the config file
...
Thanks Jakub Konka for exploring this.
2020-07-23 10:58:07 -07:00
heidezomp
32a6759a7a
Fix std.log example to make the log handler print the newline
...
Follow up from #5910
2020-07-22 22:08:08 +00:00
luna
a6626802f9
Add signalfd support ( #5322 )
...
* add signalfd_siginfo to linux bits
* Cast sigaddset's shift value to u5
* linux: add signalfd4
* os: add signalfd
2020-07-22 17:26:27 -04:00
Andrew Kelley
9505bb74cd
Merge pull request #5879 from kubkon/readlink-win
...
Implement readlink on Windows
2020-07-22 17:59:40 +00:00
joachimschmidt557
c6bd8e8c53
Make the default log handler print a newline
...
Closes #5907
2020-07-22 17:02:27 +00:00
Jakub Konka
aa6fcaf76f
Add missing cross-platform Dir.readLink fns
2020-07-22 08:51:23 +02:00
Jakub Konka
65581b37cb
Enable std.os.symlinkat tests on Windows
2020-07-22 08:51:23 +02:00
Jakub Konka
3d41d3fb6e
Draft out ReadLinkW using NT primitives
2020-07-22 08:51:23 +02:00
Jakub Konka
4887350bf4
Finish drafting CreateSymolicLink using NT calls
2020-07-22 08:51:23 +02:00
Jakub Konka
99f0e64fa0
Draft out dir symlinks branch
2020-07-22 08:51:23 +02:00
Jakub Konka
c53bcd027f
Start drafting CreateSymbolicLink using ntdll syscalls
2020-07-22 08:51:23 +02:00
Jakub Konka
2c9c13f624
Add various build fixes
...
Fix WASI build, fix atomicSymlink by using `cwd().symLink`, add
`Dir.symLink` on supported targets.
2020-07-22 08:51:22 +02:00
Jakub Konka
e0b77a6b77
Ensure Dir.deleteTree does not dereference symlinks
...
Otherwise, the behaviour can lead to unexpected results, resulting
in removing an entire tree that's not necessarily under the root.
Furthermore, this change is needed if are to properly handle dir
symlinks on Windows. Without explicitly requiring that a directory
or file is opened with `FILE_OPEN_REPARSE_POINT`, Windows automatically
dereferences all symlinks along the way. This commit adds another
option to `OpenDirOptions`, namely `.no_follow`, which defaults to
`false` and can be used to specifically open a directory symlink on
Windows or call `openat` with `O_NOFOLLOW` flag in POSIX.
2020-07-22 08:51:22 +02:00
Jakub Konka
3c8ceb674e
Fix Windows build
2020-07-22 08:51:22 +02:00
Jakub Konka
fc7d87fef1
Move symlink to fs.symlinkAbsolute with SymlinkFlags
...
This way `std.fs.symlinkAbsolute` becomes cross-platform and we can
legally include `SymlinkFlags` as an argument that's only used on
Windows. Also, now `std.os.symlink` generates a compile error on
Windows with a message to instead use `std.os.windows.CreateSymbolicLink`.
Finally, this PR also reshuffles the tests between `std.os.test` and
`std.fs.test`.
2020-07-22 08:51:22 +02:00
Jakub Konka
dd366d316d
Fix more compilation errors on other hosts
2020-07-22 08:51:22 +02:00
Jakub Konka
08e7ac3028
Fix compilation on other hosts
2020-07-22 08:51:22 +02:00
Jakub Konka
22362568cf
Refactor
2020-07-22 08:51:22 +02:00
Jakub Konka
3ab5e6b1a9
Ensure we use Win32 prefix in Win32 calls
2020-07-22 08:51:22 +02:00
Jakub Konka
cc9c5c5b0e
Handle relative/absolute symlinks; add more tests
2020-07-22 08:51:22 +02:00
Jakub Konka
a8a02dfbfa
Add smoke test for dir symlinks
2020-07-22 08:51:22 +02:00
Jakub Konka
30f1176a54
Add SymlinkFlags needed to create symlinks to dirs on Win
2020-07-22 08:51:22 +02:00
Jakub Konka
4894de2b32
Fix readlink smoke test
2020-07-22 08:51:22 +02:00
Jakub Konka
99e3e29e2e
Refactor
2020-07-22 08:51:22 +02:00
Jakub Konka
c47cb8d09f
Fix unlinkatW to allow file symlink deletion on Windows
2020-07-22 08:51:22 +02:00
Jakub Konka
ae8abedbed
Use NtCreateFile to get handle to reparse point
2020-07-22 08:51:22 +02:00
Jakub Konka
d17c9b3591
Fix incorrect byte format of REPARSE_DATA_BUFFER struct
2020-07-22 08:51:22 +02:00
Jakub Konka
9b00dc941b
Use windows.CreateFileW to open the reparse point
2020-07-22 08:51:22 +02:00
Jakub Konka
49b5815364
Add windows.ReadLink similar to OpenFile but for reparse points only
2020-07-22 08:51:22 +02:00
Jakub Konka
92d11fd4e9
Debug readlinkW using OpenFile
2020-07-22 08:51:22 +02:00
Jakub Konka
791795a63a
Finish symlink implementation on Windows
2020-07-22 08:51:22 +02:00
Jakub Konka
515c663cd6
Add readlink smoke test
2020-07-22 08:51:22 +02:00
Jakub Konka
cc83d92b0b
Start drafting out os.readlink on Windows
2020-07-22 08:51:22 +02:00
Jakub Konka
9225763f8b
Add temporary fix to the CI on Win
...
Here's the [thread](https://github.com/msys2/MSYS2-packages/issues/2050 )
for reference.
2020-07-22 06:49:24 +00:00
Andrew Kelley
25a01a16e0
Merge pull request #5905 from Vexu/stage2-float
...
Stage2: floats
2020-07-21 22:35:05 +00:00
Hiroki Noda
68e0632aa5
Use function attribute "frame-pointer"
2020-07-21 21:03:02 +00:00
Vexu
dd89297388
stage2: actually implement float casting
2020-07-21 22:34:14 +03:00
Vexu
c29c79b17a
stage2: remove some dead code, fix build on aarch64
2020-07-21 22:34:14 +03:00
Vexu
7e7d1df4da
stage2: add floatCast to zir and ir
2020-07-21 22:34:12 +03:00
Vexu
7b52dbbf83
stage2: implement some casts for numbers
2020-07-21 22:29:29 +03:00
Vexu
da217fadeb
stage2: astgen for floats and other primitive literals
2020-07-21 22:29:28 +03:00
Vexu
e77ca6af70
stage2: add float values
2020-07-21 22:29:28 +03:00
Vexu
fd2f034e31
fix comptime comparisons of different sized floats
2020-07-21 22:29:15 +03:00
Andrew Kelley
8ee629aa4c
stage2: ability for ZIR to map multiple tags to the same type
2020-07-21 12:13:15 -07:00
Andrew Kelley
7a1a924788
stage2: AST: (breaking) flatten out suffix operations
2020-07-21 10:52:24 -07:00
Andrew Kelley
1ac28eed83
stage2 AST: rename OptionalUnwrap to OrElse
...
preparing to flatten suffix operations AST
2020-07-21 10:46:47 -07:00
Andrew Kelley
1cfe43d563
Merge pull request #5888 from pfgithub/stage-2-testing-Copy
...
stage2: period and suffixop
2020-07-21 17:42:46 +00:00
purringChaos
094223d634
Fix log.zig example.
2020-07-21 18:53:30 +03:00
Andrew Kelley
4abf119d95
Merge branch 'register-allocation'
2020-07-20 13:12:25 -07:00
Andrew Kelley
ef91b11295
stage2: register allocator processes operand deaths
...
also rework the IR data structures
2020-07-20 13:12:20 -07:00
Andrew Kelley
a8065a05a5
stage2: fix implementation of liveness operandDies()
2020-07-20 13:12:20 -07:00
Andrew Kelley
896472c20e
stage2: implement register copying
2020-07-20 13:12:20 -07:00
Andrew Kelley
ef9aeb6ac4
stage2: codegen: refactor to always have comptime arch
2020-07-20 13:12:20 -07:00
Anthony Arian
3658dd5e89
Merge branch 'master' of https://github.com/ziglang/zig into 5002-fix-entrypoint-with-winmain
2020-07-20 10:25:54 +01:00
Vexu
596ca6cf70
allow non-pointer extern opaque variables
2020-07-18 16:45:07 +03:00
Vexu
78962eeeda
fix floatCast type check regression
...
Closes #5900
2020-07-18 10:22:15 +03:00
data-man
39915ae086
Add trait.isTuple
2020-07-17 17:55:55 +03:00
Vexu
a1e78d0b06
add is_tuple field to struct typeinfo
...
part of #4335
2020-07-17 00:15:34 +03:00
pfg
86922b8d08
stage2: support @"identifier" syntax
2020-07-16 14:08:36 -07:00
Andrew Kelley
cc3bceea3d
Merge pull request #5889 from Vexu/translate-c
...
Translate-c support initializer lists in macros
2020-07-16 19:03:03 +00:00
Vexu
5e88a7a427
add behavior tests fro macro translations
2020-07-16 17:10:52 +03:00
Vexu
06c08e5219
std.mem.zeroes use std.mem.set instead of @memset
...
stage1 comptime is not smart enough to remeber the size of the casted
item which leads to out of bounds errors.
2020-07-16 17:05:14 +03:00
data-man
3cdc0f104e
Vectors clarification in docs
2020-07-16 16:22:28 +03:00
Vexu
37647375dc
translate-c: support initializer list expr macros
2020-07-16 16:20:47 +03:00
Vexu
8fe076daaf
std.mem.zeroInit support initiating with tuples
2020-07-16 16:00:42 +03:00
pfg
83a0073b68
stage2: period and suffixop
2020-07-16 04:22:05 -07:00
pfg
01ab167ce3
stage2: change large switch → inline for loop
2020-07-16 10:32:24 +00:00
Andrew Kelley
e079fdeee7
Merge pull request #5885 from ziglang/stage2-locals
...
self-hosted compiler local consts
2020-07-16 05:57:32 +00:00
Andrew Kelley
d29dd5834b
stage2: local consts
...
These are now supported enough that this example code hits the
limitations of the register allocator:
fn add(a: u32, b: u32) void {
const c = a + b; // 7
const d = a + c; // 10
const e = d + b; // 14
assert(e == 14);
}
// error: TODO implement copyToNewRegister
So now the next step is to implement register allocation as planned.
2020-07-15 22:36:35 -07:00
Andrew Kelley
af12596e8d
stage2: breaking AST memory layout modifications
...
InfixOp is flattened out so that each operator is an independent AST
node tag. The two kinds of structs are now Catch and SimpleInfixOp.
Beginning implementation of supporting codegen for const locals.
2020-07-15 19:39:18 -07:00
haze
82562b205f
On darwin, only add the self exe to the cache hash for compiler id ( #5880 )
...
Now that Big Sur does not have system libraries on the filesystem, zig can no longer read them and add them to the cache hash for the compiler id.
This changes it so that only the first library path returned by os_self_exe_shared_libs is added to the cache hash under Darwin. I looked into methods on getting the system version to keep parity with older versions, but @fengb reported that this works on Catalina (a version behind Big Sur)
Signed-off-by: Haze Booth <isnt@haze.cool >
2020-07-15 22:37:04 -04:00
Andrew Kelley
f119092273
stage2: breaking AST memory layout modifications
...
ast.Node.Id => ast.Node.Tag, matching recent style conventions.
Now multiple different AST node tags can map to the same AST node data
structures. In this commit, simple prefix operators now all map top
SimplePrefixOp.
`ast.Node.castTag` is now preferred over `ast.Node.cast`.
Upcoming: InfixOp flattened out.
2020-07-15 18:15:59 -07:00
Andrew Kelley
e70d6d19f5
stage2: extract AST=>ZIR code to separate file
2020-07-15 15:42:02 -07:00
Andrew Kelley
6b103324d2
Merge pull request #5872 from ziglang/ast-flatten-2
...
stage2: introduce the concept of "trailer flags" to the AST
2020-07-15 18:34:06 +00:00
Andrew Kelley
c5b7322319
TrailerFlags test: fix bad alignment assumption on 32-bit
2020-07-15 04:04:04 -07:00
Andrew Kelley
804b51b179
stage2: VarDecl and FnProto take advantage of TrailerFlags API
...
These AST nodes now have a flags field and then a bunch of optional
trailing objects. The end result is lower memory usage and consequently
better performance. This is part of an ongoing effort to reduce the
amount of memory parsed ASTs take up.
Running `zig fmt` on the std lib:
* cache-misses: 2,554,321 => 2,534,745
* instructions: 3,293,220,119 => 3,302,479,874
* peak memory: 74.0 MiB => 73.0 MiB
Holding the entire std lib AST in memory at the same time:
93.9 MiB => 88.5 MiB
2020-07-15 02:07:30 -07:00
Andrew Kelley
eac6280241
add std.meta.TrailerFlags API
...
This is useful for saving memory when allocating an object that has many
optional components. The optional objects are allocated sequentially in
memory, and a single integer is used to represent each optional object
and whether it is present based on each corresponding bit.
2020-07-14 17:19:17 -07:00
Andrew Kelley
a7c3cec65f
follow up from previous commit for generic methods
2020-07-14 15:29:07 -07:00
Andrew Kelley
4696cd3e09
fix ability to call methods on enums with pointer-to-self
...
closes #3218
2020-07-14 14:38:40 -07:00
Andrew Kelley
67273cbe76
Merge pull request #5868 from ziglang/stage2-improvements
...
Stage2 improvements
2020-07-14 09:24:43 +00:00
Andrew Kelley
a92990f993
stage2: implement enough for assert() function to codegen
2020-07-14 02:24:12 -07:00
Andrew Kelley
135580c162
stage2: fix liveness analysis of Call instructions
2020-07-13 23:48:54 -07:00
Andrew Kelley
5da5ded743
stage2: detect unreferenced non-volatile asm and NOT
2020-07-13 23:48:26 -07:00
~nue
03f14c3102
Added octal formatting fo fmt functions. ( #5867 )
...
* Added octal formatting (specifier "o") to `formatIntValue` function.
* Added octal specifier test case in `fmt.zig` (under the "int.specifier" case)
2020-07-14 02:27:58 -04:00
Andrew Kelley
4f5e065d6e
stage2: add ZIR support for BoolNot
2020-07-13 20:47:47 -07:00
Andrew Kelley
14cef9dd3d
stage2 parser: split out PrefixOp into separate AST Nodes
...
This is part of a larger effort to improve the memory layout of AST
nodes of the self-hosted parser to reduce wasted memory. Reduction of
wasted memory also translates to improved performance because of fewer
memory allocations, and fewer cache misses.
Compared to master, when running `zig fmt` on the std lib:
* cache-misses: 801,829 => 768,624
* instructions: 3,234,877,167 => 3,232,075,022
* peak memory: 81480 KB => 75964 KB
2020-07-13 20:13:51 -07:00
Nathan Michaels
bc900cdeaf
Document top-level doc comments, per #2288 .
2020-07-13 22:57:23 +00:00
Andrew Kelley
fabdef44a8
Merge pull request #5831 from paulespinosa/langref-hello-world-more
...
Explain Language Ref's Hello World
2020-07-13 22:45:32 +00:00
Paul Espinosa
a8d8ce9733
Use Writer for Language Reference Hello World Example
...
`OutStream` has been deprecated, so the "Hello, World!" example has been
updated to use `Writer`.
2020-07-13 22:41:57 +00:00
Andrew Kelley
204f61d7f5
stage2: Module: use StringHashMapUnmanaged
2020-07-13 15:34:31 -07:00
Andrew Kelley
75a720565b
Merge branch 'stage2-condbr'
2020-07-13 00:32:12 -07:00
Andrew Kelley
c94652a2fd
stage2: add new test case
2020-07-13 00:31:55 -07:00
Andrew Kelley
08154c0deb
stage2: add retvoid support to CBE
2020-07-13 00:28:11 -07:00
Andrew Kelley
25b1c00c72
stage2: add implicit return void where applicable
2020-07-13 00:08:21 -07:00
Andrew Kelley
c306392b44
stage2: codegen: more branching support
2020-07-13 00:08:21 -07:00
Andrew Kelley
b75a51f94b
stage2: implement function calling convention for calls
2020-07-13 00:08:21 -07:00
Andrew Kelley
8fe63d5042
stage2: peer type resolution with noreturn
2020-07-13 00:08:21 -07:00
Andrew Kelley
1cab40d783
Merge pull request #5864 from pixelherodev/cbe
...
CBE: get basic returns working
2020-07-13 07:07:27 +00:00
Noam Preil
8d6cadee16
CBE: Code cleanup
2020-07-13 01:49:04 -04:00
Noam Preil
4a46248198
CBE: Only generate (void) for calls whose return values are ignored
2020-07-13 01:49:04 -04:00
Noam Preil
a124b027b4
CBE: Use hasCodeGenBits instead of checking against void and noreturn
2020-07-13 01:49:04 -04:00
Noam Preil
3bad1c16cc
Get basic return test working
2020-07-13 01:49:04 -04:00
pixelherodev
2c882b2e65
CBE: Make C an ObjectFormat instead of a special bool ( #5849 )
2020-07-12 22:56:31 -04:00
Vexu
dff1ac1089
check for invalid sentinel when creating pointer with @Type
2020-07-13 00:29:53 +00:00
Isaac Freund
ef17af1270
std: add mem.joinZ
...
currently the only options are doing a second allocation and copying or
implementing this yourself.
2020-07-12 22:17:40 +00:00
xackus
5b570bceb5
document a few functions in std.mem
2020-07-12 21:55:49 +00:00
Andrew Kelley
7adbc11403
Merge pull request #5857 from daurnimator/use-unmanaged
...
Use unmanaged datastructures from std.http.headers
2020-07-12 21:46:26 +00:00
Sam Tebbs
873e187f05
Make allocator test functions public
2020-07-12 21:45:25 +00:00
Jakub Konka
eea7271c4e
Fix incorrect continue condition in PreopeonList
...
Also, check for overflow on incremented file descriptors. Previously,
we'd trigger a panic if we exceeded the `fd_t` resolution. Now, instead,
we throw an `error.Overflow` to signal that there can be no more
file descriptors available from the runtime. This way we give the user
the ability to still be able to check if their desired preopen exists
in the list or not.
2020-07-12 21:02:33 +00:00
daurnimator
91235b9371
std: don't store allocator inside of std.http.HeaderEntry
2020-07-13 00:38:59 +10:00
daurnimator
f7e4014c82
std: use *Unmanaged data structures in http.Headers object
2020-07-13 00:34:58 +10:00
daurnimator
4b48266bb7
std: add StringHashMapUnmanaged
2020-07-13 00:34:02 +10:00
Vexu
e1a5e061ca
revert accidental format of tests
...
these test the tokenizers handling of EOF and formatting makes them useless
2020-07-12 11:27:50 +03:00
Vexu
bfe9d4184f
fix alignment parsing in stage1
2020-07-12 07:35:34 +00:00
Andrew Kelley
fe08a4d065
Merge pull request #5846 from Vexu/anytype
...
Rename 'var' type to 'anytype'
2020-07-12 07:35:01 +00:00
Andrew Kelley
2dcb70a6be
Merge pull request #5847 from Vexu/decl
...
Take advantage of new HashMap API's preserving order
2020-07-12 07:31:48 +00:00
Andrew Kelley
f23987db7d
Sponsors Button => ZSF
...
Zig Software Foundation
2020-07-11 18:33:56 -04:00
Vexu
be1507a7af
update compile error tests and some doc comments
2020-07-12 00:54:07 +03:00
Vexu
3e095d8ef3
use 'anytype' in translate-c
2020-07-11 22:04:38 +03:00
Vexu
1a989ba39d
fix parser tests and add test for anytype conversion
2020-07-11 21:20:50 +03:00
Vexu
e85fe13e44
run zig fmt on std lib and self hosted
2020-07-11 20:41:19 +03:00
Vexu
9907116478
use typeInfo instead of hardcoded tables in std.Target
2020-07-11 20:11:20 +03:00
Vexu
2e6688ae27
Add test for @typeInfo declarations showing up in declaration order
...
Both the stage1 and std lib HashMap implementations now preserve insertion order
2020-07-11 19:51:20 +03:00
Vexu
8110639c79
add 'anytype' to stage1 and langref
2020-07-11 17:41:33 +03:00
Vexu
c2fb4bfff3
add 'anytype' to self-hosted parser
2020-07-11 17:41:16 +03:00
Paul Espinosa
b45a2d72c8
Introduce Error Union and Use Writer
...
This commit edits the "Hello, World!" introduction. It introduces Error Union
Types. Also, it changes `outStream` to `writer` in the code example and description.
2020-07-11 18:08:00 +07:00
Vexu
2e037fd827
use correct cast function when doing @floatCast at comptime
2020-07-11 11:36:28 +03:00
Paul
e57458a94f
Update doc/langref.html.in
...
Co-authored-by: Joachim Schmidt <joachim.schmidt557@outlook.com >
2020-07-11 09:10:08 +07:00
Paul
50df1334f3
Update doc/langref.html.in
...
Co-authored-by: Joachim Schmidt <joachim.schmidt557@outlook.com >
2020-07-11 09:09:57 +07:00
Paul
656b640e79
Update doc/langref.html.in
...
Co-authored-by: Joachim Schmidt <joachim.schmidt557@outlook.com >
2020-07-11 09:09:43 +07:00
Paul
5afa7f2545
Update doc/langref.html.in
...
Co-authored-by: Joachim Schmidt <joachim.schmidt557@outlook.com >
2020-07-11 09:09:07 +07:00
Josh Wolfe
eddc68ad94
remove stray allocator parameter
2020-07-10 06:27:07 +00:00
Andrew Kelley
02619edf41
Revert "use correct cast function when doing @floatCast at comptime"
...
This reverts commit 2e1bdd0d14 .
Test failures
2020-07-09 23:24:21 -07:00
Vexu
2e1bdd0d14
use correct cast function when doing @floatCast at comptime
...
Closes #5832
2020-07-09 21:25:55 +03:00
Paul Espinosa
f510f38592
Explain Language Ref's Hello World
...
To introduce the Zig programming language, the "Hello, world!" code sample now has
documentation to explain some of the features shown in the code sample
and contains links to those features in the rest of the documentation.
Writing style goals:
* Balance writing style to keep beginner and experience programmers interested.
* Be concise: allow the rest of the documentation to clarify language features.
2020-07-09 21:32:51 +07:00
Andrew Kelley
a489ea0b2f
Merge branch 'register-allocation'
2020-07-08 21:03:28 -07:00
Andrew Kelley
bf56cdd9ed
start to make test runner aware of logging
...
by default the test runner will only print logs with "warning" or
higher. this can be configured via the std.testing API.
See #5738 for future plans
2020-07-08 21:01:13 -07:00
Andrew Kelley
7bd0500589
Merge remote-tracking branch 'origin/master' into register-allocation
2020-07-08 20:46:06 -07:00
Andrew Kelley
8e425c0c8d
stage2: if AST=>ZIR
2020-07-08 20:33:33 -07:00
Andrew Kelley
0e1c7209e8
Merge pull request #5822 from pixelherodev/cbe
...
CBE cleanup
2020-07-09 03:32:34 +00:00
Ryan Liptak
12a7dedb1f
langref: Expand "if error union with optional" test case
...
Follow-up to #5818 , closes #5819
2020-07-09 03:30:35 +00:00
xackus
2064e84cdd
ci: check langref.html for html errors
2020-07-08 19:34:44 +00:00
Ryan Liptak
f77c968cf8
langref: Add test case for "if error union with optional"
...
This is an edge case that isn't too uncommon but is rather confusing to try to deduce without documentation, since it feels like `else` is being overloaded in this scenario and there's no obvious 'correct' behavior here. This just adds a test demonstrating how Zig currently behaves in this scenario.
2020-07-08 19:32:15 +00:00
Paul Espinosa
eeae3a8f9d
Rename langref's Index to Contents (TOC)
...
The language reference's Index is a list of the documentation's contents in
order of appearance. This commit renames "Index" to "Contents" as in table of
contents. It also renames the HTML/CSS identifiers from "index" to "toc".
2020-07-08 19:31:38 +00:00
Noam Preil
d060be8804
CBE: Don't expose openCFile, always close file after an update
2020-07-08 14:10:11 -04:00
Noam Preil
6b48634166
CBE: Emit asm decls for now, but rename to make them valid
2020-07-08 14:05:07 -04:00
Andrew Kelley
6fbb5f0a81
Merge pull request #5816 from pixelherodev/cbe
...
Beginnings of C backend
2020-07-08 10:45:17 +00:00
Andrew Kelley
be0546d877
stage2: implement compare operator AST->ZIR
2020-07-08 07:04:43 +00:00
Andrew Kelley
5e60872060
stage2 misc fixes
2020-07-08 06:56:20 +00:00
Andrew Kelley
8849604131
stage2: proper indenting when printing ZIR text
2020-07-08 05:44:51 +00:00
Andrew Kelley
ab9df5b04b
stage2: machine code for condbr jumps
2020-07-08 05:35:41 +00:00
Noam Preil
9d92d62525
CBE: Only try to use GNU attribute when __GNUC__is set
2020-07-08 00:33:44 -04:00
Noam Preil
e2aad33d4e
Stage2: facepalm.
2020-07-08 00:11:41 -04:00
Noam Preil
9aaffe00d3
CBE: Cleanup unimplementeds
2020-07-07 23:59:55 -04:00
Noam Preil
089c056dbe
CBE: Improve resource cleanup
2020-07-07 23:24:30 -04:00
Noam Preil
7a6104929b
CBE: truncate output file
2020-07-07 23:19:25 -04:00
Noam Preil
173e671241
CBE: Some cleanup
2020-07-07 23:11:17 -04:00
Vexu
5667a21b1e
fix missing check on extern variables with no type
2020-07-08 03:09:41 +00:00
Noam Preil
b91cf15972
CBE: Move standards determination to generated code
2020-07-07 22:57:34 -04:00
Noam Preil
5461c482d0
CBE: Integrate into stage2 via --c-standard
2020-07-07 21:54:34 -04:00
Noam Preil
64bf130182
CBE: working asm Inputs and Outputs; std{int,def}.h auto-inclusion
2020-07-07 21:35:42 -04:00
Noam Preil
cf09b335d8
CBE: Working function call w/ no args or return value
2020-07-07 19:35:33 -04:00
Andrew Kelley
597a363673
Merge pull request #5755 from kubkon/dir-iter-tests
...
[libstd]: add Dir.Iterator tests
2020-07-07 23:13:58 +00:00
Noam Preil
cf86aa8772
Fix a dumb in tests
2020-07-07 18:43:25 -04:00
Jakub Konka
417c928952
Add comment about memory invalidation in Iterator.next on Win
2020-07-08 00:03:45 +02:00
Noam Preil
6ece36a051
Working translation of empty function
2020-07-07 17:51:59 -04:00
Noam Preil
2f28ecf946
CBE: Get test more useful
2020-07-07 17:06:07 -04:00
Noam Preil
aaaebfe97f
Detect unexpected compilation errors in tests
2020-07-07 16:47:39 -04:00
Noam Preil
a17200dab1
CBE skeleton
2020-07-07 16:40:14 -04:00
Noam Preil
b4c571301b
Stage2: Refactor in preparation for C backend
2020-07-07 14:55:44 -04:00
Andrew Kelley
b55d0193e4
stage2: progress towards Block and CondBr codegen
2020-07-07 08:01:54 +00:00
Andrew Kelley
4d01385e14
fix liveness analysis and not correctly propagating link errors
...
We still flush the ELF file even when there are compile errors.
2020-07-07 03:48:20 +00:00
Noam Preil
0db0258fb2
Remove old comment
2020-07-06 17:54:06 -04:00
Vexu
485231deae
fix HashMap.clone()
2020-07-06 16:51:53 +03:00
Andrew Kelley
12737c9a30
stage2: codegen skeleton for cmp and sub
2020-07-06 09:21:57 +00:00
Andrew Kelley
8be8ebd698
stage2: skeleton codegen for x64 ADD
...
also rework Module to take advantage of the new hash map implementation.
2020-07-06 06:10:44 +00:00
Andrew Kelley
ad2ed457dd
std: expose unmanaged hash maps
...
These are useful when you have many of them in memory, and already have
the allocator stored elsewhere.
2020-07-06 06:10:03 +00:00
Andrew Kelley
a2fd8f72c1
std: add new array list functions
2020-07-06 06:09:47 +00:00
Andrew Kelley
8fb392dbb4
stage2: implement liveness analysis
2020-07-05 23:20:08 +00:00
Andrew Kelley
abcd4ea5d8
Merge pull request #5793 from pfgithub/stage-2-testing
...
stage2 + operator and @as builtin
2020-07-05 22:58:05 +00:00
Alluet
a0a93f2091
Rewrite std.fmt.parseInt
2020-07-05 22:56:06 +00:00
Andrew Kelley
682fccaaf0
Merge branch 'emekoi-windowsver-fix'
...
closes #5011
2020-07-05 22:44:46 +00:00
Andrew Kelley
86ef3202dd
add doc comment for std.Target.Os.WindowsVersion
2020-07-05 22:44:25 +00:00
emekoi
68be229917
added custom format method for WindowsVersion
2020-07-05 22:43:10 +00:00
Jonathan Marler
27c1e0b453
Fix issue 5757: increase branch quota for formatting enums
2020-07-05 22:27:50 +00:00
Andrew Kelley
dcca5cf1a9
Merge pull request #5797 from xackus/intcast-runtime-safety
...
stage1: `@intcast` runtime safety for unsigned -> signed of same bit count
2020-07-05 22:24:25 +00:00
Andrew Kelley
289eab9177
Merge pull request #5786 from ziglang/std-hash-map
...
reimplement std.HashMap
2020-07-05 21:12:20 +00:00
Andrew Kelley
3a89f214aa
update more HashMap API usage
2020-07-05 21:11:42 +00:00
Andrew Kelley
3c8b13d998
std hash map: do the pow2 improvement again
...
it's a noticeable speedup
2020-07-05 21:11:42 +00:00
Andrew Kelley
632acffcbd
update std lib to new hash map API
2020-07-05 21:11:42 +00:00
Andrew Kelley
b3b6ccba50
reimplement std.HashMap
...
* breaking changes to the API. Some of the weird decisions from before
are changed to what would be more expected.
- `get` returns `?V`, use `getEntry` for the old API.
- `put` returns `!void`, use `fetchPut` for the old API.
* HashMap now has a comptime parameter of whether to store hashes with
entries. AutoHashMap has heuristics on whether to set this parameter.
For example, for integers, it is false, since equality checking is
cheap, but for strings, it is true, since equality checking is
probably expensive.
* The implementation has a separate array for entry_index /
distance_from_start_index. Entries no longer has holes; it is an
ArrayList, and iteration is simpler and more cache coherent.
This is inspired by Python's new dictionaries.
* HashMap is separated into an "unmanaged" and a "managed" API. The
unmanaged API is where the actual implementation is; the managed API
wraps it and provides a more convenient API, storing the allocator.
* Memory usage: When there are less than or equal to 8 entries, HashMap
now incurs only a single pointer-size integer as overhead, opposed to
using an ArrayList.
* Since the entries array is separate from the indexes array, the holes
in the indexes array take up less room than the holes in the entries
array otherwise would. However the entries array also allocates
additional capacity for appending into the array.
* HashMap now maintains insertion order. Deletion performs a "swap
remove". It's now possible to modify the HashMap while iterating.
2020-07-05 21:11:42 +00:00
xackus
b8553b4813
compiler-rt: fix bugs uncovered by previous commit
2020-07-05 20:44:08 +02:00
xackus
51f8c306d9
stage1: add missing runtime safety for @intCast unsigned -> signed of same bit count
2020-07-05 17:58:21 +02:00
pfg
4a63189bf1
stage2: add and @as tests
2020-07-04 15:30:17 -07:00
pfg
d4456d92f5
stage2: builtin @as
2020-07-04 15:16:46 -07:00
pfg
1d52438bd5
stage2: InfixOp add
2020-07-04 15:16:46 -07:00
joachimschmidt557
0ae1157e45
std.mem.dupe is deprecated, move all references in std
...
Replaced all occurences of std.mem.dupe in stdlib with
Allocator.dupe/std.mem.dupeZ -> Allocator.dupeZ
2020-07-04 21:40:06 +03:00
heidezomp
672b4d5c24
zig build --help: Consistent capitalization/punctuation
2020-07-04 13:00:53 +00:00
pfg
65aac13257
don't try to find config_h if it's not needed
2020-07-04 12:50:37 +00:00
Andrew Kelley
70dca0a0c6
Merge pull request #5779 from ziglang/stage1-hash-map
...
stage1 HashMap: store hash & do robin hood hashing
2020-07-03 17:11:54 +00:00
Andrew Kelley
f281b928d9
cmake: add -DZIG_WORKAROUND_POLLY_SO
...
to work around #4799 until a newer llvm version is released.
2020-07-03 04:48:48 +00:00
Andrew Kelley
72cd11dd60
Merge branch 'timotheecour-pr_fix_4799'
...
closes #5092
2020-07-03 04:43:21 +00:00
Andrew Kelley
14e07e9a72
clean up readme
2020-07-03 04:43:05 +00:00
Timothee Cour
9a7f05378f
fix https://github.com/ziglang/zig/issues/4799
2020-07-03 04:40:25 +00:00
Andrew Kelley
22f0a103c3
stage1 HashMap: linear scan for < 16 entries
2020-07-03 03:50:35 +00:00
Andrew Kelley
df2c27eb48
stage1 HashMap: store hash & do robin hood hashing
...
This adds these two fields to a HashMap Entry:
uint32_t hash
uint32_t distance_from_start_index
Compared to master branch, standard library tests compiled 8.4% faster
and took negligible (0.001%) more memory to complete. The amount of
memory used is still down from before 8b82c40104 which moved indexes
to be stored separately from entries.
So, it turns out, keeping robin hood hashing plus separating indexes
did result in a performance improvement. What happened previously is
that the gains from separating indexes balanced out the losses from
removing robin hood hashing, resulting in a wash.
This also serves as an inspiration for adding a benchmark to
std.AutoHashMap and improving the implementation.
2020-07-02 22:38:55 +00:00
Jakub Konka
e7d02eae4d
Update lib/std/fs/test.zig
...
Co-authored-by: Joachim Schmidt <joachim.schmidt557@outlook.com >
2020-07-02 20:54:57 +02:00
Ian Simonson
70cc1751ca
Translate-c fix rhs not cast on array access
...
Closes #5671 . Checks if the rhs is integral and of
differing or the same signedness. If they are different
does an @intCast to the lhs type
2020-07-02 14:05:12 +00:00
Jakub Konka
b5badd1122
Fix memory corruption in Dir.Iterator test
2020-07-02 10:35:44 +02:00
Jakub Konka
64bd134818
Add Dir.Iterator tests
...
This commit adds some `std.fs.Dir.Iterator` tests.
2020-07-02 10:35:44 +02:00
Andrew Kelley
8b82c40104
stage1: reimplement HashMap
...
The indexes are stored separately using an array of
uint8_t, uint16_t, uint32_t, or size_t, depending on the number of
entries in the map.
Entries only contain a key and a value, no longer have
distance_from_start_index or is_used.
In theory this should be both faster and use less memory.
In practice it seems to have little to no effect. For the standard
library tests, vs master branch, the time had no discernable
difference, and it shaved off only 13 MiB of peak rss usage.
2020-07-02 04:53:26 +00:00
luna
e2cfc65909
Merge branch 'master' into ebadf-error
2020-07-02 00:49:56 -03:00
Andrew Kelley
6f98ef09e3
Merge pull request #5717 from squeek502/fs-dir-file-ops
...
Add tests for using file operations on directories
2020-07-01 23:20:50 +00:00
Andrew Kelley
d2a4e5e226
Merge pull request #5749 from kubkon/wasi-notcapable
...
[libstd]: handle ENOTCAPABLE in WASI
2020-07-01 23:12:26 +00:00
Alexandros Naskos
30ae7f7573
Corrected default value field initialization in std.zeroInit
2020-07-01 23:09:08 +00:00
Chris Watson
b8d5b3e611
Add documentation for @src() builtin
2020-07-01 22:22:30 +00:00
CodeMyst
7eed220924
in docs removed "path can be absolute" for imports
2020-07-01 22:12:44 +00:00
Andrew Kelley
f69875d85c
build: -Dlib-files-only prevents self-hosted compiler from being built
...
closes #5756
2020-07-01 21:57:04 +00:00
Shawn Anastasio
51fcf949f9
Implement std.start for powerpc64le
...
This is a bit hacky since we end up doing more than just grabbing
the stack pointer in the inline assembly block. Ideally _start would
be implemented in pure asm for powerpc64le, but this will do for now.
Still to be implemented is powerpc, powerpc64, and powerpc64 (ELFv2)
support. The latter will just require correctly determing target ABI
for powerpc64 and enabling the existing powerpc64le implementation for
it.
2020-07-01 16:13:14 -05:00
Shawn Anastasio
8574861ca0
Implement required ABI bits for powerpc{,64,64le}
2020-07-01 16:12:27 -05:00
Shawn Anastasio
15371775d1
Implement clone() for powerpc64{,le}
...
Implementation borrowed from musl, as most (all?) of the other
ones seem to be.
2020-07-01 16:11:26 -05:00
Shawn Anastasio
ec0d775524
Implement std.os for powerpc64{,le}
2020-07-01 16:10:49 -05:00
antlilja
dcc406deff
Add new error message for unreachable else prongs
...
* Adds error message for types: enum, int and bool
* Adds compile error tests
2020-07-01 16:09:36 +02:00
Jakub Konka
8306826d53
Map ENOTCAPABLE into error.AccessDenied instead of error.NotCapable
...
This is direct result of review comments left by andrewrk and
daurnimator. It makes sense to map `ENOTCAPABLE` into a more generic
`error.AccessDenied`.
2020-06-30 18:21:38 +02:00
Jakub Konka
5bc99dd7e8
Fix more compilation errors
2020-06-29 21:42:11 +02:00
Luna
3f5b2d6c51
std.os: map EBADF to errors on WASI read/write syscalls
2020-06-29 16:23:58 -03:00
Jakub Konka
b96882c57a
Fix compilation errors
2020-06-29 18:09:22 +02:00
Jakub Konka
bf8bf528c6
Handle ENOTCAPABLE in WASI
...
This commit adds `error.NotCapable` enum value and makes sure that
every applicable WASI syscall that can return `ENOTCAPABLE` errno
remaps it to `error.NotCapable.
2020-06-29 17:10:01 +02:00
Jonathan Marler
67e97a1f0f
ArenaAllocator: use full capacity
2020-06-29 05:12:30 -04:00
Jonathan Marler
35e8876c23
Revert "arena_allocator: refactor and use full capacity"
...
This reverts commit e120b07a52 .
2020-06-29 05:12:30 -04:00
Andrew Kelley
1eed0cf0f3
zig fmt and delete unused type
2020-06-28 19:45:10 -04:00
Andrew Kelley
aa92446365
stage2: implement function parameters
...
In codegen.zig, the std.Target.Cpu.Arch is now generally available as a
comptime value where needed. This is a tradeoff that causes the compiler
binary to be more bloated, but gives us higher performance, since the
optimizer can optimize per architecture (which is usually how compilers
are designed anyway, with different code per-architecture), and it also
allows us to use per-architecture types, such as a Register enum that is
specific to the comptime-known architecture.
Adds abiSize method to Type.
2020-06-28 19:45:10 -04:00
Jonathan Marler
e120b07a52
arena_allocator: refactor and use full capacity
2020-06-28 18:40:15 -04:00
Jonathan Marler
c2eead9629
Fix issue 5741, use after free
2020-06-28 18:05:18 -04:00
Luna
f47c6d3c6b
std.os: make EBADF return error for read and write
2020-06-28 18:40:43 -03:00
Ryan Liptak
74c245aea9
Disable wasi 'readFileAlloc on a directory' assertion for now
2020-06-28 13:56:00 -07:00
Jonathan Marler
374e3e42e0
WasmPageAllocator: fix bug not aligning allocations
2020-06-28 14:25:39 -04:00
Andrew Kelley
581d16154b
Merge pull request #5696 from alexnask/async_call_tuple
...
@asyncCall now takes arguments as a tuple instead of varargs
2020-06-28 01:00:58 -04:00
Andrew Kelley
ac6bf53069
stage2: clean up test harness, implement symbol collision detection ( #5708 )
...
* Clean up test harness
* Stage2/Testing: Add convenience wrappers
* Add a `compiles` wrapper case
* fix incremental compilation after error
* exported symbol collision detection
* function redefinition detection for Zig code
* handle missing function names
* Stage2/Testing: Simplify incremental compilation tests
* Stage2/Testing: Update documentation
* Stage2/TestHarness: Improve progress reporting
* Disable test
* Improve Tranform failure output
2020-06-27 21:54:11 -04:00
Noam Preil
80b70470c0
Stage2/Module: Add symbol -> export lookup table
2020-06-27 21:50:59 -04:00
Noam Preil
ffca1569d1
Return instead of branch
2020-06-27 21:39:39 -04:00
Noam Preil
38d2c5cdf1
Rename type -> extension
2020-06-27 21:39:04 -04:00
Noam Preil
1861c25142
Improve Tranform failure output
2020-06-27 21:15:23 -04:00
Noam Preil
97c41e7152
Disable test
2020-06-27 21:10:44 -04:00
Noam Preil
54148a8c88
Stage2/TestHarness: Improve progress reporting
2020-06-27 20:01:20 -04:00
Andrew Kelley
0cfe8e5d6f
Merge pull request #5064 from marler8997/newAllocator
...
new allocator interface
2020-06-27 18:21:00 -04:00
Jonathan Marler
a728436992
new allocator interface after Andrew Kelley review
2020-06-27 08:57:35 -06:00
Noam Preil
ab307a22f6
Stage2: remove clearErrors, fix ZIR export collision detection
2020-06-27 07:17:20 -04:00
Ryan Liptak
626b5eccab
Move fs-specific tests from os/test.zig to fs/test.zig
...
The moved tests do not use `std.os` directly and instead use `std.fs` functions, so it makes more sense for them to be in `fs/test.zig`
2020-06-27 10:17:08 +00:00
Ryan Liptak
12aca758c6
Dir.deleteFile: Fix symlink behavior when translating EPERM to EISDIR
2020-06-26 17:12:02 -07:00
Ryan Liptak
505bc9817a
Implement Dir.deleteFile in terms of deleteFileZ/deleteFileW
...
Reduces duplicate code, consistent with other fn/fnZ/fnW implementations
2020-06-26 16:08:26 -07:00
Ryan Liptak
14c3c47fb7
fs.deleteFile: Translate to error.IsDir when appropriate on POSIX systems
...
Linux deviates from POSIX and returns EISDIR while other POSIX systems return EPERM. To make all platforms consistent in their errors when calling deleteFile on a directory, we have to do a stat to translate EPERM (AccessDenied) to EISDIR (IsDir).
2020-06-26 16:00:43 -07:00
Jonathan Marler
dc9648f868
new allocator interface
2020-06-26 13:34:48 -06:00
Andrew Kelley
bb55889ce0
README: add link to troubleshooting build issues wiki page
...
See #5673
2020-06-26 15:10:30 -04:00
Noam Preil
52787f2c9b
Fix a dumb
2020-06-26 06:52:29 -04:00
Noam Preil
6d536168b0
Stage2/Testing: Update documentation
2020-06-26 06:51:35 -04:00
Noam Preil
0e952a9f3a
Stage2/Testing: Simply incremental compilation tests
2020-06-26 05:00:53 -04:00
Noam Preil
c8f60b2e2f
Stage2: handle missing function names
2020-06-26 04:36:17 -04:00
Noam Preil
6510888039
Stage2: function redefinition detection for Zig code
2020-06-26 04:05:41 -04:00
Noam Preil
4a17e008da
Stage2: exported symbol collision detection
2020-06-26 03:17:13 -04:00
Noam Preil
e5a3cb8d71
Stage2: fix incremental compilation after error
2020-06-26 03:16:36 -04:00
Noam Preil
53fead580e
Add a compiles wrapper case
2020-06-26 03:09:56 -04:00
Ryan Liptak
0e3d74df8a
Add tests for using file operations on directories
2020-06-26 00:06:23 -07:00
Noam Preil
649da2df52
Stage2/Testing: Add convenience wrappers
2020-06-26 02:42:02 -04:00
Andrew Kelley
130c7fd23b
self-hosted: working towards conditional branching test case
...
New features:
* Functions can have parameters in semantic analysis. Codegen
is not implemented yet.
* Support for i8, i16, i32, i64, u8, u16, u32, u64 primitive
identifiers.
* New ZIR instructions: arg, block, and breakvoid
Implementation details:
* Move Module.Body to ir.Body
* Scope.Block gains a parent field and an optional Label field
* Fix bug in integer type equality comparison.
Here's the test case I'm working towards:
```
@void = primitive(void)
@i32 = primitive(i32)
@fnty = fntype([@i32, @i32], @void)
@0 = str("entry")
@1 = export(@0, "entry")
@entry = fn(@fnty, {
%0 = arg(0)
%1 = arg(1)
%2 = add(%0, %1)
%3 = int(7)
%4 = block("if", {
%neq = cmp(%2, neq, %3)
%5 = condbr(%neq, {
%6 = unreachable()
}, {
%7 = breakvoid("if")
})
})
%11 = returnvoid()
})
```
$ ./zig-cache/bin/zig build-obj test.zir
test.zir:9:12: error: TODO implement function parameters for Arch.x86_64
That's where I left off.
2020-06-26 02:30:14 -04:00
Andrew Kelley
e820678ca1
Merge pull request #5588 from tgschultz/leb128-output
...
LEB128 overhaul and output
2020-06-25 19:10:31 -04:00
Andrew Kelley
061c8be049
Merge pull request #5684 from squeek502/fs-file-dir-ops
...
Add tests for using directory operations on files
2020-06-25 19:08:30 -04:00
data-man
77bb2dc094
Use writer in benchmarks
2020-06-25 19:07:25 -04:00
Ryan Liptak
dcdbb7006c
Add tests for using directory operations on files
2020-06-25 03:49:58 -07:00
Ryan Liptak
f50ed94174
Windows: Fix fs.Dir.openDir not handling STATUS_NOT_A_DIRECTORY
...
Now correctly returns error.NotDir
2020-06-25 03:49:58 -07:00
Andrew Kelley
41c6cc9001
Merge pull request #5677 from kubkon/fstatat
...
[libstd]: implement fstatat in WASI plus fix on macOS
2020-06-25 00:01:38 -04:00
arbrk1
78d8931647
Fix issue #5618 ( #5685 )
...
* fix issue #5618
* A test for the issue #5618 added.
Also inserted a comma in the neighboring test to make it more zigfmt-friendly.
2020-06-24 23:58:50 -04:00
Alexandros Naskos
2fde8249b7
Fixed crash when resolving peer types of *[N:s]const T and [*:s]const T
2020-06-24 23:58:02 -04:00
Noam Preil
c88edbc46f
OOM -> catch unreachable
2020-06-24 23:34:58 -04:00
Noam Preil
5d7e981f95
Clean up test harness
2020-06-24 22:43:18 -04:00
Andrew Kelley
d337469e44
Merge pull request #5583 from ziglang/zig-ast-to-zir
...
self-hosted: hook up Zig AST to ZIR
2020-06-24 22:37:58 -04:00
Code Hz
7875649c24
Pdb.openFile use []const u8 instead of []u8
2020-06-24 22:27:30 -04:00
Andrew Kelley
20b4a2cf2c
self-hosted: add compare output test for new AST->ZIR code
2020-06-24 21:28:42 -04:00
Andrew Kelley
5aa3f56773
self-hosted: fix test regressions
...
I'm allowing incremental compilation of ZIR modules to be broken. This
is not a real use case of ZIR, and the feature requires a lot of code
duplication with incremental compilation of Zig AST (which works great).
2020-06-24 20:28:52 -04:00
Andrew Kelley
fd7a97b3b2
fix memory leak of anonymous decl name
2020-06-24 16:20:02 -04:00
Andrew Kelley
e42b7702eb
Merge remote-tracking branch 'origin/master' into zig-ast-to-zir
2020-06-24 15:36:59 -04:00
Alexandros Naskos
129a4fb251
Copy union const values correctly
2020-06-24 15:21:58 -04:00
Jakub Konka
d40e367b73
Reformat using if-else where appropriate
2020-06-24 21:00:21 +02:00
Jakub Konka
c63b23d684
Use fstatat on macOS (otherwise uses 32bit)
2020-06-24 21:00:21 +02:00
Jakub Konka
be78b7b648
Implement fstatat targeting WASI
...
Also, add more informative `@compileError` in a few `std.os` functions
that would otherwise yield a cryptic compile error when targeting
WASI. Finally, enhance docs in a few places and add test case for
`fstatat`.
2020-06-24 21:00:21 +02:00
Andrew Kelley
2c7fc1c5c5
Merge branch 'marler8997-fixAzureMsys2'
...
closes #5688
closes #5679
2020-06-24 14:53:02 -04:00
Andrew Kelley
489c31b6f5
azure ci: install tar and xz with pacman
2020-06-24 14:52:34 -04:00
Jonathan Marler
3a2cc5decf
azure-pipelines: fix msys2 install
2020-06-24 14:33:01 -04:00
antlilja
e60be30824
Remove unreachable else prongs
2020-06-24 19:03:32 +02:00
Alexandros Naskos
ff2ddcf38d
Updated @asyncCall docs
2020-06-24 19:01:38 +03:00
Alexandros Naskos
7f342451b6
Fixed @asyncCall in runtime safety test
2020-06-24 18:43:11 +03:00
antlilja
fd50696359
Store else node in IrInstSrcCheckSwitchProngs
...
* Remove have_else_prong (bool)
* Add else_prong (AstNode*)
2020-06-24 17:36:24 +02:00
Alexandros Naskos
eefcd04462
Small fixes, fixed tests, added test for argument tuple type
2020-06-24 16:56:24 +03:00
Alexandros Naskos
50b70bd77f
@asyncCall now requires an argument tuple
2020-06-24 14:07:39 +03:00
Andrew Kelley
14aa08fcd3
self-hosted: restore ZIR functionality
2020-06-24 03:46:32 -04:00
Andrew Kelley
3aab6012c4
Revert "building mingw-w64 for windows ARM looks in lib64/lib32 for .def files"
...
This reverts commit 93f0bcb649 .
This is not correct (from #mingw-w64 IRC):
<andrewrk> is there no .def file for ntdll on arm 64 bit?
<andrewrk> or does mingw-w64-crt/lib64/ntdll.def apply to both x86_64
and aarch64?
<wbs> andrewrk: there's none at the moment (as apps rarely link directly
against ntdll, and I didn't want to guess needlessly around that one
originally when I added arm64 support, before I actually had a real
arm64 windows device)
<wbs> andrewrk: but I guess I could/should complete that now
<wbs> (if you need one right now, the libarm32 one probably is the
closest match)
2020-06-24 02:08:08 -04:00
Andrew Kelley
93f0bcb649
building mingw-w64 for windows ARM looks in lib64/lib32 for .def files
2020-06-24 01:59:19 -04:00
Andrew Kelley
b1b7708cc8
self-hosted: hook up incremental compilation to .zig source code
2020-06-23 23:29:51 -04:00
Andrew Kelley
a1a1f94a0d
Merge pull request #5681 from kubkon/refactor-wasi-preopens
...
[libstd]: refactor std.fs.wasi.PreopenList.find()
2020-06-23 22:23:20 -04:00
Andrew Kelley
d9c1d8fed3
self-hosted: improve handling of anonymous decls
...
* anonymous decls have automatically generated names and symbols, and
participate in the same memory management as named decls.
* the Ref instruction is deleted
* the DeclRef instruction now takes a `[]const u8` and DeclRefStr takes
an arbitrary string instruction operand.
* introduce a `zir.Decl` type for ZIR Module decls which holds
content_hash and name - fields that are not needed for `zir.Inst`
which are created as part of semantic analysis. This improves the
function signatures of Module.zig and lowers memory usage.
* the Str instruction is now defined to create an anonymous Decl and
reference it.
2020-06-23 19:53:32 -04:00
Jakub Konka
5fed725e0a
Remove some leftover debugging checks
2020-06-23 23:59:32 +02:00
Jakub Konka
66e5205047
Refactor PreopenList.find()
...
This commit generalizes `std.fs.wasi.PreopenList.find(...)` allowing
search by `std.fs.wasi.PreopenType` union type rather than by dir
name. In the future releases of WASI, it is expected to have more
preopen types (or capabilities) than just directories. This commit
aligns itself with that vision.
This is a potentially breaking change. However, since `std.fs.wasi.PreopenList`
wasn't made part of any Zig release yet, I think we should be OK
to introduce those changes without pointing to any deprecations.
2020-06-23 21:54:36 +02:00
antlilja
0de35af98b
Add duplicate checking for switch on types
...
* Add compile error tests
2020-06-23 15:17:04 -04:00
antlilja
46106b018c
Add expectWithinEpsilon + test
2020-06-23 18:08:15 +02:00
antlilja
2fc2355fc3
Add expectWithinMargin and test
2020-06-23 18:05:32 +02:00
Andrew Kelley
6938245fcc
Merge remote-tracking branch 'origin/master' into zig-ast-to-zir
2020-06-22 23:22:17 -04:00
Vexu
7b68385d7d
self-hosted: astGenIntegerLiteral support other bases
2020-06-22 23:19:12 -04:00
Vexu
d98aed6eff
self-hosted: generalize astGenBuiltinCall
2020-06-22 23:19:12 -04:00
Andrew Kelley
78c6d39cd4
Merge pull request #5667 from cartr/windows-arguments-unclosed-quote
...
In std.process.ArgIteratorWindows, don't treat unclosed quotes like they're escaped
2020-06-22 20:07:43 -04:00
Jakub Konka
923c0feda1
Add std.fs.File.readAllAlloc tests
...
This commit adds some unit tests for `std.fs.File.readAllAlloc`
function. It also updates the docs of `Reader.readNoEof`
which were outdated, and swaps `inStream()` for `reader()` in
`File.readAllAlloc` with the former being deprecated.
2020-06-22 20:03:21 -04:00
Andrew Kelley
6ff6ac866d
Merge pull request #5666 from kubkon/symlinkat-readlinkat
...
[libstd]: enhance std.os.{symlinkat, readlinkat} coverage
2020-06-22 20:02:27 -04:00
Andrew Kelley
44bd0a2670
Merge pull request #5662 from shtanton/meta-cast
...
Adds std.meta.cast and uses it to simplify translate-c
2020-06-22 19:54:30 -04:00
prime31
65ef74e2cd
try allocation of pointer type when parsing (#5665 )
...
* `try` allocation of pointer type when parsing
* fixes pointer destroy compile error
2020-06-22 17:30:02 +03:00
Carter Sande
7cb41a415a
ArgIteratorWindows: simplify quote state tracking
2020-06-22 03:03:30 -07:00
Carter Sande
8faa85ac19
ArgIteratorWindows: don't treat unclosed quotes like they're escaped
2020-06-22 03:03:20 -07:00
Jakub Konka
c950f0c6c3
Enhance std.os.readlinkat coverage
...
Adds Windows stub (still needs to be implemented on Windows),
adds WASI implementation, adds unit test testing basic chain of
ops: create file -> symlink -> readlink.
2020-06-22 09:40:06 +02:00
Jakub Konka
64078ca924
Enhance std.os.symlinkat coverage
...
Fixes `std.os.symlinkat` compile errors, adds Windows stub (still
needs to be implemented), adds WASI implementation.
2020-06-22 09:14:51 +02:00
Charlie Stanton
8c15cfe3da
Compacts switch statements and string literal
2020-06-21 21:48:12 +01:00
xackus
d907f574e0
stage1: fix concat of sliced str literals
2020-06-21 14:57:12 -04:00
Robin Voetter
8696e52a3d
Make unary minus for unsigned types a compile error ( #5654 )
...
* Make unary minus for unsigned types a compile error
* Add unreachable when generating unsigned negate
2020-06-21 14:55:44 -04:00
Andrew Kelley
126f5702df
Merge pull request #5655 from squeek502/zig-fmt-cli-test
...
Add zig fmt to cli tests
2020-06-21 14:54:58 -04:00
Charlie Stanton
6f47513009
Adds std.meta.cast and uses it to simplify translate-c
2020-06-21 18:24:59 +01:00
Alexandros Naskos
b70c38c33c
Close source file after reading it in zig fmt
2020-06-21 12:22:16 -04:00
Ryan Liptak
399f6b77c4
Add 'no changes' test to zig fmt cli test
2020-06-20 22:21:23 -07:00
Ryan Liptak
b216d8de88
Simplify unformatted code in zig fmt cli test
2020-06-20 22:20:23 -07:00
Ryan Liptak
b5f90244a4
temporary: Add test-cli step for only running cli tests
2020-06-20 22:02:56 -07:00
Ryan Liptak
ca9d8a1337
Add zig fmt test to cli tests for both files and directories
...
Should catch basic `zig fmt` regressions that were previously going uncaught and breaking things
2020-06-20 22:02:55 -07:00
Nameless
56220449ab
Add errors to windows.WSAStartup and WSACleanup
2020-06-21 00:13:06 -04:00
Andrew Kelley
edea7a46e5
Merge branch 'DrDeano-master'
...
closes #5648
2020-06-20 23:06:04 -04:00
Andrew Kelley
faf783e595
implement new stat functionality for WASI
2020-06-20 22:09:47 -04:00
Andrew Kelley
225f196842
std.fs: fix shadowing stat with a local variable
2020-06-20 20:43:56 -04:00
Andrew Kelley
64dfd1883e
zig fmt: avoid unnecessary file system access
...
zig fmt previously would write a temp file, and then either rename it
into place if necessary, or unlink it if nothing was changed. Now zig
fmt renders into a memory buffer, and only writes the temp file and
renames it into place if anything changed.
Based on the performance testing I did this actually did not have much
of an impact, however it's likely that on other operating systems and
other hard drives this could make a big difference.
2020-06-20 20:14:33 -04:00
Andrew Kelley
0a9672fb86
rework zig fmt to avoid unnecessary realpath() calls
...
* add `std.fs.Dir.stat`
* zig fmt checks for sym link loops using inodes instead of using
realpath
2020-06-20 19:46:14 -04:00
Andrew Kelley
da549a72e1
zig fmt
2020-06-20 18:39:15 -04:00
Andrew Kelley
d87cd06296
rework zig fmt to use less syscalls and open fds
...
* `std.fs.Dir.Entry.Kind` is moved to `std.fs.File.Kind`
* `std.fs.File.Stat` gains the `kind` field, so performing a stat() on
a File now tells what kind of file it is. On Windows this only will
distinguish between directories and files.
* rework zig fmt logic so that in the case of opening a file and
discovering it to be a directory, it closes the file descriptor
before re-opening it with O_DIRECTORY, using fewer simultaneous open
file descriptors when walking a directory tree.
* rework zig fmt logic so that it pays attention to the kind of
directory entries, and when it sees a sub-directory it attempts to
open it as a directory rather than a file, reducing the number of
open() syscalls when walking a directory tree.
2020-06-20 18:27:37 -04:00
DrDeano
bc0ca73887
Moved the check for formatting a directory
...
The original check for a directory was for the `readAllAlloc` so move the check from open to read. This in turn fixes the fmt step in the build script for directories.
2020-06-20 17:25:12 -04:00
data-man
5229f6ec68
Use writer in std.fmt
2020-06-20 18:23:57 +00:00
Veikka Tuominen
aa894cea2c
Merge pull request #5645 from Sobeston/patch-7
...
langref - document that This works on enums too
2020-06-20 11:34:07 +00:00
Sebastian
8527718350
langref - document that This works on enums too
2020-06-20 12:16:57 +01:00
Eleanor NB
605769ec25
Replaced all occurrences of std.debug.warn in the docs with std.debug.print
2020-06-19 19:03:37 -04:00
Haze Booth
237c5429b0
Don't attempt to use io from thin air
2020-06-19 02:06:27 -04:00
Andrew Kelley
c9a0ec25e0
self-hosted: add Tracy integration
...
This tool helps give an intuitive picture of performance. This will help
us understand where to improve the code.
2020-06-18 21:55:37 -04:00
Andrew Kelley
0d18eda1d6
Merge pull request #5348 from ifreund/std-log
...
Introduce std.log
2020-06-18 21:40:06 -04:00
Andrew Kelley
c70633eacd
Merge pull request #5203 from tadeokondrak/@type-for-even-more-types
...
implement @typeInfo for Frame and implement @Type for Frame, EnumLiteral, and ErrorSet
2020-06-18 21:25:03 -04:00
Andrew Kelley
b9e3df92db
Merge branch 'deingithub-fmt-mode-thingybob'
...
closes #5617
closes #5616
2020-06-18 21:09:32 -04:00
Andrew Kelley
f7bcc8e040
rework zig fmt to only make one allocation
...
taking advantage of the fstat size
2020-06-18 21:08:30 -04:00
Cassidy Dingenskirchen
8b49487c33
Fix fs.File.mode() not returning mode_t on windows
2020-06-18 20:41:40 -04:00
Cassidy Dingenskirchen
b30642a86a
Fix zig fmt clobbering a file's mode
2020-06-18 20:41:40 -04:00
Michael Rees
bd17a373cc
Add std.unicode.Utf8Iterator.peek
2020-06-18 20:35:03 -04:00
Andrew Kelley
5ea0f589c9
Merge pull request #5625 from antlilja/master
...
Improve support for f128 and comptime_float operations
2020-06-18 20:32:43 -04:00
Vexu
caaa26c9f0
reference emit_raw in std lib tests
2020-06-18 20:17:53 -04:00
Andrew Kelley
355319fb67
zig cc: add missing cxxabi include path
2020-06-18 18:17:26 -04:00
Andrew Kelley
7e44302260
stage2: explicit hash and equality function for the DeclTable
2020-06-18 17:12:56 -04:00
Andrew Kelley
81f766eecd
self-hosted parser: make a function pointer comptime
2020-06-18 17:12:56 -04:00
Andrew Kelley
46b57748a5
stage1: stop emitting memset to undefined when safety is off
2020-06-18 17:12:56 -04:00
Andrew Kelley
02f688d710
remove std.debug.warn debugging logs
2020-06-18 17:12:56 -04:00
Andrew Kelley
7e58c56ca7
self-hosted: implement Decl lookup
...
* Take advantage of coercing anonymous struct literals to struct types.
* Reworks Module to favor Zig source as the primary use case.
Breaks ZIR compilation, which will have to be restored in a future commit.
* Decl uses src_index rather then src, pointing to an AST Decl node
index, or ZIR Module Decl index, rather than a byte offset.
* ZIR instructions have an `analyzed_inst` field instead of Module
having a hash table.
* Module.Fn loses the `fn_type` field since it is redundant with
its `owner_decl` `TypedValue` type.
* Implement Type and Value copying. A ZIR Const instruction's TypedValue
is copied to the Decl arena during analysis, which allows freeing the
ZIR text instructions post-analysis.
* Don't flush the ELF file if there are compilation errors.
* Function return types allow arbitrarily complex expressions.
* AST->ZIR for function calls and return statements.
2020-06-18 17:12:56 -04:00
Andrew Kelley
b4eac0414a
stage2: hook up Zig AST to ZIR
...
* Introduce the concept of anonymous Decls
* Primitive Hello, World with inline asm works
* There is still an unsolved problem of how to manage ZIR instructions
memory when generating from AST. Currently it leaks.
2020-06-18 17:12:56 -04:00
Andrew Kelley
4a38799631
make file and fn_name fields of SourceLocation also null-terminated
...
One of the main motivating use cases for this language feature is
tracing/profiling tools, which expect null-terminated strings for these
values. Since the data is statically allocated, making them
additionally null-terminated comes at no cost.
This prevents the requirement of compile-time code to convert to
null-termination, which could increase the compilation time of
code with tracing enabled.
See #2029
2020-06-18 17:09:10 -04:00
Andrew Kelley
e54ed9f638
Merge pull request #5628 from Vexu/src
...
Implement @src
2020-06-18 16:23:56 -04:00
Vexu
14acc65675
add tests for @src
2020-06-18 21:11:34 +03:00
Vexu
a5379aa3ee
implement @src
2020-06-18 21:11:09 +03:00
Isaac Freund
c3e0224792
Add std.debug.print for "printf debugging"
2020-06-17 18:36:44 +02:00
antlilja
eb7fad28f8
Improve f128 standard library support
...
* Add functions: floor128, ceil128, trunc128 and round128
* Add corresponding tests
2020-06-17 18:18:45 +02:00
antlilja
1157ee1307
Improve builtin op support for f128/comptime_float
...
* Add support for fabs, floor, ceil, trunc and round
* Add behavior tests
2020-06-17 17:35:45 +02:00
Isaac Freund
8e5393a779
Deprecate std.debug.warn
2020-06-17 02:14:52 +02:00
Isaac Freund
0bd067d19a
Introduce std.log
...
std.log provides 8 log levels and corresponding logging functions. It
allows the user to override the logging "backend" by defining root.log
and to override the default log level by defining root.log_level.
Logging functions accept a scope parameter which allows the implementer
of the logging "backend" to filter logging by library as well as level.
Using the standardized syslog [1] log levels ensures that std.log will
be flexible enough to work for as many use-cases as possible. If we were
to stick with only 3/4 log levels, std.log would be insufficient for
large and/or complex projects such as a kernel or display server.
[1]: https://tools.ietf.org/html/rfc5424#section-6.2.1
2020-06-17 02:14:52 +02:00
Andrew Kelley
9781342042
Merge pull request #5607 from daurnimator/cleanup-debug-stderr
...
std: clean up debug stderr variables
2020-06-16 18:27:44 -04:00
Jonathan Marler
f0b8791da7
ArrayList(u8) support writer interface
2020-06-16 18:26:54 -04:00
Andrew Kelley
593db7e8d0
Merge pull request #5608 from alexnask/windows_utf16_dir
...
Use PathSpace and wide FS calls on windows in stage1
2020-06-16 18:26:02 -04:00
Jakub Konka
04c3fae720
Remove obsolete branch in ir_analyze_cast
...
Branch handling `*[N]T` to `E![]T` is already handled in a more complete
branch handling `*[N]T` to `[]T` *and* `*[N]T` to `E![]T` so it seems
safe to remove this one.
2020-06-16 18:24:45 -04:00
tgschultz
38e69a9e6a
Added test to ensure minimum number of bytes is emitted for writes
2020-06-16 16:20:59 +00:00
tgschultz
a0160d776f
Code cleanup, documentation added, read*Mem functions now take *[]const u8
2020-06-16 16:20:59 +00:00
tgschultz
00ec81b0dc
Overhauled leb128:
...
handles integers < 8 bits
incorrect overflow bugs fixed
simplified *mem implementations
added wrte* functions
added thurough write/read testing
2020-06-16 16:20:59 +00:00
tgschultz
928d3ee9ea
Code cleanup, documentation added, read*Mem functions now take *[]const u8
2020-06-16 16:20:58 +00:00
tgschultz
e94eba5df5
Overhauled leb128:
...
handles integers < 8 bits
incorrect overflow bugs fixed
simplified *mem implementations
added wrte* functions
added thurough write/read testing
2020-06-16 16:20:58 +00:00
tgschultz
7f24860737
Code cleanup, documentation added, read*Mem functions now take *[]const u8
2020-06-16 16:20:58 +00:00
tgschultz
8978fe94cf
Overhauled leb128:
...
handles integers < 8 bits
incorrect overflow bugs fixed
simplified *mem implementations
added wrte* functions
added thurough write/read testing
2020-06-16 16:20:58 +00:00
Andrew Kelley
f595545c10
Merge pull request #5422 from pixelherodev/error_tests
...
[Stage2/Testing] ZIR tests for expected errors
2020-06-16 03:50:56 -04:00
Noam Preil
a99e61ebaa
Stage2/Testing: Code cleanup
2020-06-15 21:47:42 -04:00
Noam Preil
afec3e72f4
Stage2/Testing: Enable another test
2020-06-15 20:42:22 -04:00
Noam Preil
7d1c9a69cc
Stage2/Testing: Remove dead code
2020-06-15 20:33:43 -04:00
Noam Preil
adb21f1caf
Stage2/Testing: Add error tests to ZIRCase
2020-06-15 20:33:43 -04:00
Noam Preil
7ee0462f5f
Stage2/Testing: Fix transformation tests
2020-06-15 20:33:39 -04:00
Noam Preil
1e5945d0a9
Stage2/Testing: remove ZIRTransformCase
2020-06-15 20:33:39 -04:00
Noam Preil
71dca252a5
Stage2/Testing: Rename stage -> update
2020-06-15 20:33:32 -04:00
Noam Preil
b6bd51ed69
Stage2/Testing: Move Transformation case to ZIRCase
2020-06-15 20:33:25 -04:00
Noam Preil
e77fc7fe7e
Stage2/Testing: Fix error specification
2020-06-15 20:33:17 -04:00
Noam Preil
6dce317fe3
Stage2/Testing: Fix error tests
2020-06-15 20:33:07 -04:00
Noam Preil
d4fd7c6a01
Stage2/Testing: Staged test harness draft design
2020-06-15 20:32:54 -04:00
DixiE
68fe3e116d
Update Stack Trace For start.zig Changes
2020-06-15 23:33:58 +01:00
Noam Preil
2ed07a36f8
[Stage2/Testing] Attempt to call nakedcc function
2020-06-15 17:52:21 -04:00
Noam Preil
bf8b3a4394
[Stage2/Testing] Handle decl and export errors
2020-06-15 17:51:43 -04:00
Noam Preil
68cc068a3a
[Stage2/Testing] Make API more friendly
2020-06-15 17:51:43 -04:00
Noam Preil
bebc1f49cf
[Stage2/Testing] Add (failing) test
2020-06-15 17:51:43 -04:00
Noam Preil
2d1d012f11
[Stage2/Testing] Reduce test
2020-06-15 17:51:43 -04:00
Noam Preil
e030414c16
[Stage2/Testing] Always finish case, note all errs
2020-06-15 17:51:43 -04:00
Noam Preil
f2399db3ef
[Stage2/Testing] Don't rely on update erroring
2020-06-15 17:51:42 -04:00
Noam Preil
67414be86b
[Stage2/Testing] Print name of failed test
2020-06-15 17:51:42 -04:00
Noam Preil
c92816fbef
[Stage2/Testing] ZIR tests for expected errors
2020-06-15 17:51:29 -04:00
Anthony Arian
5e48ed4a8d
Implement WinMain Callers that Pass Valid Params
2020-06-15 22:46:16 +01:00
Andrew Kelley
2bb3e1aff4
stage1: implement type coercion of anon struct literal to struct
...
closes #3672
2020-06-15 16:52:18 -04:00
Alexandros Naskos
2c8a3aaf85
Use _wfopen instead of fopen on windows
2020-06-15 22:21:01 +03:00
Alexandros Naskos
242246f793
UTF16 create process, utf8->utf16 fix
2020-06-15 21:51:53 +03:00
Alexandros Naskos
c34bdff4bb
Use more wide functions on windows
2020-06-15 18:38:41 +03:00
daurnimator
af592f0ddd
std: remove std.debug.getStderrStream
...
Rather than migrate to new 'writer' interface, just remove it
2020-06-15 23:51:25 +10:00
daurnimator
ce30357532
std: clean up debug stderr variables
...
- stderr_file_writer was unused
- stderr_stream was a pointer to a stream, rather than a stream
- other functions assumed that getStderrStream has already been called
2020-06-15 23:48:33 +10:00
Alexandros Naskos
3b0b56b81a
Switched more Windows FS calls to their wide versions
2020-06-15 16:15:10 +03:00
Alexandros Naskos
037c72fe67
Convert paths to UTF-16 before calling CreateDirectory on windows
2020-06-15 15:52:59 +03:00
Vexu
e7207bc267
add workaround for #5599
2020-06-14 20:13:02 +03:00
Carter Sande
09cded209d
Add strict_align to pre-v6 ARM targets
...
This matches GCC's and Clang's default behavior for these targets.
2020-06-12 13:43:12 -04:00
Andrew Kelley
866651a5a3
Merge pull request #5589 from kubkon/preopens-example
...
Add doc example for extracting WASI preopens
2020-06-12 13:40:30 -04:00
Alexandros Naskos
1bc92b1fde
Fix formatting of floating point values with the B and Bi specifiers
2020-06-12 13:38:12 -04:00
Cassidy Dingenskirchen
57f1ed5325
Fix a few std.sort.sort invocations
2020-06-12 13:33:31 -04:00
Veikka Tuominen
7d8fd45267
Merge pull request #5595 from ifreund/doc-arraylist-fix
...
docs: fix mention of deprecated ArrayList.span()
2020-06-12 19:10:47 +03:00
Isaac Freund
a254297953
docs: fix mention of deprecated ArrayList.span()
2020-06-12 17:58:43 +02:00
Jakub Konka
200f9ea6fb
Add unit test for std.fs.wasi.PreopenList
2020-06-11 23:00:02 +02:00
Jakub Konka
c7721bb368
Add custom format method for Preopen struct
2020-06-11 22:31:08 +02:00
Jakub Konka
e4a8598ddd
Add doc example for extracting WASI preopens
2020-06-11 22:30:02 +02:00
Jonathan Marler
a282ac7a91
Support Reader for InStream
2020-06-09 13:36:17 -04:00
Andrew Kelley
4302f276ed
Merge branch 'kubkon-wasm-instrinsics'
...
closes #5507
2020-06-09 00:22:43 -04:00
Jakub Konka
42c95a64d6
Update langref.html.in
2020-06-09 00:22:34 -04:00
Jakub Konka
660eef9a43
Document the builtins
2020-06-09 00:22:34 -04:00
Jakub Konka
52b97eeef1
Return u32 in @wasmMemorySize instead of i32
2020-06-09 00:22:34 -04:00
Jakub Konka
057d97c093
Return should be i32 due to error signaling in memory.grow
...
Also, fix tests.
2020-06-09 00:22:34 -04:00
Jakub Konka
3f0a3cea6e
Fix builtins to return and accept u32 instead of i32
2020-06-09 00:22:34 -04:00
Jakub Konka
8ffa8ed9a8
Expose full llvm intrinsic
2020-06-09 00:22:34 -04:00
Jakub Konka
73a3bfd1dd
Add basic tests for the new builtins
2020-06-09 00:22:34 -04:00
Jakub Konka
146be2a8cb
Use builtins in std.heap.WasmAllocator
2020-06-09 00:22:17 -04:00
Jakub Konka
601e831f1d
Add builtin for llvm.wasm.memory.grow.i32 intrinsic
...
This will allow the developer to request additional memory pages
from the runtime to be allocated for the Wasm app. Typical usage:
```zig
var wasm_pages = @wasmMemorySize();
@wasmMemoryGrow(1);
@import("std").debug.assert((wasm_pages + 1) == @wasmMemorySize());
```
2020-06-09 00:22:17 -04:00
Jakub Konka
ce3f0077cf
Add builtin for llvm.wasm.memory.size.i32 instrinsic
...
This will allow the developer to poll the runtime for currently
allocated memory in the number of Wasm pages. Typical usage:
```zig
var wasm_pages = @wasmMemorySize();
@import("std").debug.assert(wasm_pages > 0);
```
2020-06-09 00:22:17 -04:00
Jonathan Marler
12051b02f1
fix memory errors
2020-06-09 00:17:22 -04:00
Andrew Kelley
9ee98f103b
Merge pull request #5539 from mikdusan/issue5474
...
stage1: fix constness in some corner cases
2020-06-09 00:12:57 -04:00
Jonathan Marler
7481582774
support Writer instead of OutStream
...
Start implementing https://github.com/ziglang/zig/issues/4917 which is to rename instream/outstream to reader/writer. This first change allows code to use Writer/writer instead of OutStream/outStream, but still maintains the old outstream names with "Deprecated" comments.
2020-06-08 22:59:28 -04:00
Michael Dusan
f5b584cc13
Merge pull request #5567 from mikdusan/qemu
...
ci linux: bump qemu-5.0.0-49ee115552
2020-06-08 22:12:14 -04:00
Andrew Kelley
d2278f2156
Merge pull request #5566 from ziglang/stage2-garbage-collect-decls
...
Stage2 garbage collect decls
2020-06-08 18:29:12 -04:00
Jakub Konka
0ff5d7b24e
Add option for overriding the stack size
...
This commit adds a `--stack [size]` link-time option to zig compiler
allowing the user to override the default stack size set for the
specified executable/library format. This is currently limited to
ELF, COFF and Wasm however (i.e., Mach-O is excluded).
2020-06-08 17:44:06 -04:00
Jakub Konka
cde7c75676
Increase default Wasm stack to 1MB
...
This commit increases the default Wasm stack to 1MB from the default
of 1 Wasm page which equal 64KB. This seems like a reasonable default
size while at the same time not overly large. Also, Rust lang seems
to be favouring this default as well: [rust-lang#50083].
[rust-lang#50083]: https://github.com/rust-lang/rust/pull/50083
2020-06-08 17:29:14 -04:00
xackus
0d40cb6255
stage1: fix crash on slice byte reinterpretation
2020-06-08 17:19:06 -04:00
Andrew Kelley
05d284c842
update sort callsite to new API
2020-06-08 16:33:35 -04:00
Michael Dusan
c2f547f91f
ci linux: bump qemu-5.0.0-49ee115552
...
update qemu to upstream with mremap patch
2020-06-08 16:20:39 -04:00
Andrew Kelley
47090d234e
stage2: add passing test for compile error in unreferenced cycle
2020-06-08 15:16:40 -04:00
Andrew Kelley
9ea4965ceb
self-hosted: remove deleted Decls from failed_decls
2020-06-08 15:16:40 -04:00
Andrew Kelley
91930a4ff0
stage2: fix not re-loading source file for updates after errors
2020-06-08 15:16:40 -04:00
Andrew Kelley
cf654b52d6
stage2: -femit-zir respects decl names and supports cycles
2020-06-08 15:16:40 -04:00
Andrew Kelley
d4d954abd2
std.sort: give comparator functions a context parameter
2020-06-08 15:16:40 -04:00
Noam Preil
c405844b0a
[Stage2/x86] Fix 8-bit register order
2020-06-08 02:28:39 -04:00
Andrew Kelley
37695ed81e
Merge pull request #5556 from iansimonson/try_other_addresses
...
tcpConnectToHost try all addresses in AddressList
2020-06-07 13:53:12 -04:00
Ian Simonson
a6d1ef64d7
tcpConnectToHost try all addresses in AddressList
...
The AddressList returned can contain more than one item
e.g. the ipv4 and ipv6 addresses for a given hostname.
Previously if a server had multiple addresses but
was not listening on one of them Zig would give up
immediately.
Now on std.os.ConnectError.ConnectionRefused Zig will
try the next address in the list. Zig still gives up on
all other errors as they are related to the system and
system resources rather than whether the remote server
is listening on a particular address.
2020-06-07 22:39:35 +10:00
Ian Simonson
983f93c840
Test case for tcpConnectToHost fix
2020-06-07 22:39:35 +10:00
Veikka Tuominen
499df9680c
Merge pull request #5531 from Vexu/translate-c
...
Translate-c don't crash on complex switches
2020-06-05 10:41:56 +03:00
Michael Dusan
c0c9d11d8c
stage1: fix constness in some corner cases
...
- for one-possible-value types, ir_analyze_struct_field_ptr()
no longer hardcodes const/volatile
- when slicing arrays, ir_analyze_instruction_slice()
no longer consults ConstValSpecialStatic
closes #5474
2020-06-05 00:49:57 -04:00
Ryan Liptak
f839d34baa
std.os.windows.OpenFile: Handle FILE_IS_A_DIRECTORY status
...
Fixes #5533
2020-06-04 22:53:23 -04:00
Ryan Liptak
95a5f6bf2d
Windows: Handle ERROR_DIRECTORY in std.fs.deleteDirAbsolute when called on a file path
...
ERROR_DIRECTORY (267) is returned from kernel32.RemoveDirectoryW if the path is not a directory. Note also that os.DirectDirError already includes NotDir
Before: error.Unexpected: GetLastError(267): The directory name is invalid.
After: error: NotDir
2020-06-04 22:52:53 -04:00
Ryan Liptak
f7b6957fb4
Windows: Fix std.fs.Dir.deleteDir() deleting files
...
Would previously delete files, now correctly returns error.NotDir. Fixes #5536
2020-06-04 22:51:58 -04:00
Vexu
c27a8bd6be
translate-c: don't crash on complex switches
2020-06-04 14:22:27 +03:00
Vexu
fd067fbe8b
add workaround for #5525
2020-06-04 13:11:23 +03:00
Jesse Rudolph
3fba076f92
demonstrate start + len > new_items.len
2020-06-03 06:29:50 -05:00
Jesse Rudolph
c0a0193c0a
add replaceRange() function to ArrayList
...
generalizes functionality of ArrayList.insertSlice() to overwrite
a range of elements in the list and to grow or shrink the list as needed
to accommodate size difference of the replacing slice and the range
of existing elements.
2020-06-02 17:00:01 -05:00
Andrew Kelley
6524a64bda
stage2: fix referencing decls which appear later in the file
2020-06-02 17:43:51 -04:00
Andrew Kelley
14d235dd6e
Merge branch 'lun-4-resolve-ip6'
...
closes #4864
2020-06-02 15:31:14 -04:00
Andrew Kelley
7fd937fef4
cleanups
...
* improve docs
* add TODO comments for things that don't have open issues
* remove redundant namespacing of struct fields
* guard against ioctl returning EINTR
* remove the general std.os.ioctl function in favor of the specific
ioctl_SIOCGIFINDEX function. This allows us to have a more precise
error set, and more type-safe API.
2020-06-02 15:28:46 -04:00
Luna
0d091dc923
Replace os.linux to os.system
2020-06-02 14:56:19 -04:00
Luna
6623efd7d4
Change ioctl's request type to i32
2020-06-02 14:56:19 -04:00
Luna
6d3d1152ea
Add declaration for libc ioctl
2020-06-02 14:56:19 -04:00
Luna
7c71054286
Replace syscall3 to os.ioctl
2020-06-02 14:56:19 -04:00
Luna
09c01ea7b9
Use resolveIp when looking up addresses on linux
2020-06-02 14:56:19 -04:00
Luna
c8468bed42
Add std.os.ioctl
2020-06-02 14:56:19 -04:00
Luna
c7b790ded6
net.test: only call resolveIp6 when os is linux
2020-06-02 14:56:06 -04:00
Luna
15efe03d1f
Add tests for overflow
2020-06-02 14:56:06 -04:00
Luna
b72c862725
Use IFNAMESIZE for scope id value
2020-06-02 14:56:06 -04:00
Luna
aebf28eba3
Make ifru fields sentinel-terminated
2020-06-02 14:56:06 -04:00
Luna
c60daa255f
Replace C types in declarations
2020-06-02 14:56:06 -04:00
Luna
2fa9cf51ff
Plug resolveIp6 into IPv6 tests
2020-06-02 14:56:06 -04:00
Luna
64e55a74de
Add validation for scope ids
2020-06-02 14:56:06 -04:00
Luna
10ea2db5cb
Replace C shorts by integer types
2020-06-02 14:56:06 -04:00
Luna
11a06d4341
Remove warn() calls
2020-06-02 14:56:06 -04:00
Luna
cb649b769c
Fix ifreq definition
2020-06-02 14:56:06 -04:00
Luna
c50ac9a764
Change Unsupported to InterfaceNotFound
2020-06-02 14:56:06 -04:00
Luna
38109d48a3
Make interface name null-terminated before syscall
2020-06-02 14:56:06 -04:00
Luna
5919831529
Stop using mem.len on array
2020-06-02 14:56:06 -04:00
Luna
901aab8761
Add ioctl errors
2020-06-02 14:56:06 -04:00
Luna
2c641c93da
Only resolve scope id when needed
2020-06-02 14:56:06 -04:00
Luna
f02f4c0880
Fix typo and add if_nametoindex
2020-06-02 14:56:06 -04:00
Luna
9c200035f3
Add some interface structs to linux bits
2020-06-02 14:56:06 -04:00
Luna
b816303122
Add basics of resolveIp6
...
Instead of streaming the scope id digits to an u32, we keep a [32]u8 in
the stack and fill it up with the characters we get for scope id.
2020-06-02 14:56:05 -04:00
Andrew Kelley
bae0c9b554
std.HashMap: allow ensureCapacity with a zero parameter
2020-06-02 14:41:45 -04:00
Veikka Tuominen
40a1cfed53
Merge pull request #5510 from jessrud/arraylist-fix
...
pass allocator to self.resize() in appendNTimes()
2020-06-02 18:13:55 +03:00
Jesse Rudolph
100aa6fbaf
pass allocator to self.resize() in appendNTimes()
2020-06-02 09:59:13 -05:00
Alexandros Naskos
aa1a727284
Allow carriare return in comments
2020-06-02 00:56:05 -04:00
Andrew Kelley
c6764fd254
Merge pull request #5475 from marler8997/windowsDns
...
support name resolution on windows
2020-06-01 15:33:05 -04:00
Andrew Kelley
8f4bc77260
Merge pull request #5449 from data-man/more_traits
...
Add more traits
2020-06-01 14:50:01 -04:00
Andrew Kelley
f9b220ec2c
Merge branch 'brodeuralexis-zero-init-helper'
...
closes #5472
2020-06-01 14:47:55 -04:00
Andrew Kelley
109c0b9d96
rename std.mem.defaultInit to std.mem.zeroInit
2020-06-01 14:47:18 -04:00
Alexis Brodeur
c0e5eca6f2
Add initialization helper
...
When using C libraries, C99 designator list initialization is often
times used to initialize data structure.
While `std.mem.zeroes` and manually assigning to each field can
achieve the same result, it is much more verbose then the equivalent
C code:
```zig
usingnamespace @cImport({
@cInclude("sokol_app.h");
});
// Using `std.mem.zeroes` and manual assignment.
var app_desc = std.mem.zeroes(sapp_desc);
app_desc.init_cb = init;
app_desc.frame_cb = frame;
app_desc.cleanup_cb = cleanup;
app_desc.width = 400;
app_desc.height = 300;
app_desc.window_name = "no default init";
// Using `std.mem.defaultInit`.
var app_desc = std.mem.defaultInit(sapp_desc, .{
.init_cb = init,
.frame_cb = frame,
.cleanup_cb = cleanup,
.width = 400,
.height = 300,
.window_name = "default init"
});
```
The `std.mem.defaultInit` aims to solve this problem by zero
initializing all fields of the given struct to their zero, or default
value if any. Each field mentionned in the `init` variable is then
assigned to the corresponding field in the struct.
If a field is a struct, and an initializer for it is present, it is
recursively initialized.
2020-06-01 14:45:35 -04:00
Sebastian
937dcad0b3
fixed timestamp()
2020-06-01 14:43:13 -04:00
Alexandros Naskos
215a0d61ab
Fix evented builds on windows with runtime safety on
2020-06-01 14:22:45 -04:00
Veikka Tuominen
078e4afdaf
Merge pull request #5500 from Vexu/fix
...
Fix std.zig rejecting literal tabs in comments
2020-06-01 17:24:30 +03:00
Veikka Tuominen
eb687810cf
Merge pull request #4976 from xackus/std-lib-docs
...
std lib docs: fix null and int values
2020-06-01 14:50:05 +03:00
Veikka Tuominen
8c5c860b00
Merge pull request #5443 from data-man/mem_len_vectors
...
Support vectors in mem.len
2020-06-01 14:44:38 +03:00
Vexu
a47257d9b0
fix std.zig rejecting literal tabs in comments
2020-06-01 14:37:36 +03:00
Jonathan Marler
0d32f4acf7
enable dns test on windows
2020-05-31 11:58:50 -06:00
Veikka Tuominen
f5eb31a55a
Merge pull request #5491 from xackus/fix_5487
...
stage1: fix unresolved inferred error sets
2020-05-31 20:48:04 +03:00
daurnimator
f5167f73e8
deps/SoftFloat-3e/: commit with LF line endings
...
`git add --renormalize .`
For text files, git expects that all files are commited with LF line endings,
it then (optionally) swaps to CRLF on checkout depending on .gitattributes and
git config.
2020-05-31 12:18:31 -04:00
Jonathan Marler
58fb5b29b6
more windows network fixes
...
* support posix SOCK_NONBLOCK and SOCK_CLOEXEC flags on windows
* fix bugs in os.socket and os.connect to return at the correct place
2020-05-31 10:07:51 -06:00
Veikka Tuominen
899d79f8f0
Merge pull request #5478 from vrischmann/fix-iouring
...
linux: fix IOSQE_BIT decl and io_uring_sqe flags
2020-05-31 16:59:04 +03:00
Veikka Tuominen
30b2bc86b9
Merge pull request #5477 from alexnask/patch-1
...
Fix WSARecvFrom signature
2020-05-31 16:49:08 +03:00
Veikka Tuominen
21544267ee
Merge pull request #5481 from kubkon/typo-packedintarray
...
Fix typo in PackedIntArray tests
2020-05-31 16:48:19 +03:00
xackus
250dd9ac21
stage1: fix unresolved inferred error sets
2020-05-31 15:04:34 +02:00
Veikka Tuominen
557d75d58a
Merge pull request #5480 from Vexu/fix
...
Fix zig fmt out of bounds on empty file
2020-05-31 13:50:03 +03:00
Jakub Konka
13c405127d
Fix typo in PackedIntArray tests
...
Both `PackedIntArray` and `PackedIntSlice` tests defined `max_bits`
but didn't use it in the predicate in the inline while loop.
2020-05-30 23:17:55 +02:00
Vexu
010c58e303
fix zig fmt out of bounds on empty file
2020-05-30 23:07:51 +03:00
Jonathan Marler
2bae91e769
convert getaddrinfo rc to enum before switching on it
2020-05-30 09:56:52 -06:00
Vincent Rischmann
636d3ba780
linux: fix IOSQE_BIT decl and io_uring_sqe flags
2020-05-30 16:05:46 +02:00
Alexandros Naskos
dbdacb0938
Fix WSARecvFrom signature
...
The lpFromLen should be a pointer.
2020-05-30 16:46:32 +03:00
Jonathan Marler
2eaab1e65e
more windows network support, including dns
2020-05-29 22:38:48 -06:00
foobles
51682717d7
Support equality comparison for optional to non-optional (?T ==/!= T)
...
extracted function ir_try_evaluate_bin_op_const
extracted type_is_self_comparable function
renamed ir_try_evaluate_bin_op_const to ir_try_evaluate_bin_op_cmp_const
implemented analysis of ?T == T
added ir_set_cursor_at_end_and_append_basic_block_gen
use build_br_gen and ir_set_cursor_at_end_and_append_block_gen
added ir_append_basic_block_gen
removed include of all_types in ir.cpp
extracted compile-time and runtime evaluation of cmp_optional_non_optional to separate functions
closes #5390
closes #1332
2020-05-29 18:46:09 -04:00
Andrew Kelley
f107d654e0
Merge branch 'gereeter-reduced-path-max'
...
closes #4837
2020-05-29 18:41:40 -04:00
Andrew Kelley
89a97a7a27
cleanups
2020-05-29 18:30:09 -04:00
Jonathan S
c209da1589
Document the failure to improve selfExe{,Dir}PathAlloc
2020-05-29 18:27:39 -04:00
Jonathan S
0674b51453
In getCwdAlloc, geometrically allocate larger buffers to find an appropriate size.
2020-05-29 18:27:39 -04:00
Jonathan S
ab3931fa95
Prefer Files to paths in std.debug. Additionally [breaking] add a flags parameter to openSelfExe and stop exporting openElfDebugInfo.
...
This should save a call to readlink in openSelfDebugInfo and support executables in overlong paths on Linux.
2020-05-29 18:27:39 -04:00
Jonathan S
631633b252
Document and reduce usage of MAX_PATH_BYTES, lifting arbitrary buffer size requirements
2020-05-29 18:23:06 -04:00
Veikka Tuominen
4c8b937fb0
Merge pull request #5184 from alexnask/typeof_extern_call
...
Extern functions are now evaluated to undefined values at comptime in TypeOf calls.
2020-05-30 01:11:22 +03:00
Andrew Kelley
65c3833ec2
Merge pull request #5388 from kubkon/wasi-args-iter
...
Add ArgIteratorWasi and integrate it with ArgIterator
2020-05-29 15:55:14 -04:00
Noam Preil
e9f344dcd4
Add include dirs to translate-c ( close #5098 )
2020-05-29 13:39:16 -04:00
Noam Preil
3b4e29f1ad
[CI] Use ninja on Azura and Drone
2020-05-29 13:34:15 -04:00
Noam Preil
834e8ac2dc
[Stage2/Codegen] Extract REX
2020-05-29 13:33:09 -04:00
Jakub Konka
6e347e6180
Fix args iterator test
2020-05-29 17:12:19 +02:00
Jakub Konka
6f48842ddb
Make ArgIterator.init() a compile error in WASI
...
Given that the previous design would require the use of a default
allocator to have `ArgIterator.init()` work in WASI, and since in
Zig we're trying to avoid default allocators, I've changed the design
slightly in that now `init()` is a compile error in WASI, and instead
in its message it points to `initWithAllocator(*mem.Allocator)`.
The latter by virtue of requiring an allocator as an argument can
safely be used in WASI as well as on other OSes (where the allocator
argument is simply unused). When using `initWithAllocator` it is then
natural to remember to call `deinit()` after being done with the
iterator. Also, to make use of this, I've also added `argsWithAllocator`
function which is equivalent to `args` minus the requirement of supplying
an allocator and being fallible.
Finally, I've also modified the WASI only test `process.ArgWasiIterator`
to test all OSes.
2020-05-29 10:48:03 +02:00
Jakub Konka
f1a4e1a70f
Add ArgIteratorWasi and integrate it with ArgIterator
...
This commit pulls WASI specific implementation of args extraction
from the runtime from `process.argsAlloc` and `process.argsFree`
into a new iterator struct `process.ArgIteratorWasi`. It also
integrates the struct with platform-independent `process.ArgIterator`.
2020-05-29 10:48:03 +02:00
data-man
dc4fea983d
Use tuples in multiTrait
2020-05-28 23:10:44 -04:00
Dmitry Atamanov
0328537ca6
Support stringify for vectors ( #5441 )
...
* use array's pointer
2020-05-28 23:10:16 -04:00
Walter Mays
8630ae7523
Remove reliance on hashing algorithm for iterator reset test.
2020-05-28 23:09:21 -04:00
Andrew Kelley
1e0de896b8
Merge pull request #5452 from squeek502/comptime-string-map
...
Add std.ComptimeStringMap based on the tokenizer optimization in #5442
2020-05-28 23:06:40 -04:00
Timon Kruiper
6e89692d81
C ABI: Add C support for passing structs of floats to an extern function
...
Currently this does not handle returning these structs yet.
Related: #1481
2020-05-28 22:56:33 -04:00
Andrew Kelley
34101127c6
Merge pull request #5463 from kubkon/link-issue-wasm-vector
...
Link issue to the failing test case: miscompiled Vector in wasm
2020-05-28 22:55:07 -04:00
Andrew Kelley
dadc4327e1
Merge branch 'stage2-vaddr-alloc'
2020-05-28 22:45:59 -04:00
Andrew Kelley
5d77fede89
remove debug log statements
2020-05-28 22:43:16 -04:00
Andrew Kelley
0bd89979fd
stage2: handle deletions and better dependency resolution
...
* Deleted decls are deleted; unused decls are also detected as deleted.
Cycles are not yet detected.
* Re-analysis is smarter and will not cause a re-analysis of dependants
when only a function body is changed.
2020-05-28 22:42:13 -04:00
Jakub Konka
4f24ab9cfc
Fix skipping condition (skip when wasm32)
2020-05-29 00:06:26 +02:00
Jakub Konka
3dbe376c77
Link issue to the failing test case targeting wasm
2020-05-28 23:32:17 +02:00
Andrew Kelley
3eed7a4dea
stage2: first pass at recursive dependency resolution
2020-05-28 12:19:00 -04:00
data-man
c91786caf3
zig fmt
2020-05-28 16:41:15 +05:00
data-man
f9bdf325d3
Added tests with tuple
2020-05-28 16:39:00 +05:00
Andrew Kelley
c7ca1fe6f7
self-hosted: introduce a virtual address allocation scheme
...
The binary file abstraction changed its struct named "Decl" to
"TextBlock" and it now represents an allocated slice of memory in
the .text section. It has two new fields: prev and next, making it
a linked list node. This allows a TextBlock to find its neighbors.
The ElfFile struct now has free_list and last_text_block fields.
Doc comments for free_list are reproduced here:
A list of text blocks that have surplus capacity. This list can have false
positives, as functions grow and shrink over time, only sometimes being added
or removed from the freelist.
A text block has surplus capacity when its overcapacity value is greater than
minimum_text_block_size * alloc_num / alloc_den. That is, when it has so
much extra capacity, that we could fit a small new symbol in it, itself with
ideal_capacity or more.
Ideal capacity is defined by size * alloc_num / alloc_den.
Overcapacity is measured by actual_capacity - ideal_capacity. Note that
overcapacity can be negative. A simple way to have negative overcapacity is to
allocate a fresh text block, which will have ideal capacity, and then grow it
by 1 byte. It will then have -1 overcapacity.
The last_text_block keeps track of the end of the .text section.
Allocation, freeing, and resizing decls are all now more sophisticated,
and participate in the virtual address allocation scheme. There is no
longer the possibility for virtual address collisions.
2020-05-27 15:23:27 -04:00
Veikka Tuominen
2ae9e06363
Merge pull request #5448 from Vexu/translate-c
...
Translate-c use correct scope in for loop condition
2020-05-27 17:00:31 +03:00
Vexu
cd5b7b9e1d
translate-c: use correct scope in for loop condition
2020-05-27 14:14:17 +03:00
Ryan Liptak
3cac0a5614
Not sure how a tab snuck in there
2020-05-26 23:26:19 -07:00
Ryan Liptak
b683498ae8
Use ComptimeStringMap in std.meta.stringToEnum when feasible
2020-05-26 23:10:13 -07:00
Ryan Liptak
dfafafac7b
std.ComptimeStringMap: Add support for void value type (i.e. a set)
2020-05-26 23:10:12 -07:00
Ryan Liptak
62cfc68d2f
Use std.ComptimeStringMap in the C tokenizer
2020-05-26 23:10:08 -07:00
Ryan Liptak
a9dd79d293
Use std.ComptimeStringMap in zig's tokenizer
...
Should have no performance change, the implementation was just made generic/re-usable
2020-05-26 21:36:58 -07:00
Ryan Liptak
0865e5d360
Add std.ComptimeStringMap
2020-05-26 21:34:55 -07:00
Jakub Konka
e61e8c94be
Reenable zig parser tests disabled targeting Wasm
...
I'm not sure why I disabled them when landing extended Wasm/WASI
support, but they pass the parser tests just fine now, so I'm gonna
go ahead and re-enable them.
2020-05-26 21:01:54 -04:00
data-man
78a1f6976d
Add more traits
2020-05-27 04:00:38 +05:00
Andrew Kelley
ba41a9d5d7
different strategy for tokenizing keywords
...
throughput: 279 MiB/s => 347 MiB/s
2020-05-26 18:59:49 -04:00
data-man
b6e1670d2b
Use ccache (optionally)
2020-05-26 16:04:40 -04:00
Walter Mays
e1186c88ea
Remove unimplemented init call from ArrayListUnmanaged.
2020-05-26 15:59:56 -04:00
Andrew Kelley
ef42ef9ce8
Merge pull request #5440 from kubkon/align-fn-error-wasm
...
Make align expr on fns a compile error in Wasm
2020-05-26 15:49:19 -04:00
data-man
49dd2cbd9a
Support vectors in mem.len
2020-05-27 00:00:19 +05:00
Dmitry Atamanov
dd62f63c04
fmt padding correction ( #5403 )
...
* Make .Left as default
2020-05-26 20:53:51 +03:00
Walter Mays
19a04d8ebd
Add writeToSlice method to SegmentedList. ( #5405 )
2020-05-26 13:04:25 -04:00
foobles
cb6bc5bdb5
Add caller location tracking for asserts (ir_assert, src_assert, ir_assert_gen) ( #5393 )
2020-05-26 12:55:31 -04:00
Andrew Kelley
57b78fff73
Merge branch 'daurnimator-pretty-print-non-exhaustive-enums'
...
closes #4693
2020-05-26 12:15:37 -04:00
Andrew Kelley
62fefe8648
std.fmt: non-exhaustive enums: avoid the loop when it's not necessary
2020-05-26 12:15:08 -04:00
daurnimator
5cdeac3b0e
std: in fmt, use tag names of non-exhaustive enums when available
2020-05-26 12:00:33 -04:00
daurnimator
292d515e91
std: allow specifiying enums to be formatted as numbers
2020-05-26 12:00:33 -04:00
Jakub Konka
08b0cae777
Add matching compile error test
2020-05-26 18:00:08 +02:00
Jakub Konka
015c899297
Make align expr on fns a compile error in Wasm
...
In Wasm, specifying alignment of function pointers makes little sense
since function pointers are in fact indices to a Wasm table, therefore
any alignment check on those is invalid. This can cause unexpected
behaviour when checking expected alignment with `@ptrToInt(fn_ptr)`
or similar. This commit proposes to make `align` expressions a
compile error when compiled to Wasm architecture.
Some references:
[1] [Mozilla: WebAssembly Tables](https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format#WebAssembly_tables )
[2] [Sunfishcode's Wasm Ref Manual](https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md#indirect-call )
2020-05-26 17:17:32 +02:00
data-man
d10e407977
More vector support in std.meta
2020-05-26 10:56:29 -04:00
Alexandros Naskos
d88db4d34b
Changed test name to reflect it only fixes #4328
2020-05-26 12:36:02 +03:00
Veikka Tuominen
4b8077ea8e
Merge pull request #5383 from Vexu/fix
...
Fix missing compile error on while/for missing block
2020-05-26 11:13:09 +03:00
Andrew Kelley
49f3defe5b
Merge branch 'leroycep-feature-cache-hash-zig'
...
closes #4635
2020-05-25 21:04:10 -04:00
Andrew Kelley
7c8d0cc678
fix pwrite on 32-bit linux
2020-05-25 19:59:39 -04:00
Andrew Kelley
a83aab5209
fix std lib tests for WASI
2020-05-25 19:46:28 -04:00
Andrew Kelley
cda102be02
improvements to self-hosted cache hash system
...
* change miscellaneous things to more idiomatic zig style
* change the digest length to 24 bytes instead of 48. This is
still 70 more bits than UUIDs. For an analysis of probability of
collisions, see:
https://en.wikipedia.org/wiki/Universally_unique_identifier#Collisions
* fix the API having the possibility of mismatched allocators
* fix some error paths to behave properly
* modify the guarantees about when file contents are loaded for input files
* pwrite instead of seek + write
* implement isProblematicTimestamp
* fix tests with regards to a working isProblematicTimestamp function.
this requires sleeping until the current timestamp becomes
unproblematic.
* introduce std.fs.File.INode, a cross platform type abstraction
so that cache hash implementation does not need to reach into std.os.
2020-05-25 19:29:03 -04:00
Vexu
e07b467c7c
fix missing compile error on while/for missing block
2020-05-25 23:25:06 +03:00
Andrew Kelley
69ff89fd12
stage2 parser: heuristics to pre-allocate token arrays
...
throughput: 72.2 MiB/s => 75.3 MiB/s
I also tried the idea from the deleted comment in this commit and it
made the throughput worse.
2020-05-25 15:12:23 -04:00
Andrew Kelley
6d5ec184ab
stage2 parser: heuristics to pre-allocate token arrays
...
throughput: 72.2 MiB/s => 75.3 MiB/s
2020-05-25 15:02:02 -04:00
LeRoyce Pearson
72716ecc3a
Fix improper initialization of CacheHashFiles
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
c3c332c9ec
Add max_file_size argument
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
5a1c6a3627
Set manifest's maximum size to Andrew's recommendation
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
be69e8e871
Remove non-null assertion in CacheHash.release()
...
People using the API as intended would never trigger this assertion
anyway, but if someone has a non standard use case, I see no reason
to make the program panic.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
e6a37ed941
Change null pointer test to addFilePost test
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
42007307be
Make if statement more idiomatic
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
2c59f95e87
Don't use iterate when opening manifest directory
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
1ffff1bb18
Add test case for fix in previous commit
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
0fa89dc51d
Fix read from null pointer in CacheHash.hit
...
It occured when the manifest file was manually edited to include an extra
file. Now it will simply copy the file name in the manifest file
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
f13c67bcfe
Return an index from CacheHash.addFile
...
This makes it possible for the user to retrieve the contents of the
file without running into data races.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
4d62d97076
Update code using deprecated ArrayList APIs
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
b429f4607c
Make addFilePost* functions' documentation more clear
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
e7657f2938
Make CacheHash.release return an error
...
If a user doesn't care that the manifest failed to be written, they can
simply ignore it. The program will still work; that particular cache
item will simply not be cached.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
967b9825a7
Add "no file inputs" test
...
It checks whether the cache will respond correctly to inputs that don't
initially depend on filesystem state. In that case, we have to check
for the existence of a manifest file, instead of relying on reading the
list of entries to tell us if the cache is invalid.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
4254d389d3
Add test checking file changes invalidate cache
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
b67a9f2281
Switch to using testing.expect* in tests
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
d457919ff5
Make CacheHash cleanup consistent (always call release)
...
Instead of releasing the manifest file when an error occurs, it is
only released when when `CacheHash.release` is called. This maps better
to what a zig user expects when they do `defer cache_hash.release()`.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
05edfe983c
Add addFilePost and addFilePostFetch functions
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
af730c64bd
Put base64 alphabet into a named constant
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
d770dae1b8
Add documentation to CacheHash API
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
67d6432d10
Check for problematic timestamps
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
73d2747084
Open file with exclusive lock
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
204aa7dc1a
Remove unnecessary contents field from File
...
It was causing a segfault on `mipsel` architecture, not sure why other
architectures weren't affected.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
c88ece3679
Remove error union from CacheHash.final
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
dfb53beb52
Check if inode matches inode from manifest
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
7917f25b0a
Update cache_hash to zig master
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
16c5499098
Remove up files created in test at end of test
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
fffd59e6c4
Remove file handle from CacheHash
...
A file handle is not the same thing as an inode index number.
Eventually the inode will be checked as well, but there needs to be
a way to get the inode in `std` first.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
21d7430696
Replace ArrayList in write_manifest with an array
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
061c1fd9ab
Use readAllAlloc
...
Now that the memory leak mentioned in #4656 has been fixed.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
4f709d224a
Make hash digest same size as in the c API
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
8e4b80522f
Return base64 digest instead of using an out variable
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
e75a6e5144
Rename cache_file -> addFile
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
50cbf1f3aa
Add slice and array support to add method
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
fde188aadc
Make type specific add functions
...
Basically, move type specific code into their own functions instead
of making `add` a giant function responsible for everything.
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
4173dbdce9
Rename cache functions to add
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
27bf1f781b
Store fs.Dir instead of path to dir
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
55a3925ab7
Rename CacheHashFile -> File
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
c8062321b3
Use fs.File
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
86fe88bbcb
Use std.fs.base64_encoder in std.cache_hash
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
8c8813a5cf
Add filesystem base64 decoder
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
ce5b2286f1
Support caching bools; make caching values infallible
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
de341b8fb8
Fix memory leak in cache_hash
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
8a77c1c637
Add cache method; add support for caching integers
2020-05-25 13:48:43 -04:00
LeRoyce Pearson
3158dc424e
Partially implement cache hash API in zig
2020-05-25 13:48:43 -04:00
data-man
0ecdbdb3cb
Support comptime floats in std.fmt
2020-05-25 12:48:59 -04:00
Andrew Kelley
0fd77c2de3
Merge pull request #5431 from alexnask/build_step_ids
...
Added and id and a cast function to build steps
2020-05-25 11:24:15 -04:00
Alexandros Naskos
65d827183b
Added custom build step id, made tests.zig steps use it
2020-05-25 11:36:12 +03:00
Alexandros Naskos
d268e0cf2e
Added and id and a cast function to build steps
2020-05-25 11:20:31 +03:00
Andrew Kelley
3052fd84c8
fix regression in std.os.windows.fromSysTime
2020-05-25 00:37:47 -04:00
Andrew Kelley
c693c3ae50
Merge branch 'leroycep-feature-nano-timestamp'
...
closes #5237
2020-05-24 21:40:23 -04:00
Andrew Kelley
53d011fa1a
(breaking) std.time fixups and API changes
...
Remove the constants that assume a base unit in favor of explicit
x_per_y constants.
nanosecond calendar timestamps now use i128 for the type. This affects
fs.File.Stat, std.time.nanoTimestamp, and fs.File.updateTimes.
calendar timestamps are now signed, because the value can be less than
the epoch (the user can set their computer time to whatever they wish).
implement std.os.clock_gettime for Windows when clock id is
CLOCK_CALENDAR.
2020-05-24 21:40:08 -04:00
LeRoyce Pearson
c6e7d0fcfd
Use better names for darwin timestart
2020-05-24 21:40:08 -04:00
LeRoyce Pearson
b85a191398
Fix compile errors for MacOS
2020-05-24 21:40:08 -04:00
LeRoyce Pearson
2dfe798217
Use once to init _timestart in thread safe way
2020-05-24 21:40:08 -04:00
LeRoyce Pearson
7586ce0023
Implement a faster way to get nanoseconds on darwin
2020-05-24 21:40:08 -04:00
LeRoyce Pearson
bb46894115
Add std.time.nanoTimestamp function
2020-05-24 21:40:08 -04:00
Jethro Nederhof
4b1a846471
target: Implement running OS version detection for FreeBSD ( #5416 )
...
* target: Implement OS version detection for FreeBSD
Fixes #4582
* freebsd version: handle errors explicitly
2020-05-24 20:52:13 -04:00
Noam Preil
07472fb453
[Stage2/Codegen] Properly handle arch in genCall
2020-05-24 20:49:29 -04:00
data-man
db0c30446a
Supports vectors in mem.zeroes
2020-05-24 20:48:29 -04:00
data-man
b13dd3cf61
Treat vectors as indexable
2020-05-24 20:44:17 -04:00
Andrew Kelley
dd05f2be80
run zig fmt on std lib
2020-05-24 10:04:09 -04:00
Andrew Kelley
1c0b7ddda8
fix regression in AST node iteration
...
the new iteration code caused an integer underflow for function
prototypes with no parameters. now fixed.
2020-05-24 10:03:26 -04:00
Andrew Kelley
2ff3995a70
Merge pull request #5378 from ziglang/speed-up-stage2-parsing
...
improve std.zig.parse performance using flat arrays for AST nodes and tokens
2020-05-24 09:44:08 -04:00
Andrew Kelley
8a3cd82b85
translate-c: fix a use-after-free bug
2020-05-23 23:15:58 -04:00
Andrew Kelley
882921b5dd
Merge pull request #5415 from jethron/freebsd-bits
...
Freebsd bits
2020-05-23 20:54:09 -04:00
Andrew Kelley
2952604d5d
update docgen to new ast API
2020-05-23 20:40:09 -04:00
Andrew Kelley
c432811d96
fix regression in compile errors
2020-05-23 20:27:09 -04:00
Andrew Kelley
f771545a7e
revert std.zig.ast iterator changes back to master branch API
2020-05-23 20:14:38 -04:00
Jethro Nederhof
f83fd47b14
os/bits/freebsd audit
2020-05-24 10:08:43 +10:00
Jethro Nederhof
b504169fef
FreeBSD: missing networking constants
2020-05-24 10:08:43 +10:00
Andrew Kelley
c78a2e2e8d
translate-c: emit local typedefs
2020-05-23 19:59:26 -04:00
Andrew Kelley
395786fd50
translate-c: fix regression in param name mangling
2020-05-23 19:28:14 -04:00
Andrew Kelley
88f5e3a60d
translate-c: fix regression in switch statement
2020-05-23 17:58:35 -04:00
Andrew Kelley
f67b8c68a0
translate-c: fix regression on array initialization
2020-05-23 17:52:46 -04:00
Andrew Kelley
32c27daae4
translate-c: fix decl statement regression
2020-05-23 17:50:35 -04:00
Andrew Kelley
46f50ee76c
translate-c: fix regression in do-while loop
2020-05-23 17:25:13 -04:00
Andrew Kelley
8f6d7b3208
std: update singly linked list tests to new API
2020-05-23 16:38:43 -04:00
Andrew Kelley
1a90a5e63a
translate-c is building again, but I have 1 @panic in there
2020-05-23 16:24:03 -04:00
Andrew Kelley
e072692e1f
update translate-c to new AST API
2020-05-23 12:48:17 -04:00
Noam Preil
63aa9ffedc
[Stage2/Codegen] Typo fix
2020-05-22 15:34:32 -04:00
Noam Preil
a52d1476b7
[Stage2/Codegen] Document x64 register enum layout
2020-05-22 15:32:33 -04:00
Greg Anders
64955deb72
Add poll definitions for Darwin
2020-05-22 13:21:34 -04:00
Andrew Kelley
8df0841d6a
stage2 parser: token ids in their own array
...
To prevent cache misses, token ids go in their own array, and the
start/end offsets go in a different one.
perf measurement before:
2,667,914 cache-misses:u
2,139,139,935 instructions:u
894,167,331 cycles:u
perf measurement after:
1,757,723 cache-misses:u
2,069,932,298 instructions:u
858,105,570 cycles:u
2020-05-22 12:34:12 -04:00
Andrew Kelley
295bca9b5f
stage2 parser: don't append doc comments to the list
...
The DocComment AST node now only points to the first doc comment token.
API users are expected to iterate over the following tokens directly.
After this commit there are no more linked lists in use in the
self-hosted AST API.
Performance impact is negligible. Memory usage slightly reduced.
2020-05-22 00:28:59 -04:00
Andrew Kelley
1dac9e71b5
std.testing: fix a crash when printing diffs
2020-05-22 00:27:51 -04:00
Andrew Kelley
8252c8b9d6
stage2 parser: different multiline string literal parsing strategy
...
and using flat memory rather than singly linked list
roughly equivalent performance, slightly reduced memory usage, better
API.
2020-05-21 23:25:15 -04:00
Andrew Kelley
19de259936
stage2 parser: arrays and structs directly in memory after the node
...
Slightly reduced memory usage. Roughly the same API and perf.
2020-05-21 22:52:45 -04:00
Andrew Kelley
9377af934f
stage2 parser: SwitchCase uses intrusive array instead of linkedlist
...
no perf impact, but the API is better
2020-05-21 22:28:30 -04:00
Andrew Kelley
d37b81d43b
stage2 parser performance/API improvements
...
* Extract Call ast node tag out of SuffixOp; parameters go in memory
after Call.
* Demote AsmInput and AsmOutput from AST nodes to structs inside the
Asm node.
* The following ast nodes get their sub-node lists directly following
them in memory:
- ErrorSetDecl
- Switch
- BuiltinCall
* ast.Node.Asm gets slices for inputs, outputs, clobbers instead of
singly linked lists
Performance changes:
throughput: 72.7 MiB/s => 74.0 MiB/s
maxrss: 72 KB => 69 KB (nice)
2020-05-21 22:01:16 -04:00
Andrew Kelley
32ecb416f3
fix compile errors when setting NodeIndex/TokenIndex to u32
2020-05-21 00:30:08 -04:00
Andrew Kelley
e694cd265a
more progress on updating translate-c
2020-05-21 00:14:55 -04:00
Andrew Kelley
d57d9448aa
stage2 parsing: rework block statements AST memory layout
...
block statements are now directly following the Block AST node rather
than a singly linked list. This had negligible impact on performance:
throughput: 72.3 MiB/s => 72.7 MiB/s
however it greatly improves the API since the statements are laid out in
a flat array in memory.
2020-05-20 23:47:04 -04:00
Andrew Kelley
3c5d581ce3
update translate-c to the new fn params AST node API
2020-05-20 23:28:31 -04:00
Andrew Kelley
140dc2f43e
stage1: fix false positive redeclared variable compile error
2020-05-20 23:13:02 -04:00
Andrew Kelley
688aa114e4
Revert "stage2 parser: elide memcpy of large initialization lists"
...
This reverts commit 84df1d4f3d .
Not worth the complexity! Always memcpy initialization lists into the
arena.
2020-05-20 22:42:43 -04:00
Andrew Kelley
84df1d4f3d
stage2 parser: elide memcpy of large initialization lists
...
throughput: 71.4 MiB/s => 72.9 MiB/s
2020-05-20 22:41:18 -04:00
Andrew Kelley
44aeb38328
make rand function public, fixes crypto benchmark
2020-05-20 21:27:08 -04:00
Andrew Kelley
897f23f20f
stage2 parser: split off some SuffixOp AST nodes into separate tags
...
These SuffixOp nodes have their own ast.Node tags now:
* ArrayInitializer
* ArrayInitializerDot
* StructInitializer
* StructInitializerDot
Their sub-expression lists are general-purpose-allocator allocated
and then copied into the arena after completion of parsing.
throughput: 72.9 MiB/s => 74.4 MiB/s
maxrss: 68 KB => 72 KB
The API is also nicer since the sub expression lists are now flat arrays
instead of singly linked lists.
2020-05-20 19:18:14 -04:00
Andrew Kelley
7c2c0e36f8
stage2 parser: different memory layout of ParamDecl
...
Instead of being its own node, it's a struct inside FnProto.
Instead of FnProto having a SinglyLinkedList of ParamDecl nodes,
ParamDecls are appended directly in memory after the FnProto.
throughput: 72.2 MiB/s => 72.9 MiB/s
maxrss: 70 KB => 68 KB
Importantly, the API is improved as well since the data is arranged
linearly in memory.
2020-05-20 17:39:54 -04:00
Andrew Kelley
5db9f306ba
update translate-c for new Root and ContainerDecl AST
2020-05-20 16:54:21 -04:00
Andrew Kelley
ad4b591db1
small bump to ArenaAllocator minimum alloc size
...
self-hosted parser benchmark:
throughput: 69.4 MiB/s => 72.2 MiB/s
2020-05-20 16:30:28 -04:00
Andrew Kelley
64c149ca19
fields and decls: ArrayList appending, memcpy to ast arena
...
This makes fields and decl ast nodes part of the Root and ContainerDecl
AST nodes.
Surprisingly, it's a performance regression from using a singly-linked
list for these nodes:
throughput: 76.5 MiB/s => 69.4 MiB/s
However it has much better memory usage:
maxrss: 392 KB => 77 KB
It's also better API for consumers of the parser, since it is a flat
list in memory.
2020-05-20 16:13:02 -04:00
Andrew Kelley
b1bcdc96ca
arena allocator: smaller minimum allocation size
2020-05-20 16:11:55 -04:00
Andrew Kelley
8c10178a1e
golly jeepers it's taking a long time to update translate-c
2020-05-20 13:53:53 -04:00
Andrew Kelley
4617c5907a
fix zig fmt test regressions
2020-05-20 00:19:00 -04:00
Andrew Kelley
82225f6568
zig fmt parser tests are compiling again
2020-05-19 23:08:48 -04:00
Noam Preil
70239802c9
[Stage2/Codegen] Fix a typo
2020-05-19 22:27:22 -04:00
Andrew Kelley
93384f7428
use singly linked lists for std.zig.parse
...
std.ast uses a singly linked list for lists of things. This is a
breaking change to the self-hosted parser API.
std.ast.Tree has been separated into a private "Parser" type which
represents in-progress parsing, and std.ast.Tree which has only
"output" data. This means cleaner, but breaking, API for parse results.
Specifically, `tokens` and `errors` are no longer SegmentedList but a
slice.
The way to iterate over AST nodes has necessarily changed since lists of
nodes are now singly linked lists rather than SegmentedList.
From these changes, I observe the following on the
self-hosted-parser benchmark from ziglang/gotta-go-fast:
throughput: 45.6 MiB/s => 55.6 MiB/s
maxrss: 359 KB => 342 KB
This commit breaks the build; more updates are necessary to fix API
usage of the self-hosted parser.
2020-05-19 21:22:52 -04:00
Andrew Kelley
ed137d25ef
Merge branch 'stage2-fn-calls'
2020-05-19 13:56:06 -04:00
Andrew Kelley
8d3cca7fc2
stage2: function calls using the global offset table
...
so far they don't support parameters or return values
2020-05-19 13:51:46 -04:00
Andrew Kelley
8d812dba30
stage2: set up a trampoline table for functions
...
However there does not appear to be an x86 encoding for calling an
immediate address. So there's no point of setting this up. We should
just emit an indirect call to the got addr.
2020-05-19 13:33:36 -04:00
Andrew Kelley
1cde0edff4
json: properly stringify error sets
...
I did this wrong originally in
feade9ef00
2020-05-18 19:23:40 -04:00
Andrew Kelley
fe28d73271
Merge pull request #5303 from kubkon/dir-fns
...
Add/fix missing WASI functionality to pass libstd tests
2020-05-18 19:00:25 -04:00
Ryan Liptak
a80ad0782d
CMake: Make fallthrough support version check specific to GCC
2020-05-18 18:19:00 -04:00
Jakub Konka
cd8daa533a
Undo accidentally checked-in changes to fs/test.zig
2020-05-18 22:22:27 +02:00
Jakub Konka
57719006bb
Always return false for ANSI escape codes compat in WASI
2020-05-18 21:17:49 +02:00
Jakub Konka
3d267bab71
Re-enable refAllDecls gen and check in std.zig
2020-05-18 21:05:29 +02:00
Alexandros Naskos
75a4c02880
Updated test
2020-05-18 19:28:26 +03:00
Alexandros Naskos
400a91e1c6
Add TypeOf resolution of dereferences and struct fields of undefined values
2020-05-18 19:15:44 +03:00
Jakub Konka
34f84c3608
Narrow down behaviour test cases; this removes wasmtime-enabled check in tests
2020-05-18 17:56:17 +02:00
Jakub Konka
2a59ecd7ec
Integrate getTestDir with tmpDir logic
2020-05-18 17:10:49 +02:00
Jakub Konka
f26ab568aa
Remove obsolete runtime panics from sleep impl
2020-05-18 17:10:17 +02:00
Jakub Konka
5186711a96
Change to Self from *const Self/*Self where possible
2020-05-18 17:10:06 +02:00
Jakub Konka
fae4af9e1c
Make mode_t a 0-byte type in WASI
2020-05-18 17:09:52 +02:00
Jakub Konka
40812063cc
Disable tests requiring Wasmtime be default; require -Denable-wasmtime flag otherwise
2020-05-18 16:12:03 +02:00
Jakub Konka
bd9a616586
Skip WASI tests in drone and on FreeBSD
2020-05-18 16:10:54 +02:00
Jakub Konka
14510f412d
Download and unpack wasmtime on Linux
2020-05-18 16:10:32 +02:00
Jakub Konka
be796e40a3
Run WASI tests on Linux only
2020-05-18 16:10:14 +02:00
Jakub Konka
d43c08a3e5
Add/fix missing WASI functionality to pass libstd tests
...
This rather large commit adds/fixes missing WASI functionality
in `libstd` needed to pass the `libstd` tests. As such, now by
default tests targeting `wasm32-wasi` target are enabled in
`test/tests.zig` module. However, they can be disabled by passing
the `-Dskip-wasi=true` flag when invoking the `zig build test`
command. When the flag is set to `false`, i.e., when WASI tests are
included, `wasmtime` with `--dir=.` is used as the default testing
command.
Since the majority of `libstd` tests were relying on `fs.cwd()`
call to get current working directory handle wrapped in `Dir`
struct, in order to make the tests WASI-friendly, `fs.cwd()`
call was replaced with `testing.getTestDir()` function which
resolved to either `fs.cwd()` for non-WASI targets, or tries to
fetch the preopen list from the WASI runtime and extract a
preopen for '.' path.
The summary of changes introduced by this commit:
* implement `Dir.makeDir` and `Dir.openDir` targeting WASI
* implement `Dir.deleteFile` and `Dir.deleteDir` targeting WASI
* fix `os.close` and map errors in `unlinkat`
* move WASI-specific `mkdirat` and `unlinkat` from `std.fs.wasi`
to `std.os` module
* implement `lseek_{SET, CUR, END}` targeting WASI
* implement `futimens` targeting WASI
* implement `ftruncate` targeting WASI
* implement `readv`, `writev`, `pread{v}`, `pwrite{v}` targeting WASI
* make sure ANSI escape codes are _not_ used in stderr or stdout
in WASI, as WASI always sanitizes stderr, and sanitizes stdout if
fd is a TTY
* fix specifying WASI rights when opening/creating files/dirs
* tweak `AtomicFile` to be WASI-compatible
* implement `os.renameatWasi` for WASI-compliant `os.renameat` function
* implement sleep() targeting WASI
* fix `process.getEnvMap` targeting WASI
2020-05-18 16:09:49 +02:00
Andrew Kelley
feade9ef00
std.json: support stringify for anyerror
2020-05-17 17:07:27 -04:00
Veikka Tuominen
2a5c0ef7f0
Merge pull request #5164 from daurnimator/in_stream-helpers
...
A couple of helpers for streams that I've found helpful
2020-05-17 22:02:10 +03:00
Andrew Kelley
16f100b82e
Merge pull request #5307 from ziglang/self-hosted-incremental-compilation
...
rework self-hosted compiler for incremental builds
2020-05-17 13:53:27 -04:00
Andrew Kelley
b0968abccb
update ZIR compare output test to test incremental updates
2020-05-17 13:49:22 -04:00
Andrew Kelley
9a22c8b6ca
Merge pull request #5057 from xackus/opaque-param
...
stage1: fix assert fail on opaque fn ptr param
2020-05-17 12:48:56 -04:00
Noam Preil
03ed9e4173
Fix compilation with GCC 5
2020-05-17 12:18:53 -04:00
Andrew Kelley
88c8ff6e37
move some files around
2020-05-17 12:08:47 -04:00
Noam Preil
e198eec76a
Document register functions
2020-05-17 12:03:01 -04:00
Noam Preil
773281c1f4
Remove trailing whitespace
2020-05-17 12:03:01 -04:00
Noam Preil
e2196a458f
Minor cleanup
2020-05-17 12:03:01 -04:00
Noam Preil
497eb31820
Fix the dumb in x86 too
2020-05-17 12:03:01 -04:00
Noam Preil
638554544a
Fix a dumb (thanks daurminator!)
2020-05-17 12:03:01 -04:00
Noam Preil
13ea698a40
rework x64 genSetReg
2020-05-17 12:03:01 -04:00
Veikka Tuominen
241984987b
Merge pull request #5367 from Vexu/fix
...
Fix zig fmt regression
2020-05-17 17:43:25 +03:00
Vexu
28d449b38d
fix zig fmt regression
2020-05-17 15:13:19 +03:00
Vincent Rischmann
e5ffb94911
linux: remove duplicated fields
2020-05-17 02:42:59 -04:00
Andrew Kelley
54820a3005
fix source not being loaded when printing errors
2020-05-16 20:23:15 -04:00
Andrew Kelley
017ecc5148
self hosted repl: close executables between updates
...
This allows the executable to be executed
2020-05-16 15:44:20 -04:00
Andrew Kelley
f2ceb023f4
Merge pull request #5217 from wozeparrot/master
...
build.zig recursive dep support
2020-05-16 14:24:51 -04:00
Vexu
eda03354dc
Merge pull request #5358 from Vexu/parser
...
Fix infinite loop with invalid comptime
2020-05-16 20:49:37 +03:00
Andrew Kelley
b0375978ba
self-hosted: remove zig libc command for now
...
Since it depends on the C++ Windows SDK code. For now, self-hosted is
staying pure self hosted, no C/C++ components.
2020-05-16 13:25:39 -04:00
Andrew Kelley
cf34480f2a
Merge pull request #5231 from kubkon/wasi-preopens
...
Add mechanism for extracting preopens from the runtime
2020-05-16 12:49:08 -04:00
Felix (xq) Queißner
7dc29fdee1
Creates std.ascii.control_code that contains the C0 control codes as named constants.
2020-05-16 12:46:44 -04:00
data-man
6647c3f054
Fixes fmt padding for some types
2020-05-16 12:45:43 -04:00
Michael Dusan
e05923f34b
macos: use realpath$DARWIN_EXTSN
...
macOS 10.15 Catalina causes an ancient variant of `realpath` to fail,
likely due to 10.15's evolving security model.
closes #5325
2020-05-16 12:41:53 -04:00
Andrew Kelley
79462bb591
Merge pull request #5354 from DrDeano/master
...
Add enum to addBuildOption
2020-05-16 12:40:06 -04:00
Vexu
081ffe24cf
fix infinite loop with invalid comptime
2020-05-16 19:23:59 +03:00
Andrew Kelley
cd5f69794d
cross compile the stage2 tests for the target that they work for
2020-05-16 12:19:31 -04:00
Vexu
74f7d710bb
Merge pull request #5032 from LakeByTheWoods/redo_translate_c
...
Translate C: Redo Add comment containing c source location for failed decls.
2020-05-16 17:37:19 +03:00
DrDeano
72b72faa0b
Add Enum Option
2020-05-16 15:36:18 +01:00
DrDeano
b2cb8beed9
Add enum to addBuildOptions
2020-05-16 15:35:42 +01:00
Vexu
d061e5854a
Merge pull request #5020 from jinroh/docs/search-perf
...
docs: search perf
2020-05-16 16:43:41 +03:00
Vexu
758de71d97
Merge pull request #5353 from Vexu/parser
...
Self-hosted parser fixes
2020-05-16 15:56:03 +03:00
Vexu
3e375ee2b9
translate-c use tagName for token id
2020-05-16 14:17:50 +03:00
Vexu
092f726eec
Merge pull request #5175 from daurnimator/multi-out-stream
...
std: add io.MultiOutStream
2020-05-16 13:43:50 +03:00
Vexu
e2a0f5741d
Merge pull request #5189 from zigazeljko/patch-1
...
Split AES struct into AESEncrypt and AESDecrypt
2020-05-16 13:20:14 +03:00
Vexu
6c10075dd3
Merge pull request #5350 from yvt/test-global-linkage
...
Enable the test `standalone/global_linkage`
2020-05-16 13:10:01 +03:00
Vexu
5ac684ec50
fix building translate-c
2020-05-16 13:05:43 +03:00
Vexu
a05011d403
move ParamType to Node.ParamDecl
2020-05-16 12:54:51 +03:00
Vexu
ed62081d38
recover from missing semicolon after if stmt
2020-05-16 12:29:01 +03:00
Vexu
6ca0def499
recover from invalid global error set access
2020-05-16 12:09:34 +03:00
Andrew Kelley
69a5f0d797
Merge remote-tracking branch 'origin/master' into self-hosted-incremental-compilation
2020-05-16 01:26:18 -04:00
Andrew Kelley
a286b5de38
build.zig: -Dlib-files-only skips installing self-hosted
2020-05-16 01:22:56 -04:00
Andrew Kelley
294bfb3321
stage2 zir tests passing
2020-05-15 23:54:13 -04:00
Andrew Kelley
f2feb4e47a
move Module to its own file
2020-05-15 21:44:33 -04:00
Andrew Kelley
64f4ef7556
update ZIR test cases
2020-05-15 21:29:52 -04:00
Andrew Kelley
5135238f86
ZIR: emit proper string literals
2020-05-15 19:11:00 -04:00
Andrew Kelley
8980f150e9
fix memory leaks of one of the ZIR test cases
2020-05-15 18:54:48 -04:00
Vexu
b2f16d4484
fix infinite loop with mismatced bracket
2020-05-15 23:50:47 +03:00
Andrew Kelley
e1d4b59c5b
self-hosted: update main.zig
...
After this commit there are no more bit rotted files.
The testing program that was in ir.zig has been moved to main.zig
Unsupported command line options have been deleted, or error messages
added.
The compiler repl is available from the build-exe, build-lib,
build-obj commands with the --watch option.
The main zig build script now builds the self-hosted compiler
unconditionally. Linking against LLVM is behind a -Denable-llvm
flag that defaults to off.
2020-05-15 15:20:42 -04:00
yvt
b747d4d1ce
Enable the test standalone/global_linkage
...
This test was added to the source tree in c39d7a6 , but has never been
referenced from anywhere.
2020-05-16 02:05:55 +09:00
Vexu
a00fd6e254
properly handle extra closing braces at top level
2020-05-15 14:30:49 +03:00
Vexu
f8b99331a2
Merge pull request #5336 from Vexu/parser
...
Make self-hosted parser more error tolerant
2020-05-15 14:15:30 +03:00
Vexu
440189a04a
cleanup* remove unecessary error* properly handle ReturnTypeInvalid in ast.zig functions* assert that the tree is clean in render.zig* simplify parser recovery with top level decls
2020-05-15 11:35:37 +03:00
Andrew Kelley
ebb81ebe59
fix the global offset table code and updating decl exports
2020-05-15 01:22:04 -04:00
Andrew Kelley
81a01bd481
fix codegen of sentinel-terminated arrays and .got alignment
...
we now have an exit(0) program working
2020-05-14 16:34:04 -04:00
Andrew Kelley
0986dcf1cf
self-hosted: fix codegen and resolve some analysis bugs
2020-05-14 13:20:27 -04:00
Vexu
c77fee0344
fix infinite loop
...
findToken wasn't as generic as I thought it was
2020-05-14 19:56:55 +03:00
Vexu
c4552ee8ed
store rparen in ReturnType.Invalid
...
This is useful for getting a partial function signature
2020-05-14 17:18:14 +03:00
Vexu
a32e240540
improve recovery from invalid container members
...
Instead of trying to find the end of the block or the next comma/semicolon
we no try to find the next token that can start a container member.
2020-05-14 12:09:40 +03:00
Vexu
89f2923a8a
recover from missing semicolon
2020-05-14 11:19:50 +03:00
Vexu
ac319b2734
remove useless nosuspend parsing
...
nosuspend cannot be used in a type expression and
all other use casesare covered by PrimaryExpr
2020-05-14 11:19:14 +03:00
Andrew Kelley
fb947c365e
work around stage1 compiler bug
...
breaking from inside the block with defers in scope triggered
broken LLVM module found: Terminator found in the middle of a basic
block!
2020-05-13 22:20:31 -04:00
Andrew Kelley
6a2425c38c
self-hosted: fix the rest of the compile errors
2020-05-13 22:12:38 -04:00
Andrew Kelley
080022f6c6
self-hosted: fix compile errors, except for codegen.zig
2020-05-13 20:06:01 -04:00
Vexu
c3b76d0913
recover from invalid builtin/async call
2020-05-14 00:16:56 +03:00
Vexu
1f81887a78
recover after invalid inline/extern
2020-05-13 23:35:58 +03:00
Vexu
ad71d959d7
correctly recover from invalid top level declarations
2020-05-13 23:28:04 +03:00
Vexu
2296906e2a
modernize std.zig.tokenizer
2020-05-13 23:08:42 +03:00
Vexu
23c5ff94e9
improve recovery on top level declarations
2020-05-13 20:42:18 +03:00
Vexu
4b898893e2
Merge pull request #5254 from ifreund/top-level-struct-file-names
...
Apply naming conventions of structs to files
2020-05-13 19:28:14 +03:00
Vexu
118db892be
Merge pull request #5321 from gpanders/ascii-case-sensitive
...
Add helper functions and docstrings to ascii.zig
2020-05-13 19:04:53 +03:00
Vexu
76681e6b96
Make PriorityQueue.Iterator public
...
The `iterator` function was already public but these seem to have been forgotten.
2020-05-13 18:38:03 +03:00
Vexu
be2b8d58ef
Merge pull request #5337 from DrDeano/master
...
Make StackIterator next public
2020-05-13 18:32:01 +03:00
DrDeano
2589f7207b
Make StackIterator next public
2020-05-13 16:21:15 +01:00
Vexu
3715226b9f
Merge pull request #5332 from jwmerrill/patch-1
...
Fix comment typo RFC8529 -> RFC8259
2020-05-13 18:04:27 +03:00
Vexu
afab095b61
translate-c remove error set from checkForBuiltinTypedef
2020-05-13 17:53:15 +03:00
Vexu
cefc04348e
continue parsing on invalid and token
2020-05-13 17:36:06 +03:00
Vexu
be392777b7
continue parsing after missing commas and invalid statements
2020-05-13 17:21:27 +03:00
Vexu
91358f3092
continue parsing on extra qualifier errors
2020-05-13 16:51:23 +03:00
Andrew Kelley
a3da584248
self-hosted: ir: implement separated analysis of Decl and Fn
2020-05-12 23:59:46 -04:00
Jason Merrill
706311cad9
Fix comment typo RFC8529 -> RFC8259
...
Ref: https://tools.ietf.org/html/rfc8259
2020-05-12 19:11:05 -07:00
Andrew Kelley
e3a0fac1a7
self-hosted: link: global offset table support for decls
2020-05-12 20:11:47 -04:00
Andrew Kelley
fda0eef9fb
clear progress indicator before printing errors
2020-05-12 16:43:50 -04:00
Vexu
df22c7dfef
std.zig attempt to continue parsing on error
2020-05-12 22:37:39 +03:00
Vexu
fa57463bb9
make parser testError take a list of expected errors
2020-05-12 21:44:08 +03:00
Vexu
80d0c2f166
Merge pull request #5118 from xackus/fix-json-writestream
...
fix json.WriteStream.emitJson
2020-05-12 17:44:06 +03:00
Greg Anders
c6420820b0
Remove redundant ASCII functions
...
The `matchCase` variants are simply duplicates of the `eql` and
`indexOf` functions found in std.mem.
2020-05-12 08:38:15 -06:00
Vexu
08e2e690d7
Merge pull request #5275 from strangebug/docs-markdown-links
...
Add support for external links and URL to markdown parser.
2020-05-12 15:35:50 +03:00
Vexu
29b3be4f2f
Merge pull request #5319 from Vexu/float-fix
...
Fix intToFloat on comptime_floats
2020-05-12 15:20:03 +03:00
Vexu
b1ebaba408
std.json properly handle comptime int/float
2020-05-12 15:15:21 +03:00
Andrew Kelley
619159cf48
self-hosted: rework the memory layout of ir.Module and related types
...
* add TypedValue.Managed which represents a Type, a Value, and some
kind of memory management strategy.
* introduce an analysis queue
* flesh out how incremental compilation works with respect to exports
* ir.text.Module is only capable of one error message during parsing
* link.zig no longer has a decl table map and instead has structs that
exist directly on ir.Module.Decl and ir.Module.Export
* implement primitive .text block allocation
* implement linker code for updating Decls and Exports
* implement null Type
Some supporting std lib changes:
* add std.ArrayList.appendSliceAssumeCapacity
* add std.fs.File.copyRange and copyRangeAll
* fix std.HashMap having modification safety on in ReleaseSmall builds
* add std.HashMap.putAssumeCapacityNoClobber
2020-05-12 01:02:48 -04:00
Greg Anders
9f496c0777
Add helper functions and docstrings to ascii.zig
...
* Add an upper case variant of `allocLowerString`
* Add case-sensitive variants of `eqlIgnoreCase`, `indexOfIgnoreCase`,
and `indexOfIgnoreCasePos`
* Add and update docstrings on functions
2020-05-11 19:36:41 -06:00
Vexu
7456389ef3
Merge pull request #5308 from xiongxin/master
...
mem.eql need slice type
2020-05-12 01:41:51 +03:00
Vexu
7aee8a93eb
Merge pull request #5315 from xackus/fix-bigint_fits_in_bits
...
stage1: detect underflow in bigint_fits_in_bits
2020-05-12 01:25:24 +03:00
Vexu
0847b47bf8
fix @intToFloat on comptime_floats
2020-05-12 00:24:09 +03:00
Vexu
3e3c651b67
Merge pull request #5316 from marler8997/pubSockLen
...
make Address.getOsSockLen pub
2020-05-11 20:10:59 +03:00
Jonathan Marler
832f6c1228
make Address.getOsSockLen pub
2020-05-11 09:11:05 -06:00
xackus
204f8daeed
stage1: detect underflow in bigint_fits_in_bits
2020-05-11 14:06:37 +02:00
熊鑫
0363f3c6f3
mem.eql need slice type
2020-05-10 20:35:21 +08:00
Andrew Kelley
a32d3a85d2
rework self-hosted compiler for incremental builds
...
* introduce std.ArrayListUnmanaged for when you have the allocator
stored elsewhere
* move std.heap.ArenaAllocator implementation to its own file. extract
the main state into std.heap.ArenaAllocator.State, which can be
stored as an alternative to storing the entire ArenaAllocator, saving
24 bytes per ArenaAllocator on 64 bit targets.
* std.LinkedList.Node pointer field now defaults to being null
initialized.
* Rework self-hosted compiler Package API
* Delete almost all the bitrotted self-hosted compiler code. The only bit
rotted code left is in main.zig and compilation.zig
* Add call instruction to ZIR
* self-hosted compiler ir API and link API are reworked to support
a long-running compiler that incrementally updates declarations
* Introduce the concept of scopes to ZIR semantic analysis
* ZIR text format supports referencing named decls that are declared
later in the file
* Figure out how memory management works for the long-running compiler
and incremental compilation. The main roots are top level
declarations. There is a table of decls. The key is a cryptographic
hash of the fully qualified decl name. Each decl has an arena
allocator where all of the memory related to that decl is stored.
Each code block has its own arena allocator for the lifetime of
the block. Values that want to survive when going out of scope in
a block must get copied into the outer block. Finally, values must
get copied into the Decl arena to be long-lived.
* Delete the unused MemoryCell struct. Instead, comptime pointers are
based on references to Decl structs.
* Figure out how caching works. Each Decl will store a set of other
Decls which must be recompiled when it changes.
This branch is still work-in-progress; this commit breaks the build.
2020-05-10 02:05:54 -04:00
Haze Booth
e79d7e0ded
Remove fs.File artifact from connectUnixSocket
2020-05-09 12:29:27 -04:00
Vexu
d4d509090b
make std.build.getInstallPath public
...
Closes #5299
2020-05-09 00:31:11 +03:00
Vexu
453df1cc1e
Merge pull request #4892 from Sobeston/patch-4
...
mem.zeroes - add sentinel terminated array support
2020-05-08 22:37:27 +03:00
Vexu
336ddb5b76
std: add test for mem.zeroes on sentinel terminated arrays
2020-05-08 19:03:27 +03:00
Vexu
f2d3266075
Merge pull request #4932 from Qix-/fix-private-access
...
Fix private access
2020-05-08 18:21:15 +03:00
Vexu
f1e5a4f163
Merge pull request #5296 from daurnimator/osx-RTLD
...
std: fix RTLD_ constants on OSX
2020-05-08 18:05:04 +03:00
daurnimator
45f7c78bfc
std: fix RTLD_ constants on OSX
2020-05-08 22:34:18 +10:00
Vexu
10abffcd98
fix more private member access
2020-05-08 15:10:38 +03:00
Josh Junon
b6dc7fc9ff
publicize member functions affected by #4909
2020-05-08 14:26:28 +03:00
Josh Junon
4a5c58dd35
fix private member checking for non-canonical invocations ( fixes #4909 )
2020-05-08 14:26:13 +03:00
Josh Junon
fbf081a306
add failing test for #4909
2020-05-08 14:26:13 +03:00
xackus
2c9effc101
stage1: handle all cases of invalid struct field default value
2020-05-07 16:39:16 -04:00
Andrew Kelley
3aa259d119
Merge branch 'kristoff-it-macos-kqueue'
...
closes #5286
2020-05-07 13:41:26 -04:00
Loris Cro
35a59b5b0f
remove readable check when opening a socket connection
2020-05-07 13:41:17 -04:00
Loris Cro
7e8b859095
fix oneshot flag erroneusly set as filter_flag
2020-05-07 13:41:17 -04:00
Loris Cro
a78ac96134
fix crash in single-threaded builds
2020-05-07 13:41:02 -04:00
xackus
79bf4003da
stage1: add ZigList gdb pretty printing
2020-05-07 12:43:22 -04:00
Andrew Kelley
ba43492c0e
Merge pull request #5268 from tadeokondrak/remove-callconv-redundant-syntax
...
Remove syntax redundant with callconv
2020-05-07 12:42:26 -04:00
Jens Goldberg
20c1696865
Removed GetModuleHandleA from user32
...
GetModuleHandleA is an kernel32 function and already defined there, it doesn't belong in user32.
2020-05-07 12:38:46 -04:00
Jens Goldberg
25810bc1e6
Removed duplicate WM_ACTIVATE
2020-05-07 12:38:46 -04:00
Vexu
54b2a6ec41
Merge pull request #5287 from marler8997/fixAllocWithPayload
...
fix copy/paste error in AllocWithOptionaPayload
2020-05-07 12:39:57 +03:00
Jonathan Marler
0a76e11617
add failAllocator to enable some regression tests
2020-05-06 23:56:48 -06:00
Jonathan Marler
0c7397b49f
fix copy/paste error in AllocWithOptionaPayload
2020-05-06 23:08:08 -06:00
Timon Kruiper
b336dda076
Standard library: Fix a regression in loop.waitUntilFdWritableOrReadable
...
This broke async io on linux.
Regressed in 8ebcca6734
2020-05-06 13:14:06 -04:00
Vexu
9c422c28f6
Merge pull request #5281 from data-man/hash_vector_nocopy
...
Optimization of vectors hashing
2020-05-06 18:12:35 +03:00
data-man
3c4abacba6
Optimization of vectors hashing
2020-05-06 17:08:49 +05:00
Vexu
0e30edd8d0
std: handle ConnectionTimedOut in switch
...
regression from #5266
closes #5270
2020-05-06 12:52:26 +03:00
Vexu
06e6d39c6c
Merge pull request #5257 from matt1795/scoped-typedef
...
Add scoped typedef to translate-c
2020-05-06 12:28:30 +03:00
Vexu
c0b269bf46
translate-c: small patch to fix bultin type detection
2020-05-06 11:48:46 +03:00
Matthew Knight
52f0adb305
checkForBuiltinTypedef now returns a string
2020-05-05 23:26:00 -07:00
Lann
eb4fa63d3d
Remove reference to import type ( #5279 )
...
* Remove reference to import type
* Improve language in `@This()` doc
2020-05-05 19:13:35 -04:00
Andrew Kelley
ae080b5c21
readme: remove the part about stage2 until it's done
2020-05-05 15:26:36 -04:00
Andrew Kelley
ad43155f25
Merge branch 'haze-hb/test-evented-io-build-zig'
...
closes #5274
2020-05-05 15:18:34 -04:00
Andrew Kelley
6f3d76f61e
simplify test-evented-io build setting
2020-05-05 15:18:04 -04:00
Haze Booth
a39cb034ea
Add setUseTestEventedIO for test steps in build.zig
2020-05-05 15:16:54 -04:00
Andrew Kelley
b13a02ed1a
avoid unnecessary fcntl syscalls when setting socket flags
2020-05-05 12:50:50 -04:00
Andrew Kelley
0a2104689b
fix incorrect flags being set in os.setSockFlags
...
fixes networking stuff on darwin
2020-05-05 12:45:39 -04:00
Tadeo Kondrak
84a0a9688c
update docs/tests for async/extern fn removal
2020-05-05 10:31:32 -06:00
StrangeBug
54088fe6e1
Add support for external links and URL to markdown parser.
2020-05-05 18:09:32 +02:00
Tadeo Kondrak
6745a6f6f6
zig fmt
2020-05-05 09:38:02 -06:00
Tadeo Kondrak
d0e996405b
add zig fmt fix for async/extern fn
2020-05-05 09:37:59 -06:00
Tadeo Kondrak
7ada59f873
remove nakedcc/stdcallcc/async fn/extern fn fnproto
2020-05-05 09:37:28 -06:00
Jakub Konka
81d824bf80
Clear PreopenList on every populate call
2020-05-05 17:23:49 +02:00
Andrew Kelley
e6955688ac
Merge pull request #5272 from tadeokondrak/noasync-to-nosuspend
...
Noasync to nosuspend
2020-05-05 11:21:02 -04:00
Jakub Konka
07a968b344
Add docs
2020-05-05 17:05:30 +02:00
Vexu
fde6d28c23
Merge pull request #5273 from haze/hb/fix-posix-errorunion-thread-spawn-result
...
Update ErrorUnion thread spawn result to return null instead of 0
2020-05-05 16:20:05 +03:00
Jakub Konka
558bb24601
Move preopen and path wasi helpers to std.fs.wasi module
...
Previously, the path and preopens helpers were prototyped in `std.os.wasi`
module, but since they are higher-level abstraction over wasi, they belong in
`std.fs.wasi` module.
2020-05-05 15:08:52 +02:00
Jakub Konka
d4c33129cf
Shuffle things around; add PreopenList.findByPath method
...
This commit removes `std.os.openatWasi` function, and renames it to
`std.os.wasi.openat`. Additionally, the added `PreopenList.findByPath`
method allows querying the list for a matching preopen by path.
2020-05-05 15:08:52 +02:00
Jakub Konka
dd238352a4
Encapsulate getPreopens inside PreopenList
2020-05-05 15:08:52 +02:00
Jakub Konka
fc77e393fd
Remove obsolete PATH_MAX const
2020-05-05 15:08:52 +02:00
Jakub Konka
b8112b3d17
Simplify File constructors
2020-05-05 15:08:52 +02:00
Jakub Konka
8bce1b6981
Refactor resolve_preopen into getPreopens function
...
This commit refactors `std.os.wasi.resolve_preopen` into a (higher-level)
`std.os.wasi.getPreopens` funtion which returns a slice with _all_
preopens at any given time. This fn allows the WASI module to
inquire at any given time for all preopens provided by the runtime.
This commit also makes `cwd()` a compile error on WASI.
2020-05-05 15:08:52 +02:00
Jakub Konka
05fb3e79fe
Make std.fs.cwd() return preopen for "." if exists
...
This commit adds WASI specific impl of `std.fs.cwd()` in which we
emulate the `cwd` behaviour by inquiring the runtime for a "."
preopen if available. This is OK for simple relative ops, but will
not work for any ops which require absolute paths.
2020-05-05 15:08:52 +02:00
Jakub Konka
8e1cd69717
Implement std.fs.Dir.openFileWasi
...
It seems that `std.os.openZ` is too POSIX-specific, so I think it
should not be a point of entry for WASI `open` call. I figure
WASI should be treated as a separate "os" that's _not_ POSIX
especially given the incoming changes in the ephemeral snapshot.
2020-05-05 15:08:52 +02:00
Jakub Konka
d7ca220121
Start drafting out openZ
2020-05-05 15:08:52 +02:00
Tadeo Kondrak
fdfdac4939
update comments for nosuspend
2020-05-05 05:55:27 -06:00
Tadeo Kondrak
2c9204032d
update tests for nosuspend
2020-05-05 05:55:26 -06:00
Tadeo Kondrak
af00afed98
zig fmt
2020-05-05 05:55:25 -06:00
Tadeo Kondrak
b957dc29a4
Rename noasync to nosuspend in C++ compiler
2020-05-05 05:17:34 -06:00
Tadeo Kondrak
8d5636ebe4
Rename noasync to nosuspend in self-hosted, add rewriter
2020-05-05 05:17:33 -06:00
Haze Booth
4cb4097b08
Update ErrorUnion thread spawn result to return null instead of 0
2020-05-05 04:15:43 -04:00
Matthew Knight
db4833d4d6
moved duplicated code to common functions
2020-05-04 23:45:31 -07:00
Vexu
f127dee474
Merge pull request #5267 from Vexu/const-call
...
Fix missing compile error on call assigned to const
2020-05-04 21:45:15 +03:00
Jonathan Marler
75b699b2c6
os.zig: add ETIMEDOUT error case to read function
...
According to documentation ETIMEDOUT (110) is a valid error code for the read function. I just had my long-running (been running for about 7 weeks) network program crash because it did not handle the ETIMEDOUT error code from "read".
2020-05-04 13:48:34 -04:00
Vexu
85fd484f07
std: fix blake3 assignment to constant
2020-05-04 14:45:36 +03:00
Vexu
adc444ceeb
fix missing compile error on call assigned to const
2020-05-04 14:28:58 +03:00
xackus
887bf8ba93
stage1: remove unneeded switch
2020-05-04 06:51:51 +02:00
xackus
0db9e90e8f
stage1: fix assert fail on opaque fn ptr param
2020-05-04 06:51:37 +02:00
Cato
9b788b765c
Pass filtered_sock_type to system.socket. Cover PermissionDenied error
2020-05-03 15:35:36 -04:00
daurnimator
277d088558
std: use async for MultiOutStream
2020-05-03 18:33:04 +10:00
Matthew Knight
c5198bd76f
added scoped typedef to translate-c
2020-05-02 20:22:43 -07:00
data-man
c8b4cc2ff9
Include dbg.h to third-party libs
2020-05-02 18:29:02 -04:00
Andrew Kelley
1b201f460f
Merge branch 'ninjacato-tomerge-darwin-fix-accept-sockets'
...
closes #5251
2020-05-02 17:38:17 -04:00
Andrew Kelley
8a8beefa36
solve the problem with Darwin shims in std.os instead
...
* implement SOCK_NONBLOCK and SOCK_CLOEXEC Darwin shims in std.os
* revert changes to std.net
* remove os.accept and rename os.accept4 to os.accept
2020-05-02 17:36:28 -04:00
Isaac Freund
3a397795be
Apply naming conventions of structs to files
2020-05-02 23:28:44 +02:00
Tadeo Kondrak
a62e9bc8e5
Implement @Type for ErrorSet
2020-05-02 14:39:32 -06:00
Tadeo Kondrak
647901b4a8
Constify TypeInfo
2020-05-02 14:39:31 -06:00
Tadeo Kondrak
ca6db2d008
Implement @Type() for EnumLiteral and FnFrame
2020-05-02 14:39:28 -06:00
Tadeo Kondrak
1696e943ac
Implement @typeInfo for @Frame()
...
Closes https://github.com/ziglang/zig/issues/3066
2020-05-02 14:39:27 -06:00
Cato
07bee9da42
Fixed Darwin-incompatible socket flags and unavailable system calls
2020-05-02 16:37:39 -04:00
Andrew Kelley
03a7124543
Merge pull request #5249 from ziglang/FireFox317-windows-evented-io
...
fix behavior test with --test-evented-io on windows
2020-05-02 16:29:58 -04:00
Andrew Kelley
b7914d901c
add test coverage for top level fields
...
closes #2022
2020-05-02 14:53:20 -04:00
Andrew Kelley
7998e2b0f4
Merge remote-tracking branch 'origin/master' into FireFox317-windows-evented-io
2020-05-02 14:16:59 -04:00
Chris Heyes
8ebcca6734
Get evented io code paths to build on macOS ( #5233 )
...
* Get evented io code paths to build on macOS
* Use mode_t instead of usize where appropriate
2020-05-02 14:14:46 -04:00
Andrew Kelley
5656f5090d
fs.File: improve handling async I/O on Windows
...
Before it was possible for .intended_io_mode = .blocking,
.capable_io_mode = .evented, and then the implementation would put a
request on the fs thread, which is the wrong behavior. Now it always
calls the appropriate WriteFile/ReadFile function, passing the intended
io mode directly as a parameter.
This makes the behavior tests pass on Windows with --test-evented-io.
2020-05-02 14:09:17 -04:00
Michael Dusan
33705d06bb
Merge pull request #5250 from mikdusan/qemu
...
ci linux: bump qemu-5.0.0-z2
2020-05-02 09:46:40 -04:00
Michael Dusan
5fb8d7dcdc
ci linux: bump qemu-5.0.0-z2
...
closes #5245
see 1b41e31a5c
2020-05-02 04:39:36 -04:00
Andrew Kelley
9dac8a5be9
update windows impl of child process to new File API
2020-05-02 04:31:26 -04:00
nycex
77376a54bf
correct usages of std.fs.dir.DeleteFileError ( #5058 )
...
* correct usages of std.fs.dir.DeleteFileError
* test std.fs.createFileAbsolute() and std.fs.deleteFileAbsolute()
2020-05-02 04:19:07 -04:00
Andrew Kelley
428065da30
Merge pull request #5243 from niacat/kern-arand
...
Avoid reading from /dev/urandom on NetBSD
2020-05-02 04:16:24 -04:00
Andrew Kelley
6546c74825
child process: no need to remove O_CLOEXEC before execve
2020-05-02 03:38:05 -04:00
Andrew Kelley
92f3e9c92a
remove last use of share_with_child_process
2020-05-02 01:54:36 -04:00
Andrew Kelley
beebcbb677
Merge remote-tracking branch 'origin/master' into FireFox317-windows-evented-io
2020-05-02 01:53:24 -04:00
Andrew Kelley
43f7856bac
fix regressions in windows std lib tests
2020-05-02 01:25:22 -04:00
Andrew Kelley
2272a07ca0
std.event.Loop: promote the fs thread to be available for all OS's
2020-05-02 00:41:19 -04:00
Andrew Kelley
45bce27b8f
cleanup and fixes. behavior tests passing with evented I/O
2020-05-01 23:17:28 -04:00
Michael Dusan
3dbe02e2d8
Merge pull request #5247 from mikdusan/housekeeping
...
stage1: cleanup
2020-05-01 20:57:56 -04:00
Andrew Kelley
988031c07c
Merge branch 'windows-evented-io' of https://github.com/FireFox317/zig into FireFox317-windows-evented-io
2020-05-01 19:02:16 -04:00
Michael Dusan
09d6dc1ce6
stage1: cleanup
...
- remove unused IrInstSrcOptionalUnwrapPtr.initializing
2020-05-01 18:01:21 -04:00
Andrew Kelley
3386bb896d
Merge pull request #5192 from ziglang/stage2-tests
...
add ZIR compare output test case to test suite
2020-05-01 17:35:52 -04:00
Andrew Kelley
94b0d0e802
std.progress: handle error from FillConsoleOutputAttribute
...
I observed this returning an error. Fall back to not doing
terminal stuff if an error occurs here.
See #5244
2020-05-01 15:14:44 -04:00
Cato Auestad
5418efa1e5
Added socket bits for Darwin
2020-05-01 14:28:33 -04:00
Andrew Kelley
ec6ef86219
fix off-by-one error in sizeInBaseUpperBound
2020-05-01 13:33:46 -04:00
nia
74ad315360
In init_rand avoid reading from /dev/urandom on NetBSD/FreeBSD
...
Use the KERN_ARND sysctl instead.
2020-05-01 17:23:27 +01:00
nia
14a954f350
Add arc4random_buf() in NetBSD libc, use it to implement getrandom()
2020-05-01 17:22:27 +01:00
Andrew Kelley
4044a77621
update std.meta.IntType => std.meta.Int
2020-05-01 06:49:30 -04:00
Andrew Kelley
b70e6da914
back to stage2 tests passing
2020-05-01 06:47:56 -04:00
Andrew Kelley
8766821157
rework std.math.big.Int
...
Now there are 3 types:
* std.math.big.int.Const
- the memory is immutable, only stores limbs and is_positive
- all methods operating on constant data go here
* std.math.big.int.Mutable
- the memory is mutable, stores capacity in addition to limbs and
is_positive
- methods here have some Mutable parameters and some Const
parameters. These methods expect callers to pre-calculate the
amount of resources required, and asserts that the resources are
available.
* std.math.big.int.Managed
- the memory is mutable and additionally stores an allocator.
- methods here perform the resource calculations for the programmer.
- this is the high level abstraction from before
Each of these 3 types can be converted to the other ones.
You can see the use case for this in the self-hosted compiler, where we
only store limbs, and construct the big ints as needed.
This gets rid of the hack where the allocator was optional and the
notion of "fixed" versions of the struct. Such things are now modeled
with the `big.int.Const` type.
2020-05-01 06:47:56 -04:00
Andrew Kelley
1d202008d8
add ZIR transform test case
2020-05-01 06:47:20 -04:00
Andrew Kelley
751903ba8f
zir: add breakpoint() instruction and object file ability
2020-05-01 06:47:20 -04:00
Andrew Kelley
f89dbe6c4e
link: introduce the concept of output mode and link mode
2020-05-01 06:47:20 -04:00
Andrew Kelley
28729efe29
ZIR: implement return instruction
2020-05-01 06:47:20 -04:00
Andrew Kelley
6b0f7de247
ZIR: add cmp and condbr instructions
2020-05-01 06:47:20 -04:00
Andrew Kelley
fb67a7260d
link: recognize that Windows does not have POSIX fs modes
2020-05-01 06:47:20 -04:00
Andrew Kelley
56a024bbfc
disable stage2 zir tests on not-yet-supported archs
2020-05-01 06:47:20 -04:00
Andrew Kelley
6e6d0eb690
disable stage2 zir tests on not-yet-supported OS's
2020-05-01 06:47:20 -04:00
Andrew Kelley
2bae942800
add ZIR compare output test case to test suite
2020-05-01 06:47:20 -04:00
Jakub Konka
b23a87953a
Fast-forward std.os.bits.wasi to match preview1 snapshot ABI
...
`wasi_snapshot_preview1` introduced a couple of ABI changes. This
commit fast-forwards the types and consts defined in `std.os.bits.wasi`
to match those changes.
2020-04-30 13:28:50 -04:00
wozeparrot
9d79f39844
switch anyerror to OutOfMemory
2020-04-30 12:14:17 -04:00
Vexu
7192ca14b7
Merge pull request #5216 from alexnask/windows_ansi_codes
...
Progress will now use ANSI escape codes on windows for terminals that support them
2020-04-30 18:35:55 +03:00
Vexu
155029b709
Merge pull request #5223 from iansimonson/translate_c_bool_to_int
...
Translate-C convert bools to int in complex expressions
2020-04-30 18:28:38 +03:00
Ian Simonson
a2c3ebb756
Use transCreateNodeInfixOp instead of maybeSuppressResult
2020-04-30 19:10:10 +10:00
Vexu
e72f45475d
Merge pull request #4683 from LakeByTheWoods/parser_test
...
Add visible newlines to parser_test output when there's a failure.
2020-04-30 12:04:23 +03:00
Vexu
611bd8e9f4
Merge pull request #5213 from tadeokondrak/evented-readv-fix
...
Fix std.event.Loop.readv
2020-04-30 11:00:27 +03:00
Vexu
87c9696121
move printWithVisibleNewlines to testing.expectEqualStrings
2020-04-30 10:34:18 +03:00
Vexu
2d06e731ec
rename diffIndex to indexOfDiff
2020-04-30 10:33:50 +03:00
Jakub Konka
611a1436f0
Update WASI snapshot to preview1
...
This commit updates the WASI imports to use `wasi_snapshot_preview1`
instead of the old `wasi_unstable`. There are some minor ABI
differences between the two, however, the main motivator for using
the latest "stable" snapshot (aka preview1) is that, at least in
Wasmtime, there has been a lot of improvement work put into preview1
and unfortunately I might add, the improvements were not (in full)
backported to `wasi_unstable` snapshot.
Also, this commit removes the optional bound on the pointer to
`environ_get` syscall.
2020-04-30 01:52:12 -04:00
Ian Simonson
e6fa0beb33
Translate-C convert bools to int in complex expressions
...
Pre-requisite for having a test case for #5062
In complex C statements which are outside of macros,
it is valid C to perform e.g. a bitor between an
integer and a boolean `5 | (8 == 9)`
Currently this results in a zig error after translating
as `c_int | bool` is invalid Zig.
Detects if a sub-expression of a numeric operator is
boolean and if so converts it to int
2020-04-30 12:48:27 +10:00
Michael Dusan
a08675723c
Merge pull request #5219 from mikdusan/qemu
...
ci linux: bump qemu 5.0.0-rc4 → 5.0.0
2020-04-29 19:20:20 -04:00
Michael Dusan
e97181e362
ci linux: bump qemu 5.0.0-rc4 → 5.0.0
2020-04-29 17:01:12 -04:00
Alexandros Naskos
61ba52b9e3
Add unreachable branch
2020-04-29 20:07:23 +03:00
wozeparrot
bfb40972a9
build.zig recursive dep support
2020-04-29 12:54:06 -04:00
Alexandros Naskos
273d2de099
Progress will now use ANSI escape codes on windows for terminals that support it
2020-04-29 19:49:02 +03:00
Tadeo Kondrak
07c1be80c2
Fix std.event.Loop.readv
2020-04-29 04:33:29 -06:00
Vexu
15141d865a
Merge pull request #5210 from tadeokondrak/IntType-to-Int
...
std.meta.IntType -> std.meta.Int
2020-04-29 11:01:19 +03:00
Tadeo Kondrak
350b2adacd
std.meta.IntType -> std.meta.Int
2020-04-28 19:11:31 -06:00
Tadeo Kondrak
eb183ad9fe
rename std.meta.IntType to std.meta.Int
...
Closes https://github.com/ziglang/zig/issues/5194
2020-04-28 19:11:18 -06:00
Andrew Kelley
5929e5ca0e
Merge pull request #5196 from tadeokondrak/@vector-to-@type-vector
...
`@Vector` -> `@Type(.Vector)`
2020-04-28 16:25:40 -04:00
Andrew Kelley
03dd1fca94
Merge pull request #5195 from tadeokondrak/opaquetype-to-type-opaque
...
@OpaqueType -> `@Type(.Opaque)
2020-04-28 16:21:07 -04:00
Vexu
db25c78413
Merge pull request #5201 from tadeokondrak/mangle-field-names-locally
...
Mangle field names with a local counter in records (translate-c)
2020-04-28 23:18:36 +03:00
Tadeo Kondrak
0cf129689e
Fix/add translate-c tests for previous commit
2020-04-28 08:45:52 -06:00
Tadeo Kondrak
83d2d7ab8a
Mangle field names with a local counter in records
...
See https://github.com/ifreund/river/issues/17 for an issue that occurs
because the field names are mangled globally. When using the generated
bindings, you have no choice but to use the unstable names or redeclare
the entire struct. This commit changes the behaviour to use a local
counter per record declaration, so the names are predictable each time.
2020-04-28 08:45:51 -06:00
Tadeo Kondrak
0673a8d576
Update language reference for std.meta.Vector
2020-04-28 00:47:14 -06:00
Tadeo Kondrak
f977155fdb
@Vector -> std.meta.Vector
2020-04-28 00:47:13 -06:00
Tadeo Kondrak
ee5b358d71
add std.meta.Vector to replace @Vector
2020-04-28 00:24:46 -06:00
Tadeo Kondrak
249938dde0
Validate vector types for @Vector
2020-04-28 00:24:45 -06:00
Tadeo Kondrak
2ef0795bfb
Update language reference for recent @Type changes
2020-04-28 00:02:14 -06:00
Tadeo Kondrak
17e41f6cd3
@OpaqueType -> @Type(.Opaque)
2020-04-28 00:02:13 -06:00
wozeparrot
01605a7742
add missing const to pkg dependencies
2020-04-27 18:29:55 -04:00
Andrew Kelley
ecdf75d04e
Merge pull request #5187 from ziglang/squeek502-windows-fmt-relative
...
zig fmt: Fix relative paths with . and .. on Windows as well as forward slashes
2020-04-27 18:28:53 -04:00
Žiga Željko
130435a17a
Split AES struct into AESEncrypt and AESDecrypt
2020-04-28 04:52:42 +08:00
Tadeo Kondrak
45f4a1124f
implement @Type() for more types
2020-04-27 14:37:18 -04:00
Andrew Kelley
1e04e85200
std: support / in Windows paths
2020-04-27 13:39:06 -04:00
Andrew Kelley
41e17106cd
zig fmt: still print the relative path
...
The previous commit made zig fmt print absolute paths; this commit keeps
the absolute path resolution but still prints the relative paths to
stdout.
2020-04-27 13:38:19 -04:00
Ryan Liptak
fdff381a56
fmt: Fix relative paths with . and .. on Windows
...
This is a band-aid fix due to NtCreateFile failing on paths with . or .. in them.
2020-04-27 13:35:59 -04:00
Auguste Rame
0df82889cf
Fix issue with std.json incorrectly replacing forward slashes with a backslash ( #5167 )
...
* fix breaking typo in json.zig
* add tests
2020-04-27 12:22:43 -04:00
George Roman
a17eb15e11
Add missing state to C object cache
2020-04-27 12:21:48 -04:00
Alexandros Naskos
37fa418a94
Cleaned up code, added a testcase for an extern member function call
2020-04-27 18:07:18 +03:00
Alexandros Naskos
908b908481
Added tests.
2020-04-27 15:22:15 +03:00
Alexandros Naskos
179423ec27
Extern functions can now be evaluated to undefined values in TypeOfs
2020-04-27 02:33:21 +03:00
Andrew Kelley
c22b54c9d8
stage2 zir: remove dead code
...
this was part of the live coding stream and I forgot to delete it before
committing
2020-04-26 17:37:04 -04:00
Henry Nelson
83b0f9c6f7
Fix unfortunate typo
2020-04-26 17:33:04 -04:00
Andrew Kelley
6aeceec1f2
add CLI option -Bsymbolic for binding global references locally
2020-04-26 15:30:52 -04:00
Nick Appleton
28c31a8429
Fix f64 variants of math.cosh and math.sinh to accept negative inputs. ( #5172 )
...
* add tests for negative inputs to cosh32 and cosh64. fix bug in cosh64 for negative inputs.
* fix problem with negative input with f64 sinh and add tests
2020-04-26 14:03:19 -04:00
daurnimator
122b992a95
std: add io.MultiOutStream
2020-04-27 02:50:32 +10:00
Andrew Kelley
d44c9bdbd9
ir: elemptr and add instructions
2020-04-26 01:20:58 -04:00
Andrius Mitkus
6481b02fdc
std: fix posix Thread.spawn to accept all startFn types
2020-04-25 16:15:25 -04:00
George Roman
0c037a8561
Pass each target feature flag separately
2020-04-25 15:54:02 -04:00
daurnimator
1d6e53756b
std: add in_stream.isBytes
2020-04-25 20:42:13 +10:00
daurnimator
b531c0e676
std: add instream.readBytesNoEof function
2020-04-25 20:38:46 +10:00
LemonBoy
a7a8c433d0
stage1: Prevent the creation of illegal ptr types
...
Closes #5140
2020-04-24 15:55:32 -04:00
Andrew Kelley
7634e67ba5
Merge pull request #5158 from ziglang/zir-to-elf
...
beginnings of (non-LLVM) self-hosted machine code generation and linking
2020-04-24 15:37:21 -04:00
Andrew Kelley
9ebf25d145
link: change default executable mode to 0o777
...
Jonathan S writes:
On common systems with a 022 umask, this will still result in a
file created with 755 permissions, but it works appropriately if the
system is configured more leniently. (As another data point, C's fopen
seems to open files with the 666 mode.)
2020-04-24 15:36:08 -04:00
Timon Kruiper
c829f2f7b7
Add mips support to standard library
2020-04-24 15:28:55 -04:00
Andrew Kelley
058937e44d
bug fixes to make it work
2020-04-24 02:09:30 -04:00
Andrew Kelley
229e99ca37
codegen: write the updated code size to PT_LOAD section header
2020-04-23 23:53:52 -04:00
Andrew Kelley
2d35f71fa9
codegen rdx set immediate
2020-04-23 20:30:20 -04:00
Andrew Kelley
757d13d784
codegen supports embedded-in-code constants
...
also coerce no longer requires a bitcast
2020-04-23 20:23:16 -04:00
Andrew Kelley
0ac502f372
codegen for setting rax and rdi registers
2020-04-23 19:40:17 -04:00
Andrew Kelley
63b54bcf51
codegen for inline assembly
2020-04-23 18:58:47 -04:00
Andrew Kelley
99ec614b71
codegen for const ints and string literals
2020-04-23 17:46:01 -04:00
Andrew Kelley
24a01eed90
basics of writing ELF and machine code generation
2020-04-23 16:41:20 -04:00
xackus
ebbd137a0e
fix json.WriteStream.emitJson
2020-04-23 22:14:23 +02:00
xackus
a9eb4a6740
stage1: fix crash on accessing an array of size zero with runtime index
2020-04-23 12:45:32 -04:00
LemonBoy
e6428f9401
stage1: Fix bitcast of immediate to ptr type ( #5131 )
...
Consider a (legal according to the `@bitCast` rules) conversion from u16
to [2]u8: since the former is a scalar and the latter is a pointer
(arrays are represented at pointers in the codegen phase) we have to
allocate a temporary slot on the stack and then bitcast the resulting
pointer to the desired destination type.
Beware that this means the lifetime of the resulting value is the same
of the function it's contained in and for all intents and purposes
should be regarded as a local (eg. it should not escape).
Closes #4395
Closes #5121
2020-04-23 12:44:16 -04:00
Andrew Kelley
a3dfe36ca1
zir-to-elf skeleton
2020-04-22 23:42:58 -04:00
Michael Dusan
58d5c37409
Merge pull request #5139 from mikdusan/qemu-5.0.0-rc4
...
Qemu 5.0.0 rc4
2020-04-22 20:41:16 -04:00
Michael Dusan
79809a0e54
ci: bump static-qemu 5.0.0-rc3 → 5.0.0-rc4
2020-04-22 18:02:50 -04:00
Michael Dusan
9a06f966cd
Merge pull request #5125 from mikdusan/kern.osproductversion
...
macos: add fallback version detection
2020-04-22 15:57:29 -04:00
Andrew Kelley
e8545db9d4
Merge pull request #5130 from ziglang/stage2-ir
...
beginnings of non-LLVM self-hosted backend
2020-04-22 14:42:46 -04:00
LemonBoy
b5e72c0148
stage1: Prevent the creation of illegal pointer types
...
Changing the pointer length from Unknown to Single/C now resets the
sentinel value too.
Closes #5134
2020-04-22 14:40:57 -04:00
Andrew Kelley
173a143dd0
Merge pull request #5133 from LemonBoy/win-progress
...
Progressbar for Windows
2020-04-22 12:52:48 -04:00
LemonBoy
0a2519fafb
stage2: Allow \t in string literals
...
Lift the ban on literal tab chars in string literals as they have
nothing to do with code formatting.
2020-04-22 12:48:45 -04:00
LemonBoy
155e631aa6
std: Implement progress for Windows
...
Use the Win32 API instead of using the VT escape sequences.
2020-04-22 12:58:02 +02:00
LemonBoy
395b530387
stage1: Another hack for the C ABI compatibility
...
Applying the wrong ABI is slightly better than using the Zig ABI, the
whole thing is so wrong it should be burned to the ground.
2020-04-22 12:52:24 +02:00
Andrew Kelley
1eda2ada9a
std.math.big.Int: don't rely on the allocator when printing
2020-04-22 03:49:50 -04:00
Andrew Kelley
d58233b361
ir: improve ZIR emission enough to emit hello world
2020-04-22 03:08:50 -04:00
Andrew Kelley
b1a86040dd
ir: emit zir for fntype
2020-04-22 00:26:37 -04:00
Andrew Kelley
993e654554
emit zir skeleton
2020-04-22 00:04:52 -04:00
Andrew Kelley
2e6ccec100
ir: analyze asm instruction
2020-04-21 22:19:32 -04:00
Andrew Kelley
8d3e4147d5
ir: analyze deref instruction
2020-04-21 21:33:55 -04:00
Andrew Kelley
2c11acf807
ir: analyze fieldptr instruction
2020-04-21 21:14:56 -04:00
Andrew Kelley
c12bc8652e
ir: analyze ptrtoint
2020-04-21 20:34:40 -04:00
Andrew Kelley
2cdbb5f472
ir: analyze int casting
2020-04-21 19:48:59 -04:00
Michael Dusan
3df0a3a528
macos: add fallback version detection
...
Fallback to sysctl `kern.osversion` when `kern.osproductversion` is not
available (prior to 10.13.4) .
The mapping from `sw_vers -buildVersion` to `-productVersion` is
formulaic from 10.8 to 10.15 and older is handled with switch.
closes #5119
2020-04-21 18:37:03 -04:00
elucent
48dc3b6fe9
Added peer type resolution for [*]T and *[N]T.
2020-04-21 18:09:03 -04:00
Michael Dusan
412aac8a70
cleanup: IrBasicBlockGen
...
remove unused param from `ir_ref_inst_gen`
2020-04-21 18:07:48 -04:00
Michael Dusan
73677e178d
cleanup: IrBasicBlockGen
...
remove unused members { parent, index, ref_count }
2020-04-21 18:07:48 -04:00
Haze Booth
78e2a203e3
Remove std.lazyInit
2020-04-21 18:04:37 -04:00
Andrew Kelley
0746028a2a
ir: analyze int instruction
2020-04-21 17:54:00 -04:00
Andrew Kelley
69878207e7
ir: analyze as instruction
2020-04-21 17:33:41 -04:00
Andrew Kelley
25679b63eb
ir: analyze primitive instruction
2020-04-21 17:11:42 -04:00
Andrew Kelley
8671e8d6d4
ir: analyze fntype instruction
2020-04-21 17:06:09 -04:00
Andrew Kelley
22e7ca5613
ir: analysis of fn instruction
2020-04-21 16:06:15 -04:00
Andrew Kelley
9a2ea5ca42
ir: comptime coerceArrayPtrToSlice
2020-04-21 13:50:04 -04:00
Andrew Kelley
fb63ba2577
ir: type coercion skeleton
2020-04-21 13:24:25 -04:00
Andrew Kelley
8e0bcaca9b
ir: analyze str instruction
2020-04-21 01:20:01 -04:00
Andrew Kelley
4c7507cceb
ir: semantic analysis skeleton
2020-04-21 00:56:30 -04:00
LemonBoy
aca6b70184
stage1: Handle errors when generating block IR
...
Closes #5005
2020-04-20 22:39:34 -04:00
Robin Voetter
32e5248820
Remove old-style @typeOf compatibility
2020-04-20 22:38:29 -04:00
Andrew Kelley
cc1c2bd568
simplify ZIR spec; separate parsing/rendering from analysis
2020-04-20 19:21:03 -04:00
LemonBoy
5eaf948e62
stage1: Fix wrong union access
...
Thanks to @frett27 on irc for reporting the compiler would segfault when
run on ARM.
2020-04-20 13:43:14 -04:00
Andrew Kelley
af4ccf34c1
ir: render keyword parameters
2020-04-19 23:59:00 -04:00
Andrew Kelley
f7786d0ca8
ir: render function body
2020-04-19 23:39:34 -04:00
Andrew Kelley
e74c5a7c24
ir: nice rendering of string literal constants
2020-04-19 20:44:18 -04:00
Andrew Kelley
91ca0e4b02
implement rendering escaped zig string literals
2020-04-19 20:33:15 -04:00
Andrew Kelley
ded6e0326d
ir: rendering skeleton
2020-04-19 20:04:11 -04:00
Andrew Kelley
1f3eeb5443
ir: parse type noreturn
2020-04-19 19:31:50 -04:00
Andrew Kelley
104ae419e4
ir: parse export instruction
2020-04-19 19:31:50 -04:00
Andrew Kelley
f020999ca3
ir: parse asm instructions
2020-04-19 19:31:50 -04:00
Andrew Kelley
82e294cf09
ir: parse deref instruction
2020-04-19 19:31:50 -04:00
Andrew Kelley
730dd887e4
ir: parse string literals as parameters
2020-04-19 19:31:50 -04:00
Andrew Kelley
bd37c8d8ed
ir: parse ptrtoint
2020-04-19 19:31:50 -04:00
Andrew Kelley
49e2f3ca36
ir: more foolproof way to organize instruction parsing
2020-04-19 19:31:50 -04:00
Andrew Kelley
4cb203db92
ir: parsing integer literals
2020-04-19 19:31:50 -04:00
Andrew Kelley
7127c07f68
ir: parse types
2020-04-19 19:31:50 -04:00
Andrew Kelley
59154a1c51
ir: parse fn body
2020-04-19 19:31:50 -04:00
Andrew Kelley
018daa028e
rework types and values data layout
2020-04-19 19:31:50 -04:00
Andrew Kelley
f92ccf365b
generic ir parsing framework
2020-04-19 19:31:50 -04:00
Andrew Kelley
bd4280decf
beginnings of zig ir parser
2020-04-19 19:31:50 -04:00
LemonBoy
328eb8ed8d
stage1: Fix signed multiplication overflow
...
Spotted thanks to UBSan
2020-04-19 06:46:33 -04:00
Andrew Kelley
051620dcaf
Merge pull request #5097 from Vexu/field
...
Disallow declarations between fields
2020-04-19 03:52:53 -04:00
xackus
d415ffd7d9
fix uninitialized ZigValue
2020-04-19 03:49:36 -04:00
Vexu
b6fe839248
update std lib to decls being disallowed between fields
2020-04-18 23:56:05 +03:00
Vexu
fff00c3bbb
disallow declarations between container fields
2020-04-18 23:56:03 +03:00
LemonBoy
6c907a3509
std: Introduce the Once synchronization primitive
...
The Once object allows the user to execute a function just once in a
thread-safe way.
2020-04-18 15:48:32 -04:00
Andrew Kelley
44ff55091f
Merge branch 'cshenton-patch-1'
...
closes #5085
2020-04-18 14:42:49 -04:00
Andrew Kelley
3817420d42
ziggurat uses @truncate instead of & 0xff
...
This makes it work on 32-bit targets.
closes #2939
2020-04-18 14:41:33 -04:00
Andrew Kelley
ca38b18879
rand: ref the decls so they get tested
2020-04-18 14:41:25 -04:00
Charles Shenton
e073c8a2b1
Update ziggurat.zig to use random.int(u64)
...
Ziggurat rng was using deprecated `random.scalar(u64)` which was causing compile errors on calls to public facing stdlib APIs (randExp) on 0.6+, this fixed those errors.
2020-04-18 14:39:36 -04:00
Andrew Kelley
6b2274fd99
Merge pull request #5088 from Vexu/varargs-fix
...
Add error for non-exter variadic functions
2020-04-18 14:35:35 -04:00
Christian Wesselhoeft
344f4d9bc5
std.os.readv: Add missing iov_count declaration
2020-04-18 14:32:52 -04:00
Vexu
4f02cf32b4
fix typeInfo tests
2020-04-18 11:39:52 +03:00
Andrew Kelley
986aa42d3e
update cmake, update readme, in response to the dynamic linking fiasco
2020-04-17 18:41:21 -04:00
Vexu
1afaf42525
add error for non-exter variadic functions
2020-04-17 22:02:49 +03:00
Vexu
c026a9f6d2
fix missing compile errors on builtin cast functions
2020-04-17 14:22:20 -04:00
LemonBoy
8e96922f31
stage1: Fix several bugs in constant generation
...
The codegen would sometimes change the LLVM type for some constants to
an unnamed structure in order to accomodate extra padding. This is fine
as long as the alignment of each field is still respected and it was not
the case for structure types, leading to ill-formed constants being
generated.
Optional types suffer from this to a lower extent as their layout is
quite lucky, the only missing piece was the tail padding.
Closes #4530
Closes #4594
Closes #4295
Closes my will to live
2020-04-17 13:42:23 -04:00
LemonBoy
a4b1242f0a
build: Create the output directory if it doesn't exist
...
Fixes #5054
2020-04-17 05:12:42 -04:00
LemonBoy
4872311364
debug: Minor QOL improvements for osx
...
* Handle FileNotFound errors when searching for .o files
* Use the STAB symbol name when everything else fails
2020-04-16 16:21:54 -04:00
Andrius Mitkus
157f566f2d
std: make math.clamp work for common uses, remove automatic bounds swapping
2020-04-16 16:19:12 -04:00
Layne Gustafson
480deacbab
CC: fix binary dupe with no -o
2020-04-15 12:52:35 -04:00
joachimschmidt557
3fd38429e4
Enable formatting in std.big.Int.format
2020-04-15 12:51:43 -04:00
Vexu
0276d9ddc5
Merge pull request #5046 from Vexu/translate-c
...
Translate-c correct invalid shortcut
2020-04-15 18:06:38 +03:00
Vexu
ca3bf6e6ad
translate-c cleanup and zig fmt
2020-04-15 15:15:32 +03:00
Vexu
a016fb8c62
translate-c: correct invalid shortcut
2020-04-15 15:14:10 +03:00
Jakub
1e23a3cd91
Added gdi32.zig and More user32 definitions
2020-04-14 16:20:48 -04:00
foobles
022a71ca7d
Shift error message now says "fixed-width integer type" instead of just "integer type" ( #5028 )
...
* error message of ir_analyze_bit_shift now more accurate/specific
* fixed compile error test to match bit shift error message
2020-04-14 16:19:45 -04:00
markfirmware
5974a88794
Update emit_raw.zig
2020-04-14 16:19:01 -04:00
Andrew Kelley
fc48c232e5
cli: add c++ subcommand to --help menu
...
closes #5034
2020-04-14 13:38:18 -04:00
Lachlan Easton
0122f2cff6
Translate C: Redo Add comment containing c source location for failed decls.
2020-04-14 22:13:43 +10:00
Andrew Kelley
448f8c2eb8
langref: add link to 0.6.0 version
2020-04-13 21:33:08 -04:00
LemonBoy
ce21a784a4
stage1: More fixes for BE targets
...
* Fix packed struct alignment
* Adjust some tests
2020-04-13 17:35:14 -04:00
Andrew Kelley
cf750a58d5
Release 0.6.0
2020-04-13 13:36:30 -04:00
daurnimator
d29ed2a785
std: fix StreamSource to disallow writing to a const buffer
2020-04-13 13:26:13 -04:00
Pierre Guilleminot
f31e0d9834
docs: use String.repeat for dom templates
2020-04-13 14:03:44 +02:00
daurnimator
b702964ae2
std: fix os.fstatat definition ( #5016 )
2020-04-13 00:45:39 -04:00
Andrew Kelley
b8796be79d
disable flaky event loop test
...
See #4922
2020-04-12 23:02:39 -04:00
Michael Dusan
e009c1596e
Merge pull request #5014 from nmeum/@panic-path
...
Update documentation of @panic
2020-04-12 18:21:06 -04:00
Pierre Guilleminot
297452cf67
improve search perf: trim search results
2020-04-12 23:17:20 +02:00
Pierre Guilleminot
f76d59ef76
improve search perf: batching dom list mutations
2020-04-12 23:13:57 +02:00
Heppoko
a3b2de1d1e
fix file protocol structure definitions ( #5015 )
2020-04-12 16:45:11 -04:00
emekoi
0744d93ed5
added CI job for mingw
2020-04-12 16:44:29 -04:00
Sören Tempel
6f5a7b8457
Update documentation of @panic
...
The default panic handler implementation was moved to `builtin.zig`.
2020-04-12 13:08:50 +02:00
daurnimator
8e9e126d41
std: add some basic windows user32 definitions
2020-04-12 02:28:52 -04:00
Michael Dusan
20b2457388
only use -nostdinc++ on c++ files
...
This is a follow-up to d27ef1aaef
and avoids compiler warnings:
warning: argument unused during compilation: '-nostdinc++'
2020-04-12 01:03:27 -04:00
Andrew Kelley
d27ef1aaef
Zig treats -lstdc++ identically to -lc++
...
Thanks to Michael Dusan for figuring out what was happening here.
closes #5012
2020-04-12 00:50:16 -04:00
Andrew Kelley
f79faf9008
cmake: allow not finding some clang libs
...
partial revert of aaf99371b2
because it broke the build for some people
2020-04-11 22:09:17 -04:00
xackus
dbc00e2424
ArrayList: remove old (before span) API
2020-04-11 20:40:34 -04:00
Andrew Kelley
3c34c313cf
revert Translate C: Add comment containing c source location for failed decls
...
This reverts 0db108101a .
Unfortunately this caused a regression. Closes #5007 .
2020-04-11 17:56:48 -04:00
Andrew Kelley
4ceaa0595a
move fs tests to separate file; disable flaky test
...
See #5006
2020-04-11 17:50:38 -04:00
Andrew Kelley
c236cbff39
Merge pull request #5003 from emekoi/fix-mingw
...
fix compilation under mingw
2020-04-11 16:43:38 -04:00
Andrew Kelley
eefe6956fd
clarify what "not valid" means
2020-04-11 16:43:19 -04:00
emekoi
de08d283da
fix compilation under mingw
2020-04-11 15:18:54 -05:00
emekoi
1a4f46ae7d
add note about @tagName for non-exhaustive enums
2020-04-11 01:01:37 -05:00
Andrew Kelley
a6e288d5fe
Merge pull request #4711 from leroycep/feature-file-locks
...
Add lock option to File.OpenFlags and File.CreateFlags
2020-04-10 15:00:45 -04:00
Timon Kruiper
121307679b
Fix generated docs of user code
...
fff3c1fff4 broke the docs generation for
own user code. This adds a workaround, because all the code in docs/main.js
is relying on the fact that the root package of the main package is the
root package itself.
2020-04-10 14:59:51 -04:00
LemonBoy
72dca05f5c
debug: Fix parsing of DWARF info for BE machines
...
Tested with ppc32
2020-04-10 14:59:19 -04:00
Vexu
1b1cbd9358
Merge pull request #4973 from SuperAuguste/nameless-fields
...
Nameless fields
2020-04-10 21:31:32 +03:00
Auguste Rame
df14578c9d
Merge branch 'master' into nameless-fields
2020-04-10 11:49:50 -04:00
Vexu
732c0cb58c
Merge pull request #4985 from Vexu/assignment-error
...
Add missing error message for invalid assignment
2020-04-10 18:26:45 +03:00
Andrew Kelley
4871345545
update readme instructions for homebrew
2020-04-10 01:29:04 -04:00
Andrew Kelley
e857190dab
put the previous commit behind cmake option ZIG_PREFER_CLANG_CPP_DYLIB
...
Without this, building from source caused:
CommandLine Error: Option 'mc-relax-all' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
This is due to LLVM static libs compiled in multiple times. But without
the LLVM static libs on the linker line, it caused undefined symbol
linker errors.
So our hands are tied. Homebrew users will have to specify
`-DZIG_PREFER_CLANG_CPP_DYLIB`.
2020-04-10 01:25:15 -04:00
Andrew Kelley
aaf99371b2
look for clang-cpp shared lib when it exists
...
See #4799
2020-04-10 00:38:19 -04:00
Lachlan Easton
daff072af2
Add visible newlines to parser_test output when there's a failure.
...
Also print first line that differs between expected and result.
2020-04-10 10:38:36 +10:00
Andrew Kelley
543031db35
Merge pull request #4982 from MageJohn/fix/binarySearch
...
sort.binarySearch: fix integer underflow (#4980 )
2020-04-09 14:58:07 -04:00
joachimschmidt557
f1360bee1c
Update docgen to new ArrayList API
2020-04-09 14:57:14 -04:00
Vexu
f60e7348d5
add error message for invalid assignment
2020-04-09 11:50:32 +03:00
Yuri Pieters
f5f77089b7
sort.binarySearch: Remove unneeded edge case check
2020-04-09 09:13:47 +01:00
Andrew Kelley
beae932e0f
Merge pull request #4975 from Vexu/param-reassign
...
Fix missing compile error on assign to slice and array parameters
2020-04-08 21:02:50 -04:00
markfirmware
c3afaa1f58
Update langref.html.in
2020-04-08 21:00:43 -04:00
Michael Dusan
57a2c5a63c
ci: bump static-qemu 5.0.0-rc1 → 5.0.0-rc2
2020-04-08 21:00:17 -04:00
Yuri Pieters
b7e72cc421
sort.binarySearch: test for regresson of #4980
2020-04-09 02:00:08 +01:00
Yuri Pieters
447dc2bb90
sort.binarySearch: fix integer underflow ( #4980 )
...
When the key was smaller than any value in the array, an error was
ocurring with the mid being zero and having 1 subtracted from it.
2020-04-09 01:58:57 +01:00
LeRoyce Pearson
5951211d3f
Reduce file lock test sleep time
2020-04-08 18:03:52 -06:00
Andrew Kelley
c45ba49b8b
fix formatted printing warning
...
needed to use ZIG_PRI_u64 instead of %lu
2020-04-08 19:30:18 -04:00
LeRoyce Pearson
d4161e1667
Close file1 in nonblocking lock test
2020-04-08 16:42:11 -06:00
LeRoyce Pearson
772bb1ade3
Disable open flock flags on darwin
...
The tests were put into a deadlock, and it seems that darwin doesn't
support `O_SYNC`, though it supports `O_NONBLOCK`. It shouldn't block
even with that, but I'm not sure why else it would fail.
2020-04-08 16:38:58 -06:00
Andrew Kelley
d5087ccbc8
cmake: expose ZIG_TARGET_MCPU option
2020-04-08 17:41:51 -04:00
Andrew Kelley
29ea425ca2
Merge branch 'LakeByTheWoods-translate_ptr_int'
...
closes #4688
2020-04-08 14:11:16 -04:00
Lachlan Easton
d7902707bc
Translate C: Allow casting literal ints to pointers
2020-04-08 14:11:01 -04:00
Vexu
7b5fb79b5b
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
2020-04-08 14:11:01 -04:00
LeRoyce Pearson
d0d7895d33
Return error from else
...
That removes the other switch cases (`error.WouldBlock` here) from the
error set, I think.
2020-04-08 08:37:17 -06:00
Vexu
b1e44adcba
move array and struct const checks to more appropriate places
2020-04-08 14:32:02 +03:00
LeRoyce Pearson
45d6fb9e36
Catch error.WouldBlock as unreachable
2020-04-08 00:39:17 -06:00
Andrew Kelley
b3aef49eea
zig provides shlwapi.lib for *-windows-gnu
...
closes #3711
2020-04-08 01:21:00 -04:00
LeRoyce Pearson
858aefac7f
Add OpenFileW share_access_nonblocking parameter
2020-04-07 21:26:46 -06:00
Phil Schumann
b109186dd5
std/zig/parse_string_literal.zig: add hex+unicode escapes ( #4678 )
2020-04-07 20:27:18 -04:00
LeRoyce Pearson
317f06dc77
Add lock_nonblocking flag for creating or opening files
...
Also, make windows share delete access. Rationale: this is how it works
on Unix systems, mostly because locks are (usually) advisory on Unix.
2020-04-07 18:00:12 -06:00
LeRoyce Pearson
117d15ed7a
Fix file locking on windows
...
The share_access bitfield was being ORed with what was supposed to be
parts of the default value, meaning that the share_access would be
more permissive than expected.
2020-04-07 16:49:37 -06:00
LeRoyce Pearson
71c5aab3e7
Make lock option an enum
...
For some reason, this breaks file locking on windows. Not sure if this is
a problem with wine.
2020-04-07 16:49:30 -06:00
xackus
66b2477ab6
fix lazy value in ir_analyze_instruction_elem_ptr
2020-04-07 18:22:17 -04:00
xackus
721c76b53c
refactor common pattern into a function
2020-04-07 23:37:33 +02:00
xackus
bf46117f13
std lib docs: fix null and int values
2020-04-07 23:37:01 +02:00
Vexu
ff0f97a1bc
fix missing compile error on assign to slice and array parameters
2020-04-08 00:27:14 +03:00
Andrew Kelley
ed23dad487
fix the new runtime-safety tests
...
Thanks to Vexu's work in e62671f643 , compile errors were identified in
these test cases! This commit fixes them to use `const` as appropriate.
2020-04-07 16:05:42 -04:00
SuperAuguste
116c76cf82
fix tests
2020-04-07 15:19:28 -04:00
SuperAuguste
882aa86843
more fixes
2020-04-07 15:08:46 -04:00
Andrew Kelley
4d290758bb
fix compile errors in some std.Target functions
...
The `ve` architecture needed to be added to a couple switch statements.
2020-04-07 15:06:58 -04:00
xackus
b7f116a774
langref: small updates
2020-04-07 14:54:53 -04:00
Andrew Kelley
22dbeab29d
Merge pull request #4857 from LemonBoy/fix-4777
...
Rewrite the bound checks in slice operator
2020-04-07 14:51:25 -04:00
LemonBoy
cc0fca9d83
stage1: Respect the specified name for extern var
...
Extend the logic used for function definitions to variables.
Closes #4947
2020-04-07 14:48:37 -04:00
Vexu
adaf7ad672
Merge pull request #4684 from LakeByTheWoods/comment_failed_decls
...
Translate C: Add comment containing c source location for failed decls
2020-04-07 21:47:32 +03:00
SuperAuguste
f21ac0220a
msvc fix
2020-04-07 14:39:24 -04:00
Andrew Kelley
87a7ea4c42
Merge pull request #4971 from Vexu/const-ref
...
Fix missing const on address of literal
2020-04-07 14:24:50 -04:00
joachimschmidt557
1ee59c5c31
move big.rational.gcd to big.int.gcd
2020-04-07 13:43:15 -04:00
SuperAuguste
9298d38cee
remove debug statement
2020-04-07 13:33:01 -04:00
SuperAuguste
94841d0292
Nameless struct field consistency
2020-04-07 13:26:17 -04:00
Andrew Kelley
a20f3e3f02
Merge pull request #4972 from mneumann/dragonfly-fix-compile
...
Fix compile on Dragonfly
2020-04-07 13:04:37 -04:00
Michael Neumann
2b9cef1e04
Add missing constants for DragonFly
2020-04-07 17:23:20 +02:00
Michael Neumann
7a829a7015
Fix paths to find llvm/clang on DragonFly
2020-04-07 17:13:33 +02:00
Vexu
95fefcd4c9
fix broken tests
2020-04-07 16:56:48 +03:00
Vexu
e62671f643
fix missing const on address of literal
2020-04-07 15:25:44 +03:00
LeRoyce Pearson
28d71c97d1
Fix compile error on darwin
2020-04-06 23:19:39 -06:00
LeRoyce Pearson
20597c8596
Only call os.flock on systems that lack openat locks
2020-04-06 22:28:43 -06:00
LeRoyce Pearson
49886d2e45
Remove return value from os.flock()
2020-04-06 22:07:27 -06:00
LeRoyce Pearson
798207ec80
Merge branch 'master' into feature-file-locks
2020-04-06 21:51:57 -06:00
Andrew Kelley
ab05766674
Merge pull request #4966 from ziglang/bootstrap-windows
...
cmake: improvements to cross-compiling for Windows
2020-04-06 23:16:31 -04:00
Andrew Kelley
fc662ddd54
mingw-w64: add 32-bit version.def
...
fixes -lversion on 32-bit windows builds
2020-04-06 20:31:00 -04:00
Andrew Kelley
41cb49eb58
stage1 fixes to support building with 32-bit mingw-w64
2020-04-06 20:30:34 -04:00
Andrew Kelley
9ed00b3829
provide ___mb_cur_max_func for i386-windows-gnu
2020-04-06 19:26:31 -04:00
Andrew Kelley
64d0960244
zig cc: recognize a few more linker options
...
* `--major-image-version`
* `--minor-image-version`
* `--stack`
2020-04-06 19:13:36 -04:00
Andrew Kelley
15ab61b2a0
cmake: improvements to cross-compiling for Windows
...
* don't unconditionally pass -lz3 for mingw builds. If mingw builds
require this then the llvm-config executable should put it as part of
--system-libs. If there is a bug and it does not do that, and we need
a workaround, then the workaround should be an explicit cmake option.
* don't link libstage2.a against -lntdll. This causes zig to set
`builtin.link_mode == .Dynamic` and include the TLS definitions,
which then collide with the mingw-w64 symbols. This should probably
be addressed separately, but for now this solves the problem and
there is no reason to link a static library against a DLL.
* Findllvm.cmake no longer treats the libraries as "optional" and will
emit a cmake error if one is not found. Additionally, the
not-required LLVM library LLVMTableGen is omitted.
2020-04-06 18:38:09 -04:00
Andrew Kelley
afa24ccd99
fix the build on Windows
...
Workaround for issue #2668
Zig std lib currently does not allow forward slashes in Windows path
names.
2020-04-06 18:35:49 -04:00
LemonBoy
0a936c1d76
Add some tests for the runtime safety checks
2020-04-06 20:14:06 +02:00
LemonBoy
a59d31bd28
ir: Support tuple multiplication
2020-04-06 14:03:43 -04:00
Andrew Kelley
e4eb817f79
libc_installation.zig: don't special-case based on C ABI
...
Whether the C ABI is mingw-w64 or msvc, detection of native libc paths
should be the same. In the future we may want to allow passing a C ABI
parameter to detectNativeCPaths() but for now we have the same behavior
regardless.
2020-04-06 13:33:32 -04:00
Andrew Kelley
96ed544665
build.zig supports specifying config.h location explicitly
...
also it does not try to run llvm-config executable when -Dlib-files-only
This fixes cross-compiling using the bootstrap repository.
2020-04-06 13:07:19 -04:00
LemonBoy
a0b73c9f02
compiler-rt: Separate max size allowed for load/store and CAS
...
The v6m ISA has no way to express a CAS loop natively without turning
off the interrupts or using the kernel cmpxchg harness.
On such a platform the user has to provide a few __sync_* builtins to
satisfy the linker.
2020-04-06 12:52:53 -04:00
Vexu
c5ced0d74a
Merge pull request #4939 from SuperAuguste/master
...
translate-c: Properly translate C multicharacter literals
2020-04-06 10:31:17 +03:00
Andrew Kelley
701c03d083
zig uses mingw-w64 to provide -lpsapi
2020-04-05 23:06:47 -04:00
Andrew Kelley
28d9696617
use mingw-w64 to provide -luuid if requested
2020-04-05 23:06:47 -04:00
SuperAuguste
6106cf4419
fixes
2020-04-05 19:06:43 -04:00
Benjamin Feng
cb98984ae6
Generate clearer size mismatch error message
2020-04-05 18:38:19 -04:00
Andrew Kelley
05b587fcde
Merge branch 'LemonBoy-vec-div'
...
closes #4737
2020-04-05 18:34:47 -04:00
Andrew Kelley
e84b9b70ff
annotate disabled tests with github issue links
2020-04-05 18:34:32 -04:00
Andrew Kelley
5597b11a52
add runtime safety tests for SIMD integer division
2020-04-05 18:34:31 -04:00
LemonBoy
f6cdc94a50
ir: Fix error checking for vector ops
...
The extra logic that's needed was lost during a refactoring, now it
should be fine.
2020-04-05 18:34:31 -04:00
LemonBoy
0f964e1910
I'm getting tired of this shit LLVM
2020-04-05 18:34:31 -04:00
LemonBoy
91a8e3b47b
tests: Chop away some flaky tests
2020-04-05 18:34:31 -04:00
LemonBoy
fe77c38247
ir: Remove unused and commented out code
2020-04-05 18:34:31 -04:00
LemonBoy
eff7555d5d
std: Delete a hack in the feature set code
...
Now that bitwise not works on vectors we can simplify the code.
2020-04-05 18:34:31 -04:00
LemonBoy
d2d97e55cc
ir: Support shift left/right on vectors
2020-04-05 18:34:31 -04:00
LemonBoy
2485f30046
ir: Support bitwise not on vectors
2020-04-05 18:34:31 -04:00
LemonBoy
54ffcf95a8
ir: Support div/mod/rem on vector types
...
Closes #4050
2020-04-05 18:34:31 -04:00
Andrew Kelley
e2dc63644a
type_has_one_possible_value takes comptime struct fields into account
...
Before, type_has_one_possible_value would return false for the value
`.{1}`. But actually, that type is a tuple with a single comptime field.
Such a type, in fact, has one possible value.
This plus the corresponding adjustment to get_the_one_possible_value
solves #3878 .
2020-04-05 17:09:01 -04:00
Vexu
6ef15fc8d0
Merge pull request #4901 from phase/feature/translate-c-remassign
...
translate-c: RemAssign and DivAssign
2020-04-05 21:05:18 +03:00
Andrew Kelley
607b2661a0
Merge pull request #4942 from daurnimator/tidy-atomics
...
Tidy up compiler_rt/atomics
2020-04-05 11:13:31 -04:00
daurnimator
4daec63aea
.gitattributes: deps/SoftFloat-3e/*.txt lines are crlf terminated
2020-04-05 11:03:31 -04:00
daurnimator
d4d2180148
Convert .gitattributes to use unix line endings
2020-04-05 11:03:31 -04:00
Michaël Larouche
c4a5f519f2
Do not parse native_libc.txt anymore when linking on native target, always run detection of libc.
...
Fixes #4772
2020-04-05 11:01:35 -04:00
Jadon Fowler
ae376e0758
translate-c: remove unneeded semicolon
...
Signed-off-by: Jadon Fowler <j@jadon.io >
2020-04-05 10:44:42 -04:00
daurnimator
e9e43ed0d3
compiler_rt/atomics: be consistent with const value
2020-04-05 14:08:25 +10:00
daurnimator
f947444362
Tidy up compiler_rt/atomics
2020-04-05 14:06:12 +10:00
SuperAuguste
027e2a1673
fix multichar literals in translate_c
2020-04-04 17:56:25 -04:00
xackus
cd20e0cc67
rename mem.separate to mem.split
2020-04-04 17:37:51 -04:00
Andrew Kelley
e5d479b06e
detect an endless loop when trying to detect native libc installation
...
closes #4810
2020-04-04 15:03:22 -04:00
Andrew Kelley
52db13738b
zig cc looks for native include directories unless -nostdinc
...
closes #4938
2020-04-04 14:58:24 -04:00
Andrew Kelley
d02838b71a
add libutil to zig's glibc support
2020-04-04 14:43:51 -04:00
Andrew Kelley
dc7e8b2fdc
build.zig: better detection of using outside zig executable
...
As pointed out by gereeter, dirname("/") successfully returns "/" again.
So checking for null is not sufficient.
2020-04-04 14:05:49 -04:00
Felix (xq) Queißner
12cdea4525
Adds some documentation to std.atomic.Queue.
2020-04-04 13:47:07 -04:00
Andrew Kelley
cf8728aabd
Merge pull request #4935 from LemonBoy/stage1-eb
...
Big-endian fixes for stage1
2020-04-04 13:45:49 -04:00
Andrew Kelley
d73808f3ff
remove zig BUILD_INFO hack
...
Rather than stuffing configuration information into the Zig binary, the
build script reads it from config.h. This solves a problem for package
maintainers and improves the use case of deterministic builds.
closes #3758
2020-04-04 11:57:28 -04:00
LemonBoy
ad2ebc87f2
stage1: Byteswap floats when serializing them
2020-04-04 16:55:24 +02:00
LemonBoy
084c62f5d1
stage1: Fix serialization of ZigValue on BE machines
2020-04-04 14:06:32 +02:00
Jadon Fowler
391ee996a5
translate-c: account for signedness when translating div & mod
...
Signed-off-by: Jadon Fowler <j@jadon.io >
2020-04-04 02:16:30 -04:00
Andrew Kelley
e89c42655c
Merge pull request #4868 from xackus/new-arraylist-api
...
new ArrayList API
2020-04-03 22:31:15 -04:00
Michael Dusan
1568470c44
Merge pull request #4891 from mikdusan/issue4207
...
add compiler-error test: coerce
2020-04-03 21:04:22 -04:00
Michael Dusan
8b6a06eefe
add compiler-error test: coerce
...
Issue fixed by an unknown commit.
closes #4207
2020-04-03 19:11:51 -04:00
Michael Dusan
db4c06ce60
stage1: add compile errors for sentinel slicing
...
closes #3963
2020-04-03 19:05:30 -04:00
Andrew Kelley
f1425fd9da
gitattributes: note that libcxxabi is vendored
2020-04-03 18:36:42 -04:00
Andrew Kelley
a2cad9a3d9
add issue links to disabled test cases
2020-04-03 18:36:13 -04:00
Andrew Kelley
7beea47178
Merge branch 'LemonBoy-compiler-rt-atomics'
...
closes #4924
2020-04-03 16:08:52 -04:00
Andrew Kelley
e03cbb117e
compiler-rt: don't forget to export these functions
2020-04-03 16:07:32 -04:00
LemonBoy
ed69821f5b
compiler-rt: Add the __atomic family of builtins
...
The implementation was checked against a few files using std::atomic and
compiled using zig c++.
Closes #4887
2020-04-03 16:04:44 -04:00
Andrew Kelley
cf52f3f99a
zig cc: add -allow-shlib-undefined alias
2020-04-03 13:45:16 -04:00
Andrew Kelley
11b50e3ad8
change the default ABI of riscv64-linux-musl
...
Before, this would cause a link failure when mixing Zig and C code for
RISC-V targets.
Now, the ABIs match and Zig and C code can be mixed successfully.
I will file a follow-up issue for the ability to deal more explicitly
with ABIs.
closes #4863
2020-04-03 13:13:09 -04:00
markfirmware
203d6554b1
Update fmt.zig
2020-04-03 12:12:40 -04:00
Ryan Liptak
08a9ab4d8c
Update all remaining uses of &outStream().stream
2020-04-03 12:12:23 -04:00
LemonBoy
dc54e50db2
std: Fix one more sentinel buffer overrun
2020-04-03 12:03:36 +02:00
LemonBoy
aa5865b9be
std: Fix oob slicing operator
2020-04-03 10:58:39 +02:00
LemonBoy
855edd2949
ir: Rewrite the bound checks in slice operator
...
Closes #4777
2020-04-03 10:58:39 +02:00
LeRoyce Pearson
ea32a7d2bc
Fix compile errors about adding error.FileLocksNotSupported
2020-04-03 00:27:34 -06:00
LeRoyce Pearson
4dd0822a36
Add LOCK_* constants to BSD os/bits
2020-04-02 23:50:12 -06:00
LeRoyce Pearson
733f1c25bd
Fix compile errors in stage2
2020-04-02 23:39:25 -06:00
LeRoyce Pearson
ea6525797d
Use flock instead of fcntl to lock files
...
`flock` locks based on the file handle, instead of the process id.
This brings the file locking on unix based systems closer to file
locking on Windows.
2020-04-02 22:57:02 -06:00
LeRoyce Pearson
e7cf3f92a9
Add FileLocksNotSupported error to OpenError
2020-04-02 22:12:45 -06:00
LeRoyce Pearson
f757f0ea59
Merge branch 'master' into feature-file-locks
2020-04-02 21:47:41 -06:00
LeRoyce Pearson
35c462caf0
Merge branch 'master' into feature-file-locks
2020-04-02 21:46:48 -06:00
Jay Petacat
0dbf8aaab8
crypto: fix benchmark compile error ( #4919 )
2020-04-02 23:46:46 -04:00
Andrew Kelley
048da6f631
ci: enable riscv64-linux tests
...
Thanks to Michael Dusan's work in
deef063bbf these tests can be enabled.
2020-04-02 21:44:03 -04:00
Andrew Kelley
f8cc6a1917
zig cc: fix ambiguity with -MT
...
In an MSVC context, `-MT` means
"Use static run-time"
and it is a flag with no parameter.
On POSIX it means
"Specify name of main file output in depfile"
and it is "joined or separate".
The former was interfering with the latter. Now, the MT flag is required
to be specified with a `/` to disambiguate: `/MT`.
2020-04-02 21:15:36 -04:00
Andrew Kelley
e7f555ca55
stage1: fix build for i386-linux
2020-04-02 19:07:52 -04:00
Timon Kruiper
b5526d0b3b
Fix multiplication overflow in hash_const_val
...
In some cases the compiler was actually emitting an 64 bit signed
multiplication, instead of a 32 bit unsigned one.
2020-04-02 17:51:04 -04:00
Andrew Kelley
5314641e11
zig cc: support more linker args
2020-04-02 17:29:22 -04:00
Andrew Kelley
c1778bd41f
zig cc: support --version-script linker arg
...
See #4784
2020-04-02 16:59:08 -04:00
Andrew Kelley
c4b3c84b3f
zig cc: support -F and -framework
2020-04-02 15:59:48 -04:00
Andrew Kelley
e4edc6d118
zig cc: respect -MF -MV -MD options
...
Zig disables its caching and forwards these args when any are provided.
see #4784
2020-04-02 15:47:27 -04:00
Andrew Kelley
4aa797b6bb
Merge branch 'ilmaria-master'
...
closes #4608
2020-04-02 15:06:50 -04:00
Andrew Kelley
8bf7cffe29
slight modification of the semantics of std.os.getenvW
...
Now, this function first attempts a case-sensitive lookup.
If no match is found, and `key` is ASCII, then it attempts a
second case-insensitive lookup.
It is not planned to support full Unicode case-insensitivity
on Windows, and in fact relying on non-ASCII case-insensitive
environment variables is fundamentally problematic.
2020-04-02 15:04:42 -04:00
Ilmari Autio
ba1a8b64c4
make std.os.getenvW case insensitive
...
partially addresses #4603
Fixing std.process.getEnvMap is NOT included in this commit.
2020-04-02 13:01:32 -04:00
Andrew Kelley
503c420797
Merge pull request #4908 from daurnimator/fifo-refactor
...
Modernize LinearFifo for new stream conventions
2020-04-02 12:13:44 -04:00
Michael Dusan
deef063bbf
use static-qemu linux-x86_64 tarball
...
- no longer install qemu via apt-get
- wget hosted tarball, extract and prepend to path
2020-04-02 11:04:40 -04:00
xackus
7a28c644aa
new ArrayList API: fix everything else
2020-04-02 16:12:08 +02:00
xackus
d3ab0eb28d
new ArrayList API: fix ArrayList.shrink
2020-04-02 15:15:20 +02:00
xackus
93a20f2e82
new ArrayList API: fix std.ArrayListSentineled
2020-04-02 15:14:28 +02:00
xackus
dd570dbc0d
new ArrayList API, fix enough std lib to test
2020-04-02 15:14:18 +02:00
daurnimator
34524a1792
std: add LinearFifo().inStream
2020-04-02 21:14:15 +11:00
daurnimator
2a031c8825
std: LinearFifo matches ArrayList in always having outStream method
2020-04-02 21:07:44 +11:00
Michael Dusan
f6d384450f
add compile-error test: bitcast
...
Issue fixed by an unknown commit.
closes #3818
2020-04-01 18:07:45 -04:00
Andrew Kelley
4848b28ec8
zig cc: detect -mcpu, -march, -mtune
...
However these are all treated like zig's -mcpu parameter.
See #4784
2020-04-01 18:06:04 -04:00
Timon Kruiper
eefb0a36c0
Fix CrossTarget.parse test on platforms where abi != gnu
...
Closes #4902
2020-04-01 18:05:49 -04:00
Rejean Loyer
2b6dfdd3d4
zig cc: add support for -L linker arguments
2020-04-01 17:21:11 -04:00
Andrew Kelley
783f73c7e3
zig cc properly handles -S flag and .ll, .bc extensions
2020-04-01 16:01:06 -04:00
LemonBoy
6695fa4f32
ir: Fix comparison of ?T values
...
The code assumed that every ?T had a pointer child type T, add some more
checks to make sure the type is effectively a pointer.
Closes #4789
2020-04-01 15:56:38 -04:00
Michael Dusan
212e2354b8
stage1: make C++ switch fallthrough an error
...
Make fallthrough an error when compiler supports it. This requires a new
macro that is defined with such compilers to be used as a statement, at
all fallthrough sites:
switch (...) {
case 0:
...
ZIG_FALLTHROUGH;
case 1:
...
break;
default:
...
break;
}
If we ever move to C++17 as minimal requirement, then the macro can be
replaced with `[[fallthrough]];` at statement sites.
2020-04-01 15:56:00 -04:00
Andrew Kelley
0f1f56bb69
Merge pull request #4896 from FireFox317/fix-arm32-stuff
...
fix some nullptr dereferences on arm-linux-musleabhif
2020-04-01 15:55:31 -04:00
Andrew Kelley
c211b8f91d
fix regressions from previous commit
2020-04-01 15:02:31 -04:00
Timon Kruiper
d33766e6c7
Make sure that ZigTypeVector and ZigTypeArray have the same memory layout
...
Throughout the stage1 code it is assumed that these have the same layout,
but that was not the case. This caused an issue on 32-bit hardware.
2020-04-01 20:50:13 +02:00
Timon Kruiper
ae6965a4e7
Fix undefined behavior when shift amount is 64
2020-04-01 20:50:09 +02:00
Timon Kruiper
d9cf779b47
Fix some nullptr dereferences on arm-linux-musleabhif
2020-04-01 20:38:32 +02:00
Jadon Fowler
b9cb1e0d83
translate-c: add tests for div & rem assignment
...
Signed-off-by: Jadon Fowler <j@jadon.io >
2020-04-01 14:28:21 -04:00
Jadon Fowler
a255b0f842
translate-c: translate DivAssign & RemAssign
...
Closes #4790
Signed-off-by: Jadon Fowler <j@jadon.io >
2020-04-01 14:23:26 -04:00
Andrew Kelley
c2e8788259
Merge branch 'daurnimator-less-buffer'
...
closes #4665
2020-04-01 13:44:19 -04:00
Andrew Kelley
2e806682f4
(breaking) std.Buffer => std.ArrayListSentineled(u8, 0)
...
This new name (and the fact that it is a function returning a type) will
make it more clear which use cases are better suited for ArrayList and
which are better suited for ArrayListSentineled.
Also for consistency with ArrayList,
* `append` => `appendSlice`
* `appendByte` => `append`
Thanks daurnimator for pointing out the confusion of std.Buffer.
2020-04-01 13:30:07 -04:00
Andrew Kelley
553f0e0546
fixups and revert a few things
2020-04-01 11:56:39 -04:00
daurnimator
7eb938c909
Use length field as passed in stage2 libc_installation instead of relying on zero termination
2020-04-01 10:36:38 -04:00
daurnimator
e535057364
std: use std.ArrayList(u8).OutStream instead of std.Buffer.OutStream
2020-04-01 10:36:38 -04:00
daurnimator
3fb030e78a
std: use std.ArrayList(u8) instead of std.Buffer in src-self-hosted/translate_c.zig
2020-04-01 10:36:38 -04:00
daurnimator
37e6a64690
std: use Buffer.outStream in std/child_process.zig
2020-04-01 10:36:38 -04:00
daurnimator
ecbc235403
std: use std.ArrayList(u8) instead of std.Buffer in std/build.zig
2020-04-01 10:36:38 -04:00
daurnimator
bb5383cf00
std: don't return sentinel slices from cross_target functions
2020-04-01 10:36:38 -04:00
daurnimator
0ee2462a31
std: add std.ArrayList(u8).outStream()
2020-04-01 10:36:38 -04:00
Andrew Kelley
e8a1e2a1d8
Merge pull request #4894 from LemonBoy/netbsd-p2
...
More NetBSD bits
2020-04-01 10:24:54 -04:00
Andrew Kelley
0628c2e2ba
Merge pull request #4895 from vrischmann/fix-io-tests
...
Fix io tests
2020-04-01 10:21:27 -04:00
Andrew Kelley
d23f9a164e
Remove unneeeded address-of operator
2020-04-01 10:21:17 -04:00
Vincent Rischmann
748b2c72a3
io: fix COutStream test
2020-04-01 13:13:47 +02:00
LemonBoy
5047cd3d78
Workaround for #4789
2020-04-01 12:46:16 +02:00
Vincent Rischmann
f46121b8fc
io: fix serialization compilation and tests
2020-04-01 12:37:02 +02:00
Vincent Rischmann
eddf491bf4
io: fix PeekStream compilation
2020-04-01 12:26:49 +02:00
Vincent Rischmann
318abaad02
io: test all files under std/io
2020-04-01 12:24:09 +02:00
LemonBoy
4209ab90a8
std: Use the versioned libc symbols if needed
...
Many symbols on NetBSD and some on OSX require the definition of an
alias.
2020-04-01 12:23:18 +02:00
LemonBoy
070ace4b22
std: Fix more NetBSD bits
...
Fix some more libc definitions.
2020-04-01 12:11:19 +02:00
Sebastian
92a423739d
mem.zeroes - add sentinel terminated array support
2020-04-01 10:08:29 +01:00
Michaël Larouche
a5af78c376
Fix porting of zlib alder32 with large input
2020-03-31 20:08:42 -04:00
Michael Dusan
e3d12471a2
add compile-error test for #2687
...
Issue fixed by an unknown commit.
closes #2687
2020-03-31 20:08:00 -04:00
Timon Kruiper
9e019ed26b
Fix possible unaligned ptr from getauxval
...
This caused SIGILL on armv7a-linux
2020-03-31 15:26:06 -04:00
Andrew Kelley
c7a3796734
ci: export master branch version for update-download-page
2020-03-31 14:54:13 -04:00
Bodie Solomon
9bb76f8ce0
Use correct compiler flags in MSVC bootstrap builds of Zig
...
https://github.com/ziglang/zig/issues/4877
The CMake build of Zig from C++ uses hand-set compiler flags which are
not compatible with the Microsoft C/C++ Optimizing Compiler (cl.exe)
used by Visual Studio.
This commit attempts to conform them to match the Clang/GCC options
under MSVC builds.
Note that CL does not have a concept of C99 or "-O3", and may imply
other optimizations in "/O2" than are implied by Clang/GCC "-O3".
Visual Studio 2019 documentation for cl.exe's optimization options:
https://docs.microsoft.com/en-us/cpp/build/reference/o-options-optimize-code?view=vs-2019
Visual Studio 2019 doc for cl.exe's C++ standard options:
https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=vs-2019
2020-03-31 14:23:34 -04:00
Andrew Kelley
d34a3c66b3
Merge pull request #4543 from daurnimator/cleanup-json
...
std.json improvements
2020-03-31 12:07:25 -04:00
Andrew Kelley
28b7306a31
Merge pull request #4880 from daurnimator/use-spanZ
...
Take advantage of mem.spanZ accepting null
2020-03-31 11:57:31 -04:00
Andrew Kelley
d9d8c42426
remove unnecessary inline
...
works around a bug triggered by previous commit
2020-03-31 11:18:11 -04:00
Andrew Kelley
47a0e3ec5e
Merge pull request #4871 from boothby/issue4769
...
Address bugs when //, /// or //! are immediately followed by EOF
2020-03-31 10:56:21 -04:00
daurnimator
3cf302a71d
Tidy up some mem.spanZ use-sites now that null is accepted
2020-04-01 01:50:34 +11:00
Andrew Kelley
6d25e45123
Merge branch 'LemonBoy-more-cache'
2020-03-31 10:49:06 -04:00
Andrew Kelley
0e372ccff5
clean up the duplicate export logic for __clear_cache
2020-03-31 10:48:48 -04:00
daurnimator
b1eb831aba
std: fix mem.span* when an optional pointer is passed
2020-04-01 01:44:55 +11:00
LemonBoy
e9c49f423d
compiler-rt: More clear_cache implementations
2020-03-31 10:36:12 -04:00
Tetralux
d57b5205c6
Fix std.fifo.LinearFifo
...
- Fix undeclared variable in 'writeItem'
- Clarify docs of `read` regarding bytes vs. items
- Normalize 'writeable' to 'writable' (the more common parlance)
2020-03-31 10:18:58 -04:00
daurnimator
63409cf422
std: linux syscall numbers are now an extensible enum
2020-03-31 10:16:20 -04:00
Andrew Kelley
839d85e440
fixes to 32-bit handling, to support 32-bit arm
2020-03-31 10:10:31 -04:00
daurnimator
7a3d700fd9
std: introduce json.WriteStream.stringify
2020-04-01 00:13:00 +11:00
daurnimator
42cabe4366
std: use json.StringifyOptions.Whitespace from json.WriteStream
2020-04-01 00:12:59 +11:00
daurnimator
a32d88f12c
std: add support to std.json.stringify for null literals
2020-04-01 00:12:59 +11:00
daurnimator
62fbb6b874
std: allow picking between serialising []u8 as string or array
2020-04-01 00:12:59 +11:00
daurnimator
edf487b126
std: add options to std.json.stringfy to control escaping
2020-04-01 00:12:59 +11:00
daurnimator
17f5d04bed
std: use json.stringify logic in some json.WriteStream code paths
2020-04-01 00:12:59 +11:00
daurnimator
5a053247e2
std: use stringify from Value.dump; remove other dump helpers
2020-04-01 00:12:59 +11:00
daurnimator
e88543a504
std: add jsonStringify trait to json Value objects
2020-04-01 00:07:31 +11:00
daurnimator
48e7c6cca6
std: add whitespace control to json.stringify
2020-03-31 23:57:00 +11:00
daurnimator
3a0875d9e8
std: have json tests take options parameter
2020-03-31 23:19:24 +11:00
Ali Ahmed
45dc2587a3
Fix Readme to point to llvm for brew commands
...
* Homebrew has updated llvm to point to llvm@10
2020-03-30 23:21:40 -04:00
Andrew Kelley
1df85d1509
Merge branch 'FireFox317-clear-cache'
2020-03-30 23:15:33 -04:00
Andrew Kelley
83ff94b1cc
compiler-rt: don't export __clear_cache when no impl available
2020-03-30 23:15:07 -04:00
Kelly Boothby
1111d3ad13
fixed bugs hitting EOF immediately after //, /// or //!
2020-03-30 18:30:03 -07:00
Kelly Boothby
44aadaff59
added unit tests to demonstrate #4769 and related bugs
2020-03-30 18:29:48 -07:00
Timon Kruiper
f6f03cd90f
compiler-rt: implement clear_cache for arm32-linux
2020-03-31 00:29:41 +02:00
Andrew Kelley
cfedd3aca2
revert detection of rtti and exceptions
...
This caused link errors in c++ code because it was not correct to pass
these flags to child codegens. And that was the only reason to detect
these flags. Otherwise we can safely rely on non-explicitly-detected
flag forwarding.
2020-03-30 17:42:30 -04:00
Andrew Kelley
6408766d6b
linking: remove check for target_supports_libunwind
...
I'm not sure why this was ever there. Maybe it was working around a
problem with LLVM 9. Anyway this fixes linking C++ code for 32 bit
arm and riscv.
2020-03-30 15:50:53 -04:00
Andrew Kelley
9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
...
See #3811
2020-03-30 14:23:22 -04:00
Andrew Kelley
b980568c81
add peer type resolution for mixed-const []T and *[N]T
...
closes #4766
This commit also fixes the implementation of some utility functions for
adjusting properties of pointer types. Previously these functions would
incorrectly drop vector, sentinel, and inference metadata.
2020-03-30 13:02:50 -04:00
Sebastian
ef419dd72d
mem.zeroes .Array improvements
...
Before (when given an array with many elements):
```
zig\std\mem.zig:345:13: error: evaluation exceeded 1000
backwards branches
for (array) |*element| {
^
```
related to https://github.com/ziglang/zig/issues/4847#issuecomment-605721461
2020-03-30 11:16:25 -04:00
daurnimator
3be720a729
std: mem span functions can take an optional pointer
2020-03-30 11:04:58 -04:00
LemonBoy
c1cc1ebc35
ir: Avoid constant-folding ptr to sentinels
...
Constant-folding the pointers to the expected sentinel value have some
big problems: it hides the real content of the array, makes the pointer
to the sentinel point to a completely different memory region and treats
it like a const value even when the underlying array is mutable.
Fixes #4840
2020-03-30 11:03:56 -04:00
daurnimator
8cad453495
std: fix compile error since WinsockError was changed
2020-03-30 11:02:06 -04:00
Brian Cain
607892a30d
Create an "LLD_LIBDIRS" var to override lld loc
2020-03-30 11:01:36 -04:00
LemonBoy
1ef6f068f5
compiler-rt: Implement all the shift builtins
...
* Unify all the code paths with a generic function
* Add some EABI aliases
Closes #4853
2020-03-30 10:58:47 -04:00
daurnimator
9bc8a1e1d0
std: add some missing errnos on linux
2020-03-30 10:55:18 -04:00
daurnimator
356ef3840f
std: update for linux 5.6 release
2020-03-30 10:55:18 -04:00
Michael Raymond
de9933761c
std.zig.render: fix newlines before DocComments
2020-03-29 22:41:39 -04:00
Andrew Kelley
b717df786b
Merge pull request #4845 from xackus/fix-parseFloat
...
fix overflow in parseFloat and cleanup
2020-03-29 22:40:32 -04:00
Andrew Kelley
f9f7deaeda
linking against c++ does not trigger system library directories
2020-03-29 20:58:59 -04:00
xackus
6809222d32
cleanup parse_float.zig
2020-03-29 20:52:25 +02:00
Andrew Kelley
5aa2812507
linking is now aware -lm is provided by mingw-w64
2020-03-29 13:17:21 -04:00
Andrew Kelley
c70471fae6
enable now-passing test cases
...
These can now be enabled thanks to bug fixes that landed in
LLVM 10.
2020-03-29 10:34:12 -04:00
Andrew Kelley
38a1af5d4f
zig cc: -O0 also counts as debug mode
2020-03-29 10:34:12 -04:00
xackus
d1202b1f66
fix overflow in parseFloat
2020-03-29 11:50:41 +02:00
Andrew Kelley
86795c03f9
Merge pull request #4844 from layneson/translatec_string_concat
...
Support string concatenation in Translate-C
2020-03-29 00:31:50 -04:00
Sebastian
2b0d66736a
tcpConnectToHost - fixed compilation error
...
before:
```
std\net.zig:403:23: error: type '@TypeOf(std.net.getAddressList).ReturnType.ErrorSet!*std.net.AddressList' does not support field access
const addrs = list.addrs.toSliceConst();
^
```
2020-03-28 21:34:50 -04:00
Layne Gustafson
a55897106e
Add macro string concat tests
2020-03-28 20:40:26 -04:00
Layne Gustafson
2a05ca1c94
Conv macro string concat to ++
2020-03-28 20:40:13 -04:00
LeRoyce Pearson
457f557c37
Merge branch 'master' into feature-file-locks
2020-03-28 17:24:19 -06:00
Andrew Kelley
f9db21f03e
Merge pull request #4838 from squeek502/for-linker
...
zig cc: Add support for -Xlinker, --for-linker, --for-linker=, -z
2020-03-28 12:03:35 -04:00
Luna
2028b4ce91
Fix typo in Serializer declaration
2020-03-28 12:01:29 -04:00
LemonBoy
d788b0cd8b
std: Minor changes to TLS handling
...
* Always allocate an info block per-thread so that libc can store
important stuff there.
* Respect ABI-mandated alignment in more places.
* Nicer code, use slices/pointers instead of raw addresses whenever
possible.
2020-03-28 11:20:38 -04:00
Ryan Liptak
cc7c670851
Sync clang_options_data.zig with update_clang_options
...
Some of the recent c++ related options were added to update_clang_options but didn't make it into clang_options_data.zig
2020-03-28 00:39:33 -07:00
Ryan Liptak
874b4618ca
zig cc: Add support for -z
...
This is only the first step; it makes zig cc recognize -z and append it to the linker args, but the linker arg parsing doesn't support -z yet so it will just give the warning 'unsupported linker arg: -z'
2020-03-28 00:35:54 -07:00
Ryan Liptak
b0b29b8a2f
zig cc: Add support for -Xlinker, --for-linker, --for-linker=
2020-03-27 23:32:01 -07:00
Andrew Kelley
12e1c6e21c
Merge pull request #4835 from squeek502/export-dynamic
...
-rdynamic/--export-dynamic fixes
2020-03-28 02:16:09 -04:00
Andrew Kelley
69aa09948b
cmake: support cross compiling
2020-03-27 23:43:21 -04:00
Andrew Kelley
107b5196f6
Merge pull request #4827 from ziglang/zig-cpp
...
support compiling and linking c++ code
2020-03-27 22:35:13 -04:00
Andrew Kelley
a258741084
initial support of response files
...
See #4833
It doesn't support comments or quotes yet.
2020-03-27 22:24:40 -04:00
Andrew Kelley
e803490a56
cmake: support finding a cross compiled llvm
2020-03-27 22:24:15 -04:00
Michael Dusan
33819ecfbc
windows: don't hard-code forward-slash paths
...
`zig targets` -> unable to list targets: BadPathName
2020-03-27 21:28:52 -04:00
Andrew Kelley
0d7bd9f3ce
Merge pull request #4832 from LemonBoy/watwatwat
...
Fix the weird-ass crash on AArch64
2020-03-27 21:28:16 -04:00
Ryan Liptak
e7847f8d42
zig cc: Add --export-dynamic linker flag support
2020-03-27 17:42:02 -07:00
Ryan Liptak
1a95f1c2e0
Fix -rdynamic not sending --export-dynamic to the ELF linker
2020-03-27 17:36:43 -07:00
Michael Dusan
547ba8eb20
Merge pull request #4813 from mikdusan/cmake3.17
...
cmake: address new warnings from cmake-3.17
2020-03-27 19:15:50 -04:00
LemonBoy
ddda50a38d
ci: Delete workaround for #4822
2020-03-27 20:13:23 +01:00
LemonBoy
0512be227c
compiler-rt: Fix __floatunditf
...
This builtin converts a u64 into a f128, not a u128 into a f128.
Fixes some weird-ass crashes that happened only on AArch64 systems.
2020-03-27 20:10:59 +01:00
LeRoyce Pearson
c7f4e68464
Merge branch 'master' into feature-file-locks
2020-03-27 11:32:33 -06:00
Andrew Kelley
f407109070
zig c++: get it working with musl and mingw-w64
2020-03-27 12:38:52 -04:00
Timon Kruiper
67e51311c3
fix behavior test with --test-evented-io on windows
...
also make simple file operations work asynchronously on windows
2020-03-27 17:03:06 +01:00
Andrew Kelley
db17c0d88c
ability to compile c++ hello world with zig c++
...
closes #4786
2020-03-26 22:48:37 -04:00
Andrew Kelley
ed0dbe1a64
add libc++ and libc++abi sources
...
upstream: LLVM 10
2020-03-26 22:41:26 -04:00
Andrew Kelley
aec4967f36
Merge pull request #4814 from gereeter/reduced-path-max
...
In AtomicFile, work relative to the destination's parent directory
2020-03-26 20:32:06 -04:00
Andrew Kelley
463b90b977
ci: fix aarch64 linux
...
This patch adds a workaround for #4822 , disables one failing langref
example, and enables the rest of the test suite.
You win some, you lose some.
2020-03-26 19:42:28 -04:00
Jonathan S
cf4cbea88e
Factor out arbitrary constant 12 to AtomicFile.RANDOM_BYTES
2020-03-26 15:07:40 -05:00
Andrew Kelley
ab20b351ce
update compile error tests
2020-03-26 14:07:19 -04:00
Andrew Kelley
0d4354324c
fix behavior tests compile error on i386-linux
2020-03-26 12:54:59 -04:00
Andrew Kelley
ddd98a7f10
prevent ptr cast from forcing alignment resolution unnecessarily
2020-03-26 12:34:16 -04:00
Jonathan S
a779a96d38
In AtomicFile, work relative to the destination's parent directory. This is more robust against concurrent filesystem reorganization and avoids path length issues.
2020-03-25 23:22:36 -05:00
Andrew Kelley
f7f563ea53
Revert "Merge pull request #4807 from LemonBoy/tls-touchups"
...
This reverts commit ee6fda2297 , reversing
changes made to f313ab18ae .
This caused a test failure:
```
behavior.misc.test "behavior-arm-linux-none-Debug-bare-multi thread local variable"...test failure
/home/vsts/work/1/s/lib/std/testing.zig:191:14: 0x4608f in std.testing.expect (test)
if (!ok) @panic("test failure");
^
/home/vsts/work/1/s/test/stage1/behavior/misc.zig:616:11: 0x53e93 in behavior.misc.test "behavior-arm-linux-none-Debug-bare-multi thread local variable" (test)
expect(S.t == 1235);
^
```
2020-03-25 21:12:24 -04:00
Andrew Kelley
5ec6a0ea02
fix an invalid free having to do with bound functions
...
this should fix the drone CI failure
2020-03-25 21:00:02 -04:00
Andrew Kelley
fae6cf0961
improved handling of native system directories
...
* `-isystem` instead of `-I` for system include directories
fixes a problem with native system directories interfering with zig's
bundled libc.
* separate Stage2Target.is_native into Stage2Target.is_native_os and
Stage2Target.is_native_cpu.
2020-03-25 20:34:15 -04:00
Michael Dusan
dd66fbb96a
Merge pull request #4811 from mikdusan/fix4634
...
self-hosted: use fs.selfExePathAlloc
2020-03-25 19:49:52 -04:00
Andrew Kelley
e3fec6cce9
zig cc: add detection for -###
...
it turns on --verbose-cc and --verbose-link
2020-03-25 19:32:12 -04:00
Benjamin Feng
9dbfee49d7
Carry-over stream error to JSON.stringify
2020-03-25 18:54:04 -04:00
Andrew Kelley
ee6fda2297
Merge pull request #4807 from LemonBoy/tls-touchups
...
std: Minor changes to TLS handling
2020-03-25 18:53:04 -04:00
Michael Dusan
9cc593ca78
cmake: address new warnings from cmake-3.17
...
Match package-name case from CMakeLists.txt .
New warning sample:
The package name passed to `find_package_handle_standard_args` (LLVM) does
not match the name of the calling package (llvm). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
2020-03-25 18:43:28 -04:00
Michael Dusan
d554070de1
self-hosted: use fs.selfExePathAlloc
...
- add fs.selfExePathAlloc
- use fs.selfExePathAlloc instead of fs.selfExeDirPathAlloc
- remove redundant code from fs.selfExeDirPath
closes #4634
2020-03-25 18:40:28 -04:00
Andrew Kelley
f313ab18ae
zig cc: freestanding target implies -nostdlib
2020-03-25 12:28:41 -04:00
Andrew Kelley
6cbe589b51
zig cc: support -T linker script option
2020-03-25 12:05:48 -04:00
Andrew Kelley
3869e80331
Merge pull request #4793 from LemonBoy/netbsd-forever
...
Netbsd forever
2020-03-25 10:19:49 -04:00
LemonBoy
abcd9ac9d0
Use const instead of var
2020-03-25 12:37:44 +01:00
LemonBoy
a34f67aa66
std: Minor changes to TLS handling
...
* Always allocate an info block per-thread so that libc can store
important stuff there.
* Respect ABI-mandated alignment in more places.
* Nicer code, use slices/pointers instead of raw addresses whenever
possible.
2020-03-25 12:08:50 +01:00
LemonBoy
778dbc17ac
std: Fix setsockopt definition
...
* Add socketpair definition
2020-03-24 16:06:25 -04:00
Andrew Kelley
cbaede7f55
Merge pull request #4795 from LemonBoy/divtf3
...
Add __divtf3 to compiler-rt
2020-03-24 14:51:51 -04:00
LemonBoy
3ccf99c0bd
std: Slim duplicate logic for some calls
2020-03-24 19:47:18 +01:00
LemonBoy
cc774c603b
compiler-rt: Add __divtf3
2020-03-24 18:08:53 +01:00
LemonBoy
4e95662a4a
std: Add qNaN constants
2020-03-24 18:08:53 +01:00
Andrew Kelley
39589cffe0
compiler-rt: fix __clear_cache on aarch64 darwin
2020-03-24 11:51:13 -04:00
Andrew Kelley
03013e5176
compiler-rt: aarch64 implementation of __clear_cache
2020-03-24 10:33:23 -04:00
Andrew Kelley
93c7fa105f
Merge remote-tracking branch 'origin/llvm10'
...
LLVM 10 was released today
2020-03-24 09:57:09 -04:00
LeRoyce Pearson
1a6c3aeec9
Block until file is unlocked on windows
2020-03-23 23:20:17 -06:00
LeRoyce Pearson
8bec1304c3
Fix compile error on windows
2020-03-23 22:34:00 -06:00
LeRoyce Pearson
113b217593
Merge branch 'master' into feature-file-locks
2020-03-23 21:39:16 -06:00
Joachim Schmidt
5acc8afb5f
Use math.Order for comparing bigints instead of i8 ( #4791 )
2020-03-23 23:16:57 -04:00
LeRoyce Pearson
0b93932a21
Add O_SHLOCK and O_EXLOCK to freebsd and netbsd
2020-03-23 21:07:50 -06:00
LeRoyce Pearson
5b278fb606
Use locking open flags if they are defined
2020-03-23 20:59:09 -06:00
LemonBoy
c3f93be00c
std: Tell pthread the guard page size is zero
...
On NetBSD this is needed to avoid crashes in pthread_join as the default
value for the guard page size is not ignored even though a custom stack
address is specified.
2020-03-23 23:26:34 +01:00
LemonBoy
d6739b1397
std: Fix undefined field error
2020-03-23 23:26:21 +01:00
LemonBoy
b21d3535a5
std: Fix parameters for pthread_attr_setstack
...
The guard page size shouldn't be taken into account, pthread is only
interested in the usable area.
2020-03-23 20:12:10 +01:00
LemonBoy
09a5f172f8
std: Different thread stack allocation for NetBSD
...
* NetBSD is stricter than other OSs and doesn't allow mprotect to mark a
non-accessible region as RW
* Fix mprotect call over the whole stack, oops
2020-03-23 19:50:29 +01:00
LemonBoy
cda73c3c18
std: Add missing C bits and defines for NetBSD
2020-03-23 18:55:45 +01:00
LemonBoy
761602e3e8
std: Use getdents on all the BSDs
...
* Use the correct versioned libc calls to avoid nasty surprises
2020-03-23 18:54:14 +01:00
LemonBoy
336ed03f0f
debug: Accept relative paths in mapWholeFile
2020-03-23 18:51:49 +01:00
LemonBoy
27344464ed
std: Add missing C defines for NetBSD
2020-03-23 18:47:40 +01:00
LemonBoy
2f21c8f5ba
stage1: Link pthread on NetBSD
2020-03-23 18:47:39 +01:00
LemonBoy
bab66235b9
stage1: Remove fflush on file open for reading
...
On NetBSD this caused the libuserland compilation to fail.
Closes #3719
2020-03-23 17:17:28 +00:00
Andrew Kelley
dc44fe053c
zig cc: detect dynamic linker argument
2020-03-23 12:39:18 -04:00
Andrew Kelley
e643b414e4
zig cc: recognize .S and .C as source file extensions
2020-03-23 11:34:16 -04:00
LemonBoy
0cd953d40e
ir: Prevent crash when slicing hardcoded pointer
...
Closes #4780
2020-03-23 09:13:52 -04:00
Andrew Kelley
13d04f9963
Merge pull request #4741 from momumi/master
...
allow `_` separators in number literals (stage 1)
2020-03-23 00:54:54 -04:00
Andrew Kelley
94f7c56001
riscv: add -mrelax arg for C to work around upstream issue
...
See #4485
2020-03-22 21:47:19 -04:00
Andrew Kelley
e5e5196d8e
Merge remote-tracking branch 'origin/master' into llvm10
2020-03-22 20:48:21 -04:00
momumi
2d18178c27
minor fixes and more tests for _ separators
...
* Make the tokenizer spit out an Invalid token on the first invalid
character found in the number literal.
* More parsing and tokenizer tests for number literals
* fix invalid switch statement in ir.zig
2020-03-23 09:21:34 +10:00
Andrew Kelley
7ffdf59c44
Merge pull request #4774 from ziglang/zig-cc
...
ability to use `zig cc` as a drop-in C compiler
2020-03-22 19:20:02 -04:00
LemonBoy
9d19d9008e
debug: Correct version check in debug_line parser
...
Version 3 is similar to version 2 plus more opcodes.
2020-03-22 19:19:41 -04:00
LemonBoy
6a89751025
ir: Implement cast from anon struct to union
2020-03-22 19:06:22 -04:00
Andrew Kelley
3bded9cf29
disable failing stack trace test for aarch64
2020-03-22 18:54:19 -04:00
Andrew Kelley
380c276deb
ci: disable qemu-riscv64 tests due to qemu being too old
2020-03-22 17:36:58 -04:00
Andrew Kelley
f9992850a5
simplify cmake logic for finding clang
...
which fixes the build on windows
2020-03-22 17:35:06 -04:00
Andrew Kelley
87b8b69eb0
update stack trace test expected output
2020-03-22 17:07:24 -04:00
Andrew Kelley
10223eaea0
ci: workaround for apt.llvm.org packaging bug
2020-03-22 17:03:53 -04:00
Andrew Kelley
40f4101802
ci: fix ubuntu package name for lld
2020-03-22 15:44:39 -04:00
Andrew Kelley
8d1659bb39
ci: again fix the cache tarball URLs
2020-03-22 15:35:54 -04:00
Andrew Kelley
adf5af1bc5
ci: update cache tarball URLs
2020-03-22 15:14:46 -04:00
Andrew Kelley
23c263776c
Merge remote-tracking branch 'origin/master' into llvm10
2020-03-22 15:09:29 -04:00
momumi
8de45e5143
update parsing of int literals in self-hosted
...
* update std.math.big.Int.setString() to ignore underscores and make it
case insensitive
* fix issue in ir.zig with leading zeroes in integer literals
2020-03-22 13:59:14 +10:00
dbandstra
a8fa1ecd89
fix build.zig addBuildOption function for stream refactor
2020-03-21 23:18:09 -04:00
momumi
29324e6f39
fix formatting in tokenizer tests
2020-03-22 12:41:11 +10:00
Andrew Kelley
2b65dc1032
zig cc: detect optimization and debug flags
2020-03-21 22:30:46 -04:00
LemonBoy
dc79f181a5
ir: Disallow comparison between enum literal and untagged enum
...
Closes #4770
2020-03-21 20:54:05 -04:00
momumi
138dab4524
add number _ separators for stage 2 tokenizer
2020-03-22 10:35:19 +10:00
Andrew Kelley
4b0ddb817b
zig cc: better support for the preprocessor option (-E)
2020-03-21 20:32:48 -04:00
Michael Dusan
28ad78cb7f
rename "passthrough" → "driver_punt"
...
- punt when `-E` is supplied
- punt when `-S` is supplied
2020-03-21 16:53:59 -04:00
Andrew Kelley
4d9b458f8f
zig cc: support .cc and .cxx extensions
2020-03-21 16:51:43 -04:00
Andrew Kelley
0eee98edc1
zig cc improvements
...
* The generated options data file is sorted now in a way that
makes sure longer prefixes are first. This prevents collisions
with some parameters.
* Add support for `-fPIC`, `-fno-PIC`, `-nostdlib`, `-shared`,
`-rdynamic`, `-Wl,-soname`, `-Wl,-rpath`
* Better support for `-o`.
* Disable generating h files
* Shared library support.
* Better positional argument support.
2020-03-21 15:40:49 -04:00
Andrew Kelley
a4eaeee720
ability to use zig cc as a drop-in C compiler
...
The basics are working
2020-03-21 15:39:39 -04:00
Andrew Kelley
beea478acc
Merge pull request #4764 from LemonBoy/fix-1265
...
ir: Allow errdefer with payload
2020-03-21 14:19:52 -04:00
LemonBoy
28dbc58837
Address review comments
2020-03-21 09:54:49 +01:00
LemonBoy
128e70ff3a
ir: Allow errdefer with payload
...
Closes #1265
2020-03-21 09:54:49 +01:00
Andrew Kelley
153c6cf92e
ci: disable test-gen-h on sr.ht and drone
2020-03-20 21:33:37 -04:00
Andrew Kelley
3a2c490889
"generate .h files" feature is no longer supported in stage1
2020-03-20 18:33:36 -04:00
Andrew Kelley
8429ddecf8
Merge branch 'glibc-add-ld'
2020-03-20 15:48:57 -04:00
Andrew Kelley
7438d0fc31
glibc: include ld symbols and proper soname for ld
2020-03-20 14:39:05 -04:00
Andrew Kelley
ef69e4efa0
Merge branch 'mt-panic' of https://github.com/LemonBoy/zig into glibc-add-ld
2020-03-20 13:02:19 -04:00
Andrew Kelley
245dc9d930
include ld symbols when generating glibc dummy objects
...
closes #4748
2020-03-20 12:59:37 -04:00
LemonBoy
541e763010
ir: Peer type resolution between ?[]T and *[N]T
...
Closes #4767
2020-03-20 12:23:05 -04:00
Andrew Kelley
53b5aa812b
Merge remote-tracking branch 'origin/master' into llvm10
2020-03-19 22:19:24 -04:00
Andrew Kelley
28a6c136e9
revert std.mem.span to prefer len over sentinel; add spanZ
2020-03-19 19:30:09 -04:00
Andrew Kelley
dc04e97098
Merge pull request #4752 from ziglang/slice-array
...
slicing with comptime start and end indexes results in pointer-to-array
2020-03-19 18:06:16 -04:00
Andrew Kelley
160367e0dd
fix compile error for reading past end of pointer casted array
2020-03-19 17:23:53 -04:00
Andrew Kelley
6b6f2fcf96
std.net: remove the hack from earlier in the branch
2020-03-19 15:09:52 -04:00
Andrew Kelley
f614d94faa
update std lib to take advantage of slicing with comptime indexes
2020-03-19 14:48:47 -04:00
Andrew Kelley
555a2c0328
(breaking) std.fs.copyFile now integrates with Dir
...
Removed:
* `std.fs.updateFile`
* `std.fs.updateFileMode`
* `std.fs.copyFile`
* `std.fs.copyFileMode`
Added:
* `std.fs.Dir.copyFile`
* `std.fs.copyFileAbsolute`
* `std.fs.updateFileAbsolute`
Moved:
* `std.fs.Dir.UpdateFileOptions` => `std.fs.CopyFileOptions`
Deprecated:
* `std.fs.deleteDir`
* `std.fs.deleteDirC`
* `std.fs.deleteDirW`
* `std.fs.readLink`
* `std.fs.readLinkC`
2020-03-19 14:43:41 -04:00
Andrew Kelley
1d7861a36e
fix incorrect sentinel check
2020-03-19 13:18:14 -04:00
Andrew Kelley
8ddf9d84ff
add behavior tests for slicing with comptime indexes
2020-03-19 11:17:46 -04:00
Andrew Kelley
f824658e13
slicing sentinel-terminated slice without end
...
now results in a sentinel-terminated slice.
2020-03-19 10:54:20 -04:00
Andrew Kelley
61266d2621
test & docs fixups to work with new semantics
2020-03-19 09:53:55 -04:00
Andrew Kelley
7fa88cc0a6
std lib fixups for new semantics
...
std lib tests are passing now
2020-03-19 09:53:55 -04:00
Andrew Kelley
b5dba702ff
fixes to std.meta
...
behavior tests are passing now
2020-03-19 09:53:55 -04:00
Andrew Kelley
2164b511cc
partial revert of an improvement this branch made
...
because it uncovered a result location bug, and I need to get this
branch merged before going into a result location rabbit hole.
also fix the result type of slicing when the indexes are runtime known
and the result should be sentinel terminated.
2020-03-19 09:53:55 -04:00
Andrew Kelley
8688c43745
when result loc is a slice, avoid evaluating lazy start..end
...
This prevents lazy values from being unnecessarily evaluated.
2020-03-19 09:53:55 -04:00
Andrew Kelley
e947f0c740
0-bit array type does not resolve child type
2020-03-19 09:53:55 -04:00
Andrew Kelley
72a261b4d3
fix runtime slice of pointer not setting length
2020-03-19 09:53:55 -04:00
Andrew Kelley
4435b05b6b
fix regression when slicing 0-bit pointers
2020-03-19 09:53:55 -04:00
Andrew Kelley
2b4134459d
fix alignment when slicing with comptime start and end index
2020-03-19 09:53:54 -04:00
Andrew Kelley
8ea0a00f40
improve std lib code for the new semantics
2020-03-19 09:53:54 -04:00
Andrew Kelley
8d0ac6dc4d
@ptrCast supports casting a slice to pointer
2020-03-19 09:53:54 -04:00
Andrew Kelley
c896c5001f
fix slice of string literal having the wrong type
2020-03-19 09:53:54 -04:00
Andrew Kelley
0707be8de8
fixes in semantic analysis needed to support this feature
2020-03-19 09:53:54 -04:00
Andrew Kelley
2182d28cb0
slicing with comptime start and end results in array
...
implements #863
2020-03-19 09:53:51 -04:00
LemonBoy
e3c92d0532
ir: More changes to sentinel-terminated const arrays
...
* Don't add an extra slot for the sentinel. Most of the code keeps using
the constant value from the type descriptor, let's harmonize all the
code dealing with sentinels.
* Properly write out sentinel values when reinterpreting pointers at
comptime.
* Allow the reading of the 0th element in a `[0:S]T` type.
2020-03-19 09:53:30 -04:00
Andrew Kelley
7a361751e5
Merge branch 'LemonBoy-travbug'
...
closes #4747
2020-03-18 16:42:58 -04:00
Andrew Kelley
46ffc798b6
fix swapped logic for Windows
...
Remove `std.fs.deleteTree`. Callers instead should use
`std.fs.cwd().deleteTree`.
Add `std.fs.deleteTreeAbsolute` for when the caller has an absolute
path.
2020-03-18 16:42:47 -04:00
Andrew Kelley
27affde592
(breaking) clarify openDir API
...
* remove deprecated `std.fs.Dir` APIs
* `std.fs.Dir.openDir` now takes a options struct with bool fields for
`access_sub_paths` and `iterate`. It's now much more clear how
opening directories works.
* fixed the std lib and various zig code calling the wrong openDir
function.
* the runtime safety check for dir flags is removed in favor of the
cheaper option of putting a comment on the same line as handling
EBADF / ACCESS_DENIED, since that will show up in stack traces.
2020-03-18 16:10:57 -04:00
LemonBoy
c45fe2759f
build: Fix silly bug in directory traversal
2020-03-18 13:45:52 -04:00
LemonBoy
e15605e1c1
std: Safety check for iterate()
...
Calling iterate() on a Dir object returned by openDirTraverse is always
an error.
2020-03-18 13:45:52 -04:00
LemonBoy
4843c3b4c3
std: Introduce fnctl wrapper
2020-03-18 13:45:52 -04:00
Andrew Kelley
b1537b525f
Merge branch 'LemonBoy-fix-4749'
...
Closes #4750
Closes #4749
2020-03-18 11:16:25 -04:00
LemonBoy
11a4ce42c1
zig fmt: Respect trailing commas in error set declarations
...
The logic is not perfect as it doesn't take into account the presence of
doc comments, but it's an improvement over the status quo.
2020-03-18 11:15:22 -04:00
Andrew Kelley
63a4dbc30d
array sentinel does not count towards type_has_one_possible_value
2020-03-18 11:11:41 -04:00
LemonBoy
1479c28b49
ir: Correct ABI size calculation for arrays
...
Zero-length array with a sentinel may not have zero size.
Closes #4749
2020-03-18 11:10:45 -04:00
LemonBoy
013ada1b59
std: More type checks for Thread startFn return type
...
Closes #4756
2020-03-18 10:37:35 -04:00
Andrew Kelley
dbde5df568
clean up some self-hosted bitrot + don't assume libstdc++
...
closes #4682
The self-hosted compiler is still bit rotted and still not compiling
successfully yet. I have a more serious rework of the code in a
different branch.
2020-03-17 23:03:45 -04:00
LeRoyce Pearson
613956cc47
Remove fcntlFlock and replace with plain fcntl
2020-03-17 21:02:19 -06:00
LeRoyce Pearson
32c5825030
Match netbsd's flock fields with others
2020-03-17 20:54:38 -06:00
LeRoyce Pearson
b773a8b175
Make fcntlFlock follow conventions of os.zig
2020-03-17 20:53:43 -06:00
Jonathan Marler
7251eb1681
fix a couple sockfds to be fd_t rather than i32
...
Using i32 causes compile errors on Windows because it uses *c_void rather than i32 for it's fd_t type.
2020-03-17 12:46:07 -04:00
LeRoyce Pearson
4532f5ecad
Change fcntl params to ?*c_void
...
As recommended by LemonBoy
2020-03-16 21:50:52 -06:00
Timon Kruiper
6a15d668ee
Change the default stdin behavior of RunStep to .Inherit
...
This behaves the same as stdout and stderr behavior which also
default to .inherit. Also adds a field to RunStep to change the behavior.
Since this is a breaking change, previous behavior can be restored by doing:
`RunStep.stdin_behavior = .Ignore`.
2020-03-16 17:23:53 -04:00
LemonBoy
582991a5a8
build: Expose function-sections switch
2020-03-16 13:06:50 -04:00
Andrew Kelley
a2432b6755
Merge pull request #4735 from ziglang/renameat
...
zig build system: correctly handle multiple output artifacts
2020-03-15 17:28:12 -04:00
Andrew Kelley
a27a8561e9
adjust renameatW to always supply dest root dir
...
this fixes tests for wine
2020-03-15 17:26:29 -04:00
Andrew Kelley
7e45a3ef6a
fix typo in new mem.len test
2020-03-15 15:57:51 -04:00
Andrew Kelley
e369789062
fix std.os.renameatW
...
Ask for DELETE access when opening the source file.
Additionally, when the source and dest dir are the same, pass null
for RootDirectory.
2020-03-15 15:47:42 -04:00
Andrew Kelley
6c2b23593b
fix std.mem.span handling of sentinel-terminated arrays
...
previously this function would use the array length, but now it scans
the array looking for the first sentinel that occurs.
2020-03-15 15:46:56 -04:00
Andrew Kelley
701aaf0ddf
renameatW: handle more windows nt status codes
2020-03-15 14:46:09 -04:00
Andrew Kelley
0a69a10f2a
Merge pull request #4740 from Vexu/cleanup
...
Cleanup and a fix in self-hosted parser
2020-03-15 14:18:33 -04:00
momumi
880d8fc380
fix Serializer to work with new OutStream API
2020-03-15 14:17:16 -04:00
momumi
47f7e66580
add more test cases for invalid number literals
2020-03-15 23:42:29 +10:00
momumi
925f710852
make parsing 0.0_e1 an error
2020-03-15 13:05:24 +10:00
momumi
7aac21c6f5
allow _ separators in number literals (stage 1)
...
* Underscores `_` may be placed between two digits in a int/float literal
* Consecutive underscores are not allowed
* Fixed parsing bug in exponents of hexadecimal float literals.
Exponents should always be base 10, but hex characters would be parsed
inside the exponent and everything after them would be ignored. eg:
`0x1.0p1ab1` would be parsed as `0x1.0p1`.
2020-03-15 12:38:35 +10:00
LeRoyce Pearson
819537d70a
Skip file lock test in single threaded mode
2020-03-14 20:36:26 -06:00
LeRoyce Pearson
947abb7626
Fix compile error on windows
2020-03-14 17:13:46 -06:00
Vexu
57f9f07558
use anon literals in ast.zig and parse.zig
2020-03-15 01:11:58 +02:00
Vexu
5e5dee829d
remove .Cancel correct merge err set parsing
2020-03-15 01:02:33 +02:00
LeRoyce Pearson
49128c86f8
Extract run_lock_file_test
2020-03-14 15:31:54 -06:00
Andrew Kelley
a77386eb98
for build-obj with only 1 C file, name .o file after root_out_name
2020-03-14 17:11:51 -04:00
LeRoyce Pearson
7ab77685a8
Make lock tests more flexible
2020-03-14 14:57:56 -06:00
LeRoyce Pearson
873c7a59e9
Add multiple read lock test
2020-03-14 13:29:49 -06:00
LeRoyce Pearson
72eb9933fd
Call std.os.waitpid instead of std.os.linux.waitpid
2020-03-14 11:34:38 -06:00
LeRoyce Pearson
43ccc2d81e
Add note about mandatory locks on linux
2020-03-14 10:12:46 -06:00
LeRoyce Pearson
43c4faba55
Add test to check that locking works
2020-03-14 10:12:46 -06:00
LeRoyce Pearson
a636b59cb5
Add lock option to CreateFlags
2020-03-14 10:12:46 -06:00
LeRoyce Pearson
4eff48b12e
Add flock command paramter to os.fcntlFlock
...
Also, replace `os.fcntlFlockBlocking` with `os.fcntlFlock`
2020-03-14 10:12:46 -06:00
LeRoyce Pearson
f66a607607
Define Flock for all posix systems
2020-03-14 10:12:46 -06:00
LeRoyce Pearson
e1868029e9
Implement blocking file locking API for windows
2020-03-14 10:12:46 -06:00
LeRoyce Pearson
9af0590a28
Add fnctlFlock system call, use it to lock files
2020-03-14 10:12:46 -06:00
LeRoyce Pearson
3110060351
Add lock to fs.File.OpenFlags
2020-03-14 10:12:46 -06:00
Andrew Kelley
4a8e766ef5
fix mismatch between expected and actual output name
2020-03-14 01:26:49 -04:00
Andrew Kelley
faa3c40b54
fix docgen, which relied on stdout being path to binary
2020-03-14 00:46:40 -04:00
Andrew Kelley
66d7370fac
special case when doing build-obj with just one source file
...
When building an object file from only one source file, instead of
having a two-stage cache system, we special case it and use the cache
directory that the .o file is output to as the final cache directory for
all the build artifacts.
When there are more than 1 source file, the linker has to merge objects
into one, and so the two stage approach makes sens. But in the case of
only one source file, this prevents needlessly copying the object file.
This commit fixes an issue with the previous one, where zig with cache
enabled would print a directory that actually did not have any build
artifacts in it.
2020-03-13 23:59:36 -04:00
Andrew Kelley
66e76a0209
zig build system: correctly handle multiple output artifacts
...
Previously the zig build system incorrectly assumed that the only build
artifact was a binary. Now, when you enable the cache, only the output
dir is printed to stdout, and the zig build system iterates over the
files in that directory, copying them to the output directory.
To support this change:
* Add `std.os.renameat`, `std.os.renameatZ`, and `std.os.renameatW`.
* Fix `std.os.linux.renameat` not compiling due to typos.
* Deprecate `std.fs.updateFile` and `std.fs.updateFileMode`.
* Add `std.fs.Dir.updateFile`, which supports using open directory
handles for both the source and destination paths, as well as an
options parameter which allows overriding the mode.
* Update `std.fs.AtomicFile` to support operating based on an open
directory handle. Instead of `std.fs.AtomicFile.init`, use
`std.fs.Dir.atomicFile`.
* `std.fs.AtomicFile` deinit() better handles the situation when the
rename fails but the temporary file still exists, by still
attempting to remove the temporary file.
* `std.fs.Dir.openFileWindows` is moved to `std.os.windows.OpenFileW`.
* `std.os.RenameError` gains the error codes `NoDevice`,
`SharingViolation`, and `PipeBusy` which have been observed from
Windows.
Closes #4733
2020-03-13 21:22:08 -04:00
Andrew Kelley
75bda408cd
update stack traces test expectations
2020-03-13 17:50:29 -04:00
Noam Preil
eb4d313dbc
Fix compilation with --no-emit-bin
2020-03-13 15:40:29 -04:00
Andrew Kelley
656ba530d8
Merge remote-tracking branch 'origin/master' into llvm10
2020-03-13 15:17:53 -04:00
LemonBoy
2501e80500
Even better idle waiting method
2020-03-13 19:20:18 +01:00
LemonBoy
e496ef26da
Nicer idle wait loop
...
Trying to acquire twice the same mutex generates an idle loop.
2020-03-13 18:40:18 +01:00
LemonBoy
edcf8e0636
std: Multithreaded-aware panic handler
...
Gracefully handle the case of several threads panicking at the same
time.
2020-03-13 17:55:40 +01:00
Andrew Kelley
3eff77bfb5
Merge branch 'fengb-format-stream'
2020-03-13 12:07:06 -04:00
Andrew Kelley
4905102901
fix all the TODOs from the pull request
...
* `std.Buffer.print` is removed; use `buffer.outStream().print`
* `std.fmt.count` returns a `u64`
* `std.Fifo.print` is removed; use `fifo.outStream().print`
* `std.fmt.bufPrint` error is renamed from `BufferTooSmall`
to `NoSpaceLeft` to match `std.os.write`.
* `std.io.FixedBufferStream.getWritten` returns mutable buffer
if the buffer is mutable.
2020-03-13 12:02:58 -04:00
Andrew Kelley
2dd920ee39
Merge branch 'format-stream' of https://github.com/fengb/zig into fengb-format-stream
2020-03-13 11:31:11 -04:00
Andrew Kelley
a9297f2267
Merge pull request #4716 from LemonBoy/sys-misc
...
Introduce std.fs.file.setEndPos
2020-03-13 11:18:08 -04:00
LemonBoy
de53537f10
Add NtDll-based ftruncate implementation
2020-03-13 08:45:37 +01:00
Andrew Kelley
5dd3c8eed6
Merge pull request #4727 from nrdmn/uefi3
...
std/os/uefi: various improvements and some refactoring
2020-03-12 20:58:29 -04:00
Andrew Kelley
2f06971a7e
Merge pull request #4725 from ziglang/update-musl
...
Upgrade musl libc to 1.2.0
2020-03-12 19:56:38 -04:00
Andrew Kelley
f51bec321b
Merge pull request #4707 from Vexu/small-atomics
...
Support atomic operations with bools and non power of two integers
2020-03-12 18:55:16 -04:00
Nick Erdmann
f44530302e
std/os/uefi: file protocol improvements
2020-03-12 23:23:21 +01:00
Nick Erdmann
92beb13914
std/os/uefi: status reform
2020-03-12 23:23:12 +01:00
Nick Erdmann
6c368b9e73
std/os/uefi: device path protocol improvements
2020-03-12 23:23:02 +01:00
Nick Erdmann
9f475dae14
std/os/uefi: Add shell parameters protocol
2020-03-12 23:22:49 +01:00
Nick Erdmann
52eb4129de
std/os/uefi: loaded image protocol improvements
2020-03-12 23:22:08 +01:00
Nick Erdmann
e617e8a798
std/os/uefi: require guid output function be comptime
2020-03-12 23:22:08 +01:00
Nick Erdmann
7c12f93734
std/os/uefi: boot services and runtime services improvements
...
- Several function signatures added
- Add getNextVariableName sentinel termination annotation
2020-03-12 23:22:08 +01:00
Andrew Kelley
6e25ac2a2b
stage1: update musl libc building code for v1.2.0
2020-03-12 17:45:55 -04:00
Andrew Kelley
edd6643a26
update musl src files to v1.2.0
2020-03-12 17:17:57 -04:00
Vexu
71d776c3be
add note to disabled tests, improve comptime cmpxchg
2020-03-12 22:42:01 +02:00
Andrew Kelley
205c413962
update musl headers to v1.2.0
2020-03-12 16:26:14 -04:00
Vexu
6dde769279
Simplify stores, use sext for signed ints
2020-03-12 22:02:58 +02:00
LemonBoy
bd0b51477a
Address review comments
2020-03-12 19:40:42 +01:00
Andrew Kelley
aa49f972d6
Merge pull request #4720 from Vexu/translate-c
...
Translate-c treat C bools as ints
2020-03-12 14:00:07 -04:00
daurnimator
8a22c50c08
Remove unused static_crt_dir field from libc config
2020-03-12 12:27:45 -04:00
Benjamin Feng
4aae55b4cc
Replace fmt with new fmtstream
2020-03-12 10:41:09 -05:00
Benjamin Feng
ed7f30e1cd
Migrate last vestiges of fmt
2020-03-12 10:41:09 -05:00
Benjamin Feng
786216ca5a
Slap in workaround for Fifo
2020-03-12 10:41:09 -05:00
Benjamin Feng
6a53fe7c93
Handle potential downcast when translating stream size
2020-03-12 10:41:09 -05:00
Benjamin Feng
0059d9ee3e
Convert fmt.bufPrint / fmt.allocPrint
2020-03-12 10:41:09 -05:00
Benjamin Feng
4023ed56d4
Convert translate-c to fmtstream
2020-03-12 10:41:09 -05:00
Benjamin Feng
8dd078b99a
Convert Buffer to use fmtstream
2020-03-12 10:41:09 -05:00
Benjamin Feng
2429fdd73b
Convert JSON to fmtstream
2020-03-12 10:41:09 -05:00
Benjamin Feng
0fbccec000
Convert builtin to fmtstream
2020-03-12 10:41:04 -05:00
Andrew Kelley
214af69814
ci: remove workaround for FreeBSD upstream bug
2020-03-12 11:40:44 -04:00
Vexu
ce19638cd4
disable test on mipsel
2020-03-12 17:31:10 +02:00
Benjamin Feng
c11d1055b8
Integrated outstreams with new formatter
2020-03-12 10:26:28 -05:00
Benjamin Feng
7364e965f4
Force error coercion of custom formatters
2020-03-12 10:26:28 -05:00
Benjamin Feng
d2e4aafd64
Fixup allocPrint
2020-03-12 10:26:27 -05:00
Vexu
02c491e42a
translate-c fix order of tokens
2020-03-12 17:14:01 +02:00
Vexu
710b05b153
support @atomicRmw at comptime
2020-03-12 16:46:16 +02:00
Benjamin Feng
1c18ab01a4
Add back max_depth test
2020-03-12 09:25:13 -05:00
Benjamin Feng
f51c8f26c1
Apply explicit error type
2020-03-12 09:19:32 -05:00
Benjamin Feng
78d12762a9
Re-enable a bunch of tests
2020-03-12 09:15:49 -05:00
Benjamin Feng
8241b96f78
Re-enable testFmt
2020-03-12 09:06:12 -05:00
Benjamin Feng
e1e9ff9546
Get formatIntBuf working
2020-03-12 09:06:10 -05:00
Benjamin Feng
278b9ec1aa
Blind translation
2020-03-12 09:04:18 -05:00
Benjamin Feng
ae3fb6df00
Copy fmtstream
2020-03-12 08:58:36 -05:00
Vexu
dda711ba0d
translate-c treat c bools as ints
2020-03-12 14:40:47 +02:00
LemonBoy
11df0d0cf8
std: Add setEndPos to fs.file
...
Allow the user to shrink/grow the file size as needed.
2020-03-12 09:43:45 +01:00
LemonBoy
89d7fc773d
std: Fix pwrite invocation on 32bit architectures
2020-03-12 09:43:45 +01:00
Andrew Kelley
f58705b4a6
fix zig targets not reporting native info
2020-03-12 00:33:06 -04:00
Heppokoyuki
3f1c8e3d58
fix bug
2020-03-12 00:29:30 -04:00
Andrew Kelley
75e9a722db
Merge pull request #4714 from mikdusan/target
...
fix -target and -mcpu issues
2020-03-11 21:47:56 -04:00
Andrew Kelley
3ded862cdf
Merge pull request #4713 from Heppokoyuki/uefi-file-protocols
...
UEFI library improvements
2020-03-11 21:44:50 -04:00
Michael Dusan
bfebc11d06
fix zig-cache to treat cpu-features as raw-bytes
...
- add Stage2Target.cache_hash_len
- add cache_mem(ch, ptr, len)
- update call sites to use { ptr, len }
2020-03-11 19:33:12 -04:00
Michael Dusan
c988167377
update/apply CPU features when -mcpu native
...
- fix: features were not applied if cpu is specified as native
2020-03-11 19:33:11 -04:00
Michael Dusan
e0fe0f7f1e
parse CPU features when --target is null
...
- fixes case where features are not parsed when `-target` is null
- `zig builtin -mcpu native+bogus` should return error/list of valid features
2020-03-11 19:33:10 -04:00
Andrew Kelley
895f67cc6d
Merge pull request #4710 from ziglang/io-stream-iface
...
rework I/O stream abstractions
2020-03-11 18:54:52 -04:00
Andrew Kelley
571f3ed161
fix stray warn() in runtime safety test
2020-03-11 18:45:09 -04:00
Andrew Kelley
06d2f53ece
windows: detect HANDLE_EOF in ReadFile
2020-03-11 17:39:53 -04:00
Andrew Kelley
3657a54618
fix regressions in elf parsing code
2020-03-11 17:34:12 -04:00
Andrew Kelley
6892865ba7
FixedBufferStream: match file semantics more by clamping pos
2020-03-11 16:14:12 -04:00
Andrew Kelley
04626c176b
Merge remote-tracking branch 'origin/master' into io-stream-iface
2020-03-11 15:47:07 -04:00
Andrew Kelley
431d76c023
add std.io.StreamSource and fixes to emitRaw
2020-03-11 15:40:34 -04:00
Andrew Kelley
c71991c869
fix compilation errors for emitRaw
2020-03-11 14:34:13 -04:00
Andrew Kelley
51c6bb92b1
Merge pull request #4709 from LemonBoy/implement-2096
...
Stricter shift left/right safety checks
2020-03-11 14:22:40 -04:00
Andrew Kelley
d96b6c0d9f
fix footguns in File readAll functions
2020-03-11 13:06:30 -04:00
Heppokoyuki
58941927c4
refactor
2020-03-12 00:24:00 +09:00
Heppokoyuki
02ba1d8fe1
add file protocols
2020-03-12 00:24:00 +09:00
Vexu
9262f065f5
Move abi size checking to codegen
2020-03-11 16:48:18 +02:00
Vexu
ec906a9771
fix codegen, update docs
2020-03-11 13:55:52 +02:00
Vexu
1f66435a6b
support cmpxchg at comptime
2020-03-11 12:02:05 +02:00
Vexu
64e60d8ae2
special case atomic operations on zero bit types
2020-03-11 10:29:15 +02:00
Vexu
21809c3300
support non power of two integers in atomic ops
2020-03-11 09:24:53 +02:00
Andrew Kelley
ed13cffca4
rework some old ELF parsing code and start to fix emitRaw
2020-03-10 22:01:58 -04:00
Andrew Kelley
bd14a81e30
fix std.ChildProcess on Windows
2020-03-10 21:09:49 -04:00
Andrew Kelley
d882a30587
fix stage2 lib on windows
2020-03-10 20:51:30 -04:00
Andrew Kelley
2bff0dda79
fix regressions found by test suite
2020-03-10 20:22:30 -04:00
Andrew Kelley
9abee660dc
fix stack trace code not opening files in forced blocking mode
2020-03-10 19:28:05 -04:00
Andrew Kelley
cd26d3b0bb
fix regressions caused earlier in this branch
2020-03-10 18:54:24 -04:00
LemonBoy
2f1052a313
std: Fix broken tests
2020-03-10 23:50:04 +01:00
Andrew Kelley
18f1fef142
update standard library to new I/O streams API
2020-03-10 18:44:30 -04:00
Michael Dusan
83f6f730cd
std: simplify format enum-literals
2020-03-10 18:09:41 -04:00
LemonBoy
4ab13a359d
ir: Fix shift code for u0 operands
2020-03-10 23:04:49 +01:00
Vexu
ee5b00a8b9
use atomic bools in std lib
2020-03-10 22:54:47 +02:00
Vexu
8dc188ebe0
support atomic operations with bools
2020-03-10 22:33:32 +02:00
Andrew Kelley
b6fbd524f1
(breaking) improve and simplify fixed buffer streams API
2020-03-10 16:31:04 -04:00
LemonBoy
300fceac6e
ir: Implement more safety checks for shl/shr
...
The checks are now valid on types whose size is not a power of two.
Closes #2096
2020-03-10 20:54:05 +01:00
Andrew Kelley
ba0e3be5cf
(breaking) rework stream abstractions
...
The main goal here is to make the function pointers comptime, so that we
don't have to do the crazy stuff with async function frames.
Since InStream, OutStream, and SeekableStream are already generic
across error sets, it's not really worse to make them generic across the
vtable as well.
See #764 for the open issue acknowledging that using generics for these
abstractions is a design flaw.
See #130 for the efforts to make these abstractions non-generic.
This commit also changes the OutStream API so that `write` returns
number of bytes written, and `writeAll` is the one that loops until the
whole buffer is written.
2020-03-10 15:32:32 -04:00
Vexu
1ad831a0ef
fix zig fmt on noasync block
2020-03-10 15:27:11 -04:00
Jonathan Marler
90c232bbe8
add allocSentinel function
2020-03-10 15:03:59 -04:00
Andrew Kelley
9c4dc7b1bb
Merge pull request #4703 from Vexu/translate-c
...
Translate-c improvements
2020-03-10 12:56:17 -04:00
LemonBoy
3e93dce0a1
std: Fix detection of Linux kernel version
2020-03-10 12:55:35 -04:00
Vexu
cb4c488cbd
translate-c support struct field alignment
2020-03-10 15:57:57 +02:00
Vexu
4cace8f7c3
properly mangle shadowed primitive types
2020-03-10 15:52:54 +02:00
Vexu
baec74645d
translate-c add daurnimator's pointer check to macro cast
2020-03-10 15:52:03 +02:00
Andrew Kelley
675f01f176
Merge pull request #4590 from xackus/fix-4587
...
fix failed assert on generic fn opaque return type
2020-03-09 22:10:57 -04:00
LemonBoy
1f44b29724
ir: Fix codegen of ?*T types where T is zero-sized
...
* Fix codegen for optional types that decay to a pointer, the type
behaves as a boolean
* Fix comptime evaluation of zero-sized arrays, always initialize the
internal array elements
Closes #4673
2020-03-09 22:08:56 -04:00
Andrew Kelley
638d5c3aca
Merge pull request #4700 from Vexu/noasync
...
Implement new noasync syntax
2020-03-09 18:36:01 -04:00
xackus
e7cc456421
better error messages and more tests
2020-03-09 22:33:18 +01:00
Andrew Kelley
52c01840ce
Merge branch 'LemonBoy-fix-4527'
...
closes #4531
2020-03-09 14:24:51 -04:00
Andrew Kelley
7db6da7cb8
lazy_cmp_zero only resolves type is zero bits for alignof
2020-03-09 14:24:04 -04:00
LemonBoy
14bbb82832
ir: Fix lazy comparison between @alignOf and zero
...
Closes #4527
2020-03-09 14:05:38 -04:00
daurnimator
648f94c027
std: add some definitions for netlink sockets
2020-03-09 13:02:38 -04:00
Andrew Kelley
6ab156ce7d
Merge pull request #4695 from leroycep/feature-inode-stat
...
Expose file inode number on posix and file index on windows
2020-03-09 13:01:26 -04:00
Ryan Liptak
9b1b44b41c
Windows: Fix std.fs.realpath/os.realpathW for directories
2020-03-09 12:59:17 -04:00
Vexu
3fd2cd4367
add LemonBoy's test
2020-03-09 18:43:09 +02:00
Vexu
03c1431f9c
disallow resume and suspend in noasync scopes
2020-03-09 15:51:51 +02:00
Vexu
3618256c97
implement noasync scopes
2020-03-09 12:33:24 +02:00
Vexu
6f8d732599
update parsers to new noasync syntax
2020-03-09 12:23:30 +02:00
Lachlan Easton
0db108101a
Translate C: Add comment containing c source location for failed decls
2020-03-09 18:10:41 +11:00
LeRoyce Pearson
25d9ab95dd
Use os.ino_t for everything
...
Also, define ino_t for windows
2020-03-08 21:52:36 -06:00
LeRoyce Pearson
cb84875eed
Define ino_t for systems not yet defining it
...
Also, use ino_t instead of u64 in fs.File.INode
2020-03-08 18:31:18 -06:00
LemonBoy
e2fd289a33
ir: Create usize result_loc for array subscript expr
...
Allow the subscript expression to infer the resulting type.
Closes #4169
2020-03-08 18:52:44 -04:00
LemonBoy
06d0dac0fb
ir: Prevent crash in compiler error
...
Anonymous containers have no struct_field->type AstNode set, let's
always use the field node itself to make the error messages consistent.
Closes #4691
2020-03-08 18:12:50 -04:00
LeRoyce Pearson
e1c1ca9903
Add documentation about Stat.inode
2020-03-08 15:47:50 -06:00
LeRoyce Pearson
55077435bf
Expose file inode (linux) and file index (windows)
2020-03-08 15:19:02 -06: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
Andrew Kelley
96c07674fc
Merge remote-tracking branch 'origin/master' into llvm10
2020-03-07 12:18:41 -05:00
Michael Dusan
bc75c0de6c
stage1: fix compile error on macOS Xcode 11.4
2020-03-07 12:16:56 -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
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
c92957da0e
Merge branch 'update-mingw-w64'
...
closes #3713
2020-03-05 15:41:33 -05:00
Andrew Kelley
20ac253859
reapply mingw-w64 header patches
...
Fix compilation w/ clang
f83bb3dd9e
2020-03-05 15:41:28 -05:00
Andrew Kelley
c0242f2310
update mingw-w64 source files to v7.0.0
2020-03-05 15:41:28 -05:00
Andrew Kelley
8e5913cfee
update mingw-w64 headers to v7.0.0
2020-03-05 15:41:28 -05:00
Michael Dusan
1aae5bebe9
Merge pull request #4641 from mikdusan/housekeeping
...
stage1: housekeeping
2020-03-05 14:58:02 -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
Vexu
ad27041de9
translate-c demote struct to opaque if unable to translate type
2020-03-05 10:55:32 -05:00
Andrew Kelley
b7614e63f5
Merge pull request #4636 from Vexu/translate-c
...
Translate-c macro comma operator
2020-03-05 10:38:51 -05:00
Andrew Kelley
d7dc7d7a50
Merge pull request #4633 from daurnimator/4632-i1
...
Fix formatting of i1 values
2020-03-05 10:33:02 -05:00
Vexu
e063854563
translate-c correct assumption about macros
2020-03-05 12:23:32 +02:00
Vexu
8088bdc6d5
translate-c macro comma operator
2020-03-05 11:22:50 +02:00
daurnimator
e9c3b65bf4
std: use testing.expectEqual in math.absCast tests
2020-03-05 16:02:26 +11:00
daurnimator
488ba1560f
std: fix math.absCast on i1
2020-03-05 16:00:19 +11:00
daurnimator
4f58bfe1a8
std: fix formatting of i1 integers
2020-03-05 15:52:19 +11:00
daurnimator
d5359ea541
std: use testing.expectEqualSlices from tests
2020-03-05 15:51:21 +11:00
Andrew Kelley
378bf1c3b7
Merge branch 'LemonBoy-fix-439'
2020-03-04 18:05:34 -05:00
Andrew Kelley
116e2a93f1
update docs for @TypeOf
2020-03-04 18:05:14 -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
e029032251
std: Use @TypeOf(x,y) as return value for max
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
Andrew Kelley
3178807657
Merge remote-tracking branch 'origin/master' into llvm10
2020-03-04 15:35:46 -05:00
Andrew Kelley
6cbd1ac51a
zig is now aware of DragonflyBSD versions
2020-03-04 15:34:32 -05:00
Andrew Kelley
3ff2381042
update glibc source files to 2.31
...
This is mostly minor modifications to license text.
2020-03-04 14:59:09 -05:00
pfg
e3b37fc9c1
Generated documentation mobile support
2020-03-04 10:47:21 -05:00
Timon Kruiper
e095475d92
Fix docs generation
...
Commit edb210905d 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
Andrew Kelley
1cf3209cb8
Merge pull request #4623 from ziglang/update-glibc
...
Update glibc to 2.31
Closes #4459 .
2020-03-04 09:01:19 -05:00
Andrew Kelley
447a89cd4d
update self-hosted zig targets to print correct glibc availability
2020-03-04 01:05:42 -05:00
Andrew Kelley
b21d44f26a
update glibc abilists for 2.31
2020-03-04 00:07:15 -05:00
Andrew Kelley
cd33c5bfe8
zig build: update InstallRawStep to new std.fs API
...
closes #4622
2020-03-04 00:00:42 -05:00
Andrew Kelley
74fef9db6e
update update_glibc tool to latest zig
2020-03-03 22:52:03 -05:00
Andrew Kelley
67480cd515
update glibc headers to 2.31
2020-03-03 22:46:57 -05:00
Andrew Kelley
3841acf7ef
update process_headers tool to latest zig
2020-03-03 22:40:41 -05:00
Andrew Kelley
8aaab75af0
docs: remove reference to deprecated builtins
...
closes #3959
2020-03-03 22:14:29 -05:00
Andrew Kelley
c0c9303bd6
put FreeBSD CI in timeout for misbehavior
...
FreeBSD is dealing with some weird upstream bug right now. We can try to
re-enable this when it is fixed.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244549
very naughty
2020-03-03 21:32:01 -05:00
Andrew Kelley
3b235cfa80
std.zig.CrossTarget: fix compile errors
...
closes #4620
2020-03-03 21:09:32 -05:00
Andrew Kelley
f6f0b019be
Merge pull request #4618 from ziglang/daurnimator-paths
...
improvements to std.fs, std.os
2020-03-03 17:05:14 -05:00
Andrew Kelley
1141bfb21b
Darwin can return EBADF for sendfile on non-files
2020-03-03 16:52:32 -05:00
Andrew Kelley
c4f81586f1
update docgen to new std.fs API
2020-03-03 16:01:09 -05:00
Andrew Kelley
55dfedff42
update cli test to new std.fs API
2020-03-03 15:58:14 -05:00
Andrew Kelley
4a67dd04c9
breaking changes to std.fs, std.os
...
* improve `std.fs.AtomicFile` to use sendfile()
- also fix AtomicFile cleanup not destroying tmp files under some
error conditions
* improve `std.fs.updateFile` to take advantage of the new `makePath`
which no longer needs an Allocator.
* rename std.fs.makeDir to std.fs.makeDirAbsolute
* rename std.fs.Dir.makeDirC to std.fs.Dir.makeDirZ
* add std.fs.Dir.makeDirW and provide Windows implementation of
std.os.mkdirat. std.os.windows.CreateDirectory is now implemented
by calling ntdll, supports an optional root directory handle,
and returns an open directory handle. Its error set has a few more
errors in it.
* rename std.fs.Dir.changeTo to std.fs.Dir.setAsCwd
* fix std.fs.File.writevAll and related functions when len 0 iovecs
supplied.
* introduce `std.fs.File.writeFileAll`, exposing a convenient
cross-platform API on top of sendfile().
* `NoDevice` added to std.os.MakeDirError error set.
* std.os.fchdir gets a smaller error set.
* std.os.windows.CloseHandle is implemented with ntdll call rather than
kernel32.
2020-03-03 15:23:27 -05:00
daurnimator
1ca5f06762
Update callers of fs.makePath
2020-03-03 13:25:43 -05:00
daurnimator
695b0976c3
std: move makePath to be a Dir method
2020-03-03 13:25:43 -05:00
daurnimator
a19a30bb17
std: move null byte check into toPosixPath
...
Note that windows NT paths *can* contain nulls
2020-03-03 13:25:43 -05:00
daurnimator
d8f966a04b
std: fix fs.makePath
...
The previous behaviour of using path.resolve has unexpected behaviour around symlinks.
This more simple implementation is more correct and doesn't require an allocator
2020-03-03 13:25:43 -05:00
daurnimator
bfc569bc98
std: add os.fstatat
2020-03-03 13:25:43 -05:00
daurnimator
627618a38d
std: add Dir.changeDir as wrapper around fchdir
2020-03-03 13:25:43 -05:00
daurnimator
dfb420e6d7
std: add fs.Dir.makeDir
2020-03-03 13:25:43 -05:00
daurnimator
88e27f01c8
std: add mkdirat
2020-03-03 13:25:40 -05:00
Andrew Kelley
582db68a15
remove superfluous comptime keyword
2020-03-03 12:01:17 -05:00
LemonBoy
a6fb6dcfc9
linux: Correct pread64 syscall for ARM/MIPS
...
Closes #4615
2020-03-03 11:59:16 -05:00
Andrew Kelley
226b801830
Merge pull request #4612 from ziglang/os-read-write-sendfile
...
std.os read/write functions + sendfile
2020-03-03 10:15:37 -05:00
Andrew Kelley
9d6cc75ce3
disable sendfile test on mips
2020-03-03 09:49:46 -05:00
Andrew Kelley
66e6f5586e
enable f128 test on windows
2020-03-03 09:49:08 -05:00
Andrew Kelley
d1cb16aace
Merge remote-tracking branch 'origin/master' into llvm10
2020-03-03 09:44:13 -05:00
Andrew Kelley
3418a332ab
Revert "work around LLVM 10 llvm-config giving absolute path to libz.so"
...
This reverts commit 73256dda91 .
No longer needed with latest release/10.x branch.
2020-03-03 09:17:37 -05:00
Andrew Kelley
387418277a
Merge pull request #4601 from alexnask/fix_3997
...
Allow wrapping in VDSO lookup
2020-03-03 09:15:40 -05:00
Alexandros Naskos
7559418305
Added comment justifying wrapping operations
2020-03-03 12:41:11 +02:00
Andrew Kelley
a66c72749a
more macos fixes
2020-03-03 03:10:56 -05:00
Ryan Liptak
d7579a2fcb
Fix std.os.unlinkatW for absolute paths
...
RootDirectory can't be set in ObjectAttributes if ObjectName is an absolute path.
Fixes #4606
2020-03-03 03:07:12 -05:00
Andrew Kelley
859fc856d3
fix macosx and freebsd build failures
2020-03-03 02:57:11 -05:00
Andrew Kelley
c81345c8ae
breaking: std.os read/write functions + sendfile
...
* rework os.sendfile and add macosx support, and a fallback
implementation for any OS.
* fix sendto compile error
* std.os write functions support partial writes. closes #3443 .
* std.os pread / pwrite functions can now return `error.Unseekable`.
* std.fs.File read/write functions now have readAll/writeAll variants
which loop to complete operations even when partial reads/writes
happen.
* Audit std.os read/write functions with respect to Linux returning
EINVAL for lengths greater than 0x7fff0000.
* std.os read/write shim functions do not unnecessarily loop. Since
partial reads/writes are part of the API, the caller will be forced
to loop anyway, and so that would just be code bloat.
* Improve doc comments
* Add a non-trivial test for std.os.sendfile
* Fix std.os.pread on 32 bit Linux
* Add missing SYS_sendfile bit on aarch64
2020-03-03 02:25:26 -05:00
Terin Stock
bd287dd194
std: implement sendfile on linux
...
This changset adds a `sendfile(2)` syscall bindings to the linux bits
component. Where available, the `sendfile64(2)` syscall will be
transparently called.
A wrapping function has also been added to the std.os to transform
errno returns to Zig errors.
Change-Id: I86769fc4382c0771e3656e7b21137bafd99a4411
2020-03-02 12:54:50 -05:00
Alexandros Naskos
a48cd1cf58
Allow wrapping in VDSO lookup
2020-03-02 11:44:21 +02: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
xackus
00be934569
short std.builtin enum literals in std lib
2020-03-01 13:57:41 -05:00
Andrew Kelley
3c14327011
Merge branch 'daurnimator-fmt-sentinel-pointers'
...
closes #3972
2020-03-01 13:53:13 -05:00
Andrew Kelley
ef3d761da5
breaking: std.mem.len no longer takes a type argument
...
also update fmt code to use std.mem.span.
2020-03-01 13:21:39 -05:00
Andrew Kelley
5b26128bac
add new functions to std.mem and deprecate others
...
add std.mem.Span
add std.mem.span
add std.mem.length
add std.mem.indexOfSentinel
deprecate std.mem.len
deprecate std.mem.toSlice
deprecate std.mem.toSliceConst
2020-03-01 13:07:55 -05:00
Andrew Kelley
4505857e30
revert changes outside std.fmt
2020-03-01 13:07:31 -05:00
daurnimator
0b0de22fd1
std: format contents of sentinel terminated many pointers
...
std: add std.meta.Sentinel to get sentinel of a type
2020-03-01 13:04:29 -05:00
Andrew Kelley
b99c6d56da
stage1: fix compilation on 32-bit arm
2020-03-01 03:27:09 -05:00
Andrew Kelley
ae99fabfe4
Merge pull request #4585 from LemonBoy/fix-4581
...
target: Implement OS version detection for Windows
2020-03-01 02:53:51 -05:00
Andrew Kelley
f082e253b5
fix native OS version detection on macOS
...
closes #4583
2020-03-01 01:17:50 -05:00
Andrew Kelley
2246812184
use an explicit error set to fix a compilation error
...
this function has conditionally compiled out code in it about looking
for native glibc.
2020-02-29 22:20:44 -05:00
Andrew Kelley
6fcf6716be
std.Thread.cpuCount on Windows uses the PEB
...
rather than calling GetSystemInfo from kernel32.dll. Also remove
OutOfMemory from the error set.
2020-02-29 22:13:09 -05:00
Andrew Kelley
d951e0402a
Merge pull request #4586 from daurnimator/windows-PEB
...
Fill out windows PEB definition
2020-02-29 22:05:56 -05:00
Andrew Kelley
48cef8d5be
refactor std.zig.system.NativeTargetInfo functions
...
to make them a bit easier to test.
2020-02-29 21:31:03 -05:00
Andrew Kelley
c903b76010
Merge pull request #4589 from LemonBoy/fix-4583
...
target: Implement OS version detection for OSX
2020-02-29 20:39:29 -05:00
LemonBoy
845af5c552
Handle one more error
2020-02-29 23:11:36 +01:00
LemonBoy
3b29a72b3b
Use .len instead of @sizeOf
2020-02-29 23:08:57 +01:00
LemonBoy
84549b3955
target: Implement OS version detection for OSX
...
Closes #4583
2020-02-29 21:46:07 +01:00
LemonBoy
278f0f8fa9
Change how the build-id is checked
...
Address review comment by @rocksnest
2020-02-29 18:31:03 +01:00
Andrew Kelley
3c7f030a60
add CrossTarget.getObjectFormat
...
closes #4588
thanks Michaël Larouche for the suggested fix
2020-02-29 12:27:13 -05:00
daurnimator
d0c22619f5
Complete windows PEB_LDR_DATA definition
2020-03-01 02:10:29 +11:00
LemonBoy
5822220435
Address review comments
2020-02-29 14:19:13 +01:00
daurnimator
513076ee9c
Fill out PEB definition
2020-03-01 00:12:08 +11:00
LemonBoy
f072b0c056
target: Implement OS version detection for Windows
...
Closes #4581
2020-02-29 12:02:40 +01:00
Andrew Kelley
7e6b68a534
std.Target.standardDynamicLinkerPath: delete bad doc comment
2020-02-29 02:08:26 -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
1aef0bef75
std.Target.Os.WindowsVersion: non-exhaustive enum
2020-02-28 19:24:52 -05:00
Andrew Kelley
e683eee415
fix CrossTarget.isNative, setGnuLibCVersion, zigTriple
2020-02-28 19:18:27 -05:00
Andrew Kelley
4bc893c346
update test to newer API
2020-02-28 19:05:14 -05:00
Andrew Kelley
7e3bb00a0e
don't choose native ld path when os is non native
2020-02-28 18:48:19 -05:00
Andrew Kelley
4591236ae1
CrossTarget.cpu_model: communicate intent precisely
2020-02-28 18:31:46 -05:00
Andrew Kelley
aa13f339d4
fix handling of CrossTarget.cpu_model
2020-02-28 18:09:33 -05:00
Andrew Kelley
8691d3c50d
improve std.zig.system.NativeTargetInfo.detect
...
It now takes a std.zig.CrossTarget parameter, and only resolves
native things, leaving explicitly overridden things alone.
2020-02-28 17:23:16 -05:00
Andrew Kelley
a5a53a182a
fix typo from other commit
...
d2535c003c
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
07f52119de
implement native OS version detection for linux
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
3683ba87ac
complete the native target detection based on /usr/bin/env
2020-02-28 14:51:56 -05:00
Andrew Kelley
fd006c1c74
std.zig.system.NativeTargetInfo.detect: almost no Allocator
2020-02-28 14:51:55 -05:00
Andrew Kelley
60f2f3457d
getStandardDynamicLinkerPath renamed and no allocator
...
* `std.Target.getStandardDynamicLinkerPath` =>
`std.Target.standardDynamicLinkerPath`
* it now takes a pointer to fixed size array rather than an allocator
* `std.zig.system.NativeTargetInfo.detect` now supports reading
PT_INTERP from /usr/bin/env
2020-02-28 14:51:55 -05:00
Andrew Kelley
662b5f7c60
update docs to latest Target API
2020-02-28 14:51:55 -05:00
Andrew Kelley
f89a1844bf
don't error out for targets with unknown standard dynamic linker path
2020-02-28 14:51:55 -05:00
Andrew Kelley
70bf8874d7
update docgen to new Target API
2020-02-28 14:51:55 -05:00
Andrew Kelley
3c3316d4ba
update tests to new Target API
2020-02-28 14:51:55 -05:00
Andrew Kelley
2536e4c70c
WASI has no dynamic linker
2020-02-28 14:51:55 -05:00
Andrew Kelley
bafa895561
compiler-rt: inline at call site to workaround a bug
...
The bug is #2154
2020-02-28 14:51:55 -05:00
Andrew Kelley
36aa3c8e7f
fix __stack_chk_guard emitted even when not linking libc
2020-02-28 14:51:55 -05:00
Andrew Kelley
6226726571
fix builder.findProgram test
2020-02-28 14:51:55 -05:00
Andrew Kelley
2387f48d5c
fix incorrect builtin import code for windows
2020-02-28 14:51:54 -05:00
Andrew Kelley
7927764cc2
mips: implement Target.getStandardDynamicLinkerPath
2020-02-28 14:51:54 -05:00
Andrew Kelley
34d2700af4
clean up CrossTarget.getExternalExecutor
2020-02-28 14:51:54 -05:00
Andrew Kelley
622b5b62c2
fix not setting the dynamic linker path when cross compiling
2020-02-28 14:51:54 -05:00
Andrew Kelley
0912484c4f
improve the "external executor" detection logic
2020-02-28 14:51:54 -05:00
Andrew Kelley
cebcacd872
fix standardTargetOptions and improve init-exe to use it
2020-02-28 14:51:54 -05:00
Andrew Kelley
cf233bad58
fix target parsing
2020-02-28 14:51:54 -05:00
Andrew Kelley
c8669a4cf8
improve debug info for optionals
2020-02-28 14:51:54 -05:00
Andrew Kelley
dbe4d72bcf
separate std.Target and std.zig.CrossTarget
...
Zig now supports a more fine-grained sense of what is native and what is
not. Some examples:
This is now allowed:
-target native
Different OS but native CPU, default Windows C ABI:
-target native-windows
This could be useful for example when running in Wine.
Different CPU but native OS, native C ABI.
-target x86_64-native -mcpu=skylake
Different C ABI but otherwise native target:
-target native-native-musl
-target native-native-gnu
Lots of breaking changes to related std lib APIs.
Calls to getOs() will need to be changed to getOsTag().
Calls to getArch() will need to be changed to getCpuArch().
Usage of Target.Cross and Target.Native need to be updated to use
CrossTarget API.
`std.build.Builder.standardTargetOptions` is changed to accept its
parameters as a struct with default values. It now has the ability to
specify a whitelist of targets allowed, as well as the default target.
Rather than two different ways of collecting the target, it's now always
a string that is validated, and prints helpful diagnostics for invalid
targets. This feature should now be actually useful, and contributions
welcome to further improve the user experience.
`std.build.LibExeObjStep.setTheTarget` is removed.
`std.build.LibExeObjStep.setTarget` is updated to take a CrossTarget
parameter.
`std.build.LibExeObjStep.setTargetGLibC` is removed. glibc versions are
handled in the CrossTarget API and can be specified with the `-target`
triple.
`std.builtin.Version` gains a `format` method.
2020-02-28 14:51:54 -05:00
Andrew Kelley
87b9e744dd
update std lib to new Target API
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
68dbba212d
Merge pull request #4576 from mikdusan/housekeeping
...
stage1: housekeeping
2020-02-28 10:22:28 -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
261c94629e
Added test
2020-02-28 02:52:09 +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
6a0927d8c1
debug: Fix end-of-stream condition in DWARF parser
2020-02-26 21:02:54 -05:00
LemonBoy
fd1eade4ca
ir: Allow empty inferred error sets
...
Closes #4564
2020-02-26 21:02:22 -05:00
Andrew Kelley
0a88352689
fix behavior tests with --test-evented-io
2020-02-26 13:17:38 -05:00
Andrew Kelley
2b33e27e1c
arm baseline CPU is v7a rather than v6m
...
v6m is thumb-mode and the baseline should probably be an 'a' variant.
2020-02-26 12:37:13 -05:00
Andrew Kelley
e4180de2e9
update test expectations
2020-02-26 11:59:23 -05:00
Andrew Kelley
6291e8e492
Merge branch 'Vexu-tagname'
...
closes #4559
closes #3991
2020-02-26 11:21:30 -05:00
Andrew Kelley
62de32a18c
call deinit on the hashmaps introduced in the prev commit
2020-02-26 11:21:10 -05:00
Vexu
22432b15e3
add test for @intToEnum
2020-02-26 11:19:40 -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
Andrew Kelley
aa2aad229c
Merge pull request #4497 from LemonBoy/do-do-do
...
The great stack-trace race (Part 1 of N)
2020-02-26 11:10:38 -05:00
LemonBoy
d2535c003c
ir: Fix regression with self-referencing containers
2020-02-26 10:05:04 +01:00
Andrew Kelley
a55e536391
fix typo in previous commit
...
oops, forgot to actually run the test
2020-02-25 21:32:03 -05:00
Andrew Kelley
e75598af3d
add test case to catch regression from previous commit
...
Once this test case is passing, previous commit can be re-added.
Closes #4560
2020-02-25 21:24:27 -05:00
Andrew Kelley
dad62a7e27
Revert "ir: Fix sizeOf comparison with ptr to zst"
...
This reverts commit 89812217b4 .
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
Andrew Kelley
f33bf48af7
Merge remote-tracking branch 'origin/master' into llvm10
2020-02-25 16:30:40 -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
Andrew Kelley
26b2e5fda8
Merge branch 'vegecode-formatted-print-to-std.Buffer'
...
closes #4385
2020-02-24 22:34:24 -05:00
Andrew Kelley
7cfe854359
clean up std.Buffer.print
2020-02-24 22:34:06 -05:00
vegecode
6fa143355f
Add formatted printing directly into std.Buffer
2020-02-24 22:30:23 -05:00
Andrew Kelley
5503f3f7c4
Merge pull request #4544 from BarabasGitHub/zeroes-for-non-extern-types
...
implement zeroes for non extern structs and native types
2020-02-24 22:01:56 -05:00
Andrew Kelley
61a50a23e8
Merge pull request #4547 from Vexu/deprecate
...
Remove deprecated builtins
2020-02-24 21:57:29 -05:00
Andrew Kelley
544bc42fd9
expose --verbose-llvm-cpu-features to zig build
2020-02-24 20:11:33 -05:00
Vexu
d56115ef41
remove @IntType and @ArgType (mostly) from the compiler
2020-02-25 01:27:34 +02:00
Vexu
538d9a5dd8
remove uses of @ArgType and @IntType
2020-02-24 23:39:03 +02:00
Vexu
3458fb891d
remove @typeId, @memberCount, @memberName and @memberType from the compiler
2020-02-24 23:21:11 +02:00
Bas van den Berg
f7aa4f5280
Processed review comments. Updated documentation, used the typinfo for field access, generate compile error on allowzero and set C poitners to null
2020-02-24 22:15:04 +01:00
Vexu
45da72c5b6
remove usages of @typeId, @memberCount, @memberName and @memberType
2020-02-24 23:09:01 +02:00
Bas van den Berg
195195d238
vectors do not support iterating, do not support them (for now)
2020-02-24 20:50:51 +01:00
Bas van den Berg
0972b2a8fe
implement zeroes for non extern structs and native types
2020-02-24 20:38:33 +01: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
J.W
5275b01202
hashing algorithms: fix logic and index out of bounds
2020-02-24 13:43:54 -05:00
Heide Onas Auri
907c5589ae
std.time.Timer.lap: only read system time once ( #4533 )
...
Calling Timer.lap queried the system time twice; once to compute the lap
time and once to reset the timer. This can lead to time discrepancies
between actual and computed durations when summing the result of
Timer.lap in a loop. This commit fixes that.
also fix Timer.read to not require a pointer
2020-02-23 18:25:52 -05:00
LemonBoy
08047cd6d7
correct test expectations
2020-02-23 22:47:48 +01:00
xackus
9c35f680f7
nuke @bytesToSlice, @sliceToBytes in stage1
2020-02-23 19:03:55 +01:00
xackus
7664c3bc11
remove @bytesToSlice, @sliceToBytes from tests, docs
2020-02-23 18:03:50 +01:00
Andrew Kelley
cfe1fbad0f
Merge pull request #4304 from daurnimator/auto-json
...
Add "automatic" JSON facilities
2020-02-23 11:25:15 -05:00
frmdstryr
597648231b
Format decmial 0.0 with no precision as just 0
2020-02-23 11:17:06 -05:00
Andrew Kelley
d1243bf272
Merge pull request #4525 from ziglang/environ
...
update std lib to integrate with libc for environ
2020-02-23 01:38:03 -05:00
Andrew Kelley
94c3dbf9e3
remove no-longer-valid defer
2020-02-23 01:07:19 -05:00
Andrew Kelley
767f041068
std.process: fix typo
2020-02-22 17:49:52 -05:00
Andrew Kelley
cfffb9c5e9
improve handling of environment variables on Windows
...
std.os.getenv and std.os.getenvZ have nice compile errors when not linking
libc and using Windows.
std.os.getenvW is provided as a Windows-only API that does not require
an allocator. It uses the Process Environment Block.
std.process.getEnvVarOwned is improved to be a simple wrapper on top of
std.os.getenvW.
std.process.getEnvMap is improved to use the Process Environment Block
rather than calling GetEnvironmentVariableW.
std.zig.system.NativePaths uses process.getEnvVarOwned instead of
std.os.getenvZ, which works on Windows as well as POSIX.
2020-02-22 17:35:36 -05: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
0cd89e9176
std.os.execvpeZ_expandArg0: fix not restoring argv[0]
...
This function expands argv[0] into the absolute path resolved with PATH
environment variable before making the execve syscall. However, in case
the execve fails, e.g. with ENOENT, it did not restore argv to how it
was before it was passed in. This resulted in the caller performing an
invalid free.
This commit also adds verbose debug info when native system C compiler
detection fails. See #4521 .
2020-02-22 13:56:02 -05:00
LemonBoy
495e894225
delete extra code, more forgiveness
2020-02-22 12:44:21 +01:00
LemonBoy
41bca1ce76
unification: windows debug info
2020-02-22 12:05:50 +01:00
LemonBoy
c060cae3ce
unification: osx debug info
2020-02-22 11:51:45 +01:00
Andrew Kelley
dca19b6757
fix regression in detecting native glibc version
...
closes #4519
2020-02-21 20:48:50 -05:00
Andrew Kelley
6305ce828b
fix regression in standardTargetOptions
2020-02-21 19:22:50 -05:00
Andrew Kelley
570973761a
add regression test for already fixed bug
...
closes #3586
2020-02-21 15:31:00 -05:00
Andrew Kelley
6aecc268fd
remove the allocator from std.event.Loop
...
closes #3539
2020-02-21 15:20:36 -05:00
Andrew Kelley
dff7ca6784
annotate TODO comment with bug tracker link
2020-02-21 14:20:07 -05:00
Andrew Kelley
10e0b07135
Merge pull request #4509 from ziglang/sub-architecture-annihilation
...
sub-architecture annihilation
2020-02-21 14:19:20 -05:00
xackus
783e8ad031
remove @bytesToSlice, @sliceToBytes from std lib
2020-02-21 19:46:53 +01:00
xackus
fdae5f5a07
implement bytesAsSlice, sliceAsBytes
2020-02-21 19:40:29 +01:00
Andrew Kelley
71573584cd
std.Target.parse gives parsing diagnostics
2020-02-21 13:34:55 -05:00
Andrew Kelley
7da7fbb912
update ARM cpu models to correctly include the sub-arch
2020-02-21 12:29:27 -05:00
Andrew Kelley
61c67a9833
remove sub-arch from stage1
2020-02-21 11:47:34 -05:00
Andrew Kelley
ab56d3e18c
fix std.Target unit tests
2020-02-21 11:07:56 -05:00
LemonBoy
8df4d7e4f4
unsure
2020-02-21 12:11:04 +01:00
Andrew Kelley
a391a82e49
fix zig build adding invalid cli args
2020-02-21 01:58:40 -05:00
Andrew Kelley
7b8b4d200c
fix not initializing some ZigTarget fields
2020-02-21 01:54:00 -05:00
Michael Dusan
770631cc79
stage1: free more heap after analysis
...
- immediately free dangling IrInstGenConst after analysis
- fixup mem::List params `&Allocator` → `*Allocator`
2020-02-20 21:05:37 -05:00
Andrew Kelley
2de7d0b10c
fix zig build, ABI ABI, and update tests to new Target layout
2020-02-20 18:50:20 -05:00
Andrew Kelley
903127f36c
Merge remote-tracking branch 'origin/master' into sub-architecture-annihilation
2020-02-20 18:36:04 -05:00
Andrew Kelley
0f016b368d
support -mcpu=baseline, both in stage1 and stage2
...
See e381a42de9 for more details.
This is set up so that if we wish to make "baseline" depend on the
OS in the future, it is possible to do that.
2020-02-20 18:31:17 -05:00
Andrew Kelley
e381a42de9
quick fix: add -mcpu=baseline support to zig0
...
When the build.zig logic to build libzigstage2 was converted to a cmake
command, it neglected to use baseline CPU features rather than compiling
with native features.
This adds a hard coded flag `-mcpu=baseline` which can be used to detect
the native target, but mark it as non-native so that it does not get the
CPU features specific to the host used to compile libzigstage2.
Full `-mcpu` support is happening in the upcoming pull request #4509 ,
and so this "quick fix" will be cleaned up in that branch, before it is
merged to master.
closes #4506
2020-02-20 17:02:29 -05:00
Andrew Kelley
b0d2ebe529
remove std.io.readLine
...
This was deceptive. It was always meant to be sort of a "GNU readline"
sort of thing where it provides a Command Line Interface to input text.
However that functionality did not exist and it was basically a red
herring for people trying to read line-delimited input from a stream.
In this commit the API is deleted, so that people can find the proper
API more easily.
A CLI text input abstraction would be useful but may not even need to be
in the standard library. As you can see in this commit, the guess_number
CLI game gets by just fine by using `std.fs.File.read`.
2020-02-20 15:30:00 -05:00
Andrew Kelley
33c69d5cb6
arm: clarify which CPU features are sub-architectures
...
versus which ones are instruction sets.
2020-02-20 15:27:42 -05:00
LemonBoy
a4d0d7f1de
soldier on
2020-02-20 20:48:54 +01:00
LemonBoy
342a274948
tidy interface, const correctness
2020-02-20 20:18:51 +01:00
LemonBoy
ce2efbdca6
Correctly count all the loaded modules on Windows
2020-02-20 19:41:29 +01:00
LemonBoy
d5b583008a
sudoku
2020-02-20 19:41:29 +01:00
LemonBoy
fabab58528
less hideous
2020-02-20 19:41:29 +01:00
LemonBoy
b9c02e4076
elvis entered the building
2020-02-20 19:41:29 +01:00
LemonBoy
2a350cf174
osx
2020-02-20 19:41:29 +01:00
LemonBoy
b3f728585a
windows widestring
2020-02-20 19:41:29 +01:00
LemonBoy
463f704431
wide
2020-02-20 19:41:29 +01:00
LemonBoy
99649794e9
win
2020-02-20 19:41:29 +01:00
LemonBoy
b0b60cd468
tmp
2020-02-20 19:41:29 +01:00
LemonBoy
3620b67c26
debug: Split the DWARF stuff in its own file
2020-02-20 19:41:28 +01:00
Andrew Kelley
3d53a95718
Merge branch 'LemonBoy-fix-4508'
2020-02-20 12:40:11 -05:00
Andrew Kelley
ec889d5888
NO_MEDIA_IN_DEVICE => return error.NoDevice
2020-02-20 12:39:46 -05:00
Andrew Kelley
9c3eff9193
Revert "arm: clean up the messy sub-architecture & CPU features"
...
This reverts commit 96f45c27b6 .
2020-02-20 12:18:32 -05:00
LemonBoy
ae16a6773f
std: Handle NO_MEDIA_IN_DEVICE error in openFileWindows
...
Closes #4507
2020-02-20 13:25:45 +01:00
LemonBoy
a385547786
ir: Compile error on result_loc type mismatch w/ slicing
...
Closes #4508
2020-02-20 13:14:19 +01:00
Michael Dusan
c49ab049c5
Merge pull request #4511 from mikdusan/stage1-verbose-ir
...
stage1/ir_print: show GenConst in trailing fahsion
2020-02-20 02:48:03 -05:00
Michael Dusan
81cc52d4af
stage1/ir_print: show GenConst in trailing fahsion
2020-02-20 00:51:36 -05:00
Andrew Kelley
3c76e5e33d
update tls in std lib for lack of sub-arch
2020-02-19 22:09:35 -05:00
Andrew Kelley
7c298c8c17
fix generation of builtin import
2020-02-19 22:09:25 -05:00
Andrew Kelley
884d150408
stage1 main: fix cli parsing of architecture
2020-02-19 22:09:05 -05:00
Andrew Kelley
c33cd370fc
fix unit test for Target.parse
...
I think this is working correctly. Without also removing sse2 from the
feature set, sse gets added back into the set because sse2 is part of
the x86_64 baseline (which is the cpu provided) and sse2 depends on sse.
2020-02-19 21:55:25 -05:00
Andrew Kelley
ef2d237f2f
this is not the proper way to support this feature
2020-02-19 21:51:24 -05:00
Andrew Kelley
84f1893c18
remove the concept of "sub-architecture"
...
in favor of CPU features. Also rearrange the `std.Target`
data structure.
* note: `@import("builtin")` was already deprecated in favor of
`@import("std").builtin`.
* `std.builtin.arch` is now deprecated in favor of
`std.builtin.cpu.arch`.
* `std.Target.CpuFeatures.Cpu` is now `std.Target.Cpu.Model`.
* `std.Target.CpuFeatures` is now `std.Target.Cpu`.
* `std.Target` no longer has an `arch` field. Instead it has a
`cpu` field, which has `arch`, `model`, and `features`.
* `std.Target` no longer has a `cpu_features` field.
* `std.Target.Arch` is moved to `std.Target.Cpu.Arch` and
it is an enum instead of a tagged union.
* `std.Target.parseOs` is moved to `std.Target.Os.parse`.
* `std.Target.parseAbi` is moved to `std.Target.Abi.parse`.
* `std.Target.parseArchSub` is only for arch now and moved
to `std.Target.Cpu.Arch.parse`.
* `std.Target.parse` is improved to accept CPU name and features.
* `std.Target.Arch.getBaselineCpuFeatures` is moved to
`std.Target.Cpu.baseline`.
* `std.Target.allCpus` is renamed to `std.Target.allCpuModels`.
* `std.Target.defaultAbi` is moved to `std.Target.Abi.default`.
* Significant cleanup of aarch64 and arm CPU features, resulting in
the needed bit count for cpu feature set going from 174 to 138.
* Add `std.Target.Cpu.Feature.Set.addFeatureSet` for merging
feature sets together.
`-target-feature` and `-target-cpu` are removed in favor of
`-mcpu`, to conform to established conventions, and it gains
additional power to support cpu features. The syntax is:
-mcpu=name+on1+on2-off1-off2
closes #4261
2020-02-19 21:30:36 -05:00
Andrew Kelley
96f45c27b6
arm: clean up the messy sub-architecture & CPU features
2020-02-19 19:11:20 -05:00
Andrew Kelley
4c6f207aff
clean up arm CPU features
...
* remove "cpu features" that are actually just processors
* rename `v8` to `v8a`. this matches the corresponding
change to target/aarch64.zig
* rename types in preparation for removing sub-architecture
from `std.Target`.
I have other files changed in my dirty working tree, but about to make
some changes to arm.zig that I don't want batched with this commit.
2020-02-19 18:12:06 -05:00
Bas
1483ae37f2
Add an appendValues method to ArrayList to append a value n times. ( #4460 )
2020-02-19 11:33:35 -05:00
daurnimator
e270db956c
std: tagged unions are broken on arm64
2020-02-19 23:17:04 +11:00
daurnimator
d989396a34
std: add json.parse to automatically decode json into a struct
2020-02-19 23:16:35 +11:00
daurnimator
5a20604820
std: add json.stringify to encode arbitrary values to JSON
2020-02-19 23:01:12 +11:00
Andrew Kelley
c664692bdd
make the CLI support depending on system headers and libraries
...
(include and lib search paths)
The detection of native system paths is self-hosted.
closes #2041
2020-02-19 01:24:34 -05:00
Andrew Kelley
63383a8af8
consistent capitalization of error message
2020-02-19 01:24:19 -05:00
Andrew Kelley
c5ca0fe237
Merge branch 'pixelherodev-emit'
...
Closes #4418
2020-02-18 22:01:08 -05:00
Andrew Kelley
d7968c6d33
improvements which allow zig to emit multiple things at once
...
example: zig build-obj test.zig -femit-llvm-ir -femit-asm
this will generate all three: test.o test.s test.ll
2020-02-18 21:59:43 -05:00
Noam Preil
dba12cd693
Rename produce_* bools to emit_* to match CLI
2020-02-18 18:59:45 -05:00
Noam Preil
9c98c73e73
Disable binary generation when deprecated --emit is used
2020-02-18 18:59:45 -05:00
Noam Preil
2502cb242a
Improve support for generating LLVM IR/asm files
2020-02-18 18:59:45 -05:00
Andrew Kelley
cbc4e59e68
Merge branch 'LemonBoy-c8c8c8c8'
...
closes #4502
2020-02-18 18:45:25 -05:00
Andrew Kelley
30194f27fb
update new test case to take into account lazy @typeInfo
2020-02-18 18:27:18 -05:00
LemonBoy
eb5e6259aa
docs: Fix wrong extern fn definition
2020-02-18 18:18:29 -05:00
LemonBoy
a6b74cdd38
stage1: Make the parser reject extern fn with body
2020-02-18 18:18:29 -05:00
LemonBoy
95a71e29f8
zig fmt: Fix callconv rewriting for extern + string
...
Closes #4473
2020-02-18 18:18:15 -05:00
Andrew Kelley
ccca4b5a5e
Merge pull request #4474 from LemonBoy/saukerkraut
...
Patches
2020-02-18 18:15:11 -05:00
Andrew Kelley
7f92d0d4a4
Merge branch 'daurnimator-use-fifo-from-stdio'
...
closes #3763
2020-02-18 16:48:58 -05:00
Andrew Kelley
a8d7652001
avoid a @ptrCast with an array literal
2020-02-18 16:48:26 -05:00
daurnimator
3632f31ec2
std: use LinearFifo to implement io.BufferedOutStreamCustom
2020-02-18 16:47:03 -05:00
daurnimator
dd75cc214d
std: let PeekStream have static/dynamic variants
...
This completes a TODO in the existing implementation
2020-02-18 16:47:03 -05:00
daurnimator
38ad7daebb
std: use LinearFifo to implement io.PeekStream
2020-02-18 16:47:03 -05:00
daurnimator
bdff2f43bd
std: use LinearFifo to implement io.BufferedInStreamCustom
2020-02-18 16:47:03 -05:00
Andrew Kelley
662996e4a8
Merge branch 'FireFox317-lazy-typeinfo-decls'
...
Closes #4435
Closes #3893
Closes #2584
2020-02-18 15:34:22 -05:00
Andrew Kelley
d056c7732b
fix std.meta.refAllDecls
2020-02-18 15:34:13 -05:00
Andrew Kelley
dd58278dbe
add behavior test for previous commit
2020-02-18 15:28:14 -05:00
Timon Kruiper
7560fc716d
Makes the declaration slice resolve lazely when using @typeInfo
...
This way all the declarations in a container won't be resolved untill
the user actually uses the decls slice in the builtin TypeInfo union.
2020-02-18 15:26:37 -05:00
Andrew Kelley
e8a84927ab
Merge pull request #4478 from ziglang/self-host-libc-detection
...
self-hosted libc and dynamic linker detection
2020-02-17 22:45:49 -05:00
Andrew Kelley
35f0cb049e
stage2: fix invalid iteration code in std.ast.Node.Asm
...
closes #4480
2020-02-17 20:25:02 -05:00
Andrew Kelley
99520c4e69
target_os_requires_libc implies dynamic linking
2020-02-17 19:49:19 -05:00
Andrew Kelley
5a4e8c779a
smarter detectNativeDynamicLinker logic
...
The current target's ABI cannot be relied on for this.
For example, we may build the zig compiler for target
riscv64-linux-musl and provide a tarball for users to
download. A user could then run that zig compiler on
riscv64-linux-gnu. This use case is well-defined and
supported by Zig. But that means that we must detect
the system ABI here rather than
relying on `std.Target.current`.
2020-02-17 19:26:32 -05:00
Andrew Kelley
b53afc510c
update dl_iterate_phdr test case to new API
2020-02-17 17:22:32 -05:00
Andrew Kelley
8fe636dafd
fix ABI mismatch of ZigTarget in stage2 glue code
2020-02-17 16:49:30 -05:00
Andrew Kelley
9b02cab3da
fix glibc not forcing dynamic link
2020-02-17 16:37:22 -05:00
Andrew Kelley
a959e98273
target requiring PIC does not imply dynamic linking
...
Related: #3237
2020-02-17 16:16:58 -05:00
Andrew Kelley
4b91e4c91f
fix dynamic linker detection on windows (where there isn't one)
2020-02-17 16:03:01 -05:00
Andrew Kelley
e26f063b22
support the concept of a target not having a dynamic linker
2020-02-17 15:46:53 -05:00
Andrew Kelley
2f9c5c0644
self-host dynamic linker detection
2020-02-17 15:23:59 -05:00
Andrew Kelley
c784c52819
fix backwards warning of zig libc
...
crt_dir is only not required for darwin
2020-02-17 01:15:43 -05:00
Andrew Kelley
44c14749a1
expand argv[0] when spawning system C compiler
...
Some C compilers, such as Clang, are known to rely on
argv[0] to find the path to their own executable,
without even bothering to resolve PATH. This results
in the message:
error: unable to execute command: Executable "" doesn't exist!
So we tell ChildProcess to expand argv[0] to the absolute path
to give them a helping hand.
2020-02-17 00:58:30 -05:00
Andrew Kelley
64365bc5d7
enable behavior and std lib tests for RISC-V 64-bit
...
closes #3338
2020-02-17 00:06:19 -05:00
Andrew Kelley
a5d47be5ad
stage1 os_update_file additionally compares src and dest size
...
prevents problems when source is created and then immediately copied to
dest.
2020-02-16 22:50:04 -05:00
Andrew Kelley
d5860cbade
fix os_update_file implementation on Windows
2020-02-16 22:34:40 -05:00
Andrew Kelley
364a284eb3
stage1 os: handle errors from read/write
...
not sure why the CI is complaining about these now and not in master
branch. but this is a slight code improvement anyway
2020-02-16 21:35:12 -05:00
Andrew Kelley
a26800c099
stage1: don't copy unchanged output files
...
when both `--cache on` and `--output-dir` parameters
are provided. This prevents re-linking `zig` with every
`make` even when `libzigstage2.a` was unchanged.
2020-02-16 21:10:03 -05:00
Andrew Kelley
5c54d7bee7
add missing implementations of libc installation to detect msvc paths
2020-02-16 19:58:27 -05:00
Andrew Kelley
20f3b0efff
rename libuserland to libstage2
2020-02-16 19:16:08 -05:00
Andrew Kelley
c25742010d
add the dummy libc paths back in
2020-02-16 19:02:26 -05:00
Andrew Kelley
7eb0a3edce
remove libc dependency of zig0 building libstage2
...
Rather than `zig0 build ...` the build now does
`zig0 build-lib ...`, avoiding the requirement of linking the build
script, and thus avoiding the requirement of finding native libc,
for systems where libc is the system ABI.
2020-02-16 18:57:34 -05:00
Andrew Kelley
39ee46a6c1
fix building zig0 -> zig on macos
2020-02-16 17:35:35 -05:00
Andrew Kelley
8173fbfb66
implement os.faccessat for Windows
2020-02-16 17:10:43 -05:00
LemonBoy
6b74fd2e12
ir: Avoid invalidating the decl_table iterator
...
Collect the declarations to resolve first and run resolve_top_level_decl
on them later.
Closes #4310
2020-02-16 21:14:30 +01:00
LemonBoy
59a243ce24
std: Remove now-superflous hack
2020-02-16 19:53:53 +01:00
LemonBoy
096f79260b
ir: Prevent crash when indexing undefined ptr to array
...
Closes #4471
2020-02-16 19:53:53 +01:00
Andrew Kelley
4b02a39aa9
self-hosted libc detection
...
* libc_installation.cpp is deleted.
src-self-hosted/libc_installation.zig is now used for both stage1 and
stage2 compilers.
* (breaking) move `std.fs.File.access` to `std.fs.Dir.access`. The API
now encourages use with an open directory handle.
* Add `std.os.faccessat` and related functions.
* Deprecate the "C" suffix naming convention for null-terminated
parameters. "C" should be used when it is related to libc. However
null-terminated parameters often have to do with the native system
ABI rather than libc. "Z" suffix is the new convention. For example,
`std.os.openC` is deprecated in favor of `std.os.openZ`.
* Add `std.mem.dupeZ` for using an allocator to copy memory and add a
null terminator.
* Remove dead struct field `std.ChildProcess.llnode`.
* Introduce `std.event.Batch`. This API allows expressing concurrency
without forcing code to be async. It requires no Allocator and does
not introduce any failure conditions. However it is not thread-safe.
* There is now an ongoing experiment to transition away from
`std.event.Group` in favor of `std.event.Batch`.
* `std.os.execvpeC` calls `getenvZ` rather than `getenv`. This is
slightly more efficient on most systems, and works around a
limitation of `getenv` lack of integration with libc.
* (breaking) `std.os.AccessError` gains `FileBusy`, `SymLinkLoop`, and
`ReadOnlyFileSystem`. Previously these error codes were all reported
as `PermissionDenied`.
* Add `std.Target.isDragonFlyBSD`.
* stage2: access to the windows_sdk functions is done with a manually
maintained .zig binding file instead of `@cImport`.
* Update src-self-hosted/libc_installation.zig with all the
improvements that stage1 has seen to src/libc_installation.cpp until
now. In addition, it now takes advantage of Batch so that evented I/O
mode takes advantage of concurrency, but it still works in blocking
I/O mode, which is how it is used in stage1.
2020-02-16 13:25:30 -05:00
Andrew Kelley
5e37fc0746
more user-friendly error message for some clang diagnostics
...
See #4455
2020-02-16 01:45:48 -05:00
Andrew Kelley
7f7d1fbe5a
Implement noasync awaits
...
Note that there is not yet runtime safety for this.
See #3157
2020-02-16 01:44:52 -05:00
Andrew Kelley
cb3a818699
zig fmt: support noasync await
2020-02-16 01:44:52 -05:00
Andrew Kelley
72805fd66e
fix taking address of temporary async frame
2020-02-16 01:44:49 -05:00
Michael Dusan
652efe38b4
Merge pull request #4467 from mikdusan/translate-c-error
...
translate-c: change OutOfMemory → ASTUnitFailure
2020-02-15 15:45:02 -05:00
Michael Dusan
8583038640
translate-c: change OutOfMemory → ASTUnitFailure
...
- return a better error when no diagnostics are available
2020-02-15 05:14:31 -05:00
Vexu
b15958c557
fix c tokenizer bug
2020-02-14 18:57:57 -05:00
Andrew Kelley
9e1afdc234
Merge pull request #4454 from LemonBoy/capture-reform
...
Payload captures no longer alias the original value
2020-02-14 14:39:00 -05:00
Andrew Kelley
058f38220a
enable passing freebsd tests
...
See #3210 and #4455
2020-02-14 12:00:38 -05:00
Andrew Kelley
816b69a344
update clang drivers to llvm10.0.0rc2
2020-02-14 10:47:40 -05:00
Andrew Kelley
f4317e4387
update libunwind to llvm10.0.0rc2
2020-02-14 10:44:23 -05:00
Andrew Kelley
2289036a40
update libcxx to llvm10.0.0rc2
2020-02-14 10:34:21 -05:00
Andrew Kelley
74619cc045
update clang C headers to 10.0.0rc2
2020-02-14 10:30:06 -05:00
Andrew Kelley
a8b36fbe34
Merge remote-tracking branch 'origin/master' into llvm10
2020-02-14 10:27:44 -05:00
LemonBoy
1c8ac2a0c1
test: Add test cases for the new capture behavior
2020-02-14 15:59:28 +01:00
Andrew Kelley
40b9db7cad
Merge pull request #4451 from daurnimator/use-testing.allocator
...
Migrate (more) tests from FixedBufferAllocator to testing.allocator
2020-02-14 09:40:08 -05:00
Vexu
9206f8a8cd
translate-c improve macro cast translation
2020-02-14 09:36:44 -05:00
xackus
7396b144ba
modernize std.meta
2020-02-14 09:35:38 -05:00
LemonBoy
3038290a46
ir: Make all the payload captures do a copy
...
The payload doesn't alias anymore the same memory it comes from and is
instead a fresh copy of the original object.
2020-02-14 15:30:20 +01:00
daurnimator
6ea6d5a4bd
std: use testing.allocator in tests
2020-02-14 19:15:09 +11:00
daurnimator
ca41567924
std: use testing.allocator in big int tests
2020-02-14 18:59:40 +11:00
daurnimator
f20ba7c32c
std: increase memory available to testing allocator
2020-02-14 18:59:25 +11:00
daurnimator
b61e53cc40
std: bigint.deinit() shouldn't need a mutable pointer
2020-02-14 18:59:07 +11:00
Andrew Kelley
fb6b94f80f
cmake: remove case mismatch detection on build mode
...
See discussion here for context:
c6df5deb34 (comments)
Michael - I appreciate what you did here, making the configure script
work better for people in practice. When it was checking the build type
against a whitelist, I think it was worth it. However, now that we are
supporting systems which use non-standard cmake build modes, I don't
think this case-mismatch detection thing is worth it. It's starting to
get to the point where it's a lot of complication for very little
benefit. Besides, cmake is not case sensitive. If we support
non-standard build modes, then we would need to support a hypothetical
build mode of `release` (lower case).
So let's just remove this and rely on people to use the build system
correctly (like they will have to do when building any cmake project
from source).
2020-02-13 20:47:44 -05:00
Felix (xq) Queißner
cf67d30cdc
Makes ArenaAllocator.deinit() not require a mutable reference.
2020-02-13 16:19:34 -05:00
LemonBoy
a090a5e3bc
ir: Don't crash when converting undefined ptrs
2020-02-13 16:18:24 -05:00
Andrew Kelley
e8dfc5e7f6
Merge pull request #4442 from fengb/testing-allocator-calls
...
Migrate tests from FixedBufferAllocator to testing.allocator
2020-02-13 16:17:21 -05:00
Andrew Kelley
de23c57133
Merge branch 'LemonBoy-revive-3904'
...
closes #3904
closes #4448
2020-02-13 16:14:10 -05:00
Andrew Kelley
cdba521a06
annotate skipped test with issue link
2020-02-13 16:13:53 -05:00
data-man
948a463cf1
fmt: vector formatting
2020-02-13 16:12:54 -05:00
Andrew Kelley
1675d4f82b
Merge pull request #4443 from LemonBoy/werkzeug
...
A train of small patches
2020-02-13 13:12:18 -05:00
Vexu
fa377dbd15
fix c tokenizer bug
2020-02-13 12:21:28 -05:00
LemonBoy
f93c219f30
Minor changes for a test case
2020-02-13 12:13:56 +01:00
LemonBoy
c5260f7f86
ir: Allow implicit conversion between vector types
...
Only valid when the number of elements match and the types are
compatible.
Fixes #4334
2020-02-13 12:13:56 +01:00
data-man
4578d13b49
Vector comparison in meta and testing
2020-02-13 12:13:55 +01:00
Michael Dusan
1fb70497d2
Merge pull request #4441 from mikdusan/stage1-cmake
...
stage1: limit cmake checks on build type
2020-02-12 21:04:34 -05:00
Michael Dusan
08666a057a
Merge pull request #4439 from vegecode/custom-format-comment-issue
...
Correct comment to include comptime attribute on format output fn par…
2020-02-12 18:35:39 -05:00
Benjamin Feng
a81ae1223d
Convert a lot of json tests to use testing.allocator
2020-02-12 17:17:56 -06:00
Benjamin Feng
699c50a375
Switch a bunch of FBA to use testing.allocator
2020-02-12 17:17:56 -06:00
Michael Dusan
471662f7c9
stage1: limit cmake checks on build type
...
Various maintainers pass custom build types and we don't need to check
those. We are interested only in checking and diagnosing common errors
for Zig project supported types.
Check is now limited to look for case-mismatch only on the well-known
values { Debug, Release, RelWithDebInfo, MinSizeRel }.
2020-02-12 17:23:48 -05:00
LemonBoy
55304128c0
Fix rendering of empty arrays
2020-02-12 23:10:53 +01:00
LemonBoy
327d40e7a3
Fix a UAF when verbose-llvm-ir is specified
...
The g->module is long gone when codegen_link is called.
2020-02-12 23:10:08 +01:00
vegecode
d06bfc2e2a
Correct comment to include comptime attribute on format output fn parameter
...
Without comptime, printing custom type through the stream interface fails
2020-02-12 13:16:32 -06:00
Andrew Kelley
ab4ea5d3cf
Merge pull request #4433 from LemonBoy/ohno
...
Trivial patchset
2020-02-11 13:12:42 -05:00
LemonBoy
6c05f0949a
ir: Fix erroneous error message for ptr casts
...
Don't blindly throw an error if two integer types are checked for
compatibility.
Bug reported in #4430
2020-02-11 17:03:11 +01:00
LemonBoy
b81c5be451
riscv: Remove 'relax' from the baseline cpu features
...
LLD doesn't implement relaxations at the moment.
2020-02-11 17:03:11 +01:00
LemonBoy
f8fd8c481a
test: Skip the atomic-on-fp test for riscv64
2020-02-11 17:03:10 +01:00
LemonBoy
ea8755fda9
compiler-rt: Export the AEABI builtins when targeting thumb
2020-02-11 15:24:18 +01:00
Michael Dusan
e624c86289
Merge pull request #4389 from mikdusan/stage1-mem
...
stage1: memory/report overhaul
2020-02-10 23:08:33 -05:00
Michael Dusan
edb210905d
stage1: memory/report overhaul
...
- split util_base.hpp from util.hpp
- new namespaces: `mem` and `heap`
- new `mem::Allocator` interface
- new `heap::CAllocator` impl with global `heap::c_allocator`
- new `heap::ArenaAllocator` impl
- new `mem::TypeInfo` extracts names without RTTI
- name extraction is enabled w/ ZIG_ENABLE_MEM_PROFILE=1
- new `mem::List` takes explicit `Allocator&` parameter
- new `mem::HashMap` takes explicit `Allocator&` parameter
- add Codegen.pass1_arena and use for all `ZigValue` allocs
- deinit Codegen.pass1_arena early in `zig_llvm_emit_output()`
2020-02-10 21:08:08 -05:00
Timon Kruiper
2618366055
Add cast between [*c]T and ?[*:0]T on fn parameter
...
Fixes #4176
2020-02-10 19:43:58 -05:00
LemonBoy
3237528a59
fmt: Pass the fmt string to the inner formatters
2020-02-10 19:43:11 -05:00
Andrew Kelley
3170ead9eb
compile error instead of abort for unimplemented @typeInfo
...
of `@Frame(func)`. Closes #3995
2020-02-10 19:14:54 -05:00
Andrew Kelley
702398dd0e
Revert "windows: remove the 'A' versions of psapi functions"
...
This reverts commit 1cdefeb10b .
See #4426
2020-02-10 12:30:20 -05:00
Andrew Kelley
1cdefeb10b
windows: remove the 'A' versions of psapi functions
...
See #534
2020-02-10 12:03:11 -05:00
Vexu
ae5ba369e1
translate-c float fixes
2020-02-10 11:02:29 -05:00
Andrew Kelley
70a4794c57
fix compiler assertion when duplicating fields...
...
...in nested anonymous struct literals
closes #4391
2020-02-10 10:57:40 -05:00
Andrew Kelley
cdc5070f21
Merge remote-tracking branch 'origin/master' into llvm10
2020-02-10 00:26:33 -05:00
Andrew Kelley
014f66e6de
Merge pull request #4404 from ziglang/async-std
...
a big step towards std lib integration with async I/O
2020-02-10 00:22:59 -05:00
Andrew Kelley
27575d19c8
avoid conflict with master branch
2020-02-09 22:44:23 -05:00
Andrew Kelley
acdf4048b4
allow local variable address detection to regress
...
See #3180 for a more comprehensive plan to catch this problem. More
sophisticated control flow analysis is needed to provide compile errors
for returning local variable addresses from a function.
2020-02-09 22:40:36 -05:00
Andrew Kelley
5ea79bfc4a
fix not checking type of return pointer
...
Thanks to Vexu for the test cases.
Closes #3422
Closes #3646
Closes #3224
Closes #3327
Closes #3269
2020-02-09 22:34:34 -05:00
Andrew Kelley
04ee3b01a1
fix defer interfering with return value spill
2020-02-09 17:19:28 -05:00
Andrew Kelley
3b622f4494
fix off-by-one error in std.unicode.utf8ToUtf16LeWithNull
...
and fix larger-than-one-byte sentinels when being freed
Thank you to João Pedro for identifying both problems and
providing example code to solve them.
closes #4413
2020-02-09 14:56:19 -05:00
LemonBoy
c4d0f97b4c
compiler_rt: Fix clzsi2 implementation for Thumb1
...
The LUT contains the number of bits set, not the number of leading zeros
as we're subtracting from the total number of bits in a word.
Closes #4415
2020-02-09 14:12:01 -05:00
Andrew Kelley
5b10d9f917
std: fix bitrotted evented code
2020-02-08 16:24:26 -05:00
Andrew Kelley
6ae36807b7
solve recursion in std.atomic.Queue.dump
...
by adding a maximum depth
2020-02-08 16:22:53 -05:00
Andrew Kelley
24d197b037
solve previous commit a better way
2020-02-08 15:28:12 -05:00
Andrew Kelley
d80db3546c
Revert "properly spill optional payload capture value"
...
This reverts commit 80ba21b83c .
2020-02-08 15:07:12 -05:00
Andrew Kelley
80ba21b83c
properly spill optional payload capture value
2020-02-08 14:59:33 -05:00
Andrew Kelley
884804dbc3
fix async runtime function call resolves target fn frame
2020-02-08 13:45:31 -05:00
Andrew Kelley
c48831512b
std lib typo fixups
2020-02-08 01:38:01 -05:00
Andrew Kelley
eddca50059
fix regression in docgen
...
I used the wrong function here
2020-02-08 00:03:06 -05:00
Jared Miller
b55bc5eb26
Add wWinMain and wWinMainCRTStartup to fix #4376
2020-02-07 22:52:40 -05:00
Andrew Kelley
0e7461d4a3
Merge pull request #4408 from LemonBoy/mmap-i386-fix
...
handle SIGBUS, fix mmap on i386 linux
2020-02-07 22:51:43 -05:00
Andrew Kelley
877f39d227
fix async function call resolves target fn frame
2020-02-07 22:48:31 -05:00
Andrew Kelley
39ee1f4b97
fix invalid behavior tests from prev commit
...
and fix "no-op casts" from incorrectly spilling
2020-02-07 16:31:52 -05:00
LemonBoy
a779450fef
linux/i386: Make syscall6 more robust and correct
...
LLVM10 exposed a subtle flaw in the previous implementation that made
the mmap tests fail.
2020-02-07 22:13:05 +01:00
Andrew Kelley
4a60689309
more carefully calculate llvm field indexes
...
more correctly solves #4403
2020-02-07 14:54:58 -05:00
Andrew Kelley
9e5b248991
remove workarounds for Windows native CPU features
...
bug fixed in LLVM 10
closes #508
2020-02-07 12:41:46 -05:00
Andrew Kelley
3fce8008cc
skip self-hosted for now as we work towards async I/O
...
1. behavior tests with --test-evented-io
2. std lib tests with --test-evented-io
3. fuzz test evented I/O a bit, make it robust
4. make sure it works on all platforms (kqueue, Windows IOCP,
epoll/other)
5. restart efforts on self-hosted
2020-02-07 12:30:16 -05:00
Andrew Kelley
7f4cce3345
add fcntl support on darwin
2020-02-07 12:11:15 -05:00
pwzk
eff50abce6
Fixing library search path
2020-02-07 12:08:41 -05:00
Andrew Kelley
a1576225ca
Merge pull request #4409 from LemonBoy/llvm-10-fpchanges
...
LLVM10 changes
2020-02-07 11:47:18 -05:00
Andrew Kelley
71873e7133
implement os.pipe2 for darwin
2020-02-07 11:28:42 -05:00
LemonBoy
e3447e67fe
riscv64: Enable some more tests
...
Closes #3338
2020-02-07 17:21:28 +01:00
LemonBoy
8d6536b50c
codegen: Use the new frame-pointer fn attributes
...
no-frame-pointer-elim and no-frame-pointer-elim-non-leaf have been
deprecated for a while in favour of the newer (and clearer)
frame-pointer attribute.
Starting with LLVM10 the old attributes are silently ignored, leading to
no stack traces in debug mode.
2020-02-07 17:08:21 +01:00
LemonBoy
7a58ec81ec
std: Add a few tests for mmap/munmap
2020-02-07 16:07:12 +01:00
LemonBoy
be02616c86
debug: Show a nice error message on SIGBUS
2020-02-07 16:06:33 +01:00
Andrew Kelley
0b5bcd2f56
more std lib async I/O integration
...
* `zig test` gainst `--test-evented-io` parameter and gains the ability
to seamlessly run async tests.
* `std.ChildProcess` opens its child process pipe with O_NONBLOCK when
using evented I/O
* `std.io.getStdErr()` gives a File that is blocking even in evented
I/O mode.
* Delete `std.event.fs`. The functionality is now merged into `std.fs`
and async file system access (using a dedicated thread) is
automatically handled.
* `std.fs.File` can be configured to specify whether its handle is
expected to block, and whether that is OK to block even when in
async I/O mode. This makes async I/O work correctly for e.g. the
file system as well as network.
* `std.fs.File` has some deprecated functions removed.
* Missing readv,writev,pread,pwrite,preadv,pwritev functions are added
to `std.os` and `std.fs.File`. They are all integrated with async
I/O.
* `std.fs.Watch` is still bit rotted and needs to be audited in light
of the new async/await syntax.
* `std.io.OutStream` integrates with async I/O
* linked list nodes in the std lib have default `null` values for
`prev` and `next`.
* Windows async I/O integration is enabled for reading/writing file
handles.
* Added `std.os.mode_t`. Integer sizes need to be audited.
* Fixed #4403 which was causing compiler to crash.
This is working towards:
./zig test ../test/stage1/behavior.zig --test-evented-io
Which does not successfully build yet. I'd like to enable behavioral
tests and std lib tests with --test-evented-io in the test matrix in the
future, to prevent regressions.
2020-02-06 18:05:50 -05:00
Andrew Kelley
786700249e
build: fix handling disabling .h file generation
2020-02-06 13:46:59 -05:00
LemonBoy
cfcaf09cce
debug: Improve the frame-walking strategy
...
Clean up the code a bit and introduce a few checks meant to avoid
overshooting the end of the frame chain.
The code is now stable enough not to cause panics during the call frame
walking.
2020-02-06 11:25:40 -05:00
Andrew Kelley
5cf30b6791
Merge pull request #4369 from daurnimator/gimli
...
std.crypto.gimli enhancements
2020-02-05 18:13:28 -05:00
Andrew Kelley
e1f4f44dff
std: improve non-libc dynamic library loading
...
this is a cherry-pick of
5076f2d4f6
from the llvm10 branch
2020-02-05 18:10:26 -05:00
Andrew Kelley
80ae434b66
Merge pull request #4397 from LemonBoy/fixes
...
Fixes
2020-02-05 17:04:40 -05:00
Andrew Kelley
704cd977bd
ability to run tests in evented I/O mode
...
This adds `--test-evented-io` as a CLI parameter.
see #3117
2020-02-05 16:53:29 -05:00
Andrew Kelley
84323504ac
std.fmt.format: comptime output parameter
2020-02-05 16:52:18 -05:00
Andrew Kelley
378d733439
Merge pull request #4345 from Rocknest/open-di
...
Fix double close in openElfDebugInfo
2020-02-05 15:56:56 -05:00
Andrew Kelley
5076f2d4f6
std: improve non-libc dynamic library loading
2020-02-05 15:31:09 -05:00
LemonBoy
8c55c4550a
std: Rename isAbsoluteW to isAbsoluteWindowsW
2020-02-05 20:39:14 +01:00
LemonBoy
9d41ff335c
std: Make TCSA enum ABI-compliant
2020-02-05 20:37:00 +01:00
LemonBoy
21932a0ef2
Fix edge case in cast between fn with varargs
...
* Prevent the next_param_index to become greater than the param_count
one as it's expected by every other function.
* Fix a typo in a error message.
Closes #4381
2020-02-05 20:31:18 +01:00
Andrew Kelley
40b1fecace
Merge pull request #4363 from Vexu/trans-std-c
...
Use std.c.tokenizer in translate-c
2020-02-05 14:29:39 -05:00
Vexu
f196ddd251
translate c type names
2020-02-05 17:52:46 +02:00
Rocknest
f30feab1b9
Link the issue in doc comment
2020-02-05 17:19:00 +02:00
Rocknest
a56183197d
Fix double close in openElfDebugInfo
2020-02-05 17:18:30 +02:00
Michael Dusan
b022db16ec
Merge pull request #4394 from mikdusan/fix-cmake-regression
...
stage1: fix cmake regression
2020-02-05 10:01:16 -05:00
Michael Dusan
d0a9da74ef
stage1: fix cmake regression
...
- add `None` as a valid CMAKE_BUILD_TYPE
- this is a legitimate setting used by packagers
regression was caused by c6df5deb34
2020-02-05 08:24:50 -05:00
daurnimator
ef4ecaa462
std: add AEAD modes for gimli
2020-02-06 00:21:26 +11:00
daurnimator
b495512175
add gimli to crypto hash benchmark
2020-02-06 00:16:00 +11:00
daurnimator
5a095a3f08
std: add Gimli based PRNG to std.rand
2020-02-06 00:16:00 +11:00
Vexu
1f49460dcb
fix regressions in comments and string prefixes
2020-02-05 08:35:30 +02:00
Michael Dusan
25cbee0b84
Merge pull request #4390 from mikdusan/cherry-pick
...
stage1: guard against case-mismatched build types
2020-02-04 22:34:46 -05:00
Michael Dusan
c6df5deb34
stage1: guard against case-mismatched build types
...
- zig CMakeLists.txt CMAKE_BUILD_TYPE string comparisons are case-sensitive
- cmake itself is unclear about how tolerant it is for case-mismatches
- add CMAKE_BUILD_TYPE guard in CMakeLists.txt to force exact matches
2020-02-04 20:39:05 -05:00
LemonBoy
3e7c02edc1
std: Fix edge case in isAbsolute fn family
...
* Empty strings are not considered absolute paths.
* Refactor some common code.
Closes #4382
2020-02-04 15:52:38 -05:00
Andrew Kelley
1530e82b6b
re-apply: these are not real CPU features
...
The commit 70ee818d21
(update target CPUs and features with llvm10's data)
accidentally reverted 6793af8d8b .
This un-reverts it.
2020-02-04 15:16:44 -05:00
Andrew Kelley
73256dda91
work around LLVM 10 llvm-config giving absolute path to libz.so
2020-02-04 15:04:11 -05:00
nofmal
a697de3eac
Add basic linux termios implementation
2020-02-04 14:09:57 -05:00
Andrew Kelley
a9df637fb1
fix undef clang library symbols when linking self-hosted
2020-02-04 03:39:40 -05:00
Andrew Kelley
d0b12d7726
Merge remote-tracking branch 'origin/master' into llvm10
2020-02-03 17:30:38 -05:00
Andrew Kelley
0fdcd5c4cb
Merge pull request #4337 from LemonBoy/stdlib-bsearch
...
stdlib: Add binary search function
2020-02-03 16:53:00 -05:00
LemonBoy
1658becb62
fmt: Fix one more edge case in container formatting
2020-02-03 16:03:48 -05:00
LemonBoy
db3aea3a0b
Change API for binarySearch fn
2020-02-03 21:51:03 +01:00
Andrew Kelley
5504f155aa
Merge pull request #4366 from jayschwa/blake3
...
crypto: Add BLAKE3 hashing algorithm
2020-02-03 15:13:50 -05:00
Michaël Larouche
9b11e5e1f1
Add InstallRawStep to Zig build system that does a similar job to llvm-objcopy. To use it, do 'exe.installRaw("kernel.bin");' where exe is a LibExeObjStep
...
Part of #2826
2020-02-03 15:07:34 -05:00
Jay Petacat
cb2c14e03f
blake3: Workaround issue #4373 with named types
2020-02-02 18:44:50 -05:00
LemonBoy
958f00f1c7
Don't generate any type info for void return types
...
Closely matches what the LLVM debug emitter expects, the generated DWARF
infos are now standard-compliant.
2020-02-02 15:30:12 -05:00
Andrew Kelley
a795c36d7b
Merge pull request #4352 from LemonBoy/fix-4349
...
fmt: Respect trailing commas in field declarations
2020-02-02 15:27:53 -05:00
frmdstryr
32291ab702
Add support for dependent packages when using build.zig
2020-02-02 15:21:27 -05:00
Jay Petacat
923e567c6d
blake3: Replace &arr with arr[0..] for slice args
2020-02-02 14:59:36 -05:00
Jay Petacat
b143fc0d32
blake3: Name and const pointer refinements
2020-02-02 14:42:57 -05:00
Jay Petacat
d098e212ad
blake3: Convert *const [n]u8 types to [n]u8
...
I do not see many cases of constant pointers to arrays in the stdlib.
In fact, this makes the code run a little faster, probably because Zig
automatically converts to pointers where it makes sense.
2020-02-02 14:08:10 -05:00
Vexu
35c40f0a70
fix regressions
2020-02-02 10:49:51 +02:00
Jay Petacat
4b86c1e3bb
crypto: Add BLAKE3 hashing algorithm
...
This is a translation of the [official reference implementation][1] with
few other changes. The bad news is that the reference implementation is
designed for simplicity and not speed, so there's a lot of room for
performance improvement. The good news is that, according to the crypto
benchmark, the implementation is still fast relative to the other
hashing algorithms:
```
md5: 430 MiB/s
sha1: 386 MiB/s
sha256: 191 MiB/s
sha512: 275 MiB/s
sha3-256: 233 MiB/s
sha3-512: 137 MiB/s
blake2s: 464 MiB/s
blake2b: 526 MiB/s
blake3: 576 MiB/s
poly1305: 1479 MiB/s
hmac-md5: 653 MiB/s
hmac-sha1: 553 MiB/s
hmac-sha256: 222 MiB/s
x25519: 8685 exchanges/s
```
[1]: https://github.com/BLAKE3-team/BLAKE3
2020-02-01 23:03:23 -05:00
Vexu
3b23929be5
use std.c.tokenizer in translate-c
2020-02-02 01:40:46 +02:00
daurnimator
4f2652d504
Winsock errors can be an enum
2020-02-01 14:29:16 -05:00
LemonBoy
0bf91cce58
windows: Minor changes to psapi prototypes
2020-02-01 13:43:46 -05:00
LemonBoy
e548195fd5
fmt: Use left brace position instead of the right one
...
Fix a typo and add a test case.
2020-02-01 15:28:23 +01:00
LemonBoy
f34abbf260
fmt: Handle declarations in line with the opening brace
2020-02-01 14:43:31 +01:00
LemonBoy
3640c682a2
Run zig fmt
2020-02-01 11:32:53 +01:00
LemonBoy
8309ee8752
fmt: Respect trailing comma for field declarations
...
Closes #4349
2020-02-01 11:28:21 +01:00
Andrew Kelley
e6a812c827
Merge pull request #4340 from daurnimator/ntstatus-as-enum
...
Windows error codes as non-exhaustive enums
2020-01-31 18:27:17 -05:00
LemonBoy
dee7804a81
fmt: Fix logic to find the argument list closing )
...
Closes #4341
2020-01-31 18:25:58 -05:00
Andrew Kelley
a62b4f268a
Merge pull request #4347 from LemonBoy/psapi
...
windows: Add psapi API
2020-01-31 18:25:25 -05:00
LemonBoy
c910aa8555
windows: Add GetCurrentProcess definition
2020-02-01 00:01:09 +01:00
LemonBoy
9ffc13b6c4
windows: Add psapi API
...
Export both the "old-style" definitions from psapi and the "new-style"
ones from kernel32.
2020-01-31 23:50:26 +01:00
daurnimator
ab46713fa6
std: update for linux 5.5 release
2020-01-31 10:18:17 -05:00
daurnimator
a351350b88
std: format non-exhaustive enums
2020-01-31 22:33:56 +11:00
daurnimator
b9f720365c
Turn win32 errors into a non-exhaustive enum
2020-01-31 22:33:55 +11:00
daurnimator
7cf0b02ab4
NTSTATUS is a non-exhaustive enum
2020-01-31 22:33:17 +11:00
LemonBoy
176bc53858
translate-c: Fix translation of fn pointers
...
Closes #4332
2020-01-30 21:33:50 -05:00
meme
1e78070a40
build: Fix missing dupe
...
- Strange memory corruption issues occur when allocated memory is passed to the builder and it is `defer`'d and freed
- Instead, `dupe` the string as is done in other handlers, this fixes the issue
2020-01-30 20:57:31 -05:00
Andrew Kelley
644a344715
self-hosted: add missing arch switch prong
2020-01-30 18:45:25 -05:00
Andrew Kelley
a475877007
fix translate-c regression
...
clang.zig had incorrect enum for builtin types
2020-01-30 18:43:54 -05:00
Andrew Kelley
c5df0b3e9d
set llvm cpu features to null for exynosm1,exynosm2
...
llvm dropped support for these features
2020-01-30 18:43:28 -05:00
LemonBoy
fd8d8afb24
stdlib: Add binary search function
2020-01-31 00:40:43 +01:00
LemonBoy
d27678fe83
fmt: Refactor the arg fetching code
...
* Error out if the requested index is out-of-bound
* Tidy-up all the arg-related variables in a struct
2020-01-30 18:07:02 -05:00
Andrew Kelley
17c8f108a4
drop @newStackCall
...
this was causing unrelated behavior tests to fail.
if this commit is reverted, the docs are good, but `@newStackCall` is
already deprecated in favor of `@call`, supplying the `stack` property.
2020-01-30 17:51:55 -05:00
Andrew Kelley
13f7824266
Merge pull request #4326 from LemonBoy/fix-4181
...
Generate compilable code for array inits
2020-01-30 16:12:23 -05:00
Andrew Kelley
4d2fed6232
zig fmt behavior tests
2020-01-30 16:10:08 -05:00
Andrew Kelley
58c97b3561
fix llvm assertion with debug info for vectors
2020-01-30 15:30:38 -05:00
Andrew Kelley
7b5f4a8d10
fix llvm assertion with debug info for vectors
2020-01-30 15:30:03 -05:00
LemonBoy
979c69d6b2
Amend some failing test cases
2020-01-30 19:53:35 +01:00
LemonBoy
c944865fc7
Generate compilable code for array inits
...
The compiler still doesn't like too much the newfangled anonymous arrays
so let's use the old-style declarations.
Closes #4181
2020-01-30 19:45:08 +01:00
Shawn Landden
cbd42e44d6
rb: fix rb.Node.getLast() that never worked
2020-01-30 12:05:57 -05:00
Andrew Kelley
70ee818d21
update target CPUs and features with llvm10's data
...
based on zig-llvm-target-details-generator
commit 3aef1b9b4415ed3acfaea4ce8bc233e213548f71
2020-01-30 11:31:41 -05:00
Andrew Kelley
14d9582e9a
ci: don't rely on sourcehut's pkg system
2020-01-30 10:23:00 -05:00
Andrew Kelley
65b1a4953f
Merge pull request #4324 from fengb/testing-allocator
...
Remove debug.global_allocator in favor of testing.allocator
2020-01-30 10:01:40 -05:00
Andrew Kelley
e3a383a661
Merge pull request #4239 from shawnl/rb
...
rb: **breaking** change API to be thread-safe
2020-01-30 09:45:35 -05:00
Andrew Kelley
0303e7bd8e
Merge pull request #4319 from Rocknest/windows-traces
...
Bring windows segfault handler on par with linux
2020-01-30 09:26:39 -05:00
LemonBoy
e77a102e24
Small DWARF fixups
...
* Clang doesn't seem to emit a DW_AT_low_pc together with DW_AT_ranges
for asm files.
* Keep reading the other CUs if the lookup fails.
2020-01-30 09:11:02 -05:00
Rocknest
a5f18c2b2a
Fix one more edge case
2020-01-30 10:00:28 +02:00
Benjamin Feng
9c196efa2a
Add explicit error message for too many frees
2020-01-30 01:12:21 -06:00
Rocknest
94f29ae117
Remove intCast's
2020-01-30 08:53:38 +02:00
Benjamin Feng
46d84a1b63
Convert a few more page_allocator
2020-01-30 00:27:44 -06:00
Benjamin Feng
c1fb97aef6
Remove unnecessary allocator from mutex
2020-01-30 00:27:44 -06:00
Benjamin Feng
184128fd9e
Fix testing.allocator wiring
2020-01-30 00:27:44 -06:00
Andrew Kelley
c75f65d38c
std.Target: add ve arch
2020-01-29 23:58:28 -05:00
Andrew Kelley
a63a2fdf76
update zig_clang bindings to release/10.x
2020-01-29 23:50:24 -05:00
Andrew Kelley
c7fa71d233
update clang driver to release/10.x branch
...
upstream commit 967658150edb2cbb860c19ce54ac1e216bdc8461
2020-01-29 23:38:21 -05:00
Andrew Kelley
a95dce15ae
Merge remote-tracking branch 'origin/master' into llvm10
2020-01-29 23:33:12 -05:00
Benjamin Feng
5c8e85f388
Fix BufMap value leak
2020-01-29 22:22:01 -06:00
Benjamin Feng
b7a236d68e
Convert a bunch of page_allocator to testing.allocator
2020-01-29 22:22:01 -06:00
Benjamin Feng
ad93ad3e60
Fix errant reference to page_allocator
2020-01-29 22:22:01 -06:00
Benjamin Feng
837877ea37
Update docs to reflect new testing.allocator usage
2020-01-29 22:22:01 -06:00
Benjamin Feng
898ef82d65
Patch in arena to cleanup leaks
2020-01-29 22:22:00 -06:00
Benjamin Feng
b077f3ab7d
Promoted "leak_count_allocator" to the main testing.allocator
2020-01-29 22:22:00 -06:00
Benjamin Feng
70ad84c820
Use defer/panic to better account for test failure
2020-01-29 17:38:52 -06:00
Benjamin Feng
0c137934cb
Move FailingAllocator to testing
2020-01-29 17:38:42 -06:00
Rocknest
b1884b3a62
Fix aarch64
2020-01-30 01:17:34 +02:00
Andrew Kelley
7ebc624a15
Merge branch 'LemonBoy-fix-4259'
2020-01-29 17:21:29 -05:00
Andrew Kelley
f97b398b65
simplify int/float comparison
2020-01-29 17:20:41 -05:00
Rocknest
c0c9c601d4
Fix off-by-one error
2020-01-29 23:48:52 +02:00
LemonBoy
fe4ef7b461
Fix comptime float-int comparisons
...
Closes #4259
2020-01-29 16:37:55 -05:00
Benjamin Feng
ffd30dbe28
Fix stage1 test
2020-01-29 15:30:13 -06:00
Rocknest
4a4d6f2be9
Reorganize definitions
2020-01-29 23:15:17 +02:00
Valentin Anger
d448c3d38a
Add support for code model selection
2020-01-29 16:09:07 -05:00
LemonBoy
59bc1d2721
Fix edge case in switch with single else
...
ir_gen_switch_expr doesn't set the switch_br field at all if there are
zero cases, detect this situation and handle it gracefully.
Closes #4322
2020-01-29 16:05:14 -05:00
Benjamin Feng
c4e6e5fad6
Add explicit free to docs
2020-01-29 14:47:17 -06:00
Benjamin Feng
aa9caf5064
Create leak_count_allocator
2020-01-29 14:37:01 -06:00
Rocknest
b7cd60a354
Changing stuff and seeing what happens
2020-01-29 21:09:00 +02:00
Andrew Kelley
4fad16284e
Merge pull request #4320 from fengb/while-spills
...
Add async spills to while captured variables
2020-01-29 13:37:58 -05:00
Benjamin Feng
4d134a01f5
Move debug.global_allocator to testing.allocator
2020-01-29 12:21:29 -06:00
Andrew Kelley
34706dad3f
fix typo in doc comment
2020-01-29 12:25:25 -05:00
Andrew Kelley
0cc2489d22
Merge pull request #4317 from Vexu/std-c
...
Add (unfinished) C parser to std lib
2020-01-29 12:13:53 -05:00
LemonBoy
534014f84e
translate-c: Handle fn protos wrapped in parenthesis
...
Closes #4289
2020-01-29 12:06:53 -05:00
LemonBoy
1ba4554855
Correct dl_iterate_phdr address
...
The base should be zero so that p_vaddr + dlpi_addr = p_vaddr
2020-01-29 12:05:36 -05:00
Benjamin Feng
9a0a378e2f
Add test cases for suspend in while loops
2020-01-29 10:01:51 -06:00
Benjamin Feng
a4ac7980b4
Add a spill to while error union
2020-01-29 10:01:51 -06:00
Rocknest
3500b41bfe
Add an advanced segfault handler on windows
2020-01-29 17:27:53 +02:00
Vexu
abd1a7c91c
std-c add todos to unfinished parsing functioins
2020-01-29 12:12:28 +02:00
Benjamin Feng
2f239e3dbd
Add a spill to while optional
2020-01-28 23:36:43 -06:00
LemonBoy
3ec37c979e
Build compiler_rt/c with optimizations if possible
2020-01-28 19:28:39 -05:00
Andrew Kelley
13259acbc3
std.sort.insertionSort: remove superfluous block
2020-01-28 16:22:09 -05:00
Andrew Kelley
76fba5baf9
Merge pull request #4152 from ziglang/ir-clean-up-vars
...
pay off some result location technical debt with regards to "mem slots"
2020-01-28 16:21:41 -05:00
Andrew Kelley
3ed52e5453
fix build.zig logic for -target-cpu and -target-feature
...
fix a false negative for detecting the ability to emit these flags.
it matters for stage0/stage1 on aarch64
2020-01-28 14:54:34 -05:00
Andrew Kelley
504ce86ac9
fix more compile error test regressions
2020-01-28 14:17:25 -05:00
Andrew Kelley
793d81c4e8
fix result locations not handling undefined correctly
2020-01-28 13:33:51 -05:00
Andrew Kelley
86da9346e4
fix error message column/line number regressions
2020-01-28 13:25:49 -05:00
Andrew Kelley
e0000c47bd
fix regression of storing optional with 0-bit payload
2020-01-28 12:32:39 -05:00
Andrew Kelley
5c55a9b4e8
fix compile error regression with struct containing itself
2020-01-28 11:52:48 -05:00
Andrew Kelley
287d3c37e1
fix 0-bit child type coerced to optional return ptr result location
...
by un-special-casing 0 bit types in result locations
2020-01-28 11:39:36 -05:00
Andrew Kelley
8710fdbf39
fix line, column numbers of compile errors
2020-01-27 22:05:27 -05:00
Zac
926a7adb3a
Update langref.html.in
...
Fix typo
2020-01-27 21:39:29 -05:00
Andrew Kelley
ae20574d5e
add missing spill for for loops with pointer elems
2020-01-27 21:30:11 -05:00
Andrew Kelley
c58633ef17
fix assertion with var debug loc not initialized
2020-01-27 20:56:24 -05:00
Andrew Kelley
9d59cdb8c1
fix auto created variables not having correct alignment
2020-01-27 19:42:32 -05:00
Andrew Kelley
d8e2549996
remove invalid use of allowzero in std.crypto.murmur
2020-01-27 19:42:13 -05:00
Andrew Kelley
37ab960492
fix not handling undefined u0 correctly
2020-01-27 18:59:46 -05:00
Andrew Kelley
b38b967844
fix triple level result location with bitcast sandwich
...
...passed as tuple element
2020-01-27 18:26:39 -05:00
Andrew Kelley
b96872ef2f
@bitCast result location: fix passing invalid alignment
...
when the value has 0 bits
2020-01-27 17:45:29 -05:00
Andrew Kelley
c0fee9dfc7
fix nested bitcast passed as tuple element
2020-01-27 17:30:39 -05:00
Andrew Kelley
e2778c03e0
Merge branch 'master' into ir-clean-up-vars
2020-01-27 13:32:39 -05:00
Andrew Kelley
d896500259
Merge branch 'LemonBoy-fix-4274'
2020-01-27 09:52:49 -05:00
Andrew Kelley
f41e50dc08
Merge branch 'fx-4274' of https://github.com/LemonBoy/zig into LemonBoy-fix-4274
2020-01-27 09:52:31 -05:00
Andrew Kelley
4591389497
Merge pull request #4300 from LemonBoy/debug-windows
...
More debug fixes - This time Windows gets a treat
2020-01-27 09:46:39 -05:00
LemonBoy
d5c2a20d8e
Unify the two DWARF interpreters
...
* Let's consolidate the special-cased DWARF interpreter for OSX with the
general purpose one
* Drop the assumption that all the debug data is contained in a single
contiguous slice of memory. This is a good news for freestanding
targets and paves the way for supporting compressed debug sections.
2020-01-27 09:46:20 -05:00
LemonBoy
7336b750bd
Fix stack-trace address calculation on Windows
...
Let's always subtract 1 from the return address so that we're sure to be
inside the callee.
Fixes some edge case where the stack trace skipped the first entry.
2020-01-27 13:12:01 +01:00
LemonBoy
f8e015c85f
Handle S_GPROC32 symbols in PDB files
...
Fixes some incomplete stack traces on Windows.
2020-01-27 13:10:35 +01:00
Andrew Kelley
518dbd30cb
Merge pull request #4133 from daurnimator/4087-free-sets-undefined
...
Sets memory to undefined when freed from allocator
2020-01-26 18:52:43 -05:00
Andrew Kelley
51ac8eb08e
fix regression in windows stack traces tty detection
2020-01-26 18:28:52 -05:00
Andrew Kelley
96e5f476c3
Merge pull request #4264 from ziglang/layneson-cpus_and_features
...
Add support for target details (CPUs and their supported features)
2020-01-26 09:57:25 -05:00
Andrew Kelley
3839ea8978
fix debug info code not being freestanding compatible
...
in stack tracing code, the idea was to detect the tty settings at the
top of the stack and pass the information down. somewhere along the way
this got changed so that setTtyColor was assuming the global stderr_file
was related to the output stream the stack trace was being printed to.
now, tty_color is changed to tty_config, and it is an enum rather than a
bool, telling how tty colors are expected to be handled. windows is
still incorrectly looking at stderr_file.
2020-01-26 09:55:04 -05:00
Andrew Kelley
d9fb6c2054
fix compilation error
2020-01-26 00:55:04 -05:00
Andrew Kelley
9dffc369f1
Merge remote-tracking branch 'origin/master' into layneson-cpus_and_features
2020-01-25 23:25:29 -05:00
Andrew Kelley
4e9b1f5479
Merge pull request #4290 from ziglang/split-ir-structs
...
split IrInstruction into IrInst, IrInstSrc, IrInstGen
2020-01-25 23:24:41 -05:00
Andrew Kelley
32f0039b43
fix memory profiling
2020-01-25 22:02:10 -05:00
Andrew Kelley
6aac423964
split IrInstruction into IrInst, IrInstSrc, IrInstGen
...
This makes it so that less memory is used for IR instructions, as well
as catching bugs when one expected one kind of instruction and received
the other.
2020-01-25 21:49:32 -05:00
LemonBoy
aaa2f9ab2f
Fix handling of DW_LNE_end_sequence
...
The DWARF specification states that LNE_end_sequence should just reset
the state machine, it's not an error.
2020-01-25 20:03:50 -05:00
LemonBoy
8516ee392c
Fix parsing of DW_AT_Ranges debug entry
...
Follow the specification about what the base address is and how it can
be changed by some entries in the list itself.
2020-01-25 16:12:11 -05:00
Feix Weiglhofer
a4a9330648
translate-c: Don't make const parameters mutable. ( #4273 )
...
* translate-c: Remove arg-prefix from const parameters.
* translate-c: Add unittest for const parameters.
2020-01-24 15:32:32 -05:00
Michael Dusan
aa75df36df
Merge pull request #4279 from mikdusan/create-global-cache
...
stage1: make sure to create native_libc.txt dir
2020-01-24 00:31:18 -05:00
Tadeo Kondrak
3d8328abce
Don't include stdbool.h for void and unreachable
...
Fixes https://github.com/ziglang/zig/issues/4272
2020-01-23 23:24:45 -05:00
Michael Dusan
b54040d394
stage1: make sure to create native_libc.txt dir
...
- fix regression from #4186
2020-01-23 21:59:28 -05:00
Andrew Kelley
800ead2810
update target info to llvm 10
...
the branch builds now
2020-01-23 17:31:25 -05:00
Andrew Kelley
79fb486017
link: update to llvm 10 API
2020-01-23 17:28:13 -05:00
Andrew Kelley
72589dbffe
zig_clang builds with llvm 10
2020-01-23 17:22:13 -05:00
Andrew Kelley
32dafbdadc
zig_clang: update StmtClass to llvm 10
2020-01-23 16:52:40 -05:00
LemonBoy
8d9b8ab930
More error checking for unresolved TLDs
...
Closes #4274
2020-01-23 22:40:12 +01:00
Andrew Kelley
3588f99719
zig_clang: update TypeClass enum
2020-01-23 14:35:12 -05:00
Andrew Kelley
fbfda7f00e
fix incorrect list of sub-arches for aarch64
...
tests use older sub-arch that works in the older qemu
2020-01-23 13:02:45 -05:00
Andrew Kelley
c86589a738
disable f128 compiler_rt tests failing on windows
...
These were never working with native CPU features. In this branch,
we fix native CPU features not being enabled on Windows, and regress
f128 language features. In the llvm10 branch, all this is fixed,
and the tests are re-enabled.
2020-01-23 02:05:24 -05:00
Andrew Kelley
1a08c0d40b
new test case
2020-01-23 00:46:44 -05:00
Andrew Kelley
ead7d15772
use an older arm64 sub-arch for test suite
...
hopefully this avoids the older qemu version crashing
2020-01-23 00:41:46 -05:00
Michael Dusan
357f42da6c
compiler_rt: fix mulsi3 test typo
2020-01-22 20:17:38 -05:00
Andrew Kelley
fb8e681ea8
update zig_llvm.h and zig_llvm.cpp to llvm 10
2020-01-22 18:43:30 -05:00
Andrew Kelley
9845264a0b
aarch64: less feature-full baseline CPU
2020-01-22 18:40:34 -05:00
LemonBoy
a284be3f69
Fix unsafe cast in translate_c
...
Fixes #4250
2020-01-22 17:58:57 -05:00
Andrew Kelley
211e1b1ced
ci: update to llvm 10
2020-01-22 17:54:58 -05:00
Andrew Kelley
0c477f3c79
fix std.Target.Arch.parseCpuFeatureSet unit test
2020-01-22 17:47:18 -05:00
Andrew Kelley
74872263cc
lib/headers: update to clang 10.x C headers
...
upstream revision: 3cce3790072249cbe51b96cea26bc78019c11fd0
2020-01-22 17:42:44 -05:00
Andrew Kelley
3227aec848
fix not respecting sub-arch feature
2020-01-22 17:35:57 -05:00
Andrew Kelley
b94525c45b
Merge pull request #4263 from LemonBoy/debug-thing
...
Refactor some debug stuff
2020-01-22 17:32:48 -05:00
Andrew Kelley
48c7e6c48b
std.Target.CpuFeatures is now a struct with both CPU and feature set
...
Previously it was a tagged union which was one of:
* baseline
* a specific CPU
* a set of features
Now, it's possible to have a CPU but also modify the CPU's feature set
on top of that. This is closer to what LLVM does.
This is more correct because Zig's notion of CPUs (and LLVM's) is not
exact CPU models. For example "skylake" is not one very specific model;
there are several different pieces of hardware that match "skylake" that
have different feature sets enabled.
2020-01-22 17:13:31 -05:00
LemonBoy
69c72e24d4
compiler-rt: Port __mulsi3 builtin
2020-01-22 13:04:45 -05:00
Andrew Kelley
97b2ac598b
Merge remote-tracking branch 'origin/master' into llvm10
2020-01-22 12:12:36 -05:00
Andrew Kelley
c6bfece1d5
Revert "tests: use an older aarch64 sub-arch"
...
This reverts commit 4640ef589e .
This attempted workaround did not have the desired effect.
2020-01-21 22:24:40 -05:00
Andrew Kelley
cbe9a51518
don't trust llvm's GetHostCPUName
...
comment from this commit reproduced here:
I have observed the CPU name reported by LLVM being incorrect. On
the SourceHut build services, LLVM 9.0 reports the CPU as "athlon-xp",
which is a 32-bit CPU, even though the system is 64-bit and the reported
CPU features include, among other things, +64bit.
So the strategy taken here is that we observe both reported CPU, and the
reported CPU features. The features are trusted more; but if the features
match exactly the features of the reported CPU, then we trust the reported CPU.
2020-01-21 22:02:13 -05:00
Andrew Kelley
830e0ba2d2
enable native CPU feature for windows; disable failing tests
...
See #508 . These can be re-enabled when we upgrade to LLVM 10.
2020-01-21 21:46:06 -05:00
Andrew Kelley
4640ef589e
tests: use an older aarch64 sub-arch
...
to avoid an illegal instruction error with the older qemu
version that is available on the CI server.
2020-01-21 21:02:33 -05:00
Andrew Kelley
6e6ec3d71d
put hack back in to disable windows native cpu features
...
See #508 . This can be removed when we upgrade to LLVM 10.
2020-01-21 21:01:36 -05:00
Andrew Kelley
68b6867e76
lazily compute the full cpu features dependencies
2020-01-21 20:11:36 -05:00
Andrew Kelley
92559cd02c
hit a comptime limitation with computing dense sets
2020-01-21 19:40:44 -05:00
LemonBoy
b8601e9252
Adjust tests & work around a nasty ICE
2020-01-21 23:17:02 +01:00
LemonBoy
59d0dda080
Make writeByteNTimes faster and leaner
2020-01-21 20:58:02 +01:00
LemonBoy
bc82e0f3d3
Refactor some code in the debug output
2020-01-21 20:51:57 +01:00
Andrew Kelley
15d5cab569
fix target_triple_zig to emit zig-compatible triples
2020-01-21 12:25:22 -05:00
Andrew Kelley
91ecce3bc0
fix cache of cpu features
2020-01-21 12:14:43 -05:00
Andrew Kelley
6793af8d8b
these are not real cpu features
2020-01-21 12:14:36 -05:00
Andrew Kelley
327ad0ae89
target_triple_llvm: emit none instead of unknown
2020-01-21 03:05:56 -05:00
Andrew Kelley
1f7babbc80
properly forward baseline target cpu features to llvm
2020-01-21 03:01:20 -05:00
Andrew Kelley
0abaee79af
fix self-hosted compiler regression
2020-01-21 01:51:21 -05:00
Andrew Kelley
5974f95cb7
add cpus and cpu features to zig targets
2020-01-21 01:48:25 -05:00
Andrew Kelley
0c2dde2fda
add libc and glibcs to self-hosted zig targets
2020-01-21 01:31:27 -05:00
Andrew Kelley
39759b90fc
make zig targets show native cpu name and features
2020-01-21 01:22:37 -05:00
Andrew Kelley
e640d01535
fixups to arch data, support any number of cpu features
2020-01-21 00:34:54 -05:00
Andrew Kelley
6118b11afa
Revert "aarch64: remove CPU features that are actually just CPUs"
...
This reverts commit 6dd514ac8a .
This strategy won't work for arm 32-bit; instead need to try to figure
out how to get more bits into the bit set.
2020-01-20 23:15:07 -05:00
Andrew Kelley
89e107ee4e
uncomment all the archs in target.zig
2020-01-20 23:14:35 -05:00
Andrew Kelley
6dd514ac8a
aarch64: remove CPU features that are actually just CPUs
2020-01-20 22:49:26 -05:00
Andrew Kelley
6e88883edf
import data from llvm 9
2020-01-20 22:21:45 -05:00
Andrew Kelley
f3dd9bbdac
improve zig targets
2020-01-20 13:40:25 -05:00
Andrew Kelley
bf82929557
fix std.Target.Arch.parseCpuFeatureSet
2020-01-20 12:41:18 -05:00
LemonBoy
c522699f28
Fix ICE in build addAssemblyFile
2020-01-20 12:24:55 -05:00
Nathan Michaels
0000de4fee
Handle {s} format for C strings. ( #4219 )
...
* Handle {s} format for C strings.
* Fix "cstr" test to actually use c strings.
2020-01-20 12:23:43 -05:00
daurnimator
5cc4932461
std: allocator interface sets freed memory to undefined
2020-01-21 03:17:40 +11:00
daurnimator
65013d8599
std: fix bug in http.headers where .put captures user-held variable
2020-01-21 03:17:36 +11:00
Andrew Kelley
8f29d14073
stage1 is building. zig targets now self-hosted
2020-01-20 01:42:31 -05:00
Andrew Kelley
20af858601
some fixes
2020-01-19 21:06:41 -05:00
Andrew Kelley
e3b5e91878
do the x86 arch
2020-01-19 20:54:05 -05:00
Andrew Kelley
a313f15384
figure out zig0/stage1 and scanning for native CPU
2020-01-19 20:54:05 -05:00
Andrew Kelley
a867b43366
progress towards merging
...
see BRANCH_TODO file
2020-01-19 20:54:04 -05:00
Layne Gustafson
c15623428e
Pass target_details to child CodeGens
2020-01-19 20:53:20 -05:00
Layne Gustafson
430077df1b
Allow target details with no LLVM support
2020-01-19 20:53:20 -05:00
Layne Gustafson
62e4cc06fe
Pass target details to c compiler
2020-01-19 20:53:20 -05:00
Layne Gustafson
35c681b7b1
Fix sentinel mismatch in llvm strings
...
Previously, buffers were used with toOwnedSlice() to create c strings
for LLVM cpu/feature strings. However, toOwnedSlice() shrinks the
string memory to the buffer's length, which cuts off the null terminator.
Now toSliceConst() is used instead, and the buffer is not deinited
so that the string memory is not freed.
2020-01-19 20:53:20 -05:00
Layne Gustafson
8902f3ca32
Enable 64bit feature for riscv64
2020-01-19 20:53:20 -05:00
Layne Gustafson
de8a5cf5f5
Remove features/cpus not in LLVM v9
2020-01-19 20:53:20 -05:00
Layne Gustafson
a5c9397539
No allocations for n.t. empty strings
2020-01-19 20:53:20 -05:00
Layne Gustafson
40ff359486
Only enable requested features
2020-01-19 20:53:20 -05:00
Layne Gustafson
ebb6f15bba
Make sure llvm strings are null-terminated
2020-01-19 20:53:20 -05:00
Layne Gustafson
fd17a9962b
Add defaut feature support
2020-01-19 20:53:20 -05:00
Layne Gustafson
03dd376b55
Add builtin.zig support
2020-01-19 20:53:19 -05:00
Layne Gustafson
c61856ebcf
Add TargetDetails abstraction
2020-01-19 20:53:19 -05:00
Layne Gustafson
79a2747de4
Add llvm_name to feature defs
2020-01-19 20:53:19 -05:00
Layne Gustafson
e4ecdefa9a
Rename subfeatures -> dependencies
2020-01-19 20:53:19 -05:00
Layne Gustafson
51372200d3
Filter out non-features
2020-01-19 20:53:19 -05:00
Layne Gustafson
c1798cb632
Add build.zig cpu and feature options
2020-01-19 20:53:19 -05:00
Layne Gustafson
b3324f1901
Add cpu/feature to cache hash
2020-01-19 20:53:19 -05:00
Layne Gustafson
bd6ef21f85
Add cpu/feature specification to cmndline
2020-01-19 20:53:19 -05:00
Layne Gustafson
c8f1e0d6d8
Remove llvm_name from features
2020-01-19 20:53:19 -05:00
Layne Gustafson
c131e50ea7
Switch CPU/features to simple format
2020-01-19 20:53:18 -05:00
Layne Gustafson
9d66bda264
Fix spacing in main.cpp
2020-01-19 20:53:18 -05:00
Layne Gustafson
5bc4690d85
Make targets cmd able to list CPUs and features
2020-01-19 20:53:18 -05:00
Layne Gustafson
21908e100e
Fix CPU and feature defs
2020-01-19 20:53:18 -05:00
Layne Gustafson
8ac138a318
Add parseArchTag and fix parseArchSub
2020-01-19 20:53:18 -05:00
Layne Gustafson
8f191e0166
Update term feature deps -> subfeatures
2020-01-19 20:53:18 -05:00
Layne Gustafson
0f46c12f78
Create initial target details infrastructure
2020-01-19 20:53:15 -05:00
Shawn Landden
ad15a73240
rb: type Tree.sort with SortError
2020-01-19 23:35:56 +04:00
Vexu
ad327fed05
std-c redo scoping, do string concatanation in parser
2020-01-19 20:44:55 +02:00
LemonBoy
7a1cde7206
Fix wrong error code being returned in enum analisys
...
Fixes the assertion failure seen in #4233
2020-01-19 13:28:27 -05:00
Andrew Kelley
e491b2f5a7
Merge pull request #4231 from LemonBoy/more-builtin-work1
...
More patches for compiler-rt
2020-01-19 13:27:36 -05:00
Shawn Landden
4ab9678b95
rb: add sort() that re-sorts tree with new compare function
...
You can also specify the same compare function, but after updating the
context that the function will use (connected to the rb.Tree) before.
2020-01-19 22:10:21 +04:00
Shawn Landden
e190082922
rb: *breaking* make API thread-safe
...
use @fieldParentPtr to access your context fields, which lie if you
struct that contains a rb.Tree member (without a pointer).
Also simplifies the init() function so rb.Tree can be initialized in a single line,
without having to use "undefined".
2020-01-19 22:09:56 +04:00
Shawn Landden
de07ca77e7
rb: just use @include("std")
...
we already have to use --override-std-dir
when running std tests, and having it this way
makes it much easier to run just the tests of this file.
2020-01-19 22:05:38 +04:00
LemonBoy
861724bcf0
Fix some tests broken by the renamed files
2020-01-19 09:31:45 +01:00
Andrew Kelley
7bb4c855ad
Merge pull request #4222 from LemonBoy/eutwouwth
...
Prevent crash with empty non-exhaustive enum
2020-01-18 19:25:23 -05:00
LemonBoy
5fbc1c2812
Nuke some more code
2020-01-19 00:12:27 +01:00
LemonBoy
3247fd7862
Export MSVC builtins inconditionally
2020-01-19 00:12:27 +01:00
LemonBoy
ae31da9334
Minor cleanup
2020-01-19 00:12:26 +01:00
LemonBoy
6b056d1fb9
Nuke some repeated code
2020-01-19 00:12:25 +01:00
LemonBoy
7d94e712f1
Remove useless wrappers around f32/f64 aeabi builtins
2020-01-19 00:12:18 +01:00
LemonBoy
fa52c9e36e
Small cleanups
2020-01-19 00:11:45 +01:00
Sebastian
405b8e9eee
fixed typo - "path" lead to undeclared identifier
2020-01-18 17:56:53 -05:00
Andrew Kelley
f47b7a0437
Merge pull request #4220 from LemonBoy/fix-4214
...
Allow @tagName on enum literals
2020-01-18 17:55:21 -05:00
daurnimator
72ec445677
std: turn EAI_ constants into a non-exhaustive enum
2020-01-18 17:46:44 -05:00
daurnimator
9e6e1e58bb
std: use non-exhaustive enums from crc module
...
Un-reverts PR #3118
2020-01-18 17:42:45 -05:00
LemonBoy
b0f753e21d
Fix edge case in tagName handling of unions
...
Closes #4226
2020-01-18 20:16:15 +01:00
LemonBoy
f456b88bae
Get rid of some dead logic
2020-01-18 19:24:04 +01:00
LemonBoy
c53d94e512
Prevent crash with empty non-exhaustive enum
2020-01-18 15:13:21 +01:00
LemonBoy
5f2bac010d
Allow @tagName on enum literals
...
Closes #4214
2020-01-18 09:55:18 +01:00
Michael Dusan
b72f858194
Merge pull request #4215 from mikdusan/cmake-install
...
cmake: support `make` and `make install`
2020-01-17 21:35:29 -05:00
Michael Dusan
b9f4ac86ef
cmake: support make and make install
...
(2nd attempt to get this right)
2020-01-17 19:39:43 -05:00
Andrew Kelley
b5ac079f88
Merge pull request #4191 from Vexu/non-exhaustive-enums
...
Implement non-exhaustive enums
2020-01-17 14:26:12 -05:00
Michaël Larouche
d9be6e5dc6
Port clzsi2 from compiler_rt, required for using std.fmt.format on some ARM architecture.
2020-01-17 14:25:22 -05:00
Michael Dusan
d53e8a5751
Revert "cmake: support make and make install"
...
This reverts commit cd062b08d0 .
2020-01-17 14:24:54 -05:00
Vexu
39f92a9ee4
improve behavior test
2020-01-17 09:50:20 +02:00
Michael Dusan
9348609e6a
Merge pull request #4208 from mikdusan/contributing
...
doc: update contributing
2020-01-17 02:49:25 -05:00
Michael Dusan
af9eb7ac13
doc: update contributing
2020-01-17 02:47:47 -05:00
Michael Dusan
ab2cb435e5
Merge pull request #4209 from mikdusan/cmake-install
...
cmake: fix install lib path message
2020-01-17 02:45:32 -05:00
Michael Dusan
97cca1376a
cmake: fix install lib path message
2020-01-17 00:53:41 -05:00
Andrew Kelley
396d57c498
fix failing array test by improving copy_const_val
2020-01-16 21:58:53 -05:00
Andrew Kelley
8f336b3970
revert one part of ir get_elem_ptr analysis
...
this reverts one part of 4c3bfeca. it solves some behavior regressions
but introduces new ones. This change was incorrect to make however,
and this commit takes the code in a better direction.
2020-01-16 21:58:52 -05:00
Andrew Kelley
6a8c9f7306
fix regression with optionals and globals
2020-01-16 21:58:52 -05:00
Andrew Kelley
b952b84486
relax language requirements regarding else unreachable
2020-01-16 21:58:52 -05:00
Andrew Kelley
8bf425957b
fix regressions double implicit casting return ptr
2020-01-16 21:58:52 -05:00
Andrew Kelley
e48157c3cb
fix regression with inferred struct fields
2020-01-16 21:58:52 -05:00
Andrew Kelley
fb8da16a60
fix regressions in get_elem_ptr related to undefined
2020-01-16 21:58:52 -05:00
Andrew Kelley
d0b055d69e
fix implicit cast regression
2020-01-16 21:58:52 -05:00
Andrew Kelley
96d64a40a6
fix regression with var ptrs not being const
2020-01-16 21:58:52 -05:00
Andrew Kelley
b6c8fead00
fix regression in global const alignment
2020-01-16 21:58:51 -05:00
Andrew Kelley
fbcee58cfc
zig ir.cpp details: remove the mem_slot mechanism
...
Previously, there was hacky code to deal with result locations and how
they work with regards to comptime values and runtime values. In
addition, there was a hacky "mem_slot" mechanism that managed the memory
for local variables, and acted differently depending on comptime vs
runtime situations. All that is deleted in this commit, and as a result,
result locations code has one less complication.
Importantly, this means that a comptime result location is now passed to
a function when it is evaluated at comptime.
This test causes many regressions, and some of the behavior tests are
disabled (commented out) in this commit. Future commits will re-enable
the tests before merging the branch.
2020-01-16 21:58:47 -05:00
Michael Dusan
0240fd9140
Merge pull request #4206 from mikdusan/cmake-install
...
cmake: support `make` and `make install`
2020-01-16 21:40:05 -05:00
Andrew Kelley
7e674d6761
zig_llvm: update CodeGenFileType usage
2020-01-16 21:32:07 -05:00
Michael Dusan
cd062b08d0
cmake: support make and make install
...
- `make` or `ninja` will not build but not install
- `make install` or `ninja install` will build __and__ install
Only for build system generator Visual Studio, specify the following
to disable installation of lib files:
ZIG_SKIP_INSTALL_LIB_FILES=ON
2020-01-16 18:56:13 -05:00
Vexu
6c8f01dcde
correct field count
2020-01-16 22:52:10 +02:00
Andrew Kelley
56f433b3d9
update clang drivers to llvm 10.x (ac446302c)
2020-01-16 14:03:38 -05:00
Vexu
bac27731e3
add struct field default value to typeinfo
2020-01-16 13:22:30 -05:00
Vexu
df03fcf5f0
implement @bitSizeOf
2020-01-16 13:13:45 -05:00
Andrew Kelley
ba4cc03b4f
remove embedded LLD
...
we no longer have any patches against upstream LLD
2020-01-16 13:09:45 -05:00
Andrew Kelley
fbe6af81fd
Merge remote-tracking branch 'origin/master' into llvm10
2020-01-16 13:01:36 -05:00
LemonBoy
f609ce4f65
Minor changes to the ARM builtin fns
2020-01-16 12:50:53 -05:00
LemonBoy
7e5e767ba0
Fix regression in char printing
...
Closes #4014
2020-01-16 12:17:16 -05:00
LemonBoy
0267afa9c0
Fix garbled error messages from clang
2020-01-16 12:16:30 -05:00
Vexu
6450736c5f
translate-c default enum tag type to c_int
2020-01-16 12:50:44 +02:00
Vexu
cb257b4e11
allow non-exhaustive enums with no fields
2020-01-16 09:23:26 +02:00
Vexu
d84569895c
turn panics into compile errors, require at least 1 field in non-exhaustive enum
2020-01-16 09:04:11 +02:00
Andrew Kelley
8a792db2d8
Merge pull request #4187 from LemonBoy/builtin-rearrange
...
Some needed work on builtins
2020-01-15 18:39:50 -05:00
Vexu
02e5cb1cd4
add non-exhaustive enum to langref
2020-01-15 23:05:52 +02:00
Vexu
5c2238fc4a
small fixes
...
* error for '_' prong on exhaustive enum
* todo panic for `@tagName` on non-exhaustive enum
* don't require '_' field on tagged unions
2020-01-15 22:09:19 +02:00
Vexu
c57784aa15
add is_exhaustive field to typeinfo
2020-01-15 21:50:12 +02:00
Vexu
f3d174aa61
require size for non-exhaustive enums
2020-01-15 21:38:11 +02:00
Vexu
0ea96c11ef
disallow multiline strings in test and library names
2020-01-15 14:20:48 -05:00
LemonBoy
e8012740b9
Fix off-by-one error (and missing store op)
2020-01-15 20:03:41 +01:00
Vexu
b971c7d0ff
update tests and translate-c
2020-01-15 20:58:42 +02:00
Michael Dusan
0a41051955
stage1: move local native_libc.txt to global
...
Automatic creation of `native_libc.txt` now occurs only in global
cache. Manual creation/placement into local cache is supported.
closes #3975
2020-01-15 13:42:12 -05:00
Vexu
6fd0dddf18
implement non-exhaustive enums
2020-01-15 20:24:59 +02:00
LemonBoy
ede28755b6
Fix test case
2020-01-15 18:41:07 +01:00
LemonBoy
c5cfc9bf68
Move definition of __aeabi_read_tp
2020-01-15 17:50:51 +01:00
LemonBoy
5d5345728a
Fix div builtins to use the correct calling convention
2020-01-15 17:50:51 +01:00
LemonBoy
109e5f8a5a
Remove unnecessary logic
2020-01-15 17:50:51 +01:00
LemonBoy
44e3796285
Rearrange some builtin functions placement
2020-01-15 12:48:28 +01:00
Andrew Kelley
8d9d4a0658
Merge pull request #4182 from LemonBoy/mjeiorw
...
A bunch of patches
2020-01-15 04:28:54 -05:00
LemonBoy
c85afff5a8
Correct l_name field type
2020-01-14 23:11:10 +01:00
LemonBoy
49771f356f
Make sure @export symbol name is not empty
2020-01-14 21:23:11 +01:00
LemonBoy
c1f3766f1c
Correct dlpi_name field type
2020-01-14 21:15:33 +01:00
LemonBoy
158d98a7f2
Print sentinel value in ir_print
2020-01-14 21:13:55 +01:00
Michaël Larouche
7ee0e779af
Fix std.child_process.ChildProcess.spawnWindow when looking in PATH environment variable, it applied cwd+app_name instead of just using the app_name
2020-01-14 15:12:30 -05:00
LemonBoy
505b9db909
Fix codegen error for some union initializers
...
Closes #3377
2020-01-14 14:57:03 -05:00
Vexu
af2ede4d96
fix crash on multiline library name
2020-01-14 13:10:52 -05:00
LemonBoy
50754ba336
Fix ICE when BoundFn are passed as parameters
...
Closes #4022
Closes #3699
2020-01-14 13:09:23 -05:00
Shritesh
4c87281b5c
[docs] Add libc dependency to sentinel-term ptr example
...
Fixes "dependency on library c must be explicitly specified in the build command" error
2020-01-14 13:07:08 -05:00
Hersh Krishna
e7917d099d
Add clamp function to math module
2020-01-14 13:06:46 -05:00
Vexu
28daddae81
std-c todos and small fixes
2020-01-14 16:18:32 +02:00
Andrew Kelley
d3e67d9921
Merge pull request #4172 from LemonBoy/swish
...
Two switch-related patches
2020-01-13 18:01:19 -05:00
LemonBoy
cae93c860b
Allow switching on pointer types
...
Closes #4074
2020-01-13 22:18:49 +01:00
LemonBoy
84930fec27
Validate switch range endpoints
2020-01-13 21:45:16 +01:00
Andrew Kelley
b9f37ffe19
fix outdated comment
2020-01-13 14:48:43 -05:00
Andrew Kelley
4f9739189e
add an extra assert
2020-01-13 14:48:43 -05:00
Andrew Kelley
c774c9376a
Merge pull request #3957 from xackus/stage2_parser_3799
...
stage2 parser: fix segfault on extern block
2020-01-13 13:38:31 -05:00
Emilio G. Cota
2be12b24bc
doc/langref: mention that x is the sentinel in [N:x]T
...
Without looking at the example it is not possible to know
whether N or x is the sentinel value. Fix it.
2020-01-13 11:49:46 -05:00
Andrew Kelley
4d4852ad31
Merge pull request #4162 from LemonBoy/fix-4020
...
Fix @call being too eager to resolve the fn argument
2020-01-13 11:48:54 -05:00
LemonBoy
54b11f66a9
Fix compiler-error regression
2020-01-13 08:49:32 +01:00
Michael Dusan
d08009556e
Merge pull request #4161 from mikdusan/stage1-builtin-debugtrap
...
prefer C++ compiler builtins for BREAKPOINT
2020-01-12 18:28:10 -05:00
LemonBoy
34cdcb13c0
Fix @call being too eager to resolve the fn argument
...
Closes #4020
2020-01-12 23:51:18 +01:00
Michael Dusan
25b1ae0a5f
prefer C++ compiler builtins for BREAKPOINT
...
Fix breakpoints on macOS to trap EXC_BREAKPOINT with correct
source location when using lldb. Old behavior with `raise(SIGTRAP)`
traps SIGTRAP and incorrect source location.
Fix breakpoints on archlinux to trap SIGILL with correct source
location when using gdb. Old behavior with `raise(SIGTRAP)`
traps SIGTRAP and (sometimes) incorrect source location with
very shallow (break in main) stack.
when building stage1:
- w/ clang, use `__builtin_debugtrap()`
- w/ gcc, use `__builtin_trap()`
- else use `raise(SIGTRAP)`
2020-01-12 16:41:11 -05:00
LemonBoy
c96131f30c
Propagate errors in for loop bodies
...
Closes #3819
2020-01-12 12:49:12 -05:00
hryx
c4770e7aa5
docs: update grammar to remove C strings and add anon literals
2020-01-12 04:35:45 -05:00
Michael Dusan
a6f6d8d2f7
Merge pull request #4139 from mikdusan/stage1-relative-path-errors
...
strip cwd from compile error paths
2020-01-11 19:21:54 -05:00
Michael Dusan
fc20a58993
strip cwd from compile error paths
...
closes #43138
2020-01-11 16:45:57 -05:00
data-man
860d88037a
Correct TypeId docs
2020-01-11 15:59:00 -05:00
LemonBoy
34ae1d9aa8
Fix unsafe cast in translate_c
...
* Handle EmptyDecls to clean up the generated code
Closes #4143
2020-01-11 15:51:10 -05:00
Jonathan Marler
0827e298ed
Add WaitForSingleObject function to std.os.windows
2020-01-11 15:49:48 -05:00
LemonBoy
95619ecb8c
Stop dropping errors from clang
...
* Refactor the error-writing code to be more compact and flexible
2020-01-11 15:48:32 -05:00
Vexu
4c0776b2a5
std-c parse switch
2020-01-11 21:48:12 +02:00
xackus
5880eb3a75
stage2 parser: document undefined and clean up
2020-01-10 22:48:51 +01:00
LemonBoy
9cc7fb66bc
Don't special-case builtin too much
...
Let's use the usual declaration-searching mechanism that resolves the
`usingnamespace` declarations on the go instead of directly peeking into
the symbol table.
Fixes #4134
2020-01-10 16:44:15 -05:00
LemonBoy
84e98405de
Inform the debugger about the effective type sizes
...
Makes every debugger happy and closes #2685
2020-01-10 16:42:49 -05:00
xackus
f81529fab1
stage2 parser: fix segfault on extern block
2020-01-10 22:35:41 +01:00
LemonBoy
570ffc470e
Handle forward-declared functions
...
Closes #4130
2020-01-10 16:34:40 -05:00
Andrew Kelley
e06a6b9645
Merge pull request #4129 from daurnimator/windows-child_process
...
Fix windows child process creation
2020-01-10 03:00:25 -05:00
travisstaloch
3f98756f85
Fix translation of signed array indices ( #4113 )
...
* cast only if the index is long long or signed
* cast long long to usize rather than c_uint
closes #4075
2020-01-10 00:08:24 -05:00
daurnimator
03e1241b88
std: avoid an allocation in inner loop
2020-01-10 15:03:51 +11:00
daurnimator
6fb636050f
std: fix off by one error in windows process creation
2020-01-10 15:00:14 +11:00
Andrew Kelley
ae324985a6
clean up a TODO in self-hosted
2020-01-09 15:31:49 -05:00
Andrew Kelley
5e345ff0ee
Merge pull request #3955 from LemonBoy/fix-1528
...
Pointer arithmetic affects the alignment factor
2020-01-09 13:53:56 -05:00
LemonBoy
5ab5de89c0
New @export() handling
...
Use a struct as second parameter to be future proof (and also allows to
specify default values for the parameters)
Closes #2679 as it was just a matter of a few lines of code.
2020-01-09 13:43:06 -05:00
Rocknest
4613e4d15f
Fix C struct with function pointer member and typedefs mistranslated ( #4122 )
...
fixes #4118
2020-01-09 13:38:31 -05:00
Ryan Liptak
834218d789
Fix remaining variadic formatted prints
...
Used a series of regex searches to try to find as many instances of the old pattern as I could and update them.
2020-01-09 13:36:44 -05:00
daurnimator
d7333d8798
std: fix LoggingAllocator, add simple test
2020-01-09 13:34:46 -05:00
LemonBoy
c51b79c56e
Correct alignment calculation for runtime addends
2020-01-09 11:56:45 +01:00
LemonBoy
27b290f312
Propagate more failures upwards
...
Fixes #4112
2020-01-08 17:25:00 -05:00
LemonBoy
7ea7842ed0
Fix calculation of new alignment factor
2020-01-08 21:02:05 +01:00
LemonBoy
7fe13f4a86
Pointer alignment fixes for the stdlib
2020-01-08 20:03:03 +01:00
LemonBoy
e134e6c994
Pointer arithmetic affects the alignment factor
...
Closes #1528
2020-01-08 20:03:03 +01:00
data-man
02ace4569e
Correct @mulAdd's doc
2020-01-08 13:56:16 -05:00
Nathan Michaels
38ce7f64e3
Add removeIndex function to PriorityQueue ( #4070 )
...
It's awkward to use, but lets me cancel events in an event queue.
Co-authored-by: Dmitry Atamanov <data-man@users.noreply.github.com >
2020-01-08 13:55:47 -05:00
Andrew Kelley
0ebb07f95d
Merge pull request #4101 from LemonBoy/moremerwio
...
More translate-c fixes
2020-01-08 13:37:02 -05:00
LemonBoy
6a72eb1541
Use abort() instead of assert()
...
Let's see if the Windows/MacOS CI like this more...
2020-01-08 10:31:11 +01:00
LemonBoy
5b34697b21
Cast integer literals to their specified type
2020-01-08 10:19:04 +01:00
LemonBoy
fd7e69a2c0
More translate-c fixes
...
* Translate OpaqueValueExpr
* Translate BinaryConditionalOperator
* Fix translation of boolean->int casts
* Reoder some tokens to avoid rendering errors
2020-01-08 08:43:37 +01:00
LemonBoy
2a5c622e65
Fix crash with unresolved loc
...
Fixes #4099
2020-01-07 18:16:17 -05:00
Vexu
e21ea5bd95
std-c parser loops
2020-01-08 00:00:14 +02:00
Andrew Kelley
9f064bcf74
Merge pull request #4091 from xackus/json_copy_strings
...
json: implement copy_strings=false
2020-01-07 16:42:14 -05:00
Vexu
83b4163591
std-c parser declaratorIsFunction and small fixes
2020-01-07 23:25:38 +02:00
Andrew Kelley
7b73c7fe12
Merge branch 'std-utf16-sentinel-terminated' of https://github.com/daurnimator/zig
2020-01-07 16:13:34 -05:00
Andrew Kelley
e2e9be5dea
Merge branch 'dcao-master'
...
closes #3981
2020-01-07 16:02:58 -05:00
Andrew Kelley
af390b75db
cleanups related to --eh-frame-hdr
2020-01-07 16:02:38 -05:00
David Cao
8e57dd57ca
add --eh-frame-hdr conditionally
2020-01-07 15:58:40 -05:00
David Cao
599213463d
add --eh-frame-hdr arg for linking
2020-01-07 15:58:39 -05:00
Vexu
8b713ce889
std-c parser add options
2020-01-07 22:43:44 +02:00
Rocknest
437c6a4b7e
Make markdown parser more safe ( #4105 )
...
Fixes #3722
2020-01-07 15:26:21 -05:00
LemonBoy
3607d9ee68
Fix crash in struct initializer evaluation
...
Closes #4100
2020-01-07 15:06:22 -05:00
mogud
688d02176c
build support list options
2020-01-07 13:59:53 -05:00
emekoi
156e43b463
added -- to pass args to zig build commands
2020-01-07 13:59:16 -05:00
LemonBoy
e81b505960
Use the correct calling convention for AEABI intrinsics
2020-01-07 13:42:47 -05:00
Andrew Kelley
4e4ba6c3e1
test harness: show annotated case name when translate-c test fails
2020-01-07 13:40:17 -05:00
Vexu
dbc0457068
std-c declaration parsing
2020-01-07 20:15:57 +02:00
xackus
814b54d798
json tests: don't use debug allocator
2020-01-07 19:03:11 +01:00
hryx
2933a8241a
json: disallow overlong and out-of-range UTF-8
...
Fixes #2379
= Overlong (non-shortest) sequences
UTF-8's unique encoding scheme allows for some Unicode codepoints
to be represented in multiple ways. For any of these characters,
the spec forbids all but the shortest form. These disallowed longer
sequences are called "overlong". As an interesting side effect of
this rule, the bytes C0 and C1 never appear in valid UTF-8.
= Codepoint range
UTF-8 disallows representation of codepoints beyond U+10FFFF,
which is the highest character which can be encoded in UTF-16.
Because a 4-byte sequence is capable of resulting in such characters,
they must be explicitly rejected. This rule also has an interesting
side effect, which is that bytes F5 to FF never appear.
= References
Detecting an overlong version of a codepoint could get gnarly, but
luckily The Unicode Consortium did the hard work by creating this
handy table of valid byte sequences:
https://unicode.org/versions/corrigendum1.html
I thought this mapped nicely to the parser's state machine, so I
rearranged the relevant states to make use of it.
2020-01-07 12:07:44 -05:00
Vexu
4184d4c66a
std-c parser record and enum specifiers
2020-01-07 19:05:46 +02:00
Vexu
df12c1328e
std-c parser typing improvements
2020-01-07 16:05:13 +02:00
via
9390e8b848
Preserve packed attribute in C translated struct ( #4085 )
...
* Preserve packed attribute in C translated struct
* Add tests for packed C struct
2020-01-07 02:36:07 -05:00
Andrew Kelley
8492c46ade
add test case for already fixed bug
...
closes #2655
2020-01-06 23:03:07 -05:00
LemonBoy
8c640b3e60
Prevent bitCast to enum types
...
Stop the user from creating invalid enum values.
2020-01-06 19:36:17 -05:00
LemonBoy
7e7d0e1ffa
Better handling of decayed arrays to pointers
2020-01-06 19:32:53 -05:00
Timon Kruiper
0deab8fd3b
Add std.mem.zeroes to the standard library
...
This zero initializes the type passed in. Can be used to zero
initialize c structs.
2020-01-06 19:24:17 -05:00
Andrew Kelley
baaef7ed97
Merge pull request #4083 from LemonBoy/better-stdbool
...
Better _Bool translation
2020-01-06 19:21:55 -05:00
Andrew Kelley
bf678a12df
Merge branch 'LemonBoy-c-anon-stuff'
...
closes #4081
2020-01-06 19:18:05 -05:00
LemonBoy
62413da9d3
Add run-translated-c test & fix one more edge case
2020-01-06 19:17:47 -05:00
LemonBoy
2da9e0060b
Add explanation about weird clang behavior on windows
2020-01-06 19:17:47 -05:00
LemonBoy
1dc25d7550
Translate anonymous union/struct
2020-01-06 19:17:47 -05:00
Tadeo Kondrak
f83b02a581
translate-c: use @intToPtr to cast away qualifiers
2020-01-06 19:09:49 -05:00
LemonBoy
e3a63b4e5a
Add more compiler-rt functions for ARM platform
2020-01-06 19:08:15 -05:00
Andrew Kelley
d3d77138ec
remove redundant license file
2020-01-06 19:05:42 -05:00
Andrew Kelley
633b6bf920
Merge branch 'LemonBoy-cc-work'
2020-01-06 18:53:17 -05:00
Andrew Kelley
c0e8837ce9
update docs with regards to callconv
2020-01-06 18:26:20 -05:00
Andrew Kelley
be2483c576
fix test suite regressions
2020-01-06 18:20:31 -05:00
Andrew Kelley
5ada610e09
update translate-c and tests for new extern/callconv syntax
2020-01-06 17:54:16 -05:00
Andrew Kelley
3b5c71d2a5
fix regression with @TypeInfo
2020-01-06 17:13:45 -05:00
Andrew Kelley
53913acaf7
zig fmt and update extern fn to callconv(.C)
2020-01-06 15:34:50 -05:00
Andrew Kelley
5951b79af4
remove stdcallcc, extern, nakedcc from stage1; zig fmt rewrites
2020-01-06 15:23:05 -05:00
Andrew Kelley
0a9daeb37e
Merge branch 'cc-work' of https://github.com/LemonBoy/zig into LemonBoy-cc-work
2020-01-06 14:07:56 -05:00
Colin Svingen
4e6ad8efd9
Removes proc_raise from WASI implementation
2020-01-06 14:04:55 -05:00
xackus
6bebf741f9
json: implement copy_strings=false
2020-01-06 19:59:54 +01:00
Vexu
3ed6d7d245
std-c parser declarator
2020-01-06 20:06:17 +02:00
LemonBoy
eca294cd23
Add run-translated-c test
2020-01-06 00:18:26 +01:00
LemonBoy
cd39f6df95
Better _Bool translation
2020-01-06 00:12:18 +01:00
Andrew Kelley
c30106c906
add test case to cover already-solved bug
...
closes #2401
2020-01-05 17:42:03 -05:00
LemonBoy
6ff70d3c31
Better InitListExpr translation
2020-01-05 17:39:29 -05:00
Vexu
d5d52af26e
std-c parse pointer
2020-01-06 00:06:33 +02:00
Andrew Kelley
5888d84ea3
Merge branch 'data-man-rusage'
...
closes #3854
2020-01-05 17:03:31 -05:00
Andrew Kelley
fee9318b17
std.os.getrusage: add C extern fn and reserved field
...
* add reserved field to match musl struct definition so that
it will work with musl libc.
* add libc getrusage so that it will work with libc
what's not done in this branch is:
* test coverage. See #1629 , which should also aim to provide
general test coverage for the std lib.
* rusage struct bits for non-linux operating systems
2020-01-05 16:57:14 -05:00
data-man
2f6b045fb1
Add std.os.getrusage
2020-01-05 16:52:36 -05:00
Andrew Kelley
62bebda270
add "Improving Translate-C" section to CONTRIBUTING.md
2020-01-05 15:42:55 -05:00
Andrew Kelley
d7bff05098
Merge pull request #4064 from ziglang/fix-4054
...
use @intCast instead of @as for shift rhs
2020-01-05 15:01:21 -05:00
Andrew Kelley
a0ca34979e
Merge pull request #4053 from ziglang/test-run-translated-c
...
add test harness for "run translated C" tests
2020-01-05 14:50:02 -05:00
Vexu
5feeff7123
std-c improve error reporting and decl parsing
2020-01-05 20:25:52 +02:00
Vexu
795a503999
std-c tokenizer always add newline token
2020-01-05 20:25:51 +02:00
Vexu
f934f9b419
std-c parser fndef and static assert
2020-01-05 20:25:51 +02:00
Vexu
46f292982d
std-c parser DeclSpec
2020-01-05 20:25:51 +02:00
Vexu
25f7f66b8f
std-c type parsing
2020-01-05 20:25:51 +02:00
Vexu
dccf1247b2
std-c ifstmt compoundstmt and errors
2020-01-05 20:25:51 +02:00
Vexu
a20c0b31de
std-c parser and ast organization
2020-01-05 20:25:51 +02:00
Vexu
73a53fa263
std-c outline parser
2020-01-05 20:25:50 +02:00
Vexu
e1b01d32f0
std-c ast base
2020-01-05 20:25:50 +02:00
Vexu
2183c4bb44
std-c tokenizer string concatenation
2020-01-05 20:25:50 +02:00
Vexu
a5d1fb1e49
std-c tokenizer line continuation, tests and fixes
2020-01-05 20:25:50 +02:00
Vexu
c221593d7d
std-c tokenizer better special case handling
2020-01-05 20:25:50 +02:00
Vexu
472ca947c9
std-c tokenizer add tests
2020-01-05 20:25:50 +02:00
Vexu
d75697a6a3
std-c tokenizer keywords
2020-01-05 20:25:50 +02:00
Vexu
26bf410b06
std-c finish tokenizer
2020-01-05 20:25:49 +02:00
Vexu
f14a5287e9
std-c tokenizer strings, floats and comments
2020-01-05 20:25:49 +02:00
Vexu
05acc0b0c1
std-c tokenizer more stuff
2020-01-05 20:25:49 +02:00
Vexu
04b7cec42e
std-c tokenizer base
2020-01-05 20:25:49 +02:00
Andrew Kelley
242f5d10d5
fix test-gen-h and test-compile-errors regression
2020-01-05 13:08:18 -05:00
Andrew Kelley
157b8e6889
fix test-stack-traces regression
2020-01-05 02:35:52 -05:00
Haze Booth
2e5342512f
remove @TypeOf() hacks for comptime_int/comptime_float
2020-01-05 02:33:23 -05:00
Andrew Kelley
a690a5085d
rework and improve some of the zig build steps
...
* `RunStep` moved to lib/std/build/run.zig and gains ability to compare
output and exit code against expected values. Multiple redundant
locations in the test harness code are replaced to use `RunStep`.
* `WriteFileStep` moved to lib/std/build/write_file.zig and gains
ability to write more than one file into the cache directory, for
when the files need to be relative to each other. This makes
usage of `WriteFileStep` no longer problematic when parallelizing
zig build.
* Added `CheckFileStep`, which can be used to validate that the output
of another step produced a valid file. Multiple redundant locations
in the test harness code are replaced to use `CheckFileStep`.
* Added `TranslateCStep`. This exposes `zig translate-c` to the build
system, which is likely to be rarely useful by most Zig users;
however Zig's own test suite uses it both for translate-c tests and
for run-translated-c tests.
* Refactored ad-hoc code to handle source files coming from multiple
kinds of sources, into `std.build.FileSource`.
* Added `std.build.Builder.addExecutableFromWriteFileStep`.
* Added `std.build.Builder.addExecutableSource`.
* Added `std.build.Builder.addWriteFiles`.
* Added `std.build.Builder.addTranslateC`.
* Added `std.build.LibExeObjStep.addCSourceFileSource`.
* Added `std.build.LibExeObjStep.addAssemblyFileFromWriteFileStep`.
* Added `std.build.LibExeObjStep.addAssemblyFileSource`.
* Exposed `std.fs.base64_encoder`.
2020-01-05 02:19:22 -05:00
Andrew Kelley
508a8980ba
Merge pull request #4072 from LemonBoy/misc-stuff
...
Miscellaneous translate-c patches
2020-01-04 20:03:47 -05:00
LemonBoy
a712ea333b
Fix translation of for loop init
...
Closes #4067
2020-01-04 11:49:43 +01:00
LemonBoy
51e430fac0
Fix edge case in hex-literal translation
2020-01-04 11:06:28 +01:00
Josh Wolfe
ac867cc45f
fix tests
2020-01-03 20:55:47 -07:00
Andrew Kelley
14fcfe2981
translate-c supports --cache on
...
this will be used to provide a zig build step
2020-01-03 22:11:19 -05:00
Andrew Kelley
6ea193946d
Merge pull request #3950 from nmichaels/master
...
Document std.Mutex.
2020-01-03 20:05:03 -05:00
Josh Wolfe
7838031b43
use @intCast instead of @as for shift rhs
2020-01-03 16:41:32 -07:00
LemonBoy
b91eaba38c
Correct evaluation of optional type alignment
...
The lazy logic was too oversimplified and produced a different result
than the one computed later causing all kinds of problems.
Closes #4013
2020-01-03 17:41:55 -05:00
Andrew Kelley
3f19bc5d01
Merge pull request #4058 from LemonBoy/awful
...
builtin calls formatting - take II
2020-01-03 17:40:34 -05:00
LemonBoy
e6485282d3
Better logic for last-param rendering
2020-01-03 11:49:42 +01:00
LemonBoy
7b375a1c4a
Revert "Revert "Trailing comma is respected for builtin calls""
...
This reverts commit f83411b0b1 .
2020-01-03 10:17:40 +01:00
Haze Booth
f40b6b85f1
Remove translate-c-2 from zig help
2020-01-03 02:17:08 -05:00
Andrew Kelley
695c8f756b
add test harness for "run translated C" tests
2020-01-03 00:26:12 -05:00
Andrew Kelley
f83411b0b1
Revert "Trailing comma is respected for builtin calls"
...
This reverts commit afd0290918 .
This caused test failures.
2020-01-02 21:53:25 -05:00
LemonBoy
e9536ca10f
Fix edge case in C tokenizer
...
Closes #4042
2020-01-02 16:44:30 -05:00
LemonBoy
afd0290918
Trailing comma is respected for builtin calls
2020-01-02 16:43:39 -05:00
Andrew Kelley
a90fa45ae1
Merge pull request #4027 from ziglang/fix-float-ops
...
fix float ops with respect to vectors
2020-01-02 16:10:41 -05:00
Andrew Kelley
fe21d84c94
Merge pull request #4040 from Vexu/translate-c-cast-fixes
...
Translate c cast fixes
2020-01-02 14:57:48 -05:00
LemonBoy
b0fa2ff853
Translate struct/union initializer expressions
2020-01-02 14:16:39 -05:00
Andrew Kelley
213ff939f1
fix comptime vector float ops and add test coverage
...
also rename `@ln` to `@log` to match libc convention.
2020-01-02 14:01:48 -05:00
LemonBoy
d09bd3d86c
Fix more tests
2020-01-02 19:01:38 +01:00
LemonBoy
435528a7c5
Use the LLVM C++ API
2020-01-02 18:57:09 +01:00
LemonBoy
e99209baf0
Add transform test
2020-01-02 18:57:08 +01:00
LemonBoy
0ccac79c8e
Implement Thiscall CC
2020-01-02 18:57:08 +01:00
LemonBoy
08a26fea09
translate-c tests
2020-01-02 18:57:07 +01:00
LemonBoy
0ec64d4c0c
Integrate callconv into translate-c-2
2020-01-02 18:53:21 +01:00
LemonBoy
271fc6a247
Catch more errors during the type resolution phase
...
Returning the uninitialized/stale error condition made the compiler turn
a blind eye to some problems.
2020-01-02 18:53:20 +01:00
LemonBoy
563d9ebfe5
Implement the callconv() annotation
2020-01-02 18:53:16 +01:00
Andrew Kelley
197509e1ec
Merge LemonBoy's translate-c branch for linksection/align
...
closes #4034
2020-01-02 12:35:19 -05:00
LemonBoy
d908ca4823
Translate align attribute
2020-01-02 12:33:19 -05:00
LemonBoy
8e89bdfe99
Translate linksection attribute
2020-01-02 12:32:51 -05:00
Vexu
0f1595e72c
translate-c use @enumToInt for global enum values
2020-01-02 18:38:20 +02:00
Andrew Kelley
7bd80f2071
translate-c tests: print clang compile errors on nonzero exit code
2020-01-02 11:12:21 -05:00
Vexu
386270425f
translate-c use canonical type in casts
2020-01-02 17:49:14 +02:00
Vexu
3dd067fa2b
translate-c fix increment rendering issues
2020-01-02 10:47:14 -05:00
LemonBoy
de894f2bde
Prefer simple ptrCast between opaque types
...
Closes #4031
2020-01-02 10:42:26 -05:00
LemonBoy
1e61e5f404
Don't ptrCast a result-location assignment to _
...
After #4010 doing `_ = @bitCast(...)` triggered a nonsensical compiler
error.
2020-01-02 10:41:11 -05:00
Vexu
f35a963ac5
translate-c properly handle unused var-args
2020-01-02 10:39:52 -05:00
Andrew Kelley
cb56b26900
fix float ops with respect to vectors
...
also remove the redundant type parameter
2020-01-01 23:27:43 -05:00
Andrew Kelley
576320e6d5
Merge pull request #4025 from ziglang/Vexu-stage-2-cimport
...
Use self hosted translate-c for cImport
2020-01-01 22:46:46 -05:00
Andrew Kelley
88c5e2a96e
translate-c: don't export inline functions
2020-01-01 20:54:17 -05:00
Andrew Kelley
5ba143e7e3
avoid trying to translate microsoft's stdio.h inline functions
...
...for now. See #515
2020-01-01 20:33:07 -05:00
Andrew Kelley
a3f741e9b8
translate-c: avoid producing duplicate macro errors
...
This input file, for example, would produce duplicate identifiers
in the translated Zig code:
```
#define bar err(
#define bar err(
```
2020-01-01 20:29:35 -05:00
Andrew Kelley
365a6124d9
translate-c: fix regression from previous commit
...
This made macros which had an error being processed emit multiple times,
causing the self-hosted compiler to fail to build.
2020-01-01 19:58:41 -05:00
Andrew Kelley
ec09b9e5f0
translate-c: prevent name clashing of macros declared after locals
2020-01-01 19:23:46 -05:00
Andrew Kelley
9298b9a4aa
translate-c: prevent name clashing of globals declared after locals
2020-01-01 18:53:08 -05:00
Andrew Kelley
dc28526c6c
translate-c: improve support of integer casting
...
Widening and truncating integer casting to different signedness
works better now. For example `(unsigned long)-1` is now translated
to zig code that compiles correctly.
2020-01-01 18:10:43 -05:00
Andrew Kelley
5575e2a168
std.mem.compare: breaking API changes
...
* `std.mem.Compare` is now `std.math.Order` and the enum tags
renamed to follow new style convention.
* `std.mem.compare` is renamed to `std.mem.order`.
* new function `std.math.order`
2020-01-01 18:08:40 -05:00
Vexu
1b64a5f5f0
fix segfault in bit shift safety check
2020-01-01 13:11:42 -05:00
Andrew Kelley
7b62d5dfd8
translate-c: propagate scope properly in nested assignment
2019-12-31 21:01:49 -05:00
Andrew Kelley
0fb3e6608c
Merge branch 'lun-4-linux-memfd-create'
...
Closes #3687
2019-12-31 20:41:30 -05:00
Andrew Kelley
42945a269a
translate-c: better mangling strategy
...
Block-local identifiers have block-local mangling numbers, and more
consistent mangling is applied within blocks. Parameters, for example,
are treated the same as other block-local variables, and are not mangled
unless they conflict with another name in scope.
2019-12-31 20:39:33 -05:00
Andrew Kelley
0c8ec369f0
std.os.memfd_create: add error.SystemOutdated
2019-12-31 17:57:20 -05:00
Andrew Kelley
5749f706ef
translate-c: non-wrapping operator for pointer arithmetic
...
According to C11 6.5.6.8, pointer arithmetic may not overflow. In fact,
it may not even go more than 1 past the end of an object, or UB occurs.
This is the same as Zig pointer arithmetic semantics, and so the
`+` and `+=` operators rather than `+%` and `+%=` are appropriate for
C-translated pointer arithmetic.
2019-12-31 17:33:55 -05:00
Andrew Kelley
39ee3bc0ec
Merge branch 'stage-2-cimport' of https://github.com/Vexu/zig into Vexu-stage-2-cimport
2019-12-31 16:55:41 -05:00
Andrew Kelley
c8c65b0168
translate-c: add pub to failed-to-translate macros
2019-12-31 16:54:41 -05:00
Andrew Kelley
8186211404
improvements to memfd_create
...
* move test from std/io/test.zig to std/os/test.zig
* do glibc version check, and make direct system call if
glibc is too old
* disable test when not linking libc, to avoid not working
with outdated qemu version on the CI server. see #4019
2019-12-31 16:34:14 -05:00
Luna
a153a972ad
io.test: close memfd at end of test
2019-12-31 15:58:03 -05:00
Luna
13c9faaa2d
c.linux: add memfd_create
2019-12-31 15:58:03 -05:00
Luna
f0cbf63e1a
os: use system for memfd_create
...
- os: update flags type for memfd_create
2019-12-31 15:58:03 -05:00
Luna
997812e8fb
os: add memfd_create
...
currently only linux is supported
2019-12-31 15:58:03 -05:00
Andrew Kelley
25051832b3
std.fmt.format: add helpful compile error for non-tuple args
2019-12-31 13:13:13 -05:00
mogud
d972d1c942
generate header in separate folder
2019-12-31 02:25:57 -05:00
Andrew Kelley
86ba8c06bf
Merge branch 'lun-4-net-reuseaddr-opt'
...
Closes #3820
2019-12-30 19:36:43 -05:00
Andrew Kelley
99f6f8ead9
update setsockopt error set according to POSIX
...
In the code review I accidentally encouraged Luna to remove some
handling of errors that are possible according to POSIX, but I think how
Luna had it before was better, so I fixed it, and now the branch should
be good to merge.
2019-12-30 19:35:05 -05:00
Luna
22f6297157
std.os: update error set for setsockopt
2019-12-30 19:26:30 -05:00
Luna
0d852effe3
std.net: use mem.toBytes
2019-12-30 19:26:30 -05:00
Luna
50e6a27c29
std.net: fix setsockopt call
2019-12-30 19:26:30 -05:00
Luna
5efc0ea89e
std.os: make setsockopt receive a slice as option
2019-12-30 19:26:30 -05:00
Luna
ea8f496970
std.c: c_uint -> u32 for sockopt functions
2019-12-30 19:26:30 -05:00
Luna
3ccbf3cfc2
move parameters on sockopt functions to c_uint
...
this makes them consistent with the linux syscalls
2019-12-30 19:26:30 -05:00
Luna
d423bb3808
std.c: add setsockopt
2019-12-30 19:26:30 -05:00
Luna
0e67568bca
net: fix Options
...
- os: fix typos on setsockopt
2019-12-30 19:26:30 -05:00
Luna
4a4d2c0d80
os: add setsockopt
...
- net: use os.setsockopt()
2019-12-30 19:26:29 -05:00
Luna
631eb6783d
add StreamServer.Options.reuse_address
...
this uses a bad direct interface with std.os.linux, this should add
setsockopt to std.os.
2019-12-30 19:26:29 -05:00
Andrew Kelley
73e535e112
Merge pull request #3683 from Vexu/atomic-float
...
Support floats with some atomic operations
2019-12-30 19:19:05 -05:00
LemonBoy
cbfd66f68a
Don't crash when parsing invalid files
2019-12-30 19:17:19 -05:00
Andrew Kelley
a05150e92d
fix comparing comptime_int against undefined literal
...
closes #4004
2019-12-30 19:08:57 -05:00
Andrew Kelley
a3d04b9228
update readme tagline
2019-12-30 18:17:13 -05:00
Andrew Kelley
8f8a32d297
Merge pull request #4007 from daurnimator/json-cleanup
...
std.json: cleanups
2019-12-30 18:13:20 -05:00
LemonBoy
28a8ded95a
Resolve more types as needed
...
Closes #3994
2019-12-30 17:45:09 -05:00
LemonBoy
c1ee846c22
Fix ptrCast of zero-sized type
...
Closes #2431
2019-12-30 17:43:58 -05:00
Andrew Kelley
34b4538d7b
Merge pull request #4011 from lukechampine/chacha20poly1305
...
crypto: Implement ChaCha20-Poly1305 AEAD (fixed)
2019-12-30 17:39:46 -05:00
lukechampine
ab093228f9
Fix segfault by not reassigning to function parameter
2019-12-30 13:53:09 -05:00
lukechampine
d1a570a4b8
chacha: Fix open docstring
2019-12-30 13:35:16 -05:00
lukechampine
d6ca2323cf
chacha: Use error set instead of bool
2019-12-30 13:35:13 -05:00
lukechampine
1953b60599
chacha20poly1305: Return false on short ciphertext
2019-12-30 13:35:05 -05:00
lukechampine
ae7bb4ecc0
chacha20poly1305: verify tag in constant time
2019-12-30 13:34:57 -05:00
lukechampine
fbe7d8c1cb
crypto: Add chacha20poly1305
2019-12-30 13:34:53 -05:00
daurnimator
42727c73f9
std: fix typo in comment
2019-12-31 03:06:33 +11:00
daurnimator
ef3a01a367
std: json.unescapeString doesn't need to take an allocator
2019-12-31 02:26:09 +11:00
daurnimator
04a2a4a7cb
std: track decoded string length in std.json tokenizer
2019-12-31 02:26:06 +11:00
daurnimator
0def92cff4
std: use enum literals in std.json
2019-12-30 23:47:33 +11:00
daurnimator
80d37a13c0
std: use a union(enum) for std.json.Token
2019-12-30 23:47:29 +11:00
daurnimator
51943ff432
std: meta.TagPayloadType takes the tag type of the union
2019-12-30 23:09:18 +11:00
daurnimator
17cc511ea4
std: fmt std/json.zig
2019-12-30 22:34:19 +11:00
Haze Booth
c70a673c6e
array literal address of fix
2019-12-30 05:48:27 -05:00
Andrew Kelley
e0c7d12043
update std/json.zig to latest language changes
...
fixes regression from 54231e832b
2019-12-29 19:00:27 -05:00
Benoit Giannangeli
fb2f0cc497
ArrayList: ptrAt function returns pointer to item at given index
2019-12-29 18:46:59 -05:00
Andrew Kelley
54231e832b
Merge pull request #3648 from xackus/json-unescape
...
breaking: JSON unescape
2019-12-29 18:31:10 -05:00
data-man
6af39aa49a
Fixes #3966
2019-12-29 18:19:03 -05:00
Andrew Kelley
6b960331ee
Merge pull request #3968 from daurnimator/sigprocmask
...
Clean up linux sigprocmask, raise
2019-12-29 18:03:09 -05:00
Vexu
950eb81304
translate-c-2 macro comparision ops
2019-12-29 20:19:30 +02:00
Vexu
ca211617bd
update c_tokenzier tests to new api
2019-12-29 20:04:19 +02:00
frmdstryr
6df9e9fe47
Cleanup c_tokenizer.zig tests
2019-12-29 19:50:58 +02:00
frmdstryr
fcc82a219a
Add macro ops
2019-12-29 19:50:45 +02:00
Vexu
55348c9b93
translate-c-2 bug fixes
...
- fix use of undefined value
- fix parenexprclass result not being suppressed
- add an error and a TODO for access of an anonymous field
2019-12-29 19:23:36 +02:00
Vexu
621629e20d
translate-c-2 fix assertion failure rendering do while
2019-12-29 17:09:31 +02:00
Vexu
f5e7d2d00c
translate-c fix bugs
...
Thanks @daurnimator
2019-12-29 14:01:59 +02:00
Vexu
59cc7072e2
translate-c-2 use intCast in most places
2019-12-29 11:04:59 +02:00
Vexu
1a3633d786
fix stage2 build
2019-12-29 11:04:58 +02:00
Vexu
3f7bab7373
fix translate-c taking ages
2019-12-29 11:04:58 +02:00
Vexu
fceda07f94
use self hosted translate-c for cimports
2019-12-29 11:04:45 +02:00
Marc Tiehuis
bda355d976
Merge pull request #3992 from ForLoveOfCats/BigIntToStringLeak
...
Add missing deferred deinits to `math.big.Int.toString`
2019-12-29 14:47:59 +13:00
daurnimator
2662e50d27
std: sentinel terminated pointers for utf16 apis
2019-12-29 10:35:05 +11:00
Andrew Kelley
cb02125415
Merge pull request #3987 from daurnimator/std.unicode-fixes
...
std.unicode fixes
2019-12-28 18:13:50 -05:00
Andrew Kelley
48bf00bf34
Merge pull request #3993 from Vexu/translate-c
...
Translate-c-2 macro conditional operator and better error reporting
2019-12-28 18:12:06 -05:00
Vexu
1e52b7d690
translate-c-2 improve macro errors
2019-12-28 23:38:07 +02:00
Vexu
aea46dcd7e
translate-c-2 macro conditional operator
2019-12-28 22:32:18 +02:00
ForLoveOfCats
b28824ef66
Add missing deferred deinits to math.big.Int.toString (mem leak fix)
2019-12-28 15:31:32 -05:00
Andrew Kelley
68aa221995
Merge pull request #3986 from LemonBoy/translate-c-stuff
...
Two small translate-c(-2) patches
2019-12-28 14:26:37 -05:00
MateuszOkulus
6c3ccea29b
Make it more obvious that ifs are expressions
2019-12-28 14:26:10 -05:00
daurnimator
edb5deb39c
std: unicode codepoints are 21 bits
2019-12-28 16:49:59 +11:00
daurnimator
ab6065407d
std: simplify utf8ToUtf16Le
...
Also faster, on my machine unicode/throughput_test.zig now gives e.g.
> original utf8ToUtf16Le: elapsed: 1048 ns (0 ms)
> new utf8ToUtf16Le: elapsed: 971 ns (0 ms)
2019-12-28 16:49:59 +11:00
daurnimator
5843a6e3bc
std: optimise utf8ByteSequenceLength
...
Also tested (but not as fast):
```zig
pub fn utf8ByteSequenceLength(first_byte: u8) !u3 {
const len = @clz(u8, ~first_byte);
if (len == 0) return 1;
if (len < 4) return @intCast(u3, len);
return error.Utf8InvalidStartByte;
}
```
2019-12-28 14:39:38 +11:00
daurnimator
8b72eedc76
std: add warm up phase to benchmark
...
In my tests, whatever ran first was getting much better numbers.
Additionally, add alignment requirements so that comparison is fair.
2019-12-28 14:39:38 +11:00
daurnimator
a81c0ba2e7
std: fix unicode encoding of astral plane codepoints to utf16
2019-12-28 14:39:38 +11:00
LemonBoy
6070ffc28e
Fix crash with forward-declared enums
...
Closes #3754
2019-12-28 00:57:37 +01:00
LemonBoy
a38704d012
Fix crash in translate-c w/ parameterless fn
2019-12-28 00:50:17 +01:00
Vexu
2252951066
disable test on arm
2019-12-23 11:55:00 +02:00
Vexu
ab7fc33c83
add zig llvm wrapper for atomicrmw
2019-12-23 11:55:00 +02:00
Vexu
8bb1e04449
support some atomic operations with floats
2019-12-23 11:54:47 +02:00
Andrew Kelley
25e71216c4
Merge pull request #3974 from kprotty/event_broadcast
...
ResetEvent fixes & broadcast notify
2019-12-22 23:39:13 -05:00
kprotty
1c5a1284e3
typo fix
2019-12-22 21:45:26 -06:00
kprotty
b8fabb3426
ResetEvent: broadcast by default
2019-12-22 21:45:26 -06:00
Andrew Kelley
ad92227516
report compile errors instead of crashing when frame is invalid
2019-12-22 17:09:11 -05:00
Andrew Kelley
28dbdba37e
Merge pull request #3935 from Vexu/translate-c-2
...
Translate-c-2 the rest
2019-12-22 16:12:56 -05:00
Vexu
9d31b65b34
translate-c-2 various fixes
...
- make non-namespaced enums ints
- fix .used compound assignments not being grouped
- fix macro calls with casts producing invalid Zig
2019-12-22 14:38:06 +02:00
daurnimator
95c83388e4
std: use pid_t where appropriate
2019-12-22 20:20:58 +11:00
daurnimator
59348240d7
std: use wrappers from raise() rather than raw syscalls
2019-12-22 20:20:58 +11:00
daurnimator
6de4bd850c
std: add tkill and tgkill for linux
2019-12-22 20:20:58 +11:00
daurnimator
c31afc3736
std: remove high level linux sigprocmask wrappers
2019-12-22 20:20:58 +11:00
daurnimator
9577ff1c90
std: use simpler sigset_t definition
2019-12-22 20:20:53 +11:00
Jethro Nederhof
ba1d213f48
freebsd: add missing OS and libc bits
2019-12-22 02:27:23 -05:00
daurnimator
96c9c38b35
std: sigprocmask set is optional
2019-12-22 12:03:03 +11:00
Andrew Kelley
bc95c63cf2
Merge pull request #3940 from ziglang/sentinel-slicing
...
fix std.mem.addNullByte and implement sentinel slicing
2019-12-21 14:11:16 -05:00
Andrew Kelley
290dc5d95b
zig fmt support for slice sentinel syntax
2019-12-21 14:03:36 -05:00
Andrew Kelley
ce444771c5
fix incorrect @typeInfo for sentinels
2019-12-21 13:25:05 -05:00
Nathan Michaels
45339aec02
Fix wording on deinit.
2019-12-21 01:30:55 -05:00
Andrew Kelley
8d73703d52
fix safety for sentinel-slicing floats
2019-12-20 18:28:59 -05:00
Andrew Kelley
8918cb06fc
sentinel slicing improvements
...
* add runtime safety for slicing pointers, arrays, and slices.
* slicing without a sentinel value results in non-sentineled slice
* improved `std.debug.panic` handling of panic-during-panic
2019-12-20 18:28:59 -05:00
Andrew Kelley
26f3c2d061
fix std.mem.addNullByte and implement sentinel slicing
...
see #3770
2019-12-20 18:28:56 -05:00
Vexu
40f607d195
translate-c-2 fix macro regression
2019-12-20 22:48:40 +02:00
LemonBoy
51cbd96820
Fix sentinel value of opaque pointers in typeInfo
...
Fixes #3888
2019-12-20 15:48:34 -05:00
LemonBoy
f077c3c4cc
Fix comptime evaluation of runtime array access
...
Fix #3951
2019-12-20 15:47:43 -05:00
Andrew Kelley
9daa7e1e19
CI: update llvm apt sources to correct ubuntu version
...
In the pipelines.yml file we request Ubuntu 18.04 Bionic Beaver, but in
the script we were still using the Xenial apt.llvm.org sources.
2019-12-20 13:40:07 -05:00
Vexu
949f2369c1
translate-c-2 fix bugs found translating SDL
2019-12-20 20:22:22 +02:00
Vexu
9437d99ae2
translate-c-2 final small fixes
2019-12-20 18:51:44 +02:00
Vexu
e0046b737e
translate-c-2 improve macro escape sequences
2019-12-20 13:50:34 +02:00
Vexu
daeb939210
translate-c-2 fix switch range
2019-12-20 11:35:21 +02:00
Nathan Michaels
33b5dbb82c
Document std.Mutex.
...
Not sure what the build platform is for the generated documentation,
and it's worth thinking about how best to deal with this pattern. It
might be worth figuring out how to rewrite this to have a single
definition of the public API with the implementation chosen at compile
time.
2019-12-19 23:42:27 -05:00
Vexu
d172a7335c
translate-c-2 copy parametrs to stack
2019-12-20 00:12:08 +02:00
Vexu
b7f18164f9
translate-c-2 add missing casts
2019-12-19 21:30:51 +02:00
Vexu
61482be153
translate-c-2 improve macro fn ptr caller
2019-12-19 20:58:48 +02:00
Vexu
f837c7c9cd
translate-c-2 compound assign
2019-12-19 16:13:28 +02:00
Vexu
6cd402f1b4
translate-c-2 increments worst-case
2019-12-19 10:48:32 +02:00
Vexu
809deb6ec0
translate-c-2 unary operators common case
2019-12-19 09:56:00 +02:00
Vexu
e4c47e80b4
translate-c-2 unaryexprortypetrait + fixes
2019-12-19 08:28:36 +02:00
Vexu
122a9bad39
translate-c-2 fix some casts
2019-12-19 01:38:42 +02:00
Vexu
d54c288bd3
translate-c-2 function calls
2019-12-18 23:56:39 +02:00
Vexu
c2666c48a4
translate-c-2 array access
2019-12-18 22:57:53 +02:00
Vexu
cf7a5b7a4a
translate-c-2 member access
2019-12-18 22:29:42 +02:00
Vexu
e65b9e8f7b
translate-c-2 stmt expr
2019-12-18 21:20:38 +02:00
Vexu
62bfff5e87
translate-c-2 fix expression grouping bugs
2019-12-18 13:32:19 +02:00
Vexu
f54e7d6c99
translate-c-2 update @kavika13's work to removal of TransResult
2019-12-18 12:47:35 +02:00
Vexu
90eed4172d
Merge remote-tracking branch 'kavika13/master' into translate-c-2
2019-12-18 09:51:40 +02:00
Andrew Kelley
4d54e9a4fb
Merge pull request #3918 from kprotty/lock_fix
...
Synchronization primitive improvements
2019-12-17 20:04:02 -05:00
Vexu
21bc3353b8
translate-c-2 character literals and more test fixes
2019-12-18 01:04:01 +02:00
kprotty
c912296443
SpinLock: loopHint & yield distinction
2019-12-17 15:38:00 -06:00
kprotty
26e08d5701
ResetEvent: use futex on linux when possible
2019-12-17 15:38:00 -06:00
kprotty
ac5ba27c2b
Mutex: fix lock/spin bugs, improve perf slightly & more specialization
2019-12-17 15:38:00 -06:00
kprotty
e67ce444e7
ResetEvent: simpler interface + fix tests
2019-12-17 15:38:00 -06:00
kprotty
947db78622
Spinlock: remove Backoff & improve yielding
2019-12-17 15:38:00 -06:00
Vexu
6d7025d0c5
translate-c-2 various fixes to get more tests passing
2019-12-17 23:28:13 +02:00
LemonBoy
d8499f7abe
Make sure the fields array is always non-null
...
Fixes #3497
2019-12-17 15:45:22 -05:00
Nathan Michaels
f389e5e61f
Clarify allowzero's interaction with optional pointers.
2019-12-17 15:44:34 -05:00
Raul Leal
62c817420d
[ #3844 + #3767 ] update std.c and std.os.linux to use null-terminated pointer types ( #3900 )
...
* #3844 update std.c functions to use null-terminated pointer types
* check linux functions
* fix callsites
* fix io test
* Add allocPrintCstr function to remove other cast
2019-12-17 15:43:49 -05:00
Vexu
a6960b89ed
translate-c-2 fix container type resolution
2019-12-17 22:05:07 +02:00
Vexu
65531c73a9
translate-c-2 switch
2019-12-17 17:19:28 +02:00
Vexu
0283ab8a1a
translate-c-2 conditional operator
2019-12-17 12:06:28 +02:00
Vexu
daa22d42b0
translate-c-2 floats
2019-12-17 11:28:56 +02:00
Vexu
9cda93a24e
translate-c-2 don't shadow primitive types
2019-12-17 10:20:02 +02:00
Andrew Kelley
b242c2ac10
avoid using undefined value
...
closes #3933
2019-12-16 22:47:19 -05:00
Vexu
ab6fe57462
translate-c-2 for loops
2019-12-17 01:40:06 +02:00
Vexu
d54bcb2b62
translate-c-2 break and continue
2019-12-16 23:54:16 +02:00
Andrew Kelley
b1abe4a172
Revert "added -- to pass args to zig build commands"
...
This reverts commit d4e56ae6ae .
This broke the build
2019-12-16 16:36:42 -05:00
Dmitry Atamanov
744133acb1
Fixes utf8ToUtf16Le ( #3923 )
2019-12-16 16:27:26 -05:00
emekoi
d4e56ae6ae
added -- to pass args to zig build commands
2019-12-16 16:24:54 -05:00
Andrew Kelley
13cdc137e6
Merge pull request #3570 from ziglang/c-sanitize-undef
...
use -fsanitize=undefined for C code in safe build modes
2019-12-16 16:17:52 -05:00
LemonBoy
de0d8885b4
Fix alignment query on unresolved types
...
Fixes #3919
2019-12-16 15:54:06 -05:00
Vexu
6a3d48353b
translate-c-2 while loops
2019-12-16 22:10:17 +02:00
Andrew Kelley
839b3a61ad
expose the ability to disable C sanitization
...
and disable C sanitization when building libcs.
Empirically, they seem to trigger undef-sanitization.
2019-12-16 13:51:21 -05:00
Andrew Kelley
f8cd981c04
use -fsanitize=undefined for C code in safe build modes
...
closes #3569
2019-12-16 13:06:02 -05:00
Henry Wu
170de5ecae
generated docs: log trace instead of error
...
When the error occurred for getValueText it could potentially omit
useful documentation since the page stops rendering.
2019-12-16 12:40:38 -05:00
xackus
cb5a5ebb20
langref table of contents in a separate column on large displays
2019-12-16 12:25:56 -05:00
Andrew Kelley
b3cbf290c8
remove misleading documentation
2019-12-16 12:07:05 -05:00
Andrew Kelley
496f271d17
Merge branch 'shawnl-lessThan'
...
* always allow integer comparison operations no matter the
bit width, signedness, or comptime-ness of operands.
closes #2133
* implement comparisons for vectors, which returns vector of
bools.
closes #3001
2019-12-16 11:39:13 -05:00
Andrew Kelley
1cad0acc7e
add behavior test for vector comparison
2019-12-16 11:22:28 -05:00
Vexu
e3f1bfe483
translate-c-2 if statements
2019-12-16 18:19:37 +02:00
Vexu
626562555e
translate-c-2 wors-case assign
2019-12-16 18:19:37 +02:00
Vexu
d9527edfe0
translate-c-2 comma operator
2019-12-16 18:19:24 +02:00
Andrew Kelley
9468d63819
allow comparison of any numeric types
2019-12-16 11:09:10 -05:00
Lachlan Easton
fe0e8c87b7
Tokenizer: Copy optional tokens prior to being set to null #3737 ( #3910 )
...
* Tokenizer: Copy optional tokens prior to being set to null #3737
* Add TODO comments, reminder to audit copying optional pattern.
2019-12-16 11:01:02 -05:00
Andrew Kelley
0f09ff4923
Merge pull request #3916 from Vexu/translate-c-2
...
Translate-c-2 macros
2019-12-16 10:55:32 -05:00
Andrew Kelley
650acc5e3d
Merge pull request #3922 from LemonBoy/eventfd-err
...
More eventfd stuff
2019-12-16 10:45:09 -05:00
Vexu
04dc0bd0e4
translate-c-2 variable aliasing
2019-12-16 12:45:00 +02:00
LemonBoy
9d9b0720f5
Fix for the error codepath in ChildProcess
2019-12-16 10:57:29 +01:00
LemonBoy
c257f892fd
Revert "Revert "Use eventfd in ChildProcess on Linux""
...
This reverts commit 2c7a2aefbf .
2019-12-16 10:56:53 +01:00
Merlyn Morgan-Graham
0c03fe48b3
Fix compile errors after rebasing on master (missing switch->else)
2019-12-16 01:37:53 -08:00
Merlyn Morgan-Graham
89ef635b35
Add boolean and, boolean or binary ops in translate-c-2
2019-12-16 01:34:05 -08:00
Merlyn Morgan-Graham
acff2d407b
Add bit shift binary ops in translate-c-2
2019-12-16 01:34:04 -08:00
Merlyn Morgan-Graham
c8c89648b0
Add comparison and bitwise binary ops in translate-c-2
2019-12-16 01:34:04 -08:00
Vexu
a37caaa528
translate-c-2 parameter name aliasing
2019-12-16 10:39:31 +02:00
Shawn Landden
143603b39f
std: lessThan and greaterThan between signed and unsigned
...
It is a deviation from C, but I think we should consider making this the behavior
of the operators. See #2133
2019-12-16 01:41:26 -05:00
Andrew Kelley
2c7a2aefbf
Revert "Use eventfd in ChildProcess on Linux"
...
This reverts commit b169f7b0d5 .
This caused `integer cast truncated bits` at
std/child_process.zig:801:12
Can be reproduced on my machine simply by running `make`.
2019-12-16 01:39:41 -05:00
Vexu
620bf695e8
organize tests
2019-12-16 07:43:18 +02:00
Vexu
0f38410ea6
improve extern enum
2019-12-15 19:28:53 -05:00
Vexu
ab60c8e28f
c tokenizer escape sequences
2019-12-16 00:55:50 +02:00
Vexu
9f0e83a571
translate-c-2 macro functions
2019-12-15 23:46:35 +02:00
LemonBoy
59de23dfa0
Don't assume TLS storage has a fixed address
...
Fixes #3433
2019-12-15 16:23:42 -05:00
LemonBoy
b169f7b0d5
Use eventfd in ChildProcess on Linux
...
Closes #819
2019-12-15 14:43:37 -05:00
LemonBoy
f1407b4b7e
Generate the fn pointers into the correct address space
...
Fixes #3645
2019-12-15 14:42:53 -05:00
LemonBoy
19ddbd9e9e
Make sure the address is aligned for intToPtr ops
...
Closes #773
2019-12-15 14:41:05 -05:00
Vexu
ed2a19dcec
translate-c-2 macro cast
2019-12-15 21:32:30 +02:00
Vexu
57170f9eb6
translate-c-2 macro inline fn
2019-12-15 19:28:34 +02:00
Vexu
75218d4765
translate-c-2 macros
2019-12-15 14:44:11 +02:00
Vexu
c3724a6e72
translate-c-2 c tokenizer
2019-12-15 10:30:38 +02:00
Andrew Kelley
cf0d300dde
Merge pull request #3908 from Vexu/translate-c-2
...
Translate-c-2 enums
2019-12-14 21:13:42 -05:00
Vexu
e57e3602e7
translate-c-2 implement enums
2019-12-14 23:24:47 +02:00
Vexu
1a967db083
add default initializers to all ast.Node base values
2019-12-14 20:40:56 +02:00
Andrew Kelley
33d9dda558
Merge pull request #3906 from Vexu/translate-c-2
...
Translate-c-2 structs and unions
2019-12-14 13:12:39 -05:00
Vexu
1f84586836
translate-c-2 avoid collisions with zig keywords
2019-12-14 17:00:10 +02:00
Vexu
4dae70e702
translate-c-2 container aliases
2019-12-14 13:40:33 +02:00
Vexu
a4ac6d15c4
translate-c-2 array initializer expr
2019-12-14 10:49:25 +02:00
Vexu
e4ca1f441b
translate-c-2 record type
2019-12-14 02:00:01 +02:00
Andrew Kelley
21a85d4fb6
Merge pull request #3896 from Vexu/translate-c-2
...
Translate-c self-hosted var decl and remove translate mode
2019-12-13 15:48:10 -05:00
Vexu
45abfa9e71
revert removal of translate mode in stage 1
2019-12-13 19:06:32 +02:00
Vexu
41a67126a5
translate-c-2 typedef
2019-12-13 17:40:37 +02:00
Vexu
eb057ef41c
translate-c-2 dont eval init expr
2019-12-13 15:07:10 +02:00
Andrew Kelley
e54c49be9b
uncomment a now-passing behavior test
2019-12-12 19:45:33 -05:00
Andrew Kelley
1e4bae6692
update stack traces tests
2019-12-12 19:43:04 -05:00
Jonathan Marler
4cb4148b35
Document sentinel type in langref
2019-12-12 19:01:22 -05:00
Andrew Kelley
7699b5b997
Merge branch 'Xe-expose-callMain'
...
closes #3891
2019-12-12 18:56:39 -05:00
Andrew Kelley
fff3c1fff4
un-special-case startup code in the std lib
...
Previously, the compiler had special logic to determine whether to
include the startup code, which was in `std/special/start.zig`. Now,
the file is moved to `std/start.zig`, and there is no special logic
in the compiler. Instead, the standard library unconditionally imports
the `start.zig` file, which then has a `comptime` block that does the
logic of determining what, if any, start symbols to export. Instead of
`start.zig` being in its own special package, it is just another normal
file that is part of the standard library.
`std.builtin.TestFn` is now part of the standard library rather than
specially generated by the compiler.
2019-12-12 18:33:44 -05:00
Christine Dodrill
b37acc4d68
allow custom OS entrypoint
...
Also:
* Expose `std.start.callMain`.
* Other fixes added to fix issues found in development.
2019-12-12 16:00:23 -05:00
Andrew Kelley
81f1f72197
ci: skip non native tests for aarch64
...
We've been hitting timeouts on this service. Once zig build gains
parallel processing support, we can probably enable more tests.
2019-12-12 15:11:59 -05:00
Vexu
0795f17db2
translate-c-2 incompleteArray
2019-12-12 21:39:04 +02:00
Vexu
48ac84db1b
translate-c-2 translate apvalue
2019-12-12 20:35:40 +02:00
Vexu
c759a77aa0
fix dot init parsing
2019-12-12 13:06:48 -05:00
Vexu
3bca025091
update tests
2019-12-12 18:18:43 +02:00
Vexu
ef361161e2
translate-c-2 add var decl
2019-12-12 16:12:19 +02:00
Vexu
69dee57d95
remove concept of translate mode
2019-12-12 14:26:24 +02:00
Andrew Kelley
d08dc21116
Merge pull request #3886 from kavika13/master
...
Add function params, parens handling, and some infix operators to self-hosted translate-c
2019-12-11 18:40:35 -05:00
Christine Dodrill
b375f6e027
lib/std/io: let the bring-your-own OS package handle stdio ( #3887 )
2019-12-11 18:37:52 -05:00
Merlyn Morgan-Graham
12171dba92
Add function parameters to self-hosted translate-C
2019-12-10 23:52:40 -08:00
Merlyn Morgan-Graham
5e8186a8ce
Fix access of undefined field when calling ast.Tree.dump
2019-12-10 23:52:40 -08:00
Merlyn Morgan-Graham
fe415dae04
Add paren expression statements to self-hosted translate-C
2019-12-10 23:52:40 -08:00
Merlyn Morgan-Graham
3e4f5de33c
Add rem binary operator to self-hosted translate-C
2019-12-10 23:52:40 -08:00
Merlyn Morgan-Graham
79fe7e6515
Add mul and div binary operators to self-hosted translate-C
2019-12-10 23:52:40 -08:00
Andrew Kelley
7c1dbfab72
self-hosted: manually parse args
2019-12-11 02:08:33 -05:00
Andrew Kelley
c3d8b1ffeb
remove iterator API from std.ArrayList
...
This is not a meaningful abstraction. Use a for loop on the result
of `toSlice` or `toSliceConst`.
An iterator can be implemented on top of ArrayList by applications which
want additional functionality, such as removing elements while
iterating.
Closes #3037 .
2019-12-10 15:08:10 -05:00
frmdstryr
f30af12bea
Add hotpath for BufferedOutStream ( #3858 )
...
* Add hotpath for BufferedOutStream
2019-12-10 13:44:59 -05:00
Heppokoyuki
5ada11449a
fix con_in difinition and add EFI_SIMPLE_TEXT_INPUT_PROTOCOL difinition
2019-12-10 13:25:28 -05:00
Andrew Kelley
0d99744acc
Merge branch 'emekoi-dynlib-load'
...
closes #2598
2019-12-10 13:24:01 -05:00
Andrew Kelley
fdc3132126
fix windows dynamic lib loading test
2019-12-10 13:21:37 -05:00
Andrew Kelley
3ef8460d06
fix load dynamic library API when linking libc
2019-12-10 12:56:05 -05:00
Andrew Kelley
80882bda59
load dynamic library test: update API usage code
2019-12-10 12:48:10 -05:00
Andrew Kelley
fd6b7b160d
improve dynamic library API
2019-12-10 12:28:28 -05:00
emekoi
29fd727b79
fixed windows dynamic library loading and added loading for darwin
2019-12-10 11:41:54 -05:00
Andrew Kelley
9561e7c6b9
Merge branch 'Snektron-typeOf-to-TypeOf'
...
closes #3875
closes #1348
2019-12-10 11:13:39 -05:00
Robin Voetter
30715560c8
Rename @typeOf to @TypeOf in the language reference
2019-12-10 11:09:41 -05:00
Robin Voetter
8c096707b7
Additional replacements of @typeOf with @TypeOf
2019-12-10 11:09:41 -05:00
Robin Voetter
4b4fbe3887
Replace @typeOf with @TypeOf in all zig source
...
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
Robin Voetter
f0ee0688f2
Replace typeOf with TypeOf in stage0
2019-12-10 11:09:30 -05:00
Robin Voetter
c519bb02df
Fix usage of freed memory in zig fmt
2019-12-10 11:09:29 -05:00
Robin Voetter
d568db2386
Remove misplaced dot
2019-12-10 11:09:29 -05:00
Robin Voetter
23b901d45a
Add typeOf/TypeOf render test
2019-12-10 11:09:29 -05:00
Robin Voetter
20a3011def
Add typeOf/TypeOf substition in zig fmt
2019-12-10 11:09:29 -05:00
Andrew Kelley
cd4d638d10
Merge pull request #3830 from fengb/wasm-page-allocator
...
WasmPageAllocator
2019-12-10 10:58:50 -05:00
xackus
c27d06596b
fix integers parsed as floats
2019-12-10 10:30:41 -05:00
dbandstra
3388c777fa
print call in build.zig needs to use a tuple argument
2019-12-10 10:18:57 -05:00
Andrew Kelley
2a7103ca34
ci: update macos to fresh llvm+clang tarball cache
2019-12-10 01:32:45 -05:00
Andrew Kelley
e6c01e49d8
remove no-longer-needed workaround for var args
...
See #557
2019-12-09 16:21:16 -05:00
Andrew Kelley
a3f6a58c77
remove var args from the language
...
closes #208
2019-12-09 15:27:27 -05:00
Andrew Kelley
f205d23e65
implement async function call with @call
...
this removes the last usage of var args in zig std lib
2019-12-09 15:27:26 -05:00
Andrew Kelley
69b587c1d3
add regression cases for now-passing tests
...
closes #2749
2019-12-09 15:23:51 -05:00
Andrew Kelley
5d82744f1c
ability to give comptime and non-comptime types to same parameter
2019-12-09 13:30:53 -05:00
Andrew Kelley
640e09183d
Merge pull request #3873 from ziglang/format-no-var-args
...
std.fmt.format: tuple parameter instead of var args
2019-12-09 10:51:47 -05:00
Andrew Kelley
8b3c0bbeee
update docgen to new format API
2019-12-09 00:18:01 -05:00
Andrew Kelley
d571fad20e
update tests to new format API
2019-12-09 00:05:21 -05:00
Andrew Kelley
03396b3caa
update docs to new fmt API
2019-12-08 23:46:50 -05:00
Andrew Kelley
5f9467d78f
update formatted printing when linking libc
2019-12-08 23:39:30 -05:00
Andrew Kelley
7a4f704258
windows-specific fixes
2019-12-08 23:26:19 -05:00
Andrew Kelley
fe4963412f
update self-hosted compiler to new format API
2019-12-08 23:17:03 -05:00
Andrew Kelley
8b2622cdd5
std.fmt.format: tuple parameter instead of var args
2019-12-08 22:53:51 -05:00
Andrew Kelley
5874cb04bd
implement tuple concatenation
2019-12-08 22:44:41 -05:00
Benjamin Feng
608d36ad8c
Rewrite WasmPageAllocator tests to be less flaky on environment
2019-12-08 21:22:07 -06:00
Andrew Kelley
6504c5098e
tuple detection does not require AST node
2019-12-08 18:39:52 -05:00
LemonBoy
d5e788072d
Make array types (quasi-)lazy
...
Fixes #3843
2019-12-08 17:29:59 -05:00
Andrew Kelley
1cb19d1a46
fix anon struct literal field initialized with fn call
2019-12-08 17:28:34 -05:00
emekoi
c2342dab0b
fixed BREAKPOINT macro on mingw
2019-12-08 17:18:44 -05:00
Andrew Kelley
d57370d3ca
Merge branch 'comptime-fields'
...
closes #3677
2019-12-08 12:27:02 -05:00
Andrew Kelley
64d700bfa6
zig fmt: support comptime fields
2019-12-08 12:26:20 -05:00
Andrew Kelley
fe8d65556d
add syntax for comptime struct fields
2019-12-08 12:26:20 -05:00
Andrew Kelley
119ed128c0
implement comptime struct fields
2019-12-08 12:26:20 -05:00
LemonBoy
19c1b5a33a
Fix for @Type not picking up the sentinel value
...
The code converted the whole TypeInfo payload into an optional type
instead of using the "sentinel" field value.
Fixes #3828
2019-12-08 10:28:29 -05:00
Josh Wolfe
05fc4d34a9
documentation for mutable HashMap KV pointers
2019-12-07 13:22:23 -05:00
Andrew Kelley
edebe0586b
remove compile error for peer result comptime_int and null
...
closes #2763
2019-12-07 13:03:43 -05:00
Benjamin Feng
e91522b875
Add back comptime check for wasm
2019-12-06 17:27:11 -06:00
Andrew Kelley
ecb77af534
add regression test for fixed bug
...
closes #3742
2019-12-06 17:20:27 -05:00
data-man
80a72c225c
Crypto benchmark fixes
2019-12-06 17:14:10 -05:00
data-man
008e42f483
getStdOut fixes
2019-12-06 16:41:02 -05:00
Benjamin Feng
5a004ed834
Actually use const conventional as the comment indicates
2019-12-06 15:16:07 -06:00
Andrew Kelley
525b1e8fb4
Merge pull request #3856 from ziglang/builtin-call
...
introduce `@call` and remove other builtin calls
2019-12-06 15:49:47 -05:00
Andrew Kelley
656cc33f8d
allow calling with a new stack to regress a bit
...
Calling with a new stack, with a runtime-known stack pointer (e.g.
not a global variable) is regressed with this branch. It is now a
compile-error, due to the Runtime Hint system not being smart enough
to mix a compile-time modifier field with a runtime stack field.
I'm OK with this regression because this feature is flawed (see #3268 )
and may be deleted from the language.
2019-12-06 15:25:00 -05:00
Andrew Kelley
71b7f4b47f
remove @newStackCall from zig
2019-12-06 14:52:09 -05:00
Andrew Kelley
343987cd05
remove @inlineCall from zig
2019-12-06 14:12:01 -05:00
Andrew Kelley
d28aa38db7
Merge branch 'LemonBoy-fix-3842'
...
closes #3855
closes #3842
2019-12-06 12:28:26 -05:00
Andrew Kelley
b1895da9b8
add behavioral test case for previous commit
2019-12-06 12:27:56 -05:00
LemonBoy
f64cff3e16
Fix misinterpretation of sentinel constant value
...
Fixes #3842
2019-12-06 12:27:52 -05:00
Andrew Kelley
e41495de9d
private linkage for unnamed internal constants
2019-12-05 23:13:42 -05:00
Benjamin Feng
eb495d934b
Add WasmPageAllocator tests
2019-12-05 21:54:57 -06:00
Andrew Kelley
105ef560b3
Merge pull request #3853 from xackus/doc-fixes
...
Docs: assembly example printing garbage and minor html fixes
2019-12-05 20:43:10 -05:00
Benjamin Feng
f2b0dbea74
Resolve tests to work with or skip WasmPageAllocator
2019-12-05 19:31:49 -06:00
Benjamin Feng
694616adb5
Standardize around bigger slices
2019-12-05 18:43:51 -06:00
Benjamin Feng
7d1c4fe4dc
Switch bitmask to enums
2019-12-05 18:01:49 -06:00
Andrew Kelley
ef83358eb6
remove @noInlineCall from zig
2019-12-05 17:37:29 -05:00
Andrew Kelley
1f602fe8c5
implement @call
...
closes #3732
2019-12-05 17:07:15 -05:00
xackus
cb96a096cb
docs: fix duplicate closing tag generation
2019-12-05 22:56:56 +01:00
xackus
71354498c9
docs: add html lang and minor fixes
2019-12-05 22:40:58 +01:00
xackus
ba78d71b09
docs: fix assembly example
2019-12-05 22:40:47 +01:00
Vexu
bfb15f1c9f
fix casts
2019-12-05 15:47:06 -05:00
frmdstryr
1baaf9a503
Increase io.BufferedInStream readByte speed by ~75%
2019-12-05 10:16:50 -05:00
Andrew Kelley
8829b5316b
Merge pull request #3849 from Vexu/fix-fmt
...
Fix zig fmt c pointer return type
2019-12-05 10:14:31 -05:00
Vexu
d40ad92668
use enum literals in render.zig
2019-12-05 14:50:51 +02:00
Vexu
10cc8cad86
fix zig fmt of c pointers
2019-12-05 14:50:46 +02:00
Benjamin Feng
30da6d49f4
Fix freeing memory across bounds
2019-12-04 22:43:02 -06:00
Benjamin Feng
86ae75363e
Strip out an unnecessary memset
2019-12-04 21:41:01 -06:00
Benjamin Feng
5784985bb8
Use raw PackedIo to shave ~150b
2019-12-04 21:22:36 -06:00
Benjamin Feng
a910a6c871
Rejuggle how offsets are calculated
2019-12-04 18:12:25 -06:00
Andrew Kelley
bef3769bb7
std.fmt.ParseUnsignedError is now public
2019-12-04 18:44:22 -05:00
Andrew Kelley
10e172b1d7
add other OS and fix regression in build-exe for freestanding
2019-12-04 14:42:40 -05:00
Andrew Kelley
44e896f613
Merge pull request #3844 from Snektron/sort-improvements
...
Small sort improvements
2019-12-04 14:25:00 -05:00
Vexu
137cb32f5e
add docs for function parameters
2019-12-04 14:14:47 -05:00
Robin Voetter
841a37ab59
Add std.sort.argMax and std.sort.argMin
2019-12-04 18:20:55 +01:00
Robin Voetter
0159fa284a
Make std.sort.min and std.sort.max return ?T
2019-12-04 18:10:20 +01:00
Robin Voetter
65f57e4499
Make std.sort.max accept const slices and add tests
2019-12-04 16:42:18 +01:00
Robin Voetter
6bb0ee0bc4
Add std.sort.isSorted
2019-12-04 16:41:32 +01:00
Benjamin Feng
a6f838aab2
Remove redundant alloc
2019-12-04 00:10:37 -06:00
Benjamin Feng
01e73bba8d
Tighten recycled search
2019-12-04 00:08:09 -06:00
Benjamin Feng
baffaf7986
Extract setBits
2019-12-04 00:07:52 -06:00
Benjamin Feng
b33211ed51
Implement block-based skipping
2019-12-03 17:24:50 -06:00
Andrew Kelley
38791ac616
Merge branch 'Vexu-build-start'
...
closes #3810
closes #3793
closes #3798
2019-12-03 17:26:26 -05:00
Andrew Kelley
521744bb91
correct the calling convention of WinMainCRTStartup
2019-12-03 16:55:27 -05:00
Andrew Kelley
e3ebaab3c7
fix zig builtin
2019-12-03 13:57:13 -05:00
Andrew Kelley
8db4d2332e
correct startup logic for exporting libc main
2019-12-03 13:10:26 -05:00
Andrew Kelley
a91f552393
WinMainCRTStartup implies defaulting to console subsystem
2019-12-03 12:52:28 -05:00
Andrew Kelley
6a046c1bcd
activate start code when pub main exists
...
and rename LinkType->LinkMode, OutType->OutputMode
2019-12-03 12:50:42 -05:00
Vexu
ffd21c586d
fix tests
2019-12-03 12:50:42 -05:00
Vexu
621c08e692
exported main must be pub
2019-12-03 12:50:42 -05:00
Vexu
20bcdab462
correct caching and add test for missing fn name
2019-12-03 12:50:41 -05:00
Vexu
a0ca30ce01
move more startup code to std lib
2019-12-03 12:50:18 -05:00
LemonBoy
fd7c7be33c
Pick up WinMain with proper CC
2019-12-03 12:49:08 -05:00
Andrew Kelley
0d48b60794
Merge pull request #3837 from yvt/patch-as
...
Replace the remaining uses of the legacy cast syntax with `@as`
2019-12-03 10:26:07 -05:00
yvt
29f25cf059
Update process_headers.zig to use @as
2019-12-03 20:05:07 +09:00
yvt
3c6c317424
Update the docs to use @as
2019-12-03 19:56:50 +09:00
Benjamin Feng
45e0441278
Fix bugs
2019-12-02 22:04:09 -06:00
LemonBoy
26c8930b95
Accept comptime-known expression for asm
2019-12-02 19:53:06 -05:00
Andrew Kelley
b7be57766b
Merge pull request #3715 from daurnimator/towards-afd
...
Misc windows additions+fixes
2019-12-02 16:12:55 -05:00
Andrew Kelley
55202a021a
add missing license files
2019-12-02 16:02:03 -05:00
Andrew Kelley
6a36c549a8
add extra LICENSE file for clarification
2019-12-02 15:11:11 -05:00
Andrew Kelley
ad214c7aa0
bring your own OS layer in the std lib
...
closes #3784
2019-12-02 15:02:17 -05:00
Andrew Kelley
dcbd5ad155
remove upstream support for Zen hobby OS
...
The new plan to support hobby operating systems is #3784 .
And what kind of name is "Zen" anyway? There's already a
[Zen programming language](http://zenlang.sourceforge.net/ )
and that's just confusing.
2019-12-02 12:01:49 -05:00
Benjamin Feng
f32555aa08
Work around __heap_base for now
2019-12-02 09:59:20 -06:00
Benjamin Feng
ba38a6d122
Get stuff vaguely working
2019-12-02 09:59:20 -06:00
Benjamin Feng
eb1628b033
Initialize memory segments
2019-12-02 09:59:20 -06:00
Benjamin Feng
eff926b454
Brain dump new wasm allocator
2019-12-02 09:59:20 -06:00
Andrew Kelley
fc1373a85d
ci: update sr.ht to use alpine/latest, more reliable
2019-12-02 10:48:12 -05:00
Andrew Kelley
b6127b0fe9
add some null-termination annotations
...
closes #3797
2019-12-02 01:13:46 -05:00
Andrew Kelley
6d8550a7df
fix crash assigning optional struct with anon literal
...
closes #3827
2019-12-02 01:09:06 -05:00
Andrew Kelley
fecd540826
Merge pull request #3787 from ziglang/remove-array-type-coercion
...
Remove array type coercion and fix result location bugs
2019-12-02 00:03:41 -05:00
Andrew Kelley
e7ee6647a1
fix invalid check for fn_inline property
2019-12-01 23:56:28 -05:00
Andrew Kelley
3644e85091
fix regressions on windows
2019-12-01 21:31:00 -05:00
Andrew Kelley
37caa56fbc
fix docs regressions
2019-12-01 21:27:55 -05:00
Andrew Kelley
c32e50f505
fix regressions in compile error tests
2019-12-01 20:53:24 -05:00
Andrew Kelley
4af5c38674
fixes for self-hosted compiler
2019-12-01 19:22:03 -05:00
Andrew Kelley
080316cd4f
fix assigning to an unwrapped optional field in an inline loop
2019-12-01 18:55:35 -05:00
Andrew Kelley
c2cee40aec
add advanced IR debugging support
...
and use it to improve copy_const_val with regards to parent backrefs
2019-12-01 17:09:11 -05:00
Andrew Kelley
8524404f71
this test isn't passing in master branch either
2019-12-01 16:39:30 -05:00
Andrew Kelley
78811ff4ac
Merge remote-tracking branch 'origin/kill-ConstGlobalRefs' into remove-array-type-coercion
2019-12-01 09:58:32 -05:00
Andrew Kelley
b36c07a95a
Merge remote-tracking branch 'origin/master' into remove-array-type-coercion
2019-12-01 09:56:01 -05:00
Andrew Kelley
4b6740e19d
sometimes free stuff from Zig IR pass 1
...
Total bytes used in stage1 std lib tests:
3.418 -> 3.198 GiB (saving 225 MiB)
There's still this from pass 1 not getting freed:
Const: 6909049 items, 72 bytes each, total 474.407 MiB
This is due to 2 things hanging on to references to IrAnalyze pointers:
* ZigVar->owner_exec->analysis
* LazyValue->ira
The LazyValue one could be solved by memoizing the results after the
lazy value is resolved, and then it could unref the IrAnalyze.
ZigVars that are determined to be comptime const, could have their
const_value set to that value, instead of using the mem_slot_index
mechanism. This would prevent an IrAnalyze ref in some cases.
2019-12-01 01:13:21 -05:00
Andrew Kelley
b5df18c8fd
inline ConstGlobalRefs into ZigValue
...
Having ConstGlobalRefs be a pointer in ZigValue was a hack that caused
plenty of bugs. It was used to work around difficulties in type coercing
array values into slices.
However, after #3787 is merged, array values no longer type coerce into
slices, and so this provided an opportunity to clean up the code.
This has the nice effect of reducing stage1 peak RAM usage during the
std lib tests from 3.443 GiB to 3.405 GiB (saving 39 MiB).
There is one behavior test failing in this branch, which I plan to debug
after merging #3787 .
2019-12-01 00:29:16 -05:00
Andrew Kelley
5026b1aad5
free IrAnalyze sometimes
...
Total bytes used in stage1 std lib tests:
3.443 GiB -> 3.418 GiB
2019-11-30 23:57:48 -05:00
Andrew Kelley
951dc451d6
Merge pull request #3808 from LemonBoy/i386-for-ya
...
linux-i386 support
2019-11-30 22:00:00 -05:00
Andrew Kelley
11b8d3ce9d
Merge branch 'std.fs.File'
2019-11-30 18:37:00 -05:00
Andrew Kelley
2e7350140d
further clarify std.fs function docs
2019-11-30 18:36:47 -05:00
Andrew Kelley
034ccb4e4e
add missing error code handling on Windows
2019-11-30 16:58:32 -05:00
LemonBoy
cdeafe777a
Eat shit and die mips
2019-11-30 21:36:16 +01:00
Andrew Kelley
413f9a5cfc
move std.fs.Dir.cwd to std.fs.cwd
...
update to non-deprecated std.fs APIs throughout the codebase
Related: #3811
2019-11-30 15:35:27 -05:00
LemonBoy
6f105b5ae7
Implement target_dynamic_linker for mips
2019-11-30 21:14:32 +01:00
Andrew Kelley
d039fed831
introduce std.fs.Dir.openFile and std.fs.Dir.createFile
...
These functions have flags parameters which cover all the use cases. The
other functions are now deprecated.
2019-11-30 13:32:11 -05:00
LemonBoy
d0c6728d59
Eat shit and die glibc
2019-11-30 18:55:22 +01:00
LemonBoy
e1e06e6766
linux-i386 support
2019-11-30 16:13:33 +01:00
Andrew Kelley
85e1e3b95f
Merge pull request #3284 from Sahnvour/export_variables
...
Improved support for exporting variables
2019-11-30 00:25:52 -05:00
Andrew Kelley
b220be7a33
more test regression fixes
2019-11-29 23:04:19 -05:00
Andrew Kelley
f980c29306
fix typo in error note for integer casting
2019-11-29 22:33:55 -05:00
Andrew Kelley
d87b13f2f7
fix windows std lib regressions
2019-11-29 21:55:27 -05:00
Andrew Kelley
6936243ee1
fix self-hosted compiler regressions
2019-11-29 21:49:08 -05:00
Andrew Kelley
7278c51ddd
fix empty result location for parameters not working
2019-11-29 21:36:12 -05:00
Andrew Kelley
559bd27b08
fix @bitCast result coercing to error union by returning
2019-11-29 19:58:00 -05:00
Andrew Kelley
815b4cfd9d
fix return result loc as peer result loc in inferred error set function
2019-11-29 18:21:21 -05:00
Andrew Kelley
a438a615e6
docs: this statement was in the wrong section
2019-11-29 12:41:07 -05:00
Andrew Kelley
2ab7f31e99
std.math: remove constants that should be expressions
...
All four of these can be represented in fewer characters with
expressions, which will be guaranteed to happen at compile-time, and
have the same or better precision.
The other math constants here which depend on function calls could be
similarly removed if and when #425 is solved. However I left them for
now since Zig does not eagerly evaluate functions with comptime parameters.
2019-11-29 10:48:46 -05:00
Andrew Kelley
bcdb3a9006
more progress
2019-11-28 00:02:53 -05:00
Quetzal Bradley
a6c9c5f767
implement correct buffer wrapping logic in std.event.Channel
2019-11-27 23:09:24 -05:00
Michael Dusan
ca61a5f0b7
Windows: fix test/standalone/shared_library
...
- on Windows use first found env var { "Path", "PATH" }
Bug Description: `build test` results in the following error on in
a msys64 shell with "PATH" env var instead of "Path":
error while loading shared libraries: mathtest.dll:
cannot open shared object file: No such file or directory
2019-11-27 19:24:06 -05:00
Felix Queißner
f0d6447569
Implements std.testing.expectEqual for tagged unions. ( #3773 )
2019-11-27 16:35:32 -05:00
Andrew Kelley
0f2a9af4aa
Merge pull request #3769 from MCRusher/initcapacity-for-buffer-arraylist
...
Add initCapacity for buffer & arraylist
2019-11-27 13:40:39 -05:00
Andrew Kelley
83c664eaa0
Merge pull request #3780 from Vexu/stage2-async-review
...
Update use of async functions in self hosted compiler
2019-11-27 13:38:49 -05:00
Andrew Kelley
bf3ac66150
remove type coercion from array values to references
...
* Implements #3768 . This is a sweeping breaking change that requires
many (trivial) edits to Zig source code. Array values no longer
coerced to slices; however one may use `&` to obtain a reference to
an array value, which may then be coerced to a slice.
* Adds `IrInstruction::dump`, for debugging purposes. It's useful to
call to inspect the instruction when debugging Zig IR.
* Fixes bugs with result location semantics. See the new behavior test
cases, and compile error test cases.
* Fixes bugs with `@typeInfo` not properly resolving const values.
* Behavior tests are passing but std lib tests are not yet. There
is more work to do before merging this branch.
2019-11-27 03:37:50 -05:00
Vexu
4d8a8e65df
add more workarounds
2019-11-27 10:17:37 +02:00
Andrew Kelley
63300a21dd
Merge branch 'kprotty-event_lock'
...
closes #3751
2019-11-26 21:08:25 -05:00
daurnimator
8a71f77c4a
std: lie about windows socklen_t signed-ness
2019-11-27 13:01:34 +11:00
daurnimator
edc84e7ef7
std: add more winsock functions
2019-11-27 13:01:33 +11:00
daurnimator
19f26578c0
std: windows sockaddr constants come from ws2_32
2019-11-27 13:01:32 +11:00
daurnimator
8aa3d6019c
std: add windows.USHORT definition
2019-11-27 13:01:30 +11:00
daurnimator
254c79125b
std: fix WSAIoctl definition
...
zig automatically passes functions as pointers
2019-11-27 13:01:28 +11:00
daurnimator
d99f0a2b8f
std: IO_STATUS_BLOCK's status member is an NTSTATUS; add union
2019-11-27 13:01:10 +11:00
daurnimator
1537d4701e
std: fix definition of NtDeviceIoControlFile
2019-11-27 13:01:09 +11:00
daurnimator
a453c99ba9
std: add comments for some nt status codes
2019-11-27 13:01:08 +11:00
daurnimator
2c6788d7de
std: add windows.closesocket
2019-11-27 13:01:07 +11:00
daurnimator
6b5b0e6cd6
std: fix windows.GetOverlappedResult
2019-11-27 13:01:05 +11:00
daurnimator
ce9966a39b
std: improved windows.DeviceIoControl
2019-11-27 13:01:04 +11:00
daurnimator
b05a5a3e52
std: add CreateEvent for windows
2019-11-27 13:01:03 +11:00
daurnimator
78c0d33eb7
std: add WaitForMultipleObjects for windows
2019-11-27 13:01:02 +11:00
daurnimator
21ca54f560
std: add alertable argument for windows.WaitForSingleObject
2019-11-27 13:00:59 +11:00
kprotty
ff445814cb
remove wait timeout test cases
2019-11-26 20:40:28 -05:00
kprotty
056b5a26c9
ResetEvent: get abstime based on std.time
2019-11-26 20:40:28 -05:00
kprotty
ca2d566ec8
replace ThreadParker with ResetEvent + WordLock mutex
2019-11-26 20:40:27 -05:00
kprotty
a0955990dc
fix ResetEvent windows bugs
2019-11-26 20:40:04 -05:00
kprotty
ef208fee3c
Definition fixups & ResetEvent test cases
2019-11-26 20:40:04 -05:00
kprotty
9bce97a479
Start on ResetEvent
2019-11-26 20:40:04 -05:00
Andrew Kelley
8ecd6c4d8c
add compiler note for bad int coercion
...
closes #3724
2019-11-26 19:50:52 -05:00
syscall0
a6ef83cccf
Fix build system crash when compiling windows dll
2019-11-26 15:40:31 -05:00
Vexu
0d55075de4
fix command functions not being async pointers
2019-11-26 22:38:05 +02:00
Vexu
798d05dd02
add workaround for #3190
2019-11-26 22:11:04 +02:00
Vexu
379d547603
add missing cast to generic function call result
2019-11-26 14:32:37 -05:00
Vexu
0e405c5fc5
add missing cast to call result type
2019-11-26 14:32:34 -05:00
Andrew Kelley
7de138ad7c
std.elf: breaking improvements to the API
...
and also integration with std.Target.Arch
2019-11-26 14:25:35 -05:00
Benjamin Feng
aca1367533
Optimize binary search algorithm
2019-11-26 13:09:58 -05:00
Vexu
128034481a
solve recursion in self hosted
2019-11-26 18:25:29 +02:00
Vexu
36849d8a7b
fixes and cleanup in self hosted
2019-11-26 11:52:12 +02:00
Andrew Kelley
76f21852f6
Merge branch 'gereeter-o_path'
...
closes #3743
2019-11-25 23:46:59 -05:00
Jonathan S
ec569ff26a
Or in O_DIRECTORY in openDirFlagsC to capture the fact that it is intended for opening directories
2019-11-25 23:46:48 -05:00
Jonathan S
8baf226d69
Add missing shortening of os.windows.
2019-11-25 23:46:48 -05:00
Jonathan S
4014a8e4b4
Avoid deprecated cwd-based functions for opening directories, preferring to open explicitly relative to Dir.cwd().
2019-11-25 23:46:48 -05:00
Jonathan S
001334266a
Don't pass FILE_LIST_DIRECTORY in openDirTraverseW.
2019-11-25 23:46:48 -05:00
Jonathan S
51c5740879
Use a specific access mask in Dir.openDirListW instead of a generic one. Untested.
...
The actual desired access mask in this case seems quite confusing and badly documented. The previous combination of `GENERIC_READ` and `SYNCHRONIZE` seems both illegal and redundant according to the [`ntifs.h` documentation](https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-ntcreatefile ), which specifies that `GENERIC_READ` should not be used for directories and includes `SYNCHRONIZE`. `winnt.h` contains a number of relevant-sounding flags such as `FILE_ADD_FILE`, `FILE_ADD_SUBDIRECTORY`, and `FILE_DELETE_CHILD` that do not show up in documentation at all. These are equal in value to file-specific flags that are documented as flags you should not specify when opening a directory.
2019-11-25 23:46:47 -05:00
Jonathan S
07120c8745
Use O_PATH where available in std.fs.Dir.openPathTraverse.
2019-11-25 23:46:47 -05:00
Jonathan S
17bc1f62a5
Split std.fs.Dir.openDir into openDirList and openDirTraverse to clarify what directories can be iterated. Closes ziglang/zig#3741 .
...
The Windows-inspired nomenclature of "List" and "Traverse" was chosen over POSIX-style "Read" and "Path" (from `O_PATH`) for clarity. Using "Path" makes it look like the function is manipulating strings, and the generic "Read" ending isn't useful when there is no generic read method. Even in implementation details, `read` is never used.
Actual exploitation of the difference between the two functions will come in a later commit.
2019-11-25 23:46:47 -05:00
Michael Dusan
f96d818770
Merge pull request #3776 from mikdusan/stage1-intern-housekeeping
...
stage1: fix bad intern counting
2019-11-25 23:12:55 -05:00
daurnimator
c0cb676745
std: refactor std/debug.zig DwarfInfo operations to be methods
2019-11-25 22:49:46 -05:00
Michael Dusan
d20df7df09
stage1: fix bad intern counting
2019-11-25 20:41:17 -05:00
Andrew Kelley
f8a2dec243
docs: update references to wasm_allocator
2019-11-25 19:30:41 -05:00
Michael Dusan
6b7e1085e3
Merge pull request #3774 from mikdusan/stage1-intern-housekeeping
...
stage1: consolodate interning
2019-11-25 19:19:32 -05:00
Michael Dusan
fe254ea309
stage1: avoid building empty memory_profiling.cpp
...
During build an empty .o on macOS/Xcode emits warning:
ranlib: file: zig_cpp/libcompiler.a(memory_profiling.cpp.o) has no symbols
ranlib: file: zig_cpp/libcompiler.a(memory_profiling.cpp.o) has no symbols
2019-11-25 19:08:36 -05:00
Andrew Kelley
80f79cc9e8
Merge branch 'fengb-wasi-run-tests'
...
closes #3730
2019-11-25 18:46:35 -05:00
Andrew Kelley
4261fa3c49
move logic to the appropriate layers; add new compile error
2019-11-25 18:46:17 -05:00
Andrew Kelley
659c1bdeee
Merge branch 'wasi-run-tests' of https://github.com/fengb/zig into fengb-wasi-run-tests
2019-11-25 17:53:26 -05:00
Andrew Kelley
cb38bd0a14
rename std.heap.direct_allocator to std.heap.page_allocator
...
std.heap.direct_allocator is still available for now but it is marked
deprecated.
2019-11-25 17:25:06 -05:00
Michael Dusan
6c89f96df1
stage1: consolodate interning
...
- merge const_void_val → intern.x_void
- move const_zero_byte → intern.zero_byte
- wrap intern access
2019-11-25 17:18:56 -05:00
Andrew Kelley
35d65cceb8
Merge pull request #3502 from mikdusan/stage1-mem-diet
...
unembed ConstExprValue from IrInstruction and intern 1-possible-value types
2019-11-25 16:01:13 -05:00
Michael Dusan
a647a88dfc
const interning for 1-possible-value types
2019-11-25 15:04:49 -05:00
Michael Dusan
8f3e972da6
unembed ZigValue from IrInstruction
2019-11-25 15:04:39 -05:00
Michael Dusan
acd95546b7
rename ConstExprValue → ZigValue
2019-11-25 15:04:29 -05:00
Andrew Kelley
6b241d7b5d
ci: --no-mime-magic
2019-11-25 14:58:45 -05:00
Andrew Kelley
bdf3680be1
zig fmt
2019-11-25 13:53:13 -05:00
Andrew Kelley
8a4c2d3b07
zig fmt fixes for sentinel-terminated pointers
...
closes #3771
2019-11-25 13:53:06 -05:00
Andrew Kelley
a061ef42c1
Merge pull request #3761 from Vexu/event.fs
...
Update event.fs to new event loop
2019-11-25 12:31:23 -05:00
Vexu
7dba5ea9cf
update event.fs.watch
2019-11-25 17:57:44 +02:00
Andrew Kelley
5a98dd42b3
Merge pull request #3728 from ziglang/null-terminated-pointers
...
sentinel-terminated pointers
2019-11-25 02:20:08 -05:00
daurnimator
69b780647a
std: update for linux 5.4
2019-11-25 02:07:23 -05:00
Andrew Kelley
321726465d
fix freebsd regression
2019-11-25 02:00:47 -05:00
Andrew Kelley
d2cb740dd9
add missing null terminator in windows file path helper function
2019-11-25 01:10:30 -05:00
Andrew Kelley
29e438fd1f
more sentinel-terminated pointers std lib integration
...
See #3767
2019-11-25 00:43:36 -05:00
Andrew Kelley
15d415e10b
make std.mem.toSlice use null terminated pointers
...
and fix the fallout
2019-11-24 21:21:05 -05:00
Andrew Kelley
34b1ebefaa
Merge remote-tracking branch 'origin/master' into null-terminated-pointers
2019-11-24 20:28:46 -05:00
Andrew Kelley
b9f88c3552
fix compile errors for array sentinels mismatching
2019-11-24 20:25:14 -05:00
Andrew Kelley
ce96323ba1
update cli test
2019-11-24 19:24:52 -05:00
Andrew Kelley
7eb5acdc80
fix casting [N:x]T to [N]T memcpying too many bytes
2019-11-24 18:57:07 -05:00
Andrew Kelley
217a5090ff
fix compile error regressions
2019-11-24 18:10:31 -05:00
Andrew Kelley
8309b6188d
Merge pull request #3644 from daurnimator/bytefifo
...
Improvements to std.fifo
2019-11-24 17:33:53 -05:00
daurnimator
1a84bcefb6
std: fix mismatched doc-comment/argument names in fifo.rewind
2019-11-25 09:26:33 +11:00
daurnimator
94485b2a58
std: clean up fifo.readableSliceMut
2019-11-25 09:26:33 +11:00
daurnimator
b4091e3aec
std: fifo.deinit didn't need to take a pointer
2019-11-25 09:26:33 +11:00
daurnimator
3062e0e932
std: add fifo.writeItem
2019-11-25 09:26:33 +11:00
daurnimator
c393969a20
std: fix bug in fifo.unget if rewinding doesn't wrap around
2019-11-25 09:26:33 +11:00
daurnimator
61179a4d52
std: follow zig standard library convention and have fifo.read number of items
2019-11-25 09:26:33 +11:00
daurnimator
6037f89212
std: fifo rename from FixedSizeFifo to LinearFifo
2019-11-25 09:26:33 +11:00
daurnimator
cd749e0416
std: fifo now has 3 modes: Static, Slice and Dynamic
2019-11-25 09:26:32 +11:00
daurnimator
c0e47cb645
std: fix fifo for non-u8 types
2019-11-25 09:26:32 +11:00
daurnimator
e810f485ab
std: add optimization to fifo if size is power of two
2019-11-25 09:26:32 +11:00
daurnimator
01b2a56225
std: move auto_align constant to top of comptime function
...
At a later point in time this might be made into a parameter
2019-11-25 09:26:32 +11:00
daurnimator
52645d06e1
std: fix unfinished doc-comment in fifo
2019-11-25 09:26:32 +11:00
Andrew Kelley
c96d565166
add compile error for incompatible pointer sentinels
2019-11-24 17:02:56 -05:00
Andrew Kelley
4018034708
add test cases for arbitrary pointer sentinels
2019-11-24 16:52:32 -05:00
Andrew Kelley
09ec720dab
fix comptime @ptrCast of pointers to arrays
2019-11-24 16:25:26 -05:00
Sahnvour
6ebd26f3db
removed unnecessary backslashes in windows' libc paths
2019-11-24 21:33:58 +01:00
Sahnvour
696567d9d7
export: check variable type
...
also fixed existing occurrences
2019-11-24 21:33:58 +01:00
Sahnvour
912c1c24c3
simple test for exporting variables in static libs
2019-11-24 21:33:58 +01:00
Sahnvour
1bde3b6821
gen-h: register the need for stdbool.h and stdint.h when exploring types recursively
...
otherwise they wouldn't be included when only a struct contains them
2019-11-24 21:33:58 +01:00
Sahnvour
49156e3980
gen-h: add a pass for exported variables
2019-11-24 21:33:58 +01:00
Sahnvour
104b6f1629
refactored gen_h_file to improve maintainability and output
...
- extracted functions
- factorised extern "C" into a block containing all function prototypes instead of writing macros all over the place
- using intermediate buffers instead of writing directly to the output file
2019-11-24 21:33:58 +01:00
Andrew Kelley
f7574f44c1
add test for struct with var field
2019-11-24 15:20:15 -05:00
Andrew Kelley
44b1dc6db8
add type coercion: [:x]T to [*:x]T
2019-11-24 15:17:55 -05:00
syscall0
eea8b10463
Call DllMain entry point if declared
2019-11-24 14:46:22 -05:00
schroffl
6109e49c5b
Fix FixedSizeFifo buffer type
...
Update the `.buf` property to be a slice of the type that is given as a parameter.
2019-11-24 14:42:56 -05:00
Andrew Kelley
2b1faa1f20
Merge pull request #3748 from Vexu/modernize-stage2
...
Updates and cleanup in self hosted compiler
2019-11-24 14:40:16 -05:00
Vexu
20f5f56986
uncomment event.fs.watch
2019-11-24 17:42:20 +02:00
Vexu
ab534cc9f1
update event.fs to use global event loop
2019-11-24 17:39:08 +02:00
Vexu
0cbf00a3ec
self hosted compiler: final small fixes to get it compiling
2019-11-24 10:24:47 +02:00
Andrew Kelley
4c7b52503b
all tests passing
2019-11-24 02:14:21 -05:00
MCRusher
17abb7ef7f
Adds initCapacity() to buffer and arraylist
...
array_list.zig:
- adds ArrayList.initCapacity(*Allocator,usize) to allow preallocation of a block at initialization to reduce future allocations.
- adds a test for ArrayList.initCapacity() that ensures ArrayList.len() is unchanged and that at least the requested amount is allocated for.
buffer.zig:
- adds Buffer.initCapacity(*Allocator,usize), based off of ArrayList.initCapacity(), to preallocate a buffer before use.
note: contrary to Buffer.initSize(0) and then Buffer.list.ensureCapacity(200) (the presumed current method), this only allocates once instead of twice.
- adds Buffer.capacity to check usable allocated space, not including the null byte.
note: returns 0 when Buffer has only a null byte or when initNull() was used before without resize()/replaceContents().
- adds a test "Buffer.initCapacity" which ensures that Buffer.append()'s with [added size <= Buffer.capacity()-Buffer.len()] do not cause a reallocation to occur.
- adds a test "Buffer.initSize" which ensures that Buffer.initSize() behaves as expected, also combined with Buffer.append().
- adds a doc comment to Buffer.initSize() that makes its function and distinction from Buffer.initCapacity() clearer.
2019-11-23 23:49:55 -05:00
MCRusher
d49e0a7b90
Added initCapacity, capacity, and 2 tests.
...
Added Buffer.initCapcity() to buffer to allow preallocation of a block of memory to reduce future allocations. Uses the added ArrayList.initCapacity() function to achieve this.
Added Buffer.capacity() to track current usable allocation size, not counting null byte, and returning 0 if empty or created with Buffer.initNull()
Added a test for initCapacity() that shows that no further allocation is performed for an append of size smaller than or equal to capacity when initCapacity is used.
Added a test for initSize(), since it did not exist already.
Also added a comment to better explain the difference between initSize() and initCapacity()
note: forgot in the first commit but thanks to mikdusan for helping me brainstorm, through the process, and for drawing up a draft diff which I tweaked.
2019-11-23 23:08:33 -05:00
MCRusher
10e6cde083
Added initCapacity and relevant test
...
Added ArrayList.initCapcity() as a way to preallocate a block of memory to reduce future allocations.
Added a test "std.ArrayList.initCapacity" that ensures initCapacity adds no elements and increases capacity by at least the requested amount
2019-11-23 22:54:33 -05:00
Andrew Kelley
2dd20aa04a
langref: update for sentinel-terminated types
2019-11-23 22:29:12 -05:00
Andrew Kelley
00878a15d7
zig fmt: support sentinel-terminated pointer syntax
2019-11-23 22:21:25 -05:00
Andrew Kelley
f25182f46d
structs can have fields with type var
...
behavior tests passing now
2019-11-23 17:51:37 -05:00
Vexu
010494d8af
only test stage2 on linux
2019-11-23 23:45:54 +02:00
Vexu
89310dad56
Merge branch 'master' into modernize-stage2
2019-11-23 23:01:28 +02:00
Vexu
b9ef36094c
re-enable stage2 tests
2019-11-23 22:57:34 +02:00
Vexu
6c64f079fa
add workaround to child_process.zig
2019-11-23 22:06:51 +02:00
Vexu
d40f204ec0
self hosted compiler: small miscellaneous fixes
2019-11-23 21:57:24 +02:00
Michael Dusan
29d7b5a80c
remove UTF BOM
2019-11-23 14:17:55 -05:00
Vexu
7fa59565d3
fix small regressions in std.event
2019-11-23 14:01:00 -05:00
Vexu
133579d7c0
fix casts
2019-11-23 19:36:26 +02:00
Vexu
03cc81665b
Merge branch 'master' into modernize-stage2
2019-11-23 19:13:48 +02:00
Andrew Kelley
7597735bad
update the stage1 implementation to the new proposal
...
See #3731
2019-11-23 04:45:35 -05:00
Andrew Kelley
ad0871ea4b
Merge branch 'Vexu-missing-cast'
...
Closes #3336
Closes #3718
2019-11-21 23:25:02 -05:00
Vexu
4e6c1b676b
add cast to not hit #2561
2019-11-21 23:21:51 -05:00
Vexu
4d9318cee0
fix missing implicit cast in return instruction
2019-11-21 23:21:51 -05:00
Vexu
0b63573674
improve broken llvm module error message
2019-11-21 23:21:14 -05:00
Vexu
0e8a53514e
add missing error set to ChildProsess.SpawnError
2019-11-21 23:21:14 -05:00
Timon Kruiper
94299d16d1
Stage1: Add compile error for an empty switch on a integer
2019-11-22 04:00:47 +00:00
Andrew Kelley
6b623b5ea2
update docs for null terminated stuff
2019-11-21 20:43:42 -05:00
Andrew Kelley
fd6020c4e2
update tests, better error messages, update self-hosted tokenizer
2019-11-21 20:43:41 -05:00
Andrew Kelley
cf2fe2536e
better error message when null termination does not match
2019-11-21 20:43:41 -05:00
Andrew Kelley
47f06be369
string literals are now null terminated
...
this also deletes C string literals from the language, and then makes
the std lib changes and compiler changes necessary to get the behavior
tests and std lib tests passing again.
2019-11-21 20:43:41 -05:00
Andrew Kelley
21f344b3b9
add null terminated pointers and arrays to self-hosted
...
as well as `@typeInfo` and `@Type`
2019-11-21 20:43:41 -05:00
Andrew Kelley
1aa978f32e
implement null terminated pointers
2019-11-21 20:43:41 -05:00
Andrew Kelley
e3404e3c78
Merge branch 'std.fs.Dir.openRead'
2019-11-21 20:41:30 -05:00
Andrew Kelley
cd5f4de2a6
std: remove O_LARGEFILE from OS bits when the OS does not define it
2019-11-21 20:34:55 -05:00
Benjamin Feng
0f0d01a037
Replace magic numbers with named constants
2019-11-21 18:41:02 -06:00
Andrew Kelley
bf1cbebea1
improve std.fs.selfExePath and related functions on Windows
2019-11-21 18:51:12 -05:00
Andrew Kelley
cd37c1a377
add std.fs.Dir.openRead
...
This is progress towards file system APIs that encourage avoiding
Time Of Check, Time Of Use bugs.
2019-11-21 17:07:29 -05:00
Andrew Kelley
874b34a30f
self-hosted tokenizer handles \r in string literals
2019-11-20 21:03:17 -05:00
Andrew Kelley
ed619245e9
remove dead code shebang support from self-hosted tokenizer
2019-11-20 20:18:19 -05:00
Benjamin Feng
d27721f58c
Add .enable_wasmtime build flag
2019-11-20 12:06:21 -06:00
Benjamin Feng
218f9ff34e
Work around WASI's nonexistent @returnAddress()
2019-11-19 20:55:55 -06:00
Benjamin Feng
b88bb93af3
WASI isatty
2019-11-19 20:17:00 -06:00
Benjamin Feng
14e9c7d1f2
WASI clock functions
2019-11-19 19:44:19 -06:00
Benjamin Feng
c3d93cd9f2
WASI time_t / timespec
2019-11-19 16:12:26 -06:00
Benjamin Feng
747529e96b
Use wasm_allocator
2019-11-19 00:31:40 -06:00
Johan Bolmsjö
ad77e93415
std.testing.expectEqual: show differing pointer values
...
Show differing pointer values when comparing pointers instead of the
content they point to.
It's confusing for a test to say "expected S{.x = 1}, found S{.x = 1}"
as illustrated below when it was the pointers that differed.
There seems to be different rules for when a pointer is dereferenced by
the printing routine depending on its type. I don't fully grok this but
it's also illustrated below.
const std = @import("std");
const S = struct { x: u32 };
// before: ...expected S{ .x = 1 }, found S{ .x = 1 }
// after: ...expected S@7ffcd20b7798, found S@7ffcd20b7790
test "compare_ptr_to_struct" {
var a = S{.x = 1};
var b = S{.x = 1};
std.testing.expectEqual(&a, &b);
}
// before: ...expected u32@7fff316ba31c, found u32@7fff316ba318
// after: ...expected u32@7ffecec622dc, found u32@7ffecec622d8
test "compare_ptr_to_scalar" {
var a: u32 = 1;
var b: u32 = 1;
std.testing.expectEqual(&a, &b);
}
2019-11-19 06:22:34 +00:00
dbandstra
b3539b40a6
add std.math.tau constant (equivalent to 2 * pi)
2019-11-19 06:20:20 +00:00
frmdstryr
aa4e92f3b3
Make StreamServer return address of accecpted client
2019-11-19 01:06:04 +00:00
daurnimator
ed956b5812
translate-c: add support for MacroQualified definitions
2019-11-19 01:05:17 +00:00
Andrew Kelley
0c33ebb38e
add regression test case. closes #2980
2019-11-18 19:59:03 -05:00
Andrew Kelley
9eed0d3603
add regression test case. closes #2889
2019-11-18 19:54:37 -05:00
Andrew Kelley
828abe046f
add regression test case. closes #3007
2019-11-18 19:51:49 -05:00
Andrew Kelley
21aed86a4a
add regression test case
...
closes #3097
2019-11-18 17:31:35 -05:00
Andrew Kelley
4dd3f42972
Merge pull request #3695 from daurnimator/towards-afd
...
Windows definitions
2019-11-17 23:17:48 +00:00
Andrew Kelley
57b8614a5a
Merge pull request #3697 from Vexu/container-docs
...
Implement container level doc comments
2019-11-17 22:31:12 +00:00
daurnimator
4e28d7a5f7
fix bug on empty error union
2019-11-17 22:29:49 +00:00
Andrew Kelley
8e3370367b
Merge pull request #3705 from daurnimator/fix-std.valgrind
...
std: fix outdated valgrind module
2019-11-17 22:29:17 +00:00
LemonBoy
924dd674e2
Catch invalid type from peer resolution
...
Fixes #3703
2019-11-17 22:25:14 +00:00
Vexu
6cddf9d723
properly parse anon literal in array
2019-11-17 22:24:21 +00:00
daurnimator
d870a68e68
std: add a couple of tests to valgrind module
2019-11-17 14:16:09 +11:00
daurnimator
7d582d0a00
std: fix missing @ptrToInt in valgrind.memcheck
2019-11-17 14:14:57 +11:00
daurnimator
41c72bb54c
std: fix use of old syntax in std.valgrind.memcheck
2019-11-17 14:14:57 +11:00
daurnimator
cc76494c42
std: use enum literals in valgrind module
2019-11-17 14:14:57 +11:00
daurnimator
4a3bb557f1
std: fix outdated valgrind module
2019-11-17 14:14:57 +11:00
Vexu
314cb707fc
fix containerdoccomment not handled in docgen.zig
2019-11-15 18:44:29 +02:00
Vexu
977b613881
add container doc comments to generated docs
2019-11-15 15:17:59 +02:00
Vexu
e509d21f39
implemented container doc comments in stage 1
2019-11-15 15:02:51 +02:00
daurnimator
431eeb5e20
std: add pieces for WSAIoctl on windows
2019-11-15 10:31:52 +11:00
daurnimator
3b8afe31a0
std: add NtDeviceIoControlFile definition for windows
2019-11-15 10:31:51 +11:00
daurnimator
6469900e79
std: add WSAStartup and WSACleanup for windows
2019-11-15 10:31:47 +11:00
Andrew Kelley
8c4784f9c1
remove no longer correct comment
2019-11-14 12:38:30 -05:00
LemonBoy
a11da37734
Update discriminant value also for zero-sized unions
...
Fixes #3681
2019-11-14 17:07:20 +00:00
Vexu
b92f42d1f4
implemented container doc comments in stage 2
2019-11-14 16:25:06 +02:00
Andrew Kelley
d89f39d719
rework layout of struct type fields
...
This removes the remaining hack in the implementation of anonymous
struct literals, and they can now therefore now have greater than 16
fields/elements.
2019-11-14 03:52:39 -05:00
Andrew Kelley
f2f698a888
rework comptime struct value layout, removing 1/2 hacks
...
in the implementation of anonymous struct literals
2019-11-14 03:52:36 -05:00
daurnimator
4cf535a01b
std: add WSASocketW for windows
2019-11-14 17:09:22 +11:00
daurnimator
d9d3268cc1
std: add DeviceIoControl and GetOverlappedResult for windows
2019-11-14 17:09:21 +11:00
daurnimator
f4c6cc3270
std: add winsock some definitions
2019-11-14 17:09:19 +11:00
daurnimator
a832b35c19
std: add windows socket constants
...
Taken from https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw
2019-11-14 17:09:17 +11:00
daurnimator
be86e41d97
std: add CTL_CODE function for windows
2019-11-14 17:09:16 +11:00
daurnimator
4830415071
std: add FILE_ANY_ constants for windows
2019-11-14 17:00:09 +11:00
daurnimator
0270545edb
std: add windows ioctl transfer types
2019-11-14 17:00:07 +11:00
daurnimator
ef6cec983c
std: add windows FILE_DEVICE_ defines
2019-11-14 17:00:05 +11:00
Vexu
b83ce08a3b
add compile error for @atomicRmw on enum not being an .Xchg
2019-11-13 18:48:31 +00:00
Andrew Kelley
c806de8ae7
README: update the short description of what zig is
2019-11-13 13:44:19 -05:00
Andrew Kelley
0237e7a701
std.io.getStdOut and related fns no longer can error
...
Thanks to the Windows Process Environment Block, it is possible to
obtain handles to the standard input, output, and error streams without
possibility of failure.
2019-11-13 04:01:40 +00:00
Andrew Kelley
8bae70454d
Merge pull request #3675 from Vexu/atomic-store
...
Add @atomicStore builtin
2019-11-13 03:06:55 +00:00
Andrew Kelley
32b37e695a
fix anonymous struct literal assigned to variable
...
closes #3667
2019-11-12 21:57:25 -05:00
Andrew Kelley
37318bf151
fn parameters participate in result location semantics
...
See #3665
2019-11-12 18:55:17 -05:00
Vexu
41914321b4
fix comptime atomicStore and add tests
2019-11-13 01:32:16 +02:00
Vexu
f0c94d95dd
use @atomicStore in std lib
2019-11-13 00:52:15 +02:00
Vexu
110ef2e528
add @atomicStore builtin
2019-11-13 00:25:44 +02:00
Sahnvour
956ba8b0e7
Merge pull request #3447 from Sahnvour/vcpkg
...
build: initial support for using vcpkg libraries
2019-11-12 20:16:01 +01:00
Andrew Kelley
e32b4829f4
Merge pull request #3670 from Vexu/atomics-enum
...
Support atomic operations with enums
2019-11-12 17:45:29 +00:00
Andrew Kelley
710ccacfa3
fix assertion failure in ptrToInt
...
found by building pluto
2019-11-12 12:21:20 -05:00
Vexu
5194fc57d1
use enum with atomics in std lib
2019-11-12 17:55:54 +02:00
Vexu
7e5b234b8b
support atomic operations with enums
2019-11-12 17:13:33 +02:00
Andrew Kelley
45d2fd9b9d
fix assertion failure in init_const_undefined
...
found this from building my tetris game
2019-11-11 22:11:28 -05:00
Andrew Kelley
bf8870a60b
fix unresolved type making it to codegen
...
found this trying to build oxid
2019-11-11 22:11:22 -05:00
Andrew Kelley
5502160bd2
Merge pull request #3652 from ziglang/anon-container-lit
...
implement anonymous struct literals and anonymous list literals
2019-11-12 01:40:31 +00:00
Andrew Kelley
0c315e7f76
update docs for anonymous struct/list literals
2019-11-11 19:57:57 -05:00
Andrew Kelley
b9482fc32d
implement fully anonymous list literals
2019-11-11 19:00:39 -05:00
Andrew Kelley
a33b9aec72
add test for missing const in slice with nested array type
2019-11-11 18:01:27 -05:00
Andrew Kelley
ca2a788a24
fully anonymous struct literals
2019-11-11 17:50:41 -05:00
xackus
6d3b95a708
Stricter tests for non-streaming parser
2019-11-11 23:41:53 +01:00
xackus
f9b7d6d75d
Fix bugs in JSON parser
...
Make comments into documentation where appropriate
2019-11-11 23:25:54 +01:00
xackus
371747d8fb
json: surrogate pair support
...
test json.Parser with tests used for json.Streaming parser
(some don't pass yet)
2019-11-11 22:06:00 +01:00
Andrew Kelley
1bca8e693d
fix anon literal used with return result loc
2019-11-11 13:18:16 -05:00
Andrew Kelley
d4e6a6d5e2
zig fmt: support anon struct and anon list init syntax
2019-11-11 13:12:45 -05:00
Andrew Kelley
725b6ee634
add behavior test case for anonymous list literal syntax
2019-11-11 13:12:21 -05:00
Andrew Kelley
b4ad3e71af
add behavior test case for anon union literal
2019-11-11 13:12:21 -05:00
Andrew Kelley
5b27943498
implement anon struct literal syntax
...
This implements stage1 parser support for anonymous struct literal
syntax (see #685 ), as well as semantic analysis support for anonymous
struct literals and anonymous list literals (see #208 ). The semantic
analysis works when there is a type coercion in the result location;
inferring the struct type based on the values in the literal is not
implemented yet. Also remaining to do is zig fmt support for this new
syntax and documentation updates.
2019-11-11 13:11:58 -05:00
Andrew Kelley
de30438ed2
stage1 parser code for anon container lit
2019-11-11 13:11:58 -05:00
xackus
739f716108
minor fixes
2019-11-11 19:06:35 +01:00
Andrew Kelley
ae0a219d1f
stop accepting deprecated use keyword
...
closes #2591
2019-11-11 13:02:39 -05:00
Felix Queißner
cd5c9c8998
Fix missing @as cast in std.fmt.formatInt ( #3650 )
2019-11-10 23:08:24 +00:00
xackus
f6d124418f
Fix and document
2019-11-10 22:26:42 +01:00
xackus
6d0cdf7cd7
Unescape JSON strings
2019-11-10 22:05:03 +01:00
Andrew Kelley
d44a69689e
std.ChildProcess.spawn has a consistent error set
...
across targets. Also fix detection of pkg-config not
installed on Windows when using zig build.
2019-11-10 15:40:27 -05:00
Andrew Kelley
891e2149b0
Merge pull request #3635 from lun-4/unify-unix-sockets
...
std.net: add unix socket support to Address and StreamServer
2019-11-10 20:40:19 +00:00
Luna
c8a8da2804
remove builtin.os check in Address.initUnix
2019-11-10 16:44:18 -03:00
Luna
d1eabe81a9
add sockaddr_un to os/bits/windows
2019-11-10 14:38:33 -03:00
Luna
d99ecef943
replace panic to unreachable
...
- remove error.UnsupportedOS from StreamServer.listen
2019-11-10 14:17:39 -03:00
Luna
2d02920a90
use hasDecl instead of switch on builtin.os
2019-11-10 14:04:52 -03:00
dimenus
98e37537d1
minor fix due to recent directory handling API changes
2019-11-10 16:34:31 +00:00
Luna
25423eb453
add errors/panics for unsupported OSes
2019-11-10 10:50:22 -03:00
Luna
e4704f68f8
use at-as
2019-11-09 15:10:39 -03:00
Luna
fc2e8f92b2
Merge remote-tracking branch 'upstream/master' into unify-unix-sockets
2019-11-09 15:07:09 -03:00
Luna
348c0232a5
miscellaneous fixes
...
- make connextUnixSocket use std.net.Address
- fix StreamServer.listen giving wrong protocol for unix sockets
2019-11-09 14:53:48 -03:00
LemonBoy
d18b5f8b53
Fix initialization of union references
...
Fixes #3532
2019-11-09 12:20:34 -05:00
Luna
05ae21b78e
make StreamServer.listen family-agnostic
...
- rename Address.parseUnix to Address.initUnix
2019-11-09 12:51:33 -03:00
Luna
f4d8dc278b
rename TcpServer -> StreamServer
...
- add AF_UNIX support to getOsSockLen
2019-11-09 12:40:56 -03:00
Sahnvour
def5462d05
build: initial support for using vcpkg libraries
2019-11-09 12:37:38 +01:00
Luna
c2325053a8
add Address.parseUnix and Address.format support for AF_UNIX
2019-11-08 21:44:17 -03:00
dimenus
8c8078513e
missed cast in std/target.zig
2019-11-08 19:19:08 -05:00
Andrew Kelley
6d5abf87ec
Merge pull request #3628 from ziglang/as-builtin
...
implement `@as` builtin and fix result location semantics with regards to type coercion
2019-11-08 18:30:07 -05:00
Luna
9458620e18
replace Address.parse Address.parseIp
2019-11-08 19:59:30 -03:00
Luna
5d05cfcfe6
rename IpAddress to Address, add Address.unix
2019-11-08 19:35:04 -03:00
Andrew Kelley
f7b1e02158
fix type cast in windows child process code
2019-11-08 17:05:20 -05:00
Andrew Kelley
3cf5c2c62b
fix regressed tests and update docs to use "type coercion"
2019-11-08 15:57:25 -05:00
Andrew Kelley
3834d3dac0
passing std lib tests
2019-11-08 15:57:25 -05:00
Andrew Kelley
aef04aff0c
initial docs for @as
2019-11-08 15:57:25 -05:00
Andrew Kelley
aa0daea541
update more of the std lib to use @as
2019-11-08 15:57:25 -05:00
Andrew Kelley
a2acc27872
behavior tests passing
2019-11-08 15:57:25 -05:00
Andrew Kelley
8954a1bae5
more regressions fixed
2019-11-08 15:57:25 -05:00
Andrew Kelley
fa34dfcce7
fix result loc of cast not finding parent
2019-11-08 15:57:24 -05:00
Andrew Kelley
e0db54e89d
update the codebase to use @as
2019-11-08 15:57:24 -05:00
Andrew Kelley
2a6fbbd8fb
introduce @as builtin for type coercion
...
This commit also hooks up type coercion (previously called implicit
casting) into the result location mechanism, and additionally hooks up
variable declarations, maintaining the property that:
var a: T = b;
is semantically equivalent to:
var a = @as(T, b);
See #1757
2019-11-08 15:57:24 -05:00
Andrew Kelley
6d28b28ccc
Merge branch 'kprotty-adaptive_lock'
2019-11-08 02:09:51 -05:00
Andrew Kelley
2723ffc2b2
fixups and zig fmt
2019-11-08 01:52:23 -05:00
Andrew Kelley
fbbcf2f30d
Merge branch 'adaptive_lock' of https://github.com/kprotty/zig into kprotty-adaptive_lock
2019-11-08 01:21:22 -05:00
kprotty
e2189b6e5d
cleanup getEventHandle
2019-11-07 19:37:53 -06:00
kprotty
43900011f7
handle NtCreateKeyedEvent failure by spinning to ensure correctness
2019-11-07 18:56:43 -06:00
Andrew Kelley
9b0536e6f4
ci: add srht oauth token to drone cloud script
2019-11-07 19:00:52 -05:00
kprotty
fe8c1cf804
missing os declaration
2019-11-07 17:14:08 -06:00
kprotty
bb4abfdc78
Use system instead of builtin.link_libc
2019-11-07 16:36:33 -06:00
kprotty
12e68cbeb6
pthread_sched_yield -> sched_yield
2019-11-07 16:33:25 -06:00
Vexu
86d9563d15
self hosted compiler: various small fixes
2019-11-08 00:18:14 +02:00
kprotty
f41e58d015
fix SpinLock.yield for pull/3626
2019-11-07 15:51:20 -06:00
kprotty
b5d84635f2
remove WaitOnAddress backend in std.ThreadParker
2019-11-07 15:46:57 -06:00
kprotty
b535e86cc0
move SpinLock definitions around
2019-11-07 15:32:20 -06:00
Andrew Kelley
e2a0bea65f
ci: bump ubuntu from 16.04 to 18.04
2019-11-07 16:18:42 -05:00
Vexu
bca672372a
self hosted compiler: move functions to util.zigto avoid defining llvm instricts.
2019-11-07 23:03:57 +02:00
Vexu
459a364a33
allow Group to optionally manage function frames' memory
2019-11-07 13:26:49 -05:00
Vexu
3858a526e3
make callMainAsync async
2019-11-07 13:18:47 -05:00
kprotty
92dac89d01
lock the mutex on pthread_cond_signal()
2019-11-07 09:23:02 -06:00
Vexu
56ea07f4fc
self hosted compiler: comment out event.fs stuff
2019-11-07 10:30:56 +02:00
Vexu
7a24334199
self hosted compiler: small fixes to imports and declarations
2019-11-07 10:30:56 +02:00
Vexu
c6076a1360
self hosted compiler: use enum literals
2019-11-07 10:30:56 +02:00
Vexu
7000316113
self hosted compiler: fix calling convention in type.zig
2019-11-07 10:30:47 +02:00
Vexu
9394d14815
self hosted compiler: unify Target and std.Target
2019-11-07 10:30:47 +02:00
Vexu
6dd4a276de
self hosted compiler: update to new std.event
2019-11-07 10:30:37 +02:00
Vexu
110e575497
self hosted compiler: replace Promise with Frame and AnyFrame
2019-11-07 10:30:21 +02:00
Vexu
cb20093614
self hosted compiler: remove await async pattern
2019-11-07 10:30:11 +02:00
Vexu
b06e5b8c68
self hosted compiler: fix internal build info
2019-11-07 10:29:58 +02:00
Vexu
8edf27343f
self hosted compiler: fix zig_llvm.h function signature
2019-11-07 10:29:44 +02:00
Shawn Landden
2e52fafac5
correctly use llvm undef in release modes
2019-11-07 02:51:04 -05:00
Andrew Kelley
697c4ffd41
Merge branch 'LemonBoy-fix-more-things'
...
closes #3621
2019-11-07 02:46:20 -05:00
LemonBoy
cf6fb89ced
Add small tokenizer test case for #3468
2019-11-07 02:46:10 -05:00
LemonBoy
528908a06e
Fix ptrCast of array references to fn
...
Closes #3607
2019-11-07 02:46:10 -05:00
Andrew Kelley
c7fd414dab
Merge pull request #3618 from nrdmn/uefi
...
UEFI improvements
2019-11-06 23:19:46 -05:00
Nick Erdmann
78b54d9c96
std/os/uefi: protocol handling improvements
2019-11-07 03:06:06 +01:00
Nick Erdmann
cef51eaffb
std/os/uefi: snp, mnp, ip6, and udp6 support
2019-11-07 02:53:53 +01:00
Nick Erdmann
f4767186dd
std/os/uefi: loading images
2019-11-07 02:53:53 +01:00
Andrew Kelley
6ee3cabe5c
allow type coercion from *[0]T to E![]const T
...
This is an unambiguous, safe cast.
2019-11-06 20:44:15 -05:00
kprotty
7045f1e875
skip std.ThreadParker test on single-threaded
2019-11-06 17:23:44 -06:00
shiimizu
7277670843
Add error when too few arguments are provided to std.fmt
2019-11-06 18:22:33 -05:00
Sebastian Keller
f81f36e2ff
std.json.Value: added dumpStream(), utilize WriteStream for dump()
2019-11-06 18:21:52 -05:00
Vexu
ac6f0d245d
fix NodeErrorSetDecl rendering
2019-11-06 18:15:39 -05:00
Vexu
4530adbd33
use global event loop in std.event types
2019-11-06 15:17:40 -05:00
Andrew Kelley
913f7d0450
improve the start code for evented I/O
...
When evented I/O is being used, prevent event loop from terminating
at least until main() has returned.
2019-11-06 15:08:29 -05:00
Brendan Hansknecht
c1e8fdf812
add token for parsing pointer dereference
2019-11-06 14:03:21 -05:00
Sebastian Keller
dd4e9fb16b
Fixed a leak in the json parser.
...
parseString() created a copy of the string using the wrong allocator.
Instead of using the ArenaAllocator, it was using the allocator passed
into Parser.init(). This lead to a leak as the copied string was not
freed when the ArenaAllocator was deinited.
2019-11-06 14:00:36 -05:00
Vexu
6b61fcddfa
fix translate-c arrow deref
2019-11-06 13:58:55 -05:00
kprotty
4dbfc48ab3
Disable asm("yield") for arm in SpinLock.yieldCpu() because of CI
2019-11-05 16:16:03 -06:00
kprotty
c9db420a09
Adaptive Mutex:
...
- uses std.ThreadParker
- supports static initialization (deprecates StaticallyInitializedMutex)
2019-11-05 16:14:43 -06:00
kprotty
465ebf494d
ThreadParker implementation
2019-11-05 15:58:58 -06:00
kprotty
14209cf615
make SpinLock.Backoff pub
2019-11-05 13:43:17 -06:00
Andrew Kelley
9bc4f8ea77
zig build: addIncludeDir does -I instead of -isystem
2019-11-05 14:32:17 -05:00
Andrew Kelley
cb8af1c6d4
Merge branch 'vector-element-access'
...
This introduces the concept of vector index being part of a pointer
type. This avoids vectors having well-defined in-memory layout, and
allows vectors of any integer bit width to work the same way.
When a vector is indexed with a scalar, this is vector element access,
which this branch implements. When a vector is indexed with a vector,
this is gather/scatter, which is not implemented in this branch.
closes #3575
closes #3580
2019-11-05 13:40:57 -05:00
Andrew Kelley
9a08de93b6
fix incorrect type name on bit field pointers
2019-11-05 13:37:43 -05:00
Andrew Kelley
9b4a529164
fix initialization of vector in a struct field
2019-11-05 12:36:39 -05:00
Andrew Kelley
cbaa10fc3b
implement storing vector elements via runtime index
2019-11-05 12:11:57 -05:00
Andrew Kelley
70be308c43
implement loading vector elements via runtime index
2019-11-05 12:11:40 -05:00
Andrew Kelley
76d188551e
implement store of vector element with comptime index
2019-11-05 12:11:18 -05:00
Andrew Kelley
ece8d6c2fa
comptime load of vector element
2019-11-05 12:11:18 -05:00
Andrew Kelley
55e54d98c4
runtime load vector element with comptime index
2019-11-05 12:11:16 -05:00
Vexu
a26e9fa723
add special formatting for ipv4-mapped ipv6 addresses
2019-11-05 12:05:34 -05:00
LemonBoy
71e209521a
Mark type fields as CT
...
Fixes #3276
2019-11-05 12:05:01 -05:00
Andrew Kelley
4e9ab0306a
Merge pull request #3587 from LemonBoy/fix-things
...
Bunch'o'fixes
2019-11-05 11:44:07 -05:00
Shawn Landden
1c22cb5e51
fix noreturn function that may return.
...
we do not want undefined behavior here in --release-fast
and --release-small modes
2019-11-05 11:38:32 -05:00
Shawn Landden
55685ae780
remove duplicate isNan implementation
2019-11-05 11:34:33 -05:00
lukechampine
3d907b2943
crypto: Add support for AES-CTR
2019-11-05 11:33:11 -05:00
kprotty
84e370d0b2
Move hybrid yielding into its own struct
2019-11-05 09:31:29 -06:00
kprotty
0d4f4aad9e
adaptive SpinLock
2019-11-05 08:16:08 -06:00
daurnimator
1657bead46
std: Add fifo useful for buffers
2019-11-04 17:44:01 -05:00
data-man
42ccdc2765
Replace AES variables to constants
2019-11-04 17:43:14 -05:00
Andrew Kelley
ce70a9be24
Merge pull request #3589 from Vexu/ipv6-improvements
...
Ipv6 improvements
2019-11-04 15:22:14 -05:00
Andrew Kelley
6c17282062
std.os.read can fail with ConnectionResetByPeer
2019-11-04 14:40:30 -05:00
Andrew Kelley
aaf50970a8
Merge pull request #3574 from lukechampine/aes
...
crypto: Add AES implementation
2019-11-04 14:39:40 -05:00
LemonBoy
9170dcb73f
Fix #3558
...
Finding a suitable test case is left as an exercise to the reader.
2019-11-04 20:33:41 +01:00
LemonBoy
c47211cc60
Prevent crash when slicing undefined ptr to slice
...
Fixes #3534
2019-11-04 20:33:41 +01:00
LemonBoy
2b4bf1e7ce
Fix crash in #3483
...
The bytesToSlice is still not evaluated at comptime but at least it
doesn't crash anymore.
2019-11-04 20:33:40 +01:00
LemonBoy
61825062aa
Correctly process errors for invalid types in fn call
...
Fixes #3544
2019-11-04 20:33:40 +01:00
LemonBoy
c8b6e55299
Make the leb module available to non-std code
2019-11-04 20:33:40 +01:00
Luke Champine
eb95afbc66
remove speculative AES TODOs
2019-11-04 13:59:26 -05:00
Andrew Kelley
5db77e3c66
Merge pull request #3588 from daurnimator/tiny-std-fixes
...
Tiny std fixes
2019-11-04 13:25:37 -05:00
Brendan Hansknecht
52207f22de
Add karatsuba to big ints
2019-11-04 13:20:03 -05:00
Vexu
6e786b60d4
support ipv4-mapped ipv6 addresses
2019-11-04 19:54:36 +02:00
Vexu
32ac1b5927
improve ipv6 parsing and formatting
2019-11-04 19:00:58 +02:00
daurnimator
c8463ce9b0
std: Add definitions for (deprecated) futimes and utimes C functions
2019-11-05 02:19:25 +11:00
daurnimator
6e635c6406
std: close is OSX specific
2019-11-05 02:16:30 +11:00
LemonBoy
2f740fa19f
Fix cmpxchg trying to execute at CT
...
Fixes #3582
2019-11-04 09:54:13 +01:00
Andrew Kelley
711520d935
ci: workaround PATH apparently not working
2019-11-04 00:07:27 -05:00
kprotty
bb6ad1a6c2
Remove StaticallyInitializedMutex
2019-11-03 21:09:51 -06:00
Andrew Kelley
b7747653f2
ci: more fixes for update_download_page script
2019-11-03 22:01:59 -05:00
Andrew Kelley
0860b1919b
ci: work around pip install permission denied
2019-11-03 21:44:39 -05:00
Andrew Kelley
1a820067d0
ci: hail mary running git.exe in the windows bat file
2019-11-03 18:58:54 -05:00
Andrew Kelley
96984e3033
ci: avoid leaking oauth access token
2019-11-03 14:55:21 -05:00
Andrew Kelley
629b91da61
ci: use heredoc and alpine/edge for faster sr.ht job
2019-11-03 14:20:35 -05:00
Andrew Kelley
5001faa690
ci: stop assuming that azure will complete last
...
Each of the 3 CI services now trigger a sr.ht build via
the on_master_success script. The sr.ht build checks if all builds have
completed successfully by trying to download the JSON file for the
particular version. If all builds have completed successfully then this
sr.ht job will update the download page.
2019-11-03 14:00:28 -05:00
Michael Dusan
10046f9a52
stage1: add linux XDG Base Directory support
...
- define zig global cache based on XDG spec:
if env XDG_CACHE_HOME {
"$XDG_CACHE_HOME/zig"
} else {
"$HOME/.cache/zig"
}
- old definition "$HOME/.local/share/zig" is retired
- closes #3573
2019-11-02 18:30:07 -04:00
Luna
2e0dd5733f
add FileNotFound to os.ConnectError error set
2019-11-02 15:49:15 -04:00
Luna
d535bf2c7d
add FileNotFound error to os.connect
2019-11-02 15:49:15 -04:00
Andrew Kelley
f749bf0942
std.os: fix sendto, poll, recvfrom when linking libc
...
Thank you to Brendan Hansknecht for this patch.
2019-11-02 15:15:56 -04:00
lukechampine
f403aa6cee
crypto: Add AES implementation
2019-11-01 22:42:25 -04:00
Andrew Kelley
d6dec80261
startup code respects root source file's event_loop if present
2019-10-31 14:21:04 -04:00
Andrew Kelley
081c62fc00
fix regression in std.os.dirent64 on linux
2019-10-31 13:56:15 -04:00
Tse
00382f6dae
DragonFlyBSD tidyup
2019-10-31 13:53:32 -04:00
Andrew Kelley
790d439ce2
util.cpp: canonicalize the order of includes
2019-10-31 13:47:20 -04:00
Andrew Kelley
d3d3e4e374
startup code sets up event loop if I/O mode is declared evented
2019-10-31 11:41:39 -04:00
Andrew Kelley
788848e123
std.net: fix reference to incorrect constant name
2019-10-30 23:03:49 -04:00
Andrew Kelley
61d5a0bf48
Merge branch 'std.net'
2019-10-30 21:30:16 -04:00
Andrew Kelley
6a15e8a7a7
add comments to disabled tests linking to the tracking issue
2019-10-30 21:29:45 -04:00
Tse
33cc204481
DragonFlyBSD support
2019-10-30 21:21:58 -04:00
Henry Wu
7c73503451
generated docs: move color to box-shadow CSS prop
2019-10-30 21:20:02 -04:00
Andrew Kelley
7b7ba51642
fix os.sockaddr being a union instead of a struct
2019-10-30 20:57:20 -04:00
Andrew Kelley
d7f15aa2cb
Merge remote-tracking branch 'origin/master' into std.net
2019-10-30 20:43:56 -04:00
Andrew Kelley
c52ee6efca
canonicalize std.os IPPROTO constants
2019-10-30 20:41:28 -04:00
Andrew Kelley
0de862e8ba
make std.net more portable
...
* Delete `std.net.TmpWinAddr`. I don't think that was ever meant to
be a real thing.
* Delete `std.net.OsAddress`. This abstraction was not helpful.
* Rename `std.net.Address` to `std.net.IpAddress`. It is now an extern
union of IPv4 and IPv6 addresses.
* Move `std.net.parseIp4` and `std.net.parseIp6` to the
`std.net.IpAddress` namespace. They now return `IpAddress` instead of
`u32` and `std.net.Ip6Addr`, which is deleted.
* Add `std.net.IpAddress.parse` which accepts a port and parses either
an IPv4 or IPv6 address.
* Add `std.net.IpAddress.parseExpectingFamily` which additionally
accepts a `family` parameter.
* `std.net.IpAddress.initIp4` and `std.net.IpAddress.initIp6` are
improved to directly take the address fields instead of a weird
in-between type.
* `std.net.IpAddress.port` is renamed to `std.net.IpAddress.getPort`.
* Added `std.net.IpAddress.setPort`.
* `os.sockaddr` struct on all targets is improved to match the
corresponding system struct. Previously I had made it a union of
sockaddr_in, sockaddr_in6, and sockaddr_un. The new abstraction for
this is now `std.net.IpAddress`.
* `os.sockaddr` and related bits are added for Windows.
* `os.sockaddr` and related bits now have the `zero` fields default
to zero initialization, and `len` fields default to the correct size.
This is enough to abstract the differences across targets, and so
no more switch on the target OS is needed in `std.net.IpAddress`.
* Add the missing `os.sockaddr_un` on FreeBSD and NetBSD.
* `std.net.IpAddress.initPosix` now takes a pointer to `os.sockaddr`.
2019-10-30 20:22:05 -04:00
Andrew Kelley
618ee5b63a
fixes for macos and 32 bit arches
2019-10-30 14:43:55 -04:00
Andrew Kelley
24b3da871d
fix regressions
2019-10-30 12:49:37 -04:00
Andrew Kelley
f5ff36271b
Merge branch 'testAddresses' of https://github.com/marler8997/zig into std.net
2019-10-30 12:33:47 -04:00
Andrew Kelley
0fb1388031
std.net: enable test for resolving DNS
2019-10-30 12:16:47 -04:00
Nathan Michaels
1f0bcefe4a
Document PriorityQueue.
2019-10-30 01:05:00 -04:00
Andrew Kelley
16397241f6
fix std.net tests and std.net.TcpServer docs
2019-10-30 00:50:30 -04:00
Andrew Kelley
b3c80418a8
fix regression in behavior tests
2019-10-30 00:40:17 -04:00
Andrew Kelley
d5e438b36e
rename std.net.Server to TcpServer and simplify it
2019-10-30 00:34:30 -04:00
Andrew Kelley
c3d816a98e
std lib networking improvements, especially non-blocking I/O
...
* delete the std/event/net directory
* `std.event.Loop.waitUntilFdReadable` and related functions
no longer have possibility of failure. On Linux, they fall
back to poll() and then fall back to sleep().
* add some missing `noasync` decorations in `std.event.Loop`
* redo the `std.net.Server` API. it's quite nice now, but
shutdown does not work cleanly. There is a race condition with
close() that I am actively working on.
* move `std.io.OutStream` to its own file to match `std.io.InStream`.
I started working on making `write` integrated with evented I/O,
but it got tricky so I backed off and filed #3557 . However
I did integrate `std.os.writev` and `std.os.pwritev` with evented I/O.
* add `std.Target.stack_align`
* move networking tests to `lib/std/net/test.zig`
* add `std.net.tcpConnectToHost` and `std.net.tcpConnectToAddress`.
* rename `error.UnknownName` to `error.UnknownHostName` within the
context of DNS resolution.
* add `std.os.readv`, which is integrated with evented I/O.
* `std.os.preadv`, is now integrated with evented I/O.
* `std.os.accept4` now asserts that ENOTSOCK and EOPNOTSUPP never
occur (misuse of API), instead of returning errors.
* `std.os.connect` is now integrated with evented I/O.
`std.os.connect_async` is gone. Just use `std.os.connect`.
* fix false positive dependency loop regarding async function frames
* add more compile notes to help when dependency loops occur
in determining whether a function is async.
* ir: change an assert to ir_assert to make it easier to find
workarounds for when such an assert is triggered. In this case
it was trying to parse an IPv4 address at comptime.
2019-10-29 22:59:30 -04:00
lukechampine
48b5dc0516
inline path separator loop
2019-10-29 21:32:02 -04:00
Andrew Kelley
8d3b7689ad
std.net: port the RFC 3484/6724 destination...
...
...address selection from musl libc
2019-10-29 16:10:14 -04:00
Andrew Kelley
9ade31faaf
implement CNAME expansion
2019-10-29 14:03:39 -04:00
Jonathan Marler
4e0c2ed443
Add tests for ip address formatting
2019-10-29 00:27:45 -06:00
Andrew Kelley
67058b9b70
basic DNS address resolution for linux without libc
2019-10-29 02:19:22 -04:00
Andrew Kelley
d5865f5319
move libc/linux bits around
2019-10-28 15:29:50 -04:00
Andrew Kelley
845be4ea3e
fix regression in translate-c
2019-10-28 15:29:50 -04:00
Andrew Kelley
f4c244b3d0
partial no-libc implementation of std.net.getAddressList
2019-10-28 15:29:50 -04:00
Andrew Kelley
4b80e376e3
std.net.getAddressList
2019-10-28 15:29:50 -04:00
Andrew Kelley
4f594527c0
detect async fn recursion and emit compile error
2019-10-28 15:10:48 -04:00
Andrew Kelley
a3222b5ff1
remove dead tls code
2019-10-28 15:10:12 -04:00
Andrew Kelley
b37c009683
Merge pull request #3541 from xackus/language_server
...
* fix json parser crashing on empty input
* make implicit cast of tagged unions to enums easier to find in docs
2019-10-28 15:08:33 -04:00
Timon Kruiper
03603ea353
Std docs: Fix a js error that would cause some function to be not rendered
2019-10-28 15:06:55 -04:00
Andrew Kelley
f2d0d9820d
synchronize the target features for compiling C code
...
d91fc0fdd8 changed zig's behavior to
disable the SSE feature when cross compiling for i386-freestanding.
This commit does the same when compiling C Code.
2019-10-28 14:37:32 -04:00
Nathan Michaels
6fdeaac338
Add some documentation for standard library things. ( #3540 )
...
* Add some documentation for standard library things.
Added a bunch of descriptions for array_list.
Added some usage notes for failing_allocator.
Documented some of mem.Allocator.
2019-10-28 03:57:23 -04:00
xackus
36fa5fabc6
rename error and specify it in function
2019-10-27 21:52:28 +01:00
xackus
eeb6536c85
better test name for empty string
...
Co-Authored-By: Andrew Kelley <andrew@ziglang.org >
2019-10-27 21:41:52 +01:00
xackus
8960e8090e
make implicit cast of tagged unions to enums easier to find in docs
2019-10-27 21:35:22 +01:00
Andrew Kelley
8af6c7e34c
Merge pull request #3522 from SebastianKeller/WriteJson
...
Added 'writeJson' to write_stream.zig:
2019-10-27 15:53:24 -04:00
Sebastian Keller
78b00c0b51
Added test for 'emitJson'
2019-10-27 20:49:42 +01:00
Sebastian Keller
ac705a7bb6
Unified public api
2019-10-27 20:15:48 +01:00
Henry Wu
f756d875b1
generated docs: vertically align fns with comments
2019-10-27 15:11:36 -04:00
Andrew Kelley
4a57913ca0
std.target: use mem instead of std.mem
2019-10-27 14:27:20 -04:00
Benoit Giannangeli
73c4a5f186
lib/std/target.zig: Added missing 'mem' constant
2019-10-27 14:26:25 -04:00
xackus
a0abd3be85
fix json parser crashing on empty input
...
remove unreachable code
2019-10-27 10:45:54 +01:00
Andrew Kelley
05003d533a
Merge pull request #3537 from lun-4/fix/accept4
...
fix std.os.accept4
2019-10-26 21:31:38 -04:00
Luna
d4e41c5bc6
std: make addr_size parameter be a pointer to socklen_t
...
removes ptrCast
2019-10-26 22:05:17 -03:00
Luna
bf16fc210b
fix std.os.accept4
...
- add WouldBlock to list of errors in AcceptError
- ptrCast addr_size to the system's socklen_t, instead of assuming it's
usize
2019-10-26 22:00:50 -03:00
Andrew Kelley
fafd1fd480
ci: disable test-compare-output on aarch64
2019-10-26 18:48:42 -04:00
Noam Preil
d91fc0fdd8
Don't use SSE on freestanding
2019-10-26 16:46:43 -04:00
Noam Preil
b8305b5648
Don't save/restore stack on newStackCall to noreturn function
2019-10-26 16:45:46 -04:00
Andrew Kelley
ee21bab253
ci: -Dskip-release for aarch64 to hit 1 hour time limit
2019-10-26 13:14:54 -04:00
Timon Kruiper
d04c58816d
Translate-c: Fix a segfault when to many errors are emitted
...
This was already fixed when doing `@cImport`, but not yet when
running `zig translate-c`.
2019-10-26 13:09:23 -04:00
Andrew Kelley
05fd59e06a
ci: enable more passing tests on aarch64-linux
2019-10-26 12:09:15 -04:00
Michael Dusan
3aeb1b115d
stage1: fix compile error on macOS Xcode 11.2
...
src/codegen.cpp:7713:33: error: unused variable 'global_linkage_values' [-Werror,-Wunused-const-variable]
static const GlobalLinkageValue global_linkage_values[] = {
2019-10-25 17:49:01 -04:00
Andrew Kelley
e219f0c786
fix regression in zig run
...
changes in 1dcf540426 added a "double
free" of the progress node, causing a segfault for `zig run` when there
is a terminal attached. fixed.
2019-10-25 13:03:12 -04:00
Andrew Kelley
952aa7a9c1
ci: perform git config inside zig git repo dir
2019-10-25 04:26:22 -04:00
Andrew Kelley
c5e26b8673
ci: force git name-rev to be 9 on all targets
2019-10-25 03:27:00 -04:00
Andrew Kelley
aa2607a109
Merge branch 'ci-drone-cloud'
2019-10-24 21:41:14 -04:00
Andrew Kelley
6eba65bd7f
ci: add aarch64 to download page
2019-10-24 21:40:26 -04:00
Andrew Kelley
bf5be65be6
disable not working stuff
2019-10-24 21:13:47 -04:00
Andrew Kelley
55c282ed51
os.dup2: handle EBAF
2019-10-24 21:13:05 -04:00
Andrew Kelley
f6367a0751
ci: build docs, fix PR logic
2019-10-24 20:47:50 -04:00
Andrew Kelley
695a746aa0
ci: use x86_64 namespaced docker image
...
I took a risk that docker had implemented namespacing with regards to
architectures correctly, but of course they didn't. So the CI docker
image for x86_64 was clobbered by an aarch64 image with the same name.
Now we're doing arch namespaces with the tag name, so here's the x86_64
one.
2019-10-24 20:46:07 -04:00
Andrew Kelley
551e70dcb2
ci: add s3 secrets to drone config
2019-10-24 19:46:11 -04:00
Andrew Kelley
43f5054a90
ci: drone tests only aarch64 with docker image
2019-10-24 19:46:11 -04:00
Andrew Kelley
79cb383f7d
fix 32-bit build of translate_c.zig
2019-10-24 19:46:11 -04:00
Andrew Kelley
0e9f32d42b
disable static build for now until the docker image is ready
2019-10-24 19:46:11 -04:00
Andrew Kelley
099532af87
add Drone Cloud CI configuration
2019-10-24 19:46:11 -04:00
Andrew Kelley
ad438a95c5
avoid passing -march=native when not supported
...
Clang does not support -march=native for all targets.
Arguably it should always work, but in reality it gives:
error: the clang compiler does not support '-march=native'
If we move CPU detection logic into Zig itelf, we will not need this,
instead we will always pass target features and CPU configuration explicitly.
For now, we simply avoid passing the flag when it is known to not be
supported.
2019-10-24 19:43:56 -04:00
Andrew Kelley
f8bd1cd3b1
implement partial C ABI support for aarch64
2019-10-24 19:13:21 -04:00
Sebastian Keller
6257b4c596
Shortened switch statement
2019-10-24 22:44:12 +02:00
Andrew Kelley
32c89531b1
Add missing compile error when ptr used instead of array
...
in array literals.
Fixes #3524
2019-10-24 16:23:33 -04:00
Sebastian Keller
b82b6a7093
Added 'writeJson' to write_stream.zig:
...
Small addition to make writing a json value easier
2019-10-24 14:23:36 +02:00
Andrew Kelley
345042ecbc
Merge pull request #3519 from ziglang/move-builtin-types
...
move types from builtin to std
2019-10-24 02:25:22 -04:00
Andrew Kelley
60cd11bd4b
get rid of std.os.foo.is_the_target
...
It had the downside of running all the comptime blocks and resolving
all the usingnamespaces of each system, when just trying to discover if
the current system is a particular one.
For Darwin, where it's nice to use `std.Target.current.isDarwin()`, this
demonstrates the utility that #425 would provide.
2019-10-24 01:14:52 -04:00
Andrew Kelley
8591731f2b
refAllDecls in a test block to limit when it gets run
2019-10-24 00:32:18 -04:00
Andrew Kelley
17eb24a7e4
move types from builtin to std
...
* All the data types from `@import("builtin")` are moved to
`@import("std").builtin`. The target-related types are moved
to `std.Target`. This allows the data types to have methods, such as
`std.Target.current.isDarwin()`.
* `std.os.windows.subsystem` is moved to
`std.Target.current.subsystem`.
* Remove the concept of the panic package from the compiler
implementation. Instead, `std.builtin.panic` is always the panic
function. It checks for `@hasDecl(@import("root"), "panic")`,
or else provides a default implementation.
This is an important step for multibuilds (#3028 ). Without this change,
the types inside the builtin namespace look like different types, when
trying to merge builds with different target settings. With this change,
Zig can figure out that, e.g., `std.builtin.Os` (the enum type) from one
compilation and `std.builtin.Os` from another compilation are the same
type, even if the target OS value differs.
2019-10-23 19:09:49 -04:00
Jonathan Marler
ef62452363
Handle TERM=dumb for stdout/stderr
2019-10-23 11:44:39 -04:00
Andrew Kelley
e98e5dda52
implement safety for resuming non-suspended function
...
closes #3469
2019-10-22 23:43:27 -04:00
Andrew Kelley
1dcf540426
main.cpp: fix not ending progress node for zig build
2019-10-22 23:32:06 -04:00
emekoi
cb8dacabd8
explicity linked ntdll on mingw-w64
2019-10-22 20:42:51 -04:00
Andrew Kelley
f65b1d4680
integrate stage1 progress display with semantic analysis
2019-10-22 17:52:12 -04:00
Maximilian Hunt
dc080573d1
Add documentation on function parameter type inference.
2019-10-22 15:28:21 -04:00
Andrew Kelley
0dbdb6329f
Merge pull request #3503 from MasterQ32/markdown-renderer
...
Starts to implement markdown parser.
2019-10-22 15:26:42 -04:00
Felix Queißner
c71857703f
Adds documentation for std.fmt.format grammar and customization. ( #3474 )
2019-10-22 14:58:27 -04:00
Felix Queißner
03f1ad5007
Merge branch 'master' of https://github.com/ziglang/zig into markdown-renderer
2019-10-22 20:29:25 +02:00
Andrew Kelley
e839250c51
Merge branch 'stratact-no-dir-allocators'
...
closes #2885
closes #2886
closes #2888
closes #3249
2019-10-21 23:54:29 -04:00
Andrew Kelley
a5cc758036
std.os.accept4: improve docs and integrate with evented I/O
2019-10-21 23:23:11 -04:00
Jonathan Marler
87b11617b5
Fix accept function API
...
The sockaddr pointer and size of the accept function points to a data structure that can only be determined at runtime. The only requirement is that it must be large enough to hold 2 bytes for the address family value. Typeical usage of the socket API is for UDP/TCP IPv4 and IPv6 sockets, which use sockaddr_in and sockaddr_in6. And some sockets can actually support both simultaneously in which case the app may want to have access to the size of the returned sockaddr. Operating systems can even support custom protocols where they use custom sockaddr data structures. In this case the standard library would have no knowledge of the actual size of the sockaddr being passed into the accept function. In this case the standard library should defer to the app to pass in the size of their structure.
2019-10-21 23:12:35 -04:00
Vexu
2550cb4638
remove pub syntax for container fields
2019-10-21 23:04:19 -04:00
Andrew Kelley
064377be9a
test runner: restore previous behavior of printing all tests passed
2019-10-21 22:21:18 -04:00
Andrew Kelley
fc6f84f3f0
fix os.unlinkatW implementation
2019-10-21 20:58:53 -04:00
Andrew Kelley
65165554d0
test runner: restore previous behavior when...
...
...stderr does not support ansi escape codes
2019-10-21 20:50:47 -04:00
Andrew Kelley
9a82f00a4f
add freebsd AT_* bits
2019-10-21 20:50:47 -04:00
Andrew Kelley
5917572e59
cleanup
2019-10-21 20:50:47 -04:00
Andrew Kelley
98c4365b66
darwin: add AT_* bits
2019-10-21 19:39:30 -04:00
Andrew Kelley
87f632b08a
fs.Dir.openDir: use empty object name for "." on Windows
2019-10-21 19:19:49 -04:00
Andrew Kelley
859cbef8a4
test runner: refresh display before running test
...
This makes it so that when a test fails quickly, and writes output, it
will do so after the test name is printed.
2019-10-21 19:01:08 -04:00
Andrew Kelley
16a91e6a45
adjust test runner to print the test name when error occurs
2019-10-21 18:36:37 -04:00
Andrew Kelley
ef67c49785
[wip] use NtDll APIs on Windows to implement std.fs.Dir
2019-10-21 14:18:01 -04:00
LemonBoy
ddb87237de
Fix crash with peer type resolution & error unions
...
Fixes #3353
2019-10-20 22:03:39 -04:00
Andrew Kelley
5b1a492012
breaking: improve std.fs directory handling API
...
* Added `std.c.unlinkat` and `std.os.unlinkat`.
* Removed `std.fs.MAX_BUF_BYTES` (this declaration never made it to
master branch)
* Added `std.fs.Dir.deleteTree` to be used on an open directory handle.
* `std.fs.deleteTree` has better behavior for both relative and
absolute paths. For absolute paths, it opens the base directory
and uses that handle for subsequent operations. For relative paths,
it does a similar strategy, using the cwd handle.
* The error set of `std.fs.deleteTree` is improved to no longer have
these possible errors:
- OutOfMemory
- FileTooBig
- IsDir
- DirNotEmpty
- PathAlreadyExists
- NoSpaceLeft
* Added `std.fs.Dir.posix_cwd` which is a statically initialized
directory representing the current working directory.
* The error set of `std.Dir.open` is improved to no longer have these
possible errors:
- FileTooBig
- IsDir
- NoSpaceLeft
- PathAlreadyExists
- OutOfMemory
* Added more alternative functions to `std.fs` for when the path
parameter is a null terminated string. This can sometimes be more
effecient on systems which have an ABI based on null terminated
strings.
* Added `std.fs.Dir.openDir`, `std.fs.Dir.deleteFile`, and
`std.fs.Dir.deleteDir` which all operate on an open directory handle.
* `std.fs.Walker.Entry` now has a `dir` field, which can be used to do
operations directly on `std.fs.Walker.Entry.basename`, avoiding
`error.NameTooLong` for deeply nested paths.
* Added more docs to `std.os.OpenError`
This commit does the POSIX components for these changes. I plan to
follow up shortly with a commit for Windows.
2019-10-20 21:48:23 -04:00
LemonBoy
771dafbaba
Resolve lazy slice start/end values
...
Fixes #3489
2019-10-20 14:49:25 -04:00
Felix Queißner
5456eb1107
Starts to implement markdown parser. Implemented: strong, emphasis, strikethrough, underline, code blocks, ulist, olist, paragraphs, headings. Planned: Links, Images, internal references.
2019-10-20 11:49:28 +02:00
Andrew Kelley
6948d7fce7
Merge pull request #3429 from Rocknest/docs-local
...
Design suggestion for generated docs
2019-10-19 16:43:39 -04:00
Andrew Kelley
dbb1eaefb5
Merge pull request #3473 from nrdmn/subsystem
...
Configurable PE Subsystem
2019-10-19 15:11:23 -04:00
stratact
e78d3750c5
Use 8192 sized buffers and remove allocator parameters
2019-10-19 14:04:51 -04:00
LemonBoy
6f7939a452
Prevent too eager constant-folding of switch expression
...
A pointer was wrongly assumed to be comptime-available causing the
analysis pass to assume its initial value was constant.
Fixes #3481
2019-10-19 13:48:26 -04:00
LemonBoy
bab93e7561
Fix crash when generating constant unions with single field
2019-10-19 13:47:49 -04:00
Andrew Kelley
63dfca9715
Merge pull request #3482 from ziglang/mem-usage-report
...
add -DZIG_ENABLE_MEM_PROFILE option and -fmem-report flag
2019-10-19 12:42:32 -04:00
Andrew Kelley
4e98512344
reduce the size of IrInstruction by 8 bytes on 64 bit targets
...
This brings the std lib tests down from 3.51 GiB memory usage
to 3.41 GiB, by making two fields that were 64 bits 32 bits.
This is a small thing; the bigger wins will come from the strategy
outlined in the previous commit.
2019-10-19 03:51:04 -04:00
Andrew Kelley
fa9f1d2396
add -DZIG_ENABLE_MEM_PROFILE option and -fmem-report flag
...
This can be used to find what's taking up memory in the compiler.
Here's an example of how to use it:
```
./zig test ../lib/std/std.zig --cache off -fmem-report
```
And here's the output I get for this on x86_64-linux-gnu today:
```
Const: 6462833 items, 152 bytes each, total 936.84 MiB
ConstGlobalRefs: 17236534 items, 24 bytes each, total 394.51 MiB
ResetResult: 1698108 items, 160 bytes each, total 259.11 MiB
ConstExprValue: 3118299 items, 80 bytes each, total 237.91 MiB
EndExpr: 1345395 items, 168 bytes each, total 215.56 MiB
Unknown_8: 27370821 items, 8 bytes each, total 208.82 MiB
VarPtr: 1127866 items, 168 bytes each, total 180.70 MiB
IrBasicBlock: 794834 items, 120 bytes each, total 90.96 MiB
LoadPtr: 554024 items, 160 bytes each, total 84.54 MiB
Unknown_64: 1245715 items, 64 bytes each, total 76.03 MiB
Unknown_40: 1879218 items, 40 bytes each, total 71.69 MiB
Unknown_72: 989117 items, 72 bytes each, total 67.92 MiB
Return: 423783 items, 160 bytes each, total 64.66 MiB
Unknown_168: 332480 items, 168 bytes each, total 53.27 MiB
Unknown_152: 336890 items, 152 bytes each, total 48.84 MiB
AddImplicitReturnType: 230819 items, 168 bytes each, total 36.98 MiB
Br: 217835 items, 168 bytes each, total 34.90 MiB
Unknown_184: 179529 items, 184 bytes each, total 31.50 MiB
FieldPtr: 179388 items, 184 bytes each, total 31.48 MiB
BinOp: 171004 items, 176 bytes each, total 28.70 MiB
LoadPtrGen: 173287 items, 168 bytes each, total 27.76 MiB
CondBr: 137864 items, 192 bytes each, total 25.24 MiB
Unknown_720: 30918 items, 720 bytes each, total 21.23 MiB
CallSrc: 99320 items, 216 bytes each, total 20.46 MiB
Unknown_160: 129243 items, 160 bytes each, total 19.72 MiB
Unknown_1: 19339456 items, 1 bytes each, total 18.44 MiB
CheckStatementIsVoid: 119838 items, 160 bytes each, total 18.29 MiB
Unknown_48: 371178 items, 48 bytes each, total 16.99 MiB
TestComptime: 101443 items, 160 bytes each, total 15.48 MiB
DeclVarSrc: 72578 items, 184 bytes each, total 12.74 MiB
StorePtr: 72776 items, 176 bytes each, total 12.22 MiB
ZigVar: 79201 items, 160 bytes each, total 12.09 MiB
Unknown_16: 770643 items, 16 bytes each, total 11.76 MiB
Phi: 60482 items, 184 bytes each, total 10.61 MiB
TestErrSrc: 66177 items, 168 bytes each, total 10.60 MiB
Unknown_240: 45164 items, 240 bytes each, total 10.34 MiB
ElemPtr: 58232 items, 184 bytes each, total 10.22 MiB
AllocaSrc: 60053 items, 176 bytes each, total 10.08 MiB
CallGen: 44873 items, 224 bytes each, total 9.59 MiB
SaveErrRetAddr: 63787 items, 152 bytes each, total 9.25 MiB
Unknown_112: 82283 items, 112 bytes each, total 8.79 MiB
AllocaGen: 51909 items, 176 bytes each, total 8.71 MiB
Unknown_24: 373599 items, 24 bytes each, total 8.55 MiB
ResultLocPeer: 113683 items, 72 bytes each, total 7.81 MiB
DeclRef: 36343 items, 168 bytes each, total 5.82 MiB
UnwrapErrPayload: 34603 items, 168 bytes each, total 5.54 MiB
Ref: 33414 items, 168 bytes each, total 5.35 MiB
Unknown_104: 53882 items, 104 bytes each, total 5.34 MiB
DeclVarGen: 32540 items, 168 bytes each, total 5.21 MiB
StructFieldPtr: 30449 items, 176 bytes each, total 5.11 MiB
UnwrapErrCode: 31508 items, 168 bytes each, total 5.05 MiB
Unknown_56: 90256 items, 56 bytes each, total 4.82 MiB
SpillBegin: 28722 items, 168 bytes each, total 4.60 MiB
SpillEnd: 28722 items, 160 bytes each, total 4.38 MiB
ResultLocReturn: 64573 items, 48 bytes each, total 2.96 MiB
PtrType: 14702 items, 184 bytes each, total 2.58 MiB
SliceType: 15005 items, 176 bytes each, total 2.52 MiB
Unknown_176: 13326 items, 176 bytes each, total 2.24 MiB
RefGen: 12881 items, 168 bytes each, total 2.06 MiB
UnOp: 12102 items, 176 bytes each, total 2.03 MiB
SwitchBr: 9453 items, 200 bytes each, total 1.80 MiB
TestErrGen: 11143 items, 160 bytes each, total 1.70 MiB
Unknown_32: 52359 items, 32 bytes each, total 1.60 MiB
CheckSwitchProngs: 9094 items, 184 bytes each, total 1.60 MiB
TypeOf: 9259 items, 160 bytes each, total 1.41 MiB
IntCast: 8772 items, 168 bytes each, total 1.41 MiB
OptionalUnwrapPtr: 8755 items, 168 bytes each, total 1.40 MiB
SwitchTarget: 9094 items, 160 bytes each, total 1.39 MiB
Cast: 8198 items, 176 bytes each, total 1.38 MiB
WidenOrShorten: 8448 items, 160 bytes each, total 1.29 MiB
ErrorUnion: 7613 items, 176 bytes each, total 1.28 MiB
SliceSrc: 6249 items, 192 bytes each, total 1.14 MiB
ErrWrapCode: 7133 items, 168 bytes each, total 1.14 MiB
TypeName: 7328 items, 160 bytes each, total 1.12 MiB
ImplicitCast: 5480 items, 176 bytes each, total 941.88 KiB
ResolveResult: 5638 items, 168 bytes each, total 924.98 KiB
ResultLocInstruction: 22696 items, 40 bytes each, total 886.56 KiB
BitCastSrc: 4947 items, 168 bytes each, total 811.62 KiB
CompileErr: 5148 items, 160 bytes each, total 804.38 KiB
ReturnPtr: 5305 items, 152 bytes each, total 787.46 KiB
Unreachable: 5038 items, 152 bytes each, total 747.83 KiB
TestNonNull: 4716 items, 160 bytes each, total 736.88 KiB
BitCastGen: 4431 items, 160 bytes each, total 692.34 KiB
PtrToInt: 4289 items, 160 bytes each, total 670.16 KiB
SliceGen: 3573 items, 192 bytes each, total 669.94 KiB
ArrayType: 4081 items, 168 bytes each, total 669.54 KiB
IntType: 3868 items, 168 bytes each, total 634.59 KiB
Unknown_88: 7213 items, 88 bytes each, total 619.87 KiB
Truncate: 3771 items, 168 bytes each, total 618.68 KiB
TypeInfo: 3740 items, 160 bytes each, total 584.38 KiB
SwitchVar: 3385 items, 176 bytes each, total 581.80 KiB
ContainerInitFields: 3223 items, 184 bytes each, total 579.13 KiB
ContainerInitList: 2309 items, 192 bytes each, total 432.94 KiB
PtrCastGen: 2626 items, 168 bytes each, total 430.83 KiB
BoolNot: 2457 items, 160 bytes each, total 383.91 KiB
FnProto: 2054 items, 184 bytes each, total 369.08 KiB
MergeErrSets: 1927 items, 176 bytes each, total 331.20 KiB
Unknown_136: 2486 items, 136 bytes each, total 330.17 KiB
Unknown_80: 4059 items, 80 bytes each, total 317.11 KiB
Bswap: 1670 items, 168 bytes each, total 273.98 KiB
TypeId: 1680 items, 160 bytes each, total 262.50 KiB
PtrCastSrc: 1371 items, 176 bytes each, total 235.64 KiB
ErrName: 1193 items, 160 bytes each, total 186.41 KiB
UnionTag: 1120 items, 160 bytes each, total 175.00 KiB
TagName: 1050 items, 160 bytes each, total 164.06 KiB
SizeOf: 942 items, 160 bytes each, total 147.19 KiB
MemberName: 871 items, 168 bytes each, total 142.90 KiB
Import: 881 items, 160 bytes each, total 137.66 KiB
PtrOfArrayToSlice: 758 items, 168 bytes each, total 124.36 KiB
UnionFieldPtr: 710 items, 176 bytes each, total 122.03 KiB
EnumToInt: 778 items, 160 bytes each, total 121.56 KiB
CheckRuntimeScope: 700 items, 168 bytes each, total 114.84 KiB
FieldParentPtr: 632 items, 184 bytes each, total 113.56 KiB
BoolToInt: 719 items, 160 bytes each, total 112.34 KiB
ResultLocPeerParent: 904 items, 104 bytes each, total 91.81 KiB
IntToPtr: 537 items, 168 bytes each, total 88.10 KiB
AlignOf: 561 items, 160 bytes each, total 87.66 KiB
AtomicRmw: 356 items, 208 bytes each, total 72.31 KiB
MemberCount: 441 items, 160 bytes each, total 68.91 KiB
Memset: 342 items, 176 bytes each, total 58.78 KiB
PopCount: 321 items, 168 bytes each, total 52.66 KiB
AlignCast: 251 items, 168 bytes each, total 41.18 KiB
IrInstruction *: 5230 items, 8 bytes each, total 40.86 KiB
IrBasicBlock *: 5230 items, 8 bytes each, total 40.86 KiB
TagType: 261 items, 160 bytes each, total 40.78 KiB
HasDecl: 234 items, 168 bytes each, total 38.39 KiB
OverflowOp: 191 items, 200 bytes each, total 37.30 KiB
Export: 209 items, 176 bytes each, total 35.92 KiB
SetCold: 219 items, 160 bytes each, total 34.22 KiB
ReturnAddress: 216 items, 152 bytes each, total 32.06 KiB
FromBytes: 178 items, 176 bytes each, total 30.59 KiB
SetRuntimeSafety: 188 items, 160 bytes each, total 29.38 KiB
OptionalWrap: 151 items, 168 bytes each, total 24.77 KiB
Clz: 143 items, 168 bytes each, total 23.46 KiB
ResizeSlice: 135 items, 168 bytes each, total 22.15 KiB
UnionInitNamedField: 106 items, 184 bytes each, total 19.05 KiB
Panic: 102 items, 160 bytes each, total 15.94 KiB
SwitchElseVar: 93 items, 168 bytes each, total 15.26 KiB
ToBytes: 89 items, 168 bytes each, total 14.60 KiB
IntToFloat: 78 items, 168 bytes each, total 12.80 KiB
Unknown_4360: 3 items, 4360 bytes each, total 12.77 KiB
ErrWrapPayload: 72 items, 168 bytes each, total 11.81 KiB
FloatOp: 62 items, 176 bytes each, total 10.66 KiB
FloatToInt: 47 items, 168 bytes each, total 7.71 KiB
FloatCast: 46 items, 168 bytes each, total 7.55 KiB
ErrToInt: 47 items, 160 bytes each, total 7.34 KiB
Asm: 33 items, 216 bytes each, total 6.96 KiB
ErrSetCast: 40 items, 168 bytes each, total 6.56 KiB
Memcpy: 34 items, 176 bytes each, total 5.84 KiB
AtomicLoad: 17 items, 184 bytes each, total 3.05 KiB
AwaitSrc: 16 items, 168 bytes each, total 2.62 KiB
Resume: 14 items, 160 bytes each, total 2.19 KiB
AwaitGen: 12 items, 176 bytes each, total 2.06 KiB
ArgType: 12 items, 168 bytes each, total 1.97 KiB
AnyFrameType: 12 items, 160 bytes each, total 1.88 KiB
SuspendFinish: 10 items, 160 bytes each, total 1.56 KiB
SuspendBegin: 10 items, 160 bytes each, total 1.56 KiB
Ctz: 9 items, 168 bytes each, total 1.48 KiB
FrameHandle: 8 items, 152 bytes each, total 1.19 KiB
SetEvalBranchQuota: 7 items, 160 bytes each, total 1.09 KiB
AssertZero: 7 items, 160 bytes each, total 1.09 KiB
UndeclaredIdent: 7 items, 160 bytes each, total 1.09 KiB
CmpxchgSrc: 5 items, 216 bytes each, total 1.05 KiB
CmpxchgGen: 5 items, 200 bytes each, total 1000.00 bytes
IntToEnum: 4 items, 168 bytes each, total 672.00 bytes
VectorType: 4 items, 168 bytes each, total 672.00 bytes
ErrorReturnTrace: 2 items, 160 bytes each, total 320.00 bytes
Breakpoint: 2 items, 152 bytes each, total 304.00 bytes
FrameAddress: 2 items, 152 bytes each, total 304.00 bytes
Unknown_4: 61 items, 4 bytes each, total 244.00 bytes
VectorToArray: 1 items, 168 bytes each, total 168.00 bytes
SetAlignStack: 1 items, 160 bytes each, total 160.00 bytes
Unknown_12: 2 items, 12 bytes each, total 24.00 bytes
ErrorTableEntry *: 0 items, 8 bytes each, total 0.00 bytes
AstNode *: 0 items, 8 bytes each, total 0.00 bytes
Total bytes used: 3.51 GiB
```
You can see that most of the memory is taken up by IR instructions,
as well as comptime values. This points toward 2 changes which will
greatly reduce memory usage:
* Rework semantic analysis so that IR instructions can be freed.
Currently the comptime value struct (ConstExprValue) is embedded
directly into the IrInstruction struct. If this is made to be
separate, at the very least pass 1 IR instructions can be freed.
This includes `Const` which is the largest usage of memory currently.
* Rework the ConstExprValue struct to no longer be a tagged union.
For example, there's no need for an integer comptime value to be
80 bytes.
From this you can also see that this eliminates some things from being
the culprit. Before doing this analysis, I considered whether doing
string interning would help. From the above output, you can see that all
strings in the compiler account for only 18 MiB, so string interning
would have been a dead end.
2019-10-19 03:23:23 -04:00
Nick Erdmann
c8dec5729c
std/build: make subsystem configurable
2019-10-18 20:11:28 +02:00
Nick Erdmann
8774b1d947
std/os/windows: remove subsystem detection for uefi
2019-10-18 19:49:02 +02:00
Andrew Kelley
e42d86b657
Merge branch 'lun-4-progress-take-2'
...
closes #3362
2019-10-17 22:08:39 -04:00
Andrew Kelley
2d5b2bf1c9
improve progress reporting
...
* use erase rest of line escape code.
* use `stderr.supportsAnsiEscapeCodes` rather than `isTty`.
* respect `--color off`
* avoid unnecessary recursion
* add `Progress.log`
* disable the progress std lib test since it's noisy and uses
`time.sleep()`.
* enable/integrate progress printing with the default test runner
2019-10-17 21:55:49 -04:00
Andrew Kelley
299991019d
rework the progress module and integrate with stage1
2019-10-17 20:20:22 -04:00
Luna
a73c7bcaf9
add lib/std/progress.zig
2019-10-17 13:32:45 -04:00
Andrew Kelley
17aa8c3ee2
Merge branch 'musl-1.1.24'
...
closes #3463
2019-10-17 13:20:51 -04:00
Andrew Kelley
2aec35525d
mipsel: fix padding on stat struct
2019-10-17 13:20:30 -04:00
Andrew Kelley
88b9579488
update musl src to v1.1.24
2019-10-17 11:55:43 -04:00
Andrew Kelley
1135c9523b
update musl headers to v1.1.24
2019-10-17 11:47:57 -04:00
Andrew Kelley
0cb1c1696f
Merge pull request #3467 from ziglang/windows-static-linking
...
Fully static stage1 compiler on windows
2019-10-16 23:35:07 -04:00
Andrew Kelley
93295f3b13
remove -DZIG_FORCE_EXTERNAL_LLD=ON
...
Looks like the patch we need is in llvm trunk, not llvm 9.
2019-10-16 21:16:06 -04:00
Andrew Kelley
f80c01f9d8
ref more math decls for better docs
2019-10-16 19:16:57 -04:00
Andrew Kelley
c03dc6665f
update CI script for windows static builds
2019-10-16 19:08:41 -04:00
Sahnvour
63ecded3ce
msvc: reduce inlining aggressivity to workaround a codegen bug in cl.exe cf. #3024
2019-10-16 19:04:50 -04:00
Sahnvour
5b51f41cee
stage1: override cmake's default compilation flags to statically link the CRT on windows
...
we want to use /MT instead of /MD for a fully static executable
2019-10-16 19:04:50 -04:00
Rocknest
40d53a7bc5
Merge branch 'master' into docs-local
2019-10-17 01:57:29 +03:00
Rocknest
c95a9e9785
Cleanup
2019-10-17 01:54:39 +03:00
Rocknest
1c5dfaaca9
Changes from master
2019-10-17 01:35:10 +03:00
Andrew Kelley
7598a579ff
turn comments into doc comments
2019-10-16 18:33:12 -04:00
Sebsatian Keller
1b07ff7be0
Add 'missing' consts to math.zig
...
The C library defines constants for log2e and sqrt2 etc. Those should also be available in zig.
2019-10-16 18:31:22 -04:00
Emeka Nkurumeh
700bb19a90
fix std.mem.AsBytesReturnType ( #3442 )
...
closes #3334
2019-10-16 18:15:52 -04:00
Andrew Kelley
45e5841281
Merge pull request #3464 from nrdmn/uefi
...
UEFI improvements
2019-10-16 18:14:32 -04:00
Andrew Kelley
09abd09ab8
add docs for std.fs.File.updateTimes
2019-10-16 18:13:40 -04:00
LemonBoy
6a549a7f0c
Fix compilation of updateTimes on 32bit platforms
...
Add a test to avoid regressions.
Fixes #3412
2019-10-16 18:10:32 -04:00
Andrew Kelley
5181970807
improve docs and field names of Statx struct
2019-10-16 17:24:42 -04:00
Andrew Kelley
312880f102
Merge pull request #3439 from LemonBoy/statx
...
Add support for the statx syscall
2019-10-16 17:11:22 -04:00
Andrew Kelley
3af2202ea4
add -I command line parameter, same as clang
2019-10-16 15:51:13 -04:00
Nick Erdmann
e6eae25053
std/os/uefi: add documentation
2019-10-16 21:46:41 +02:00
Andrew Kelley
8cf3a4d586
[breaking] standardize std.os execve functions
...
* `std.os.execve` had the wrong name; it should have been
`std.os.execvpe`. This is now corrected.
* introduce `std.os.execveC` which does not look at PATH, and uses
null terminated parameters, matching POSIX ABIs. It does not
require an allocator.
* fix typo nonsense doc comment in `std.fs.MAX_PATH_BYTES`.
* introduce `std.os.execvpeC`, which is like `execvpe` except it
uses null terminated parameters, matching POSIX ABIs, and thus
does not require an allocator.
* `std.os.execvpe` implementation is reworked to only convert
parameters and then delegate to `std.os.execvpeC`.
* `std.os.execvpeC` improved to handle `ENOTDIR`. See #3415
2019-10-16 15:24:48 -04:00
Nick Erdmann
77104da43e
std/os/uefi: add Guid format()
2019-10-16 19:49:51 +02:00
Andrew Kelley
10f6176f3d
only look for .defs when needed; remove samsrv.dll cross compiling support
...
previously zig would look for all the .defs even when not needed,
wasting time. also, we only had samsrv definitions for some architectures.
remove cross compiling support for this.
2019-10-16 13:12:35 -04:00
Andrew Kelley
5bfea3f1ea
add more cross compiling support for windows system dlls
2019-10-16 12:43:57 -04:00
Andrew Kelley
f81d9d2c84
add cross compiling support for opengl32.dll
2019-10-16 12:16:35 -04:00
Andrew Kelley
1014cfdf3b
generated docs: progress towards generic types being useful
...
See #3406
2019-10-16 01:49:02 -04:00
Andrew Kelley
47dfaf3d17
merge analysis dumps tool handles errors
2019-10-15 18:40:26 -04:00
Andrew Kelley
c7f994890c
Merge branch 'dtw-waleee-fix-help-modal'
...
closes #3455
2019-10-15 18:38:12 -04:00
Andrew Kelley
e6ca61bdd1
generated docs: further clean up keyboard shortcut handling
...
now it's harder to introduce a bug when modifying keyboard shortcut
code.
2019-10-15 18:37:24 -04:00
dtw-waleee
725c873e81
fix small misstake, 'escape' v. 'Escape'
2019-10-15 18:19:13 -04:00
dtw-waleee
3e891c9c0b
Fix keyboard layout issue with help-modal
...
Some keyboard layouts produces a different ev.which value in firefox
for ? than 191, eg. the Swedish QWERTY one produces 171. Chrome/chromium
doesn't have this issue.
2019-10-15 18:19:13 -04:00
tgschultz
6a629d3a9f
Replaced setTag hack in Deserialize with @unionInit
2019-10-15 18:14:13 -04:00
Andrew Kelley
9050cd847a
fix non-byte-aligned packed struct field...
...
...passed as generic fn parameter causing invalid LLVM IR.
closes #3460
2019-10-15 18:00:16 -04:00
Vexu
7495fd8cb9
fix struct align fmt
2019-10-15 17:58:02 -04:00
Andrew Kelley
f7f3dedb1d
Merge pull request #3436 from LemonBoy/unpatch-lld
...
Assemble lib files using LLVM tools instead of lld
2019-10-13 17:55:36 -04:00
LemonBoy
b164e0ae55
Fix stack iteration stop condition
2019-10-13 17:49:47 -04:00
LemonBoy
230d27c1cd
Adapt to clang API additions
2019-10-13 11:08:16 -04:00
Andrew Kelley
9439bf3809
Merge pull request #3446 from LemonBoy/riscv-things-x
...
More RISC-V stuff
2019-10-13 11:07:39 -04:00
Sahnvour
ae0628b30c
ci: use parallel msbuild.exe processes for faster building on windows
2019-10-13 11:02:21 -04:00
LemonBoy
22e60df680
Propagate user-defined function alignment to LLVM IR
2019-10-13 14:19:36 +02:00
LemonBoy
b1f3f59d66
Fix fp-based backtracing on RISC-V
...
The fp points to the top of the frame instead of pointing to the old fp,
compensate this difference with an offset.
2019-10-13 12:13:41 +02:00
LemonBoy
ba711f1115
Add ELF architecture constant for RISC-V
2019-10-13 12:12:33 +02:00
LemonBoy
ead9630c13
Fix signedness for some fields in ARM stat definition
2019-10-12 20:52:10 +02:00
LemonBoy
40fc7a1fda
Add support for the statx syscall
2019-10-12 20:51:51 +02:00
Rocknest
b175468159
Consistent margins
2019-10-12 19:17:35 +03:00
Andrew Kelley
bd3a633e4d
Merge pull request #3441 from LemonBoy/llvm10
...
LLVM 10
2019-10-12 12:10:22 -04:00
LemonBoy
f77b0b90d8
Correctly mangle frameaddress intrinsic name
2019-10-12 16:47:51 +02:00
LemonBoy
3ea0a76fb6
More clang API changes
2019-10-12 16:25:51 +02:00
LemonBoy
fd4c8a40e9
Replace llvm::make_unique with std::make_unique
2019-10-12 16:18:44 +02:00
LemonBoy
6439759298
Add/shuffle several enum members to match Clang's API
2019-10-12 16:15:58 +02:00
LemonBoy
8a36064c96
Replace usage of createDriverOptTable
2019-10-12 15:27:57 +02:00
LemonBoy
935cce2414
Fix lld search path
2019-10-12 15:27:42 +02:00
LemonBoy
60cf3f8a8c
Revert LLD patch
...
The source is now squeaky-clean again.
2019-10-12 10:57:11 +02:00
LemonBoy
2b624fea84
Add dlltool functionality
...
Don't need no patched lld --kill-at behaviour now.
2019-10-12 10:56:16 +02:00
Andrew Kelley
8b45921664
merge targets of generated docs
2019-10-11 18:14:06 -04:00
Andrew Kelley
30a555eed4
merge dumps tool: merging ast nodes
...
-fgenerate-docs is replaced ith -femit-docs
-fno-emit-bin is added to prevent outputting binary
2019-10-11 18:13:24 -04:00
LemonBoy
8aa20227ed
Fix cross-compilation to i386-windows-msvc
...
Use Mingw's .def files to build a .lib when possible and show an error
otherwise.
2019-10-11 15:52:55 -04:00
Andrew Kelley
01b2c291d5
miscellaneous improvements to generated docs
...
* introduce std.json.WriteStream API for writing json
data to a stream
* add WIP tools/merge_anal_dumps.zig for merging multiple semantic
analysis dumps into one. See #3028
* add std.json.Array, improves generated docs
* add test for `std.process.argsAlloc`, improves test coverage and
generated docs
2019-10-10 23:25:40 -04:00
Andrew Kelley
7b20205e68
codegen.cpp: remove unused variable
2019-10-10 21:24:44 -04:00
Andrew Kelley
0e0976828a
Merge pull request #3421 from LemonBoy/win32-mingw
...
Win32 mingw
2019-10-10 21:23:28 -04:00
Rocknest
b0cd64c019
Merge branch 'master' into docs-local
2019-10-11 04:09:01 +03:00
Rocknest
2bb2a2fcea
Changes from master
2019-10-11 03:54:03 +03:00
Andrew Kelley
6082c14753
generated docs: add optional type support
2019-10-10 20:32:17 -04:00
Andrew Kelley
fa47172841
better debug info for integers
...
now we use ABI size * 8 instead of size_in_bits which makes
gdb work instead of hang
2019-10-10 19:22:15 -04:00
Andrew Kelley
bc393eefa1
generated docs: better rendering of unknown decls
2019-10-10 19:21:56 -04:00
Rocknest
352663a34c
Merge branch 'master' into docs-local
2019-10-11 01:28:43 +03:00
Rocknest
429d5f2879
Changes from master
2019-10-11 00:48:54 +03:00
Rocknest
238ea85b7e
Fix dark mode
...
Additionally introduces css variables
2019-10-11 00:39:08 +03:00
Andrew Kelley
d15a71afc9
generated docs: clean up type names and param names
...
closes #3410
2019-10-10 15:42:40 -04:00
LemonBoy
6cbb732b59
Extern unions should not trigger active field check
...
Fixes #3378
2019-10-10 13:57:48 -04:00
Andrew Kelley
4e81df12c3
generated docs: css: wider tables
2019-10-10 13:40:17 -04:00
Andrew Kelley
57fb550324
Merge branch 'Vexu-docs-union-enum'
2019-10-10 13:36:56 -04:00
Andrew Kelley
78d06ec4af
Merge branch 'docs-union-enum' of https://github.com/Vexu/zig into Vexu-docs-union-enum
2019-10-10 13:36:37 -04:00
Rocknest
a34b697c0c
Add transtition to search field
2019-10-10 18:55:14 +03:00
Rocknest
f597e0d092
Change layout and styles
2019-10-10 18:03:57 +03:00
Andrew Kelley
6330dfbea6
generated docs: better listing of functions
2019-10-10 11:03:16 -04:00
Andrew Kelley
b9d63551de
Merge pull request #3420 from FireFox317/generated-docs-improvements
...
Generated docs: add parameter names to functions
2019-10-10 10:34:44 -04:00
Michael Dusan
3464351d1e
stage1: fix ir_resolve_str() to return slice
...
`ir_resolve_str()` bug returns array expression even when when sliced
to a lesser length. Fix is to return array if slice.len == array.len,
otherwise return slice.
Bug report use-case is based on one builtin function. However, at least
the following builtins were exposed to the bug:
`@byteOffsetOf`
`@cDefine`
`@cImport`
`@cInclude`
`@cUndef`
`@compileError`
`@embedFile`
`@export`
`@fieldParentPtr`
`@hasDecl`
`@hasField`
`@import`
`@unionInit`
closes #3384
2019-10-10 10:20:04 -04:00
Michael Dusan
fd94d78ffc
cleanup: unused imports in test
2019-10-10 10:16:35 -04:00
Timon Kruiper
e34e3344d4
Generated docs: Add function paramater names
2019-10-10 15:23:24 +02:00
Timon Kruiper
4250d27fe5
Generated docs: store static container info in a containerDecl astNode
...
And then get the struct field astNodes through the containerDecl astNode.
The type of a struct field is still stored in the types array, but the
static information is in the astNodes.
2019-10-10 14:21:35 +02:00
LemonBoy
4de3f9d853
Fix stack-probe symbol redefinition
2019-10-10 09:38:57 +02:00
LemonBoy
dfcbca8d2f
Add i386/mingw to the test rooster
2019-10-10 09:38:57 +02:00
LemonBoy
86e5bbffd7
Patch lld to have a more sensible kill-at implementation
...
Lift some code from llvm-dlltool, the lld code is meant to follow what
gnu ld does but that's not much useful for our purposes.
Also use the `--kill-at` option when generating the .lib files out of
mingw's .def files: this way our building process closely matches the
one use by the upstream and now finally generates files that allow both
C code and Zig code to link.
2019-10-10 09:38:57 +02:00
Vexu
2b55484f3f
implement doc generation for union and enum
2019-10-10 10:27:12 +03:00
Andrew Kelley
12ed85d0d1
generated docs: better handle when root is std
2019-10-10 01:38:20 -04:00
Andrew Kelley
510b6443ba
generated docs: avoid clobbering browser shortcut keys
2019-10-09 18:28:50 -04:00
Andrew Kelley
000a1df4a3
generated docs: add array type support
...
See #3404
2019-10-09 18:22:46 -04:00
Andrew Kelley
6d54e8fc3c
generated docs: render values
...
also fix pressing enter in search box before search finishes
closes #3409
2019-10-09 18:09:35 -04:00
Andrew Kelley
13ae7d47b7
generated docs: refactor how type kinds work
2019-10-09 18:09:35 -04:00
Michael Dusan
42f2814d9a
stage1: fix root top-level-struct typename
...
- during diagnostics the string representation for root was empty
and now is `(root)`
- retrofitted all other namespace-qualified type naming to elide
prefixing with root
closes #2032
2019-10-09 17:36:13 -04:00
LemonBoy
c9a3c945db
Add a bunch of mingw lib32 .def files
...
Possibly incomplete, but enough to let the test suite compile & pass.
2019-10-09 22:44:36 +02:00
LemonBoy
b96fa89462
Compile the architecture-specific mingw sources
2019-10-09 22:44:36 +02:00
LemonBoy
9ae293ae3b
Remove x86/Windows name mangling hack
...
Let's fix this properly by generating the correct lib files from the
mingw sources.
2019-10-09 22:44:36 +02:00
LemonBoy
f83bb3dd9e
Fix compilation w/ clang
...
Clang pretends to be gcc 4.4 and that causes some re-definition errors.
The problem has been reported to the upstream some time ago but nothing
was done about it.
2019-10-09 22:44:35 +02:00
LemonBoy
a4b3e695af
Shuffle around some stack-probing functions
2019-10-09 22:44:35 +02:00
Andrew Kelley
e0ab685467
generated docs: more verbose fields
...
also prevent docs making hyperlinks for integer types
2019-10-09 16:31:20 -04:00
Andrew Kelley
8d5e3a2f33
generated docs: separate section for namespaces
...
if a type is a struct with no fields, then it goes in the namespaces
section.
2019-10-09 15:52:55 -04:00
Andrew Kelley
c4e4fa2287
zig build: bump default max exec output size to 400 KB
...
closes #3415
2019-10-09 15:24:15 -04:00
Andrew Kelley
3ce83e879b
generated docs: show error sets pages
...
also favicon, improve error sets css, syntax awareness of
noreturn
2019-10-09 15:23:13 -04:00
Andrew Kelley
a5714ddb97
add comments about why we choose pentium4 for i386 target
...
See #3389
2019-10-09 15:06:37 -04:00
Andrew Kelley
2286003666
improve names of error sets when using merge error sets operator
2019-10-09 13:35:19 -04:00
Timon Kruiper
8a547d9e81
Docs: adds docs comments to struct fields
2019-10-09 13:27:06 -04:00
Andrew Kelley
406b70aa56
Merge pull request #3390 from nrdmn/unicode_character_literals
...
unicode character literals
2019-10-09 13:25:41 -04:00
Andrew Kelley
f929a58d5f
Merge pull request #3389 from LemonBoy/win32
...
Win32
2019-10-09 13:22:16 -04:00
Alva
0fc97015e2
Correct std.os.connect_async docs
2019-10-09 13:15:39 -04:00
Andrew Kelley
48f5b21e7c
generated docs: functions in a table with descriptions
2019-10-09 00:24:58 -04:00
Andrew Kelley
71fb4ef8da
generated docs: separate Error Sets from Types
2019-10-08 23:33:19 -04:00
Andrew Kelley
1586f244c4
generated docs: render var decls
2019-10-08 23:24:50 -04:00
Andrew Kelley
5e765356a7
generated docs: global vars in a table
2019-10-08 23:15:47 -04:00
Andrew Kelley
ca3250a57c
generated docs: add global variables
...
See #3409
2019-10-08 22:39:12 -04:00
Andrew Kelley
cdaaf7c725
generated docs: consistent coloring
2019-10-08 19:04:35 -04:00
Andrew Kelley
e0f0e2aace
generated docs: error sets in fn docs
2019-10-08 18:09:08 -04:00
Timon Kruiper
f74c29b49a
Add initial support for struct fields in the docs
2019-10-08 17:29:03 -04:00
Christine Dodrill
1e59eb3c94
src/main: minor grammar fix in the help for zig builtin
2019-10-08 15:14:10 -04:00
Andrew Kelley
784a493dc7
generated docs: functions with inferred error sets display nicely
...
infrastructure in place for displaying error sets
2019-10-08 13:41:13 -04:00
Andrew Kelley
03a6b33a73
generated docs: bool type and fix error for some fns
2019-10-08 11:59:55 -04:00
Andrew Kelley
6814d6b332
generated docs: function parameters have links
2019-10-08 11:52:06 -04:00
Andrew Kelley
a55db08a7b
generated docs contain generic instantiations and comptime calls
2019-10-08 00:15:16 -04:00
Andrew Kelley
ffc0c26b27
generated docs: highlight active package
2019-10-08 00:15:16 -04:00
Andrew Kelley
2e26aaa70c
generated docs: prioritized sort ranking
2019-10-08 00:15:14 -04:00
Andrew Kelley
7688100b17
stage1: enable PIC for libuserland
...
we don't really have a way to determine whether the stage1
zig compiler requires PIC so to be safe we always enable it
when building libuserland.
fixes build on some configurations of alpine linux.
2019-10-08 00:06:28 -04:00
Andrew Kelley
15471531d0
generated docs: sort search results
2019-10-07 18:17:06 -04:00
Andrew Kelley
478e53911d
generated docs: smart ignore case
2019-10-07 18:12:28 -04:00
Andrew Kelley
9df0d53981
generated docs: search cleanup
2019-10-07 18:00:01 -04:00
Andrew Kelley
4a97558ae8
generated docs: navigable search results
2019-10-07 17:46:22 -04:00
Andrew Kelley
d46234ef72
generated docs: keyboard shortcuts modal
2019-10-07 15:41:45 -04:00
Andrew Kelley
16de5a7228
generated docs: fix search stuff
2019-10-07 14:47:59 -04:00
Andrew Kelley
d70c30055e
generated docs: better navigation
2019-10-07 14:29:01 -04:00
Andrew Kelley
9237461b24
generated docs: logo and basic search proof of concept
2019-10-07 13:57:01 -04:00
Andrew Kelley
2ccb48ddc3
generated docs: show doc comments on functions
2019-10-07 12:21:11 -04:00
Andrew Kelley
85b8854c41
move doc/ to docs/
...
fixes regression caused by 86171afb9b
2019-10-07 11:31:47 -04:00
Nick Erdmann
ae7392e504
unicode character literals
2019-10-07 08:18:16 +02:00
Matt Keeter
e706cc24f0
Fix typo in docs
2019-10-07 02:03:57 -04:00
Andrew Kelley
8e2c441b2e
stage1 parser supports doc comments
2019-10-06 16:39:27 -04:00
Andrew Kelley
86171afb9b
generated docs: docs/ instead of doc/
...
This appears to be more of a standard directory name.
See #21
2019-10-06 14:48:01 -04:00
LemonBoy
6a687bda76
Support for TLS on Win32
2019-10-06 16:45:51 +02:00
LemonBoy
93a49076f7
Initial support for i386-windows-msvc target
2019-10-06 14:27:36 +02:00
Andrew Kelley
571123465b
generated docs: canonical package paths
2019-10-05 18:01:01 -04:00
Andrew Kelley
0e40fc46d1
generated docs: show public stuff only
2019-10-05 16:38:42 -04:00
Andrew Kelley
19c2474b34
generated docs: render functions
2019-10-05 16:38:42 -04:00
Michael Dusan
a82c6453c1
Merge pull request #3368 from mikdusan/issue.3367
...
fix: container member access `usingnamespace` decls fails
2019-10-05 15:47:07 -04:00
Andrew Kelley
edadccde54
generated docs: add navigation bar
2019-10-05 15:33:23 -04:00
Michael Dusan
a23a022820
fix container member access for fn/struct-fn
...
- decls brought in via `usingnamespace` were not always found
because lookup was performed directly against decl_table and
use_decls was never consulted
- fix to use find_container_decl() path instead
- closes #3367
2019-10-05 14:09:09 -04:00
Andrew Kelley
5aa1e78807
generated docs: navigable types
2019-10-05 13:29:35 -04:00
Andrew Kelley
f78d49c916
generated docs: navigable packages
2019-10-05 13:07:59 -04:00
Andrew Kelley
dca6e74fec
proof of concept of stage1 doc generation
...
This commit adds `-fgenerate-docs` CLI option, and it outputs:
* doc/index.html
* doc/data.js
* doc/main.js
In this strategy, we have 1 static html page and 1 static javascript
file, which loads the semantic analysis dump directly and renders it
using dom manipulation.
Currently, all it does is list the declarations. But there is a lot more
data available to work with. The next step would be making the
declarations hyperlinks, and handling page navigation.
Another strategy would be to generate a static site with no javascript,
based on the semantic analysis dump that zig now provides. I invite the
Zig community to take on such a project. However this version which
heavily relies on javascript will also be a direction explored.
I also welcome contributors to improve the html, css, and javascript of
what this commit started, as well as whatever improvements are necessary
to the static analysis dumping code to provide more information.
See #21 .
2019-10-04 20:18:06 -04:00
Andrew Kelley
2f4dad04e0
langref: no viewport
2019-10-04 14:06:55 -04:00
Michael Dusan
81c6bd37aa
stage1: fix compile error on macOS Xcode 11.1
2019-10-04 01:33:31 -04:00
Andrew Kelley
071af5c1d6
fix noreturn attribute for msvc
2019-10-03 22:51:00 -04:00
Andrew Kelley
eca2aa66fe
Merge pull request #3372 from ziglang/dump-analysis
...
add -fdump-analysis to dump type information to json
2019-10-03 18:37:30 -04:00
Andrew Kelley
39d47b2c51
handle when std lib is unused
2019-10-03 18:05:44 -04:00
Andrew Kelley
59ac7b91da
add -fdump-analysis to dump type information to json
...
This commit adds -fdump-analysis which creates
a `$NAME-analysis.json` file with all of the finished
semantic analysis that the stage1 compiler produced.
It contains types, packages, declarations, and files.
This is an initial implementation; some data will be
missing. However it's easy to improve the implementation,
which is in `src/dump_analysis.cpp`.
The next step for #21 will be to create Zig code which parses
this json file and creates user-facing HTML documentation.
This feature has other uses, however; for example, it could
be used for IDE integration features until the self-hosted
compiler is available.
2019-10-03 17:58:22 -04:00
LemonBoy
7640bec8e0
Fix pipe syscall for MIPS
2019-10-03 17:07:53 -04:00
Andrew Kelley
7481a4ad08
zig build: fix exe file ext to match target.cpp
2019-10-03 16:02:24 -04:00
Andrew Kelley
edef35bb57
docs: use the updated png favicon
2019-10-03 11:15:55 -04:00
Andrew Kelley
a7c9aa7ddb
finish conversion of translate_c.cpp to use zig_clang.h
...
See #1964
translate_c.cpp now exclusively uses the clang API via zig_clang.h
shaves off 5 seconds from building zig when translate_c.cpp
(or any h files it uses) change.
2019-10-02 19:21:40 -04:00
Andrew Kelley
ce56ae8afe
we have to use c++14 now for llvm10
2019-10-02 13:05:10 -04:00
Andrew Kelley
6f10e3fda6
llvm 9.0.0 => llvm 10.0.0
2019-10-02 02:11:46 -04:00
Andrew Kelley
f84086132f
more conversion of translate_c.cpp to use zig_clang.h
...
Progress: 96%
See #1964
2019-10-02 02:02:31 -04:00
Andrew Kelley
a8d6954c23
fix tripping LLVM assertion in const unions
2019-10-01 17:41:03 -04:00
Andrew Kelley
c1a05f0581
translate-c: make trans_implicit_cast_expr use zig_clang.h
...
See #1964
2019-10-01 17:33:11 -04:00
LemonBoy
17f2af10b5
Correct signal bits for MIPS
...
Also enable the segfault handler for all the supported architectures
beside MIPS.
2019-10-01 13:58:58 -04:00
SamTebbs33
bed4bfa69a
Replace code occurences of --override-std-dir with --override-lib-dir
2019-10-01 07:29:24 -04:00
Andrew Kelley
5026db1d31
langref: add 0.5.0 docs link
2019-09-30 12:13:51 -04:00
Andrew Kelley
0dd8adcdb4
Release 0.5.0
2019-09-30 10:09:33 -04:00
Andrew Kelley
e0eb045b5f
remove unhelpful/outdated/unused doc file
2019-09-30 08:33:04 -04:00
Andrew Kelley
0e9f86b1db
docs: docgen supports release safe exe code examples
...
and make the type names of `@hasDecl` and `@hasField` consistent
2019-09-29 17:28:30 -04:00
Andrew Kelley
ffaf37a7e7
Merge pull request #3343 from ziglang/windows-libc-um-dir
...
detect the windows um include directory
2019-09-29 15:47:01 -04:00
Andrew Kelley
339f621735
detect the shared windows include dir as well
2019-09-29 14:12:06 -04:00
Andrew Kelley
c8e967f43d
detect the windows um include directory
2019-09-29 14:04:23 -04:00
Andrew Kelley
ec545859b9
docgen: support code examples for riscv target
2019-09-29 14:03:49 -04:00
Nick Erdmann
ff9c3c6e5b
std/os/uefi: fix Guid alignment in rng protocol
2019-09-29 12:28:14 -04:00
Andrew Kelley
bd46c1c328
RISC-V: get to the linking phase of behavior tests
...
See #3338 and #3339
2019-09-29 12:21:22 -04:00
Andrew Kelley
543e729398
Merge pull request #3331 from meme/android-ndk
...
Support Android NDK
2019-09-28 13:30:19 -04:00
meme
030abfa0d2
minor tweaks
2019-09-28 13:21:29 -04:00
meme
0c556095f4
do not link against gcc runtime on Android target
2019-09-28 12:48:13 -04:00
Andrew Kelley
ce0e794092
fix glibc builds on aarch64-linux-gnu
...
There was a missing include path in the compilation line, leading to
incorrect fstat ABI.
closes #3291
2019-09-27 18:19:21 -04:00
Andrew Kelley
579301c2af
avoid duplicated code of specifying the default glibc version
2019-09-27 17:39:11 -04:00
meme
308e7d5314
fix building static Android executables
2019-09-27 17:33:07 -04:00
Andrew Kelley
dc299166cf
std.os.fstat: EINVAL => unreachable
...
Related: #3291
2019-09-27 17:17:24 -04:00
meme
f7bf61a983
support Android NDK and bionic
2019-09-27 16:51:42 -04:00
Andrew Kelley
878aece87b
Merge branch 'LemonBoy-fix-3138'
...
closes #3213
2019-09-27 15:58:39 -04:00
Andrew Kelley
09575bc0d6
fully specify padding bytes when necessary
...
This is what I was going for originally - either we understand that
LLVM's padding is sufficient, or we do the entire padding ourselves.
2019-09-27 15:53:30 -04:00
LemonBoy
67bd0267db
Correct calculation of padding length in struct
...
Make sure the resulting type is in-sync with the one produced and used
by LLVM.
Fixes #3138
2019-09-27 15:39:19 -04:00
Andrew Kelley
70e934f116
Merge pull request #3326 from LemonBoy/misc-misc
...
Miscellaneous and very small patches regarding mipsel and musl libc
2019-09-27 14:53:52 -04:00
LemonBoy
9ad0541f2c
Enable mipsel+libc tests on CI
2019-09-27 18:44:49 +02:00
LemonBoy
a220648198
Backport patch for Musl libc
...
Allows musl to compile for mipsel targets.
https://www.openwall.com/lists/musl/2019/09/27/1/2
2019-09-27 18:20:00 +02:00
LemonBoy
5aaa7d0fbb
Avoid truncating mmap2 offsets if not multiple of page size
2019-09-27 18:18:38 +02:00
Andrew Kelley
805f9b309b
add regression test for alignment of constants
...
closes #1741
2019-09-27 10:58:39 -04:00
Andrew Kelley
a1a3e46e0a
Merge pull request #3323 from nrdmn/uefi
...
some minor UEFI improvements
2019-09-27 10:41:26 -04:00
Nick Erdmann
4527110e02
std/os/uefi: add some hii support
2019-09-27 07:56:14 +02:00
Nick Erdmann
a4f324e9ea
std/os/uefi: add exitBootServices and allocatePool
2019-09-27 07:56:02 +02:00
Andrew Kelley
23a82b5ffd
fix mipsel regression in previous commit
...
I think that should actually be a compile error, it's a usingnamespace
that depends on itself. This workaround is fine for now.
2019-09-26 21:38:04 -04:00
Andrew Kelley
ebe79329a2
fix some linux declarations not getting exposed
2019-09-26 18:49:37 -04:00
Andrew Kelley
4d65373a3d
Merge pull request #3311 from LemonBoy/mips
...
Initial support for mipsel architecture
2019-09-26 13:44:36 -04:00
LemonBoy
2c8864f634
Don't warn about redeclaration for the same var node
...
Closes #3316
2019-09-26 13:39:09 -04:00
Andrew Kelley
b89a09af4b
docgen: add "process terminated by signal" to exe_err
2019-09-26 13:11:07 -04:00
LemonBoy
a94372231c
Errno changes for MIPS
2019-09-26 18:07:39 +02:00
Andrew Kelley
94e9b9c625
docs: mention release-small along with release-fast
2019-09-26 12:05:49 -04:00
LemonBoy
dfb4446d09
Add comments about the test cases that have been disabled
2019-09-26 17:42:58 +02:00
LemonBoy
c8e4108c5b
Export _start as __start for MIPS targets
2019-09-26 17:13:57 +02:00
Michael Dusan
efea7958f8
doc: usingnamespace imports only public decls
2019-09-26 10:55:13 -04:00
LemonBoy
a9be62f085
Fix wrong IOCTL value
2019-09-26 11:49:49 +02:00
LemonBoy
4ebcf64864
Initial support for mipsel architecture¬
2019-09-26 09:31:55 +02:00
Andrew Kelley
2f20833097
add -DZIG_SKIP_INSTALL_LIB_FILES cmake option
...
closes #2221
2019-09-26 02:21:29 -04:00
Andrew Kelley
68bb394570
Merge pull request #3315 from ziglang/mv-std-lib
...
Move std/ to lib/std/
2019-09-26 01:54:45 -04:00
Andrew Kelley
4637e8f969
zig additionally looks for lib/std/std.zig
...
previously zig would search up directory parents for
lib/zig/std/std.zig. It still does that, but now it also accepts
lib/std/std.zig. This will probably be how we start shipping windows
.zip files, since the extra directory is pointless.
It also means you can run zig binaries from subdirectories of the zig
source tree without lib files being installed.
2019-09-26 00:30:51 -04:00
Andrew Kelley
dc7016344e
remove --override-std-dir. fix issues caused by moving std lib
2019-09-25 23:59:07 -04:00
Andrew Kelley
ed36dbbd9c
mv std/ lib/
...
that's all this commit does. further commits will fix cli flags and
such.
see #2221
2019-09-25 23:35:41 -04:00
Andrew Kelley
6128bc728d
macos ci: display system info before running anything
2019-09-25 22:50:21 -04:00
Andrew Kelley
568c183d2a
docgen: slightly better caching
2019-09-25 17:59:52 -04:00
Andrew Kelley
f112e8af27
Merge pull request #3312 from ziglang/armv8-linux-musleabihf
...
Enable test coverage for armv8-linux-musleabihf
2019-09-25 17:04:51 -04:00
Andrew Kelley
d1705baa74
enable test coverage for armv8-linux-musleabihf
...
* fix libc prototypes of offsets to have correct integer sizes and
signedness. This gets all behavior tests to pass for
armv8-linux-musleabihf
* fix linux mmap syscall to have correct integer size and signedness
for offset
* disable failing armv8-linux-musleabihf std lib tests. See 3289. I
suspect compiler-rt issue. Note these tests fail with this target
triple regardless of whether musl is actually linked (-lc).
2019-09-25 16:21:04 -04:00
Andrew Kelley
40e77dad83
musl [PATCH] arm: fix setjmp and longjmp asm for armv8-a
...
From: Szabolcs Nagy <szabolcs.nagy@arm.com >
armv8 removed the coprocessor instructions other than cp14, so
on an armv8 system the related hwcaps should never be set.
new llvm complains about the use of coprocessor instructions in
armv8-a mode (even though they are never executed at runtime),
so ifdef them out when musl is built for armv8.
<dalias> i think the patch looks ok
2019-09-25 15:15:52 -04:00
Andrew Kelley
dc3c4197c6
disable known-to-be-failing tests for linux-aarch64-gnueabihf
...
See #3288 . Root cause appears to be #3291 .
2019-09-25 14:17:46 -04:00
Andrew Kelley
c9690916e5
fix building musl on eabihf abis, incorrect include dirs
...
See #3286 . The issue is not fully solved however because this has
uncovered another issue.
2019-09-25 14:03:26 -04:00
Vexu
14ae23326e
ran zig fmt on stdlib
2019-09-25 12:44:11 -04:00
Vexu
29e6541db1
add noasync to zig fmt
2019-09-25 12:44:11 -04:00
LemonBoy
3907e3b675
Fix llseek behavior
2019-09-25 12:10:58 -04:00
Andrew Kelley
48c9e17aa1
Merge pull request #3308 from LemonBoy/riscv-things
...
Miscellaneous RISC-V related commits
2019-09-25 12:08:47 -04:00
LemonBoy
a56b767c35
Add DTP bias according to RISCV ABI
2019-09-25 18:07:17 +02:00
LemonBoy
453157595e
Correct some RISCV64 bits
2019-09-25 09:30:44 +02:00
Andrew Kelley
993d5bc9c9
add docs for usingnamespace
...
closes #1589
2019-09-24 21:23:12 -04:00
Andrew Kelley
53210b2304
better default enabled features for riscv
...
Until ability to specify target CPU features (#2883 ) is done, this
commit gives riscv target better default features.
This side-steps #3275 which is a deficiency in compiler-rt when features
do not include 32 bit integer division.
With this commit, RISC-V compiler-rt tests pass and Hello World works
both pure-zig and with musl libc.
2019-09-24 20:56:04 -04:00
Michael Dusan
9983501ff2
add VarDecl support for struct-method call syntax
...
implements #3306
2019-09-24 19:24:48 -04:00
Andrew Kelley
56b1818beb
docgen: test blocks support linking libc
2019-09-24 11:41:19 -04:00
Andrew Kelley
c0b937ba12
docgen: slightly cleaner display of libc cli args
2019-09-24 11:36:59 -04:00
LemonBoy
5fb7af26ab
Fix result loc unwrapping with optional in error union
...
Fixes #2899
2019-09-24 01:09:26 -04:00
LemonBoy
93367adaa7
Fix assignment to optional payload
...
Closes #3081
2019-09-24 00:31:35 -04:00
Jay Weisskopf
0bdc85181c
Create user-specified output-dir
...
Fixes #2637
2019-09-24 00:20:29 -04:00
LemonBoy
663e665843
Prevent crash with invalid extern type
...
Fixes #3240
2019-09-23 17:30:28 -04:00
LemonBoy
db988f42a7
Fix computation of switch coverage
...
Closes #3258
2019-09-23 16:13:28 -04:00
Andrew Kelley
53ae03ebe9
make type_allowed_in_extern more robust
...
Previously if the type parameter was a pointer, it would assert that the
size of the type was resolved. It used to be that the size of pointers was
always resolved, however with lazy values, pointers gained the
possibility of not having their size resolved.
Now, type_allowed_in_extern triggers the resolution of whether a pointer
is zero bits, and returns a possible error if the resolution fails.
This fixes a compiler assertion when building the
[zootdeck project](https://github.com/donpdonp/zootdeck ). I do not have
a test case reduction for the issue.
2019-09-23 15:02:38 -04:00
Andrew Kelley
29b82d20a4
zig build: linkSystemLibrary integrates with pkg-config
...
* add -D CLI option for setting C macros
* add std.ascii.allocLowerString
* add std.ascii.eqlIgnoreCase
* add std.ascii.indexOfIgnoreCasePos
* add std.ascii.indexOfIgnoreCase
2019-09-23 14:45:14 -04:00
Andrew Kelley
35c1d8cefc
Merge pull request #3290 from ziglang/more-test-coverage
...
significantly increase test coverage
2019-09-22 21:18:27 -04:00
Andrew Kelley
55925b6e25
windows CI: fix name collision
...
Previously the CMAKE_BUILD_TYPE=Release was conflicting with the
"distribution" directory `release`. I renamed this to `dist` so that
it won't conflict with any build types.
2019-09-22 19:47:07 -04:00
Andrew Kelley
96affd683a
enable test coverage for cross compiling windows mingw-w64
...
closes #3285
2019-09-22 19:11:41 -04:00
Andrew Kelley
c161ce3f7c
mingw-w64 libc: fix incorrect detection of _xgetbv
...
It was using __GNUC__ < 8 to check if _xgetbv intrinsic is available.
Since we always use zig cc with this header, we know we have clang 9,
which does have this intrinsic.
2019-09-22 19:10:27 -04:00
Andrew Kelley
23f339f1b4
add emscripten to std.build.Target.defaultAbi
...
After upgrading to LLVM 9 we now have the emscripten OS available. Fix
the compile error in this function by specifying the default ABI for
emscripten.
2019-09-22 19:10:18 -04:00
Andrew Kelley
989cd4233e
Merge pull request #3298 from ziglang/gethostname
...
gethostname
2019-09-22 18:19:37 -04:00
Andrew Kelley
d6f7b573aa
silence nonportable include path warnings when building glibc on windows
2019-09-22 18:15:30 -04:00
Andrew Kelley
f14ba904d7
tolerate windows newlines in glibc text files
2019-09-22 18:14:53 -04:00
Andrew Kelley
2c8495b4bb
git, I love you, but please stop mangling my files
2019-09-22 18:11:55 -04:00
Andrew Kelley
a239c7439f
more helpful error message when failing to parse glibc abi.txt
2019-09-22 17:41:15 -04:00
Andrew Kelley
31b72da84a
more info in assertion failures
2019-09-22 16:40:48 -04:00
Andrew Kelley
028011e59a
libc implementation of gethostname
2019-09-22 16:07:21 -04:00
Andrew Kelley
65b495af58
windows CI: use MinSizeRel to work around MSVC bug
...
See #3024
2019-09-22 15:59:06 -04:00
Andrew Kelley
1d6d6d5228
remove redundant assert
2019-09-22 15:58:57 -04:00
Andrew Kelley
12b195f9d5
ci: update windows image to MSVC 2019
2019-09-22 15:32:52 -04:00
Andrew Kelley
cf4cc9b148
do the release tests last because they take longer
2019-09-22 14:41:47 -04:00
Andrew Kelley
786052c7d3
disable running cross compiled macos tests
...
due to #3295
2019-09-22 14:40:54 -04:00
Andrew Kelley
9627a75b07
clean up compiler_rt with some enum literals
2019-09-22 14:00:05 -04:00
Andrew Kelley
e63daca92e
linux implementation of std.net.getHostName
2019-09-22 11:48:53 -04:00
Euan Torano
8a15537c6e
Fix #3272 - update docs
2019-09-22 11:23:00 -04:00
Andrew Kelley
2510edeb71
fix linux stat struct on aarch64
...
The ABI was incorrect.
2019-09-22 11:22:22 -04:00
Andrew Kelley
dc2463d9a9
windows ci: make the case of file names agree
2019-09-22 11:22:22 -04:00
Andrew Kelley
ffef5d26b6
significantly increase test coverage
...
* add zig build option `-Dskip-libc` to skip tests that build libc
(e.g. if you don't want to wait for musl to build)
* add `-Denable-wine` option which uses wine to run cross compiled
windows tests on non-windows hosts
* add `-Denable-qemu` option which uses qemu to run cross compiled
foreign architecture tests
* add `-Denable-foreign-glibc=path` option which combined with
`-Denable-qemu` enables running cross compiled tests that link
against glibc. See
https://github.com/ziglang/zig/wiki/Updating-libc#glibc for how to
produce this directory.
* the test matrix is done manually. release test builds are only
enabled by default for the native target. this should save us some CI
time, while still providing decent coverage of release builds.
- add test coverage for `x86_64-linux-musl -lc` (building musl libc)
- add test coverage for `x86_64-linux-gnu -lc` (building glibc)
- add test coverage for `aarch64v8_5a-linux-none`
- add test coverage for `aarch64v8_5a-linux-musl -lc` (building musl libc)
- add test coverage for `aarch64v8_5a-linux-gnu -lc` (building glibc)
- add test coverage for `arm-linux-none`
- test coverage for `arm-linux-musleabihf -lc` (building musl libc) is
disabled due to #3286
- test coverage for `arm-linux-gnueabihf -lc` (building glibc) is disabled
due to #3287
- test coverage for `x86_64-windows-gnu -lc` (building mingw-w64) is
disabled due to #3285
* enable qemu testing on the Linux CI job. There's not really a good
reason to enable wine, since we have a Windows CI job as well.
* remove the no longer needed `--build-file ../build.zig` from CI
scripts
* fix bug in glibc compilation where it wasn't properly reading the abi
list txt files, resulting in "key not found" error.
* std.build.Target gains:
- isNetBSD
- isLinux
- osRequiresLibC
- getArchPtrBitWidth
- getExternalExecutor
* zig build system gains support for enabling wine and enabling qemu.
`artifact.enable_wine = true;`, `artifact.enable_qemu = true;`. This
communicates that the system has these tools installed and the build
system will use them to run tests.
* zig build system gains support for overriding the dynamic linker of
an executable artifact.
* fix std.c.lseek prototype. makes behavior tests for
arm-linux-musleabihf pass.
* disable std lib tests that are failing on ARM. See #3288 , #3289
* provide `std.os.off_t`.
* disable some of the compiler_rt symbols for arm 32 bit. Fixes
compiler_rt tests for arm 32 bit
* add __stack_chk_guard when linking against glibc. Fixes std lib tests
for aarch64-linux-gnu
* workaround for "unable to inline function" using `@inlineCall`. Fixes
compiler_rt tests for arm 32 bit.
2019-09-22 11:22:17 -04:00
Michael Dusan
c5716715d5
stage1: fix lost argv[0]
...
- bug presented on FreeBSD when `/proc` filesystem is not mounted
- bogus `cc` was used as exename, causing incorrect executable spawn
- llvm::sys::fs::getMainExecutable() has platform-specific code
to get exename and fallback is to use param argv0
- linux fallback is rare because `/proc` is usually mounted
- *BSD fallback is not rare because `/proc` is often not mounted
- macOS doesn't ever fallback: bug cannot present
- windows doesn't ever fallback: bug cannot present
- other Posix will always present
2019-09-22 11:21:22 -04:00
LemonBoy
a11c20e26a
Fix TLS for VariantI arches with a twist
2019-09-21 19:53:39 -04:00
Andrew Kelley
4dd17a7c9e
zig test: don't skip execution when explicit command provided
2019-09-21 15:57:09 -04:00
Andrew Kelley
2c681d7ba1
add behavior test for float widening f16 to f128
...
it's disabled on aarch64, see #3282
2019-09-21 14:22:23 -04:00
Andrew Kelley
f3a7c346dd
Merge pull request #3278 from LemonBoy/struct-gen
...
A few steps towards AArch64 & ARM passing the behavior tests
2019-09-21 13:46:13 -04:00
Andrew Kelley
533aff3a6a
Merge pull request #3238 from Tetralux/fixed-allocator-reset
...
FixedBufferAllocator.reset
2019-09-21 12:48:45 -04:00
Tetralux
86b6790b6a
Remove 'inline', as per @andrewrk
2019-09-21 15:42:26 +00:00
LemonBoy
34d02f249b
Fix a test on ARM due to the use of undefined ptr
2019-09-21 11:39:50 +02:00
LemonBoy
57f751a864
Adjust tests for AArch64
2019-09-21 11:39:50 +02:00
LemonBoy
093ffe9f16
Correct stack alignment for new stack
2019-09-21 11:39:50 +02:00
LemonBoy
75ec7e4e00
Fix generation of tail fields for packed struct
2019-09-21 11:39:43 +02:00
Andrew Kelley
3377044ebe
Merge pull request #3183 from LemonBoy/fix-3128
...
Don't forget to resolve the pointee type
2019-09-20 18:01:42 -04:00
Andrew Kelley
257fded70c
avoid setting tail for @panic
...
Currently, slices are passed via reference, even though it would be
better to pass the ptr and len as separate arguments (#561 ). This means
that any function call with a slice parameter cannot be a tail call,
because according to LLVM spec:
> Both [tail,musttail] markers imply that the callee does not access
> allocas from the caller
There was one other place we were setting `tail` and I made that
conditional on whether or not the argument referenced allocas in the
caller.
This was causing undefined behavior in the compiler when it hit asserts,
causing it to print garbage memory to the terminal. See #3262 for
example.
2019-09-20 17:48:24 -04:00
Andrew Kelley
f663bcd6b2
add more RISCV64 linux bits to std lib
2019-09-20 15:24:50 -04:00
Andrew Kelley
ea776c287b
Merge branch 'daurnimator-linux-5.3'
...
closes #3266
2019-09-20 15:10:25 -04:00
Andrew Kelley
aab1ec5c43
fix typo
2019-09-20 15:02:47 -04:00
daurnimator
2a8facafde
std: update for linux 5.3
2019-09-20 15:01:47 -04:00
daurnimator
edea0d431b
std: update riscv64 syscalls
2019-09-20 15:01:47 -04:00
Sahnvour
74d0b5bf7c
reject types of automatic container layout in packed unions
2019-09-20 13:25:32 -04:00
Andrew Kelley
c9a5a6b83a
add test case for already fixed bug
...
closes #3046
2019-09-20 13:19:29 -04:00
Timon Kruiper
3b4a6679a6
Fix comptime bitcast inside an expression
2019-09-20 13:13:26 -04:00
Andrew Kelley
695695c852
update README
...
Also I verified that muldi3 has not changed since the previous ported
reference commit.
2019-09-20 12:58:00 -04:00
Andrew Kelley
ee200aaa8c
fix typo in docs
...
closes #3267
2019-09-20 11:48:35 -04:00
Michael Dusan
d60f9d0d4b
stage1: fix gcc 9.1.0 compiler error on archlinux
2019-09-19 23:30:48 -04:00
Andrew Kelley
e81156b873
Merge pull request #3260 from ziglang/llvm9
...
LLVM 9
2019-09-19 21:12:57 -04:00
Andrew Kelley
b76d16c7c7
update remaining llvm 8.0.0 references to 9.0.0
2019-09-19 20:55:02 -04:00
Andrew Kelley
14d2e16b60
macos ci: RISCV is no longer experimental
2019-09-19 18:32:40 -04:00
Andrew Kelley
00cd988438
update CI scripts llvm 8 to 9
2019-09-19 17:04:27 -04:00
Andrew Kelley
8a30edcde8
Merge remote-tracking branch 'origin/master' into llvm9
2019-09-19 17:02:32 -04:00
stratact
925ffbce7f
Disable Channel, Future, and Lock tests for FreeBSD ( #3253 )
...
* Disable Channel, Future, and Lock tests for FreeBSD
2019-09-19 13:45:54 -04:00
Andrew Kelley
ef3f7ecc19
update std.zig.tokenizer
2019-09-19 13:07:30 -04:00
Andrew Kelley
cd3068b4eb
Merge pull request #3017 from fengb/tokenize-cleaner-errors
...
Update stage2 parser errors to match compiler friendliness
2019-09-19 12:36:07 -04:00
daurnimator
3b297f58f7
src: use zig_panic rather than having LLVM abort
2019-09-19 11:51:39 -04:00
Shawn Landden
ff9f3275de
docs: clarify @clz and @ctz terminology to not be endian-specific.
...
This was brought up in IRC a few days ago.
2019-09-19 11:47:02 -04:00
Shawn Landden
c9937f4a2b
Allow Zig programs to implement their own startup (_start) for ELF executables.
...
/home/shawn/git/zig-simd/build/lib/zig/std/special/start.zig:23:40: error: exported symbol collision: '_start'
@export("_start", _start, .Strong);
^
/home/shawn/git/zig-simd/build/d.zig:1:1: note: other symbol is here
pub export fn _start() void {
^
/home/shawn/git/zig-simd/build/lib/zig/std/special/start.zig:124:35: error: root source file has no member called 'main'
switch (@typeInfo(@typeOf(root.main).ReturnType)) {
2019-09-19 11:43:00 -04:00
ScorrMorr
7ebb7ca580
pass param as ref in ZigList::append
2019-09-19 11:41:18 -04:00
Andrew Kelley
1eb33966b1
Merge branch 'merge-shawnl-simd5'
...
This is the commit from Shawn's SIMD patchset regarding `@splat`,
plus my fixups.
2019-09-19 11:15:07 -04:00
Andrew Kelley
28c7fe60b6
add docs for @splat
2019-09-19 11:14:42 -04:00
Andrew Kelley
005a54a853
fixups for @splat
...
* Fix codegen for splat - instead of giving vectors of length N
to shufflevector for both of the operands, it gives vectors of length
1. The mask vector is the only one that needs N elements.
* Separate Splat into SplatSrc and SplatGen; the `len` is not needed
once it gets to codegen since it is redundant with the result type.
* Refactor compile error for wrong vector element type so that the
compile error message is not duplicated in zig source code
* Improve implementation to correctly handle comptime values such as
undefined and lazy values.
* Improve compile error for bad vector element type to point to the
correct place.
* Delete dead code.
* Modify behavior test to use an array cast instead of vector element
indexing since I'm merging this splat commit out-of-order from
Shawn's patch set.
2019-09-19 10:58:12 -04:00
Shawn Landden
01577a3af4
@splat
2019-09-19 10:11:06 -04:00
Andrew Kelley
0048bcbd71
Merge branch 'merge-shawnl-simd5'
...
This is the commit from Shawn's SIMD patchset regarding `@byteSwap`,
plus my fixups.
2019-09-19 01:05:12 -04:00
Andrew Kelley
380c8ec2c9
implement runtime @byteSwap and other fixups
...
* update docs for `@byteSwap`.
* fix hash & eql functions for ZigLLVMFnIdBswap not updated to
include vector len. this was causing incorrect bswap function
being called in unrelated code
* fix `@byteSwap` behavior tests only testing comptime and not
runtime operations
* implement runtime `@byteSwap`
* fix incorrect logic in ir_render_vector_to_array and
ir_render_array_to_vector with regards to whether or not to bitcast
* `@byteSwap` accepts an array operand which it will cast to vector
* simplify `@byteSwap` semantic analysis code and various fixes
2019-09-19 00:59:04 -04:00
Shawn Landden
76f5396077
@byteSwap on vectors
2019-09-18 16:49:14 -04:00
Andrew Kelley
86209e1a92
Merge branch 'merge-shawnl-simd5'
...
This is the first 3 commits of #2945 , plus my fixups.
2019-09-18 16:35:57 -04:00
Andrew Kelley
ef0f3ba905
relax std.auto_hash requirements regarding vectors
...
Previously, auto hash tests required vectors of different types to not
hash to the same value. Now, this is allowed.
2019-09-18 16:34:36 -04:00
Andrew Kelley
2038f4d45a
rework the implementation
...
* update documentation
- move `@shuffle` to be sorted alphabetically
- remove mention of LLVM
- minor clarifications & rewording
* introduce ir_resolve_vector_elem_type to avoid duplicate compile
error message and duplicate vector element checking logic
* rework ir_analyze_shuffle_vector to solve various issues
* improve `@shuffle` to allow implicit cast of arrays
* the shuffle tests weren't being run
2019-09-18 16:15:19 -04:00
Shawn Landden
193604c837
stage1: add @shuffle() shufflevector support
...
I change the semantics of the mask operand, to make it a little more
flexible. There is no real danger in this because it is a compile-error
if you do it the LLVM way (and there is an appropiate error to tell you
this).
v2: avoid problems with double-free
2019-09-18 11:26:45 -04:00
Andrew Kelley
9e4065fa73
remove TODO regarding lazy values
...
The question was:
> // TODO do we need lazy values on vector comparisons?
Nope, in fact the existing code already was returning ErrorNotLazy
for that particular type, and would already goto
never_mind_just_calculate_it_normally. So the explicit check for
ZigTypeIdVector is not needed. I appreciate the caution though.
2019-09-18 10:54:45 -04:00
Shawn Landden
74ce5e9e13
stage1: proper return type on vector comparisons
2019-09-18 10:36:10 -04:00
Andrew Kelley
558b4ac1f0
adjust codegen of casting between arrays and vectors
...
* bitcasting is still better when the size_in_bits aligns with the ABI
size of the element type. Logic is reworked to do bitcasting when
possible
* rather than using insertelement/extractelement to work with arrays,
store/load elements directly. This matches codegen for arrays
elsewhere.
2019-09-18 10:24:28 -04:00
Shawn Landden
0e3ca4c63e
Fix array->vector and vector->array for many types. Allow vector of bool.
...
Vectors do not have the same packing as arrays, and just bitcasting
is not the correct way to convert them.
2019-09-18 09:52:58 -04:00
Andrew Kelley
914ad1ec2e
fix peer result location with typed parent, ...
...
...runtime condition, comptime prongs.
closes #3244
2019-09-17 22:30:49 -04:00
Andrew Kelley
c6e77f248d
fix tripping llvm assert
...
```
Assertion `!isa<DIType>(Scope) && "shouldn't
make a namespace scope for a type"
```
We've had this problem and solved it before; see #579 .
2019-09-16 14:31:41 -04:00
Andrew Kelley
1cefe14424
update clone on arm32 to latest musl implementation
...
See musl commit 05870abeaac0588fb9115cfd11f96880a0af2108
by Rich Felker.
Commit message from musl reproduced here:
fix code path where child function returns in arm __clone built as thumb
mov lr,pc is not a valid way to save the return address in thumb mode
since it omits the thumb bit. use a chain of bl and bx to emulate blx.
this could be avoided by converting to a .S file with preprocessor
conditions to use blx if available, but the time cost here is
dominated by the syscall anyway.
while making this change, also remove the remnants of support for
pre-bx ISA levels. commit 9f290a49bf9ee247d540d3c83875288a7991699c
removed the hack from the parent code paths, but left the unnecessary
code in the child. keeping it would require rewriting two code paths
rather than one, and is useless for reasons described in that commit.
2019-09-16 14:23:43 -04:00
Andrew Kelley
5e34fb3597
fix tripping llvm assert
...
```
Assertion `!isa<DIType>(Scope) && "shouldn't
make a namespace scope for a type"
```
We've had this problem and solved it before; see #579 .
2019-09-16 14:02:00 -04:00
Jay Weisskopf
cddd6b46d8
Fix typos: "seperate" to "separate"
...
Fixes #3236
2019-09-15 23:39:36 -04:00
Tetralux
537b260349
Add FixedBufferAllocator.reset
2019-09-16 02:40:14 +00:00
Andrew Kelley
c4416b224d
Merge remote-tracking branch 'origin/master' into llvm9
2019-09-15 20:59:53 -04:00
Andrew Kelley
8223aca09b
no-stack-arg-probe only for UEFI
2019-09-13 14:46:22 -04:00
Andrew Kelley
2b698888ce
fix regression from incorrect conflict resolution in prev commit
...
thanks for catching this LemonBoy
2019-09-13 14:42:30 -04:00
Andrew Kelley
187a6d198f
Merge branch 'nrdmn-uefi'
...
closes #2944
2019-09-13 14:11:00 -04:00
LemonBoy
eb7d36ae0d
Make single-element enum default to u0
...
* Allow comptime_int as explicit enum tag type
Closes #2997
2019-09-13 15:13:10 -04:00
stratact
742abc71c7
Add missing C dl_iterate_phdr function for FreeBSD
2019-09-13 15:10:35 -04:00
Andrew Kelley
c15e464320
Merge branch 'uefi' of https://github.com/nrdmn/zig into nrdmn-uefi
2019-09-13 14:10:42 -04:00
LemonBoy
774f770056
Correct AT_FDCWD definition
2019-09-12 13:15:50 -04:00
Andrew Kelley
cf4bccf765
improvements targeted at improving async functions
...
* Reuse bytes of async function frames when non-async functions
make `noasync` calls. This prevents explosive stack growth.
* Zig now passes a stack size argument to the linker when linking ELF
binaries. Linux ignores this value, but it is available as a program
header called GNU_STACK. I prototyped some code that memory maps
extra space to the stack using this program header, but there was
still a problem when accessing stack memory very far down. Stack
probing is needed or not working or something. I also prototyped
using `@newStackCall` to call main and that does work around the
issue but it also brings its own issues. That code is commented out
for now in std/special/start.zig. I'm on a plane with no Internet,
but I plan to consult with the musl community for advice when I get a
chance.
* Added `noasync` to a bunch of function calls in std.debug. It's very
messy but it's a workaround that makes stack traces functional with
evented I/O enabled. Eventually these will be cleaned up as the root
bugs are found and fixed. Programs built in blocking mode are
unaffected.
* Lowered the default stack size of std.io.InStream (for the async
version) to 1 MiB instead of 4. Until we figure out how to get
choosing a stack size working (see 2nd bullet point above), 4 MiB
tends to cause segfaults due to stack size running out, or usage of
stack memory too far apart, or something like that.
* Default thread stack size is bumped from 8 MiB to 16 to match the
size we give for the main thread. It's planned to eventually remove
this hard coded value and have Zig able to determine this value
during semantic analysis, with call graph analysis and function
pointer annotations and extern function annotations.
2019-09-12 01:40:58 -04:00
Andrew Kelley
68b49f74c4
consolidate std.debug.parseDie and std.debug.parseDie1
2019-09-12 01:40:55 -04:00
LemonBoy
f36b8fd7b2
Recognize & skip the UTF-8 BOM
2019-09-11 15:20:18 -04:00
Andrew Kelley
0eddee449d
add behavior test for @enumToInt(enum(u1){x}.x)
...
closes #2737
2019-09-11 15:05:00 -04:00
Andrew Kelley
67491a4222
disable runtime safety in std.io.InStream
...
Let's not be writing 0xaa in safe modes for upwards of 4 MiB for every
stream read. This is equivalent to the fact that we don't memset the
entire call stack to 0xaa for every function call.
2019-09-11 15:01:54 -04:00
Andrew Kelley
c9b2210fcf
async function calls re-use frame buffers
...
See #3069
2019-09-10 22:59:00 -04:00
Andrew Kelley
92a427437c
Merge remote-tracking branch 'origin/master' into llvm9
2019-09-10 16:53:11 -04:00
Andrew Kelley
7101e583d6
update glibc src files to 2.30
2019-09-10 16:40:54 -04:00
stratact
a165cc0535
Get more of the tests passing for FreeBSD ( #3197 )
...
* Add missing <stdint.h> include for uint8_t type declaration
* Add needed FreeBSD check to link to libpthread
* Apply patch to enable more tests in the FreeBSD CI
2019-09-10 14:50:54 -04:00
Michael Dusan
68d159ea9d
fix build on macOS + xcode + clang
2019-09-10 14:38:39 -04:00
Andrew Kelley
3cd035ba3b
update C header files to clang 9.0.0rc4
2019-09-10 13:30:43 -04:00
Andrew Kelley
e92d74958c
lld: apply patch: [mach-o] Extend LC_DATA_IN_CODE support to x86_64
...
This applies 91864f82c7d7bd1a151fdfd076a3a67a2893b868 from LLVM trunk to
the embedded LLD.
Once Zig upgrades to LLD 10, there will be no difference between Zig's
fork and upstream, and Zig's fork can be dropped.
2019-09-10 13:25:20 -04:00
Andrew Kelley
016a59e3a1
update embedded LLD to 9.0.0rc4
2019-09-10 13:10:12 -04:00
LemonBoy
8b5cb8df99
Don't forget to resolve the pointee type
...
Fixes #3128
2019-09-10 19:07:04 +02:00
Andrew Kelley
185cb13278
Merge remote-tracking branch 'origin/master' into llvm9
2019-09-10 13:00:35 -04:00
LemonBoy
ba4d83af3e
Resolve lazy arguments passed to @compileLog
...
Closes #3193
2019-09-10 11:22:40 -04:00
LemonBoy
e2c68fce89
Accept void argument for @cDefine value
...
Closes #2612
2019-09-10 11:16:50 -04:00
Andrew Kelley
e657b73f30
Merge branch 'async-std-lib'
...
This introduces the concept of "IO mode" which is configurable by the
root source file (e.g. next to `pub fn main`). Applications can put this
in their root source file:
```
pub const io_mode = .evented;
```
This will populate `std.io.mode` to be `std.io.Mode.evented`. When I/O
mode is evented, `std.os.read` handles EAGAIN by suspending until the
file descriptor becomes available for reading. Although the std lib
event loop supports epoll, kqueue, and Windows I/O Completion Ports,
this integration with `std.os.read` currently only works on Linux.
This integration is currently only hooked up to `std.os.read`, and not,
for example, `std.os.write`, child processes, and timers. The fact that
we can do this and still have a working master branch is thanks to Zig's
lazy analysis, comptime, and inferred async. We can continue to make
incremental progress on async std lib features, enabling more and more
test cases and coverage.
In addition to `std.io.mode` there is `std.io.is_async` which is equal
to `std.io.mode == .evented`. In case I/O mode is async, `std.io.InStream`
notices this and the read function pointer becomes an async function
pointer rather than a blocking function pointer. Even in this case,
`std.io.InStream` can *still be used as a blocking input stream*.
Users of the API control whether it is blocking or async at runtime by whether
or not the read function suspends. In case of file descriptors, for
example, this might correspond to whether it was opened with `O_NONBLOCK`.
The `noasync` keyword makes a function call or `await` assert that no
suspension happens. This assertion has runtime safety enabled.
`std.io.InStream`, in the case of async I/O, uses by default a 4 MiB
frame size for calling the read function. If this is too large or too
small, the application can globally increase the frame size used by
declaring `pub const stack_size_std_io_InStream = 1234;` in their root
source file. This way, `std.io.InStream` will only be generated once,
avoiding bloat, and as long as this number is configured to be high
enough, everything works fine. Zig has runtime safety to detect when
`@asyncCall` is given too small of a buffer for the frame size.
This merge introduces -fstack-report which can help identify large async
function frame sizes and explain what is making them so big. Until #3069 is
solved, it's recommended to stick with blocking IO mode.
-fstack-report outputs JSON format, which can then be viewed in a GUI
that represents the tree structure. As an example, Firefox does a decent
job of this.
One feature that is currently missing is detecting that the call stack
upper bound is greater than the default for a given target, and passing
this upper bound to the linker. As an example, if Zig detects that 20
MiB stack upper bound is needed - which would be quite reasonable -
currently on Linux the application would only be given the default of 16
MiB.
Unrelated miscellaneous change: added std.c.readv
2019-09-10 10:39:27 -04:00
Andrew Kelley
ff051f8f5d
-fstack-report outputs JSON
...
See #3069
2019-09-10 10:26:54 -04:00
Andrew Kelley
0489d06c24
make the std lib support event-based I/O
...
also add -fstack-report
2019-09-10 10:26:52 -04:00
daurnimator
a29ce78651
std: add BloomFilter data structure
2019-09-10 10:20:30 -04:00
LemonBoy
8fbae77770
Force LLVM to generate byte-aligned packed unions
...
Sometimes the frontend and LLVM would disagree on the ABI alignment of a
packed union. Solve the problem by telling LLVM we're gonna manage the
struct layout by ourselves.
Closes #3184
2019-09-10 10:07:32 -04:00
Sahnvour
a06f84fcc6
forbid opaque types in function return types
2019-09-10 10:11:49 -04:00
Michael Dusan
8bd5681651
fix tests.addPkgTests to always run native target
...
- include native-target when native-target ∉ cross_targets
old behavior:
- do nothing when `-Dskip-non-native`
- never execute pkg tests for non-members of cross_targets
2019-09-10 10:10:14 -04:00
Andrew Kelley
852679c369
fix a var decl in scope preventing for loop spills
2019-09-09 16:44:23 -04:00
Andrew Kelley
a3993465fe
Merge pull request #3200 from LemonBoy/eq-tagged-union
...
Allow comparison between union tag and enum literal
2019-09-09 16:17:45 -04:00
LemonBoy
fec795cd29
Adjust the stdlib to be 32bit compatible
2019-09-09 16:16:13 -04:00
Andrew Kelley
f50bfb94b5
fix bad LLVM IR when for target expr needs to be spilled
...
Also reduce the size of ZigVar in memory by making the name
a `const char *` rather than a `Buf`.
2019-09-09 15:59:16 -04:00
LemonBoy
e4c3067617
Fix typo in TLS initialization code
2019-09-09 13:54:31 -04:00
LemonBoy
4b1cd45472
Comptime folding of enum/union comparisons
2019-09-09 19:09:56 +02:00
LemonBoy
cc63760587
Allow comparison between union tag and enum literal
...
Closes #2810
2019-09-09 18:51:13 +02:00
Andrew Kelley
f7721ac37c
implement spilling when returning error union async function call
...
closes #3190
2019-09-09 12:15:39 -04:00
Andrew Kelley
2482bdf22b
release builds of stage1 have llvm ir verification
...
the stage2 zig code however gets compiled in release mode,
and stripped.
2019-09-09 09:33:33 -04:00
Sahnvour
19cf9bd062
use /debug:fastlink when building with msvc and debug info
2019-09-09 00:26:39 -04:00
Michael Dusan
0d9a78a852
test-stack-traces: add FreeBSD
2019-09-09 00:25:21 -04:00
Andrew Kelley
071ca00574
Merge branch 'gustavolsson-clang-frameworks-dir'
2019-09-08 15:09:51 -04:00
Andrew Kelley
5dde3cd3bd
move logic for propagating framework dirs to zig cc
2019-09-08 15:09:05 -04:00
Gustav Olsson
ec13fa3f4a
forward framework dirs to embedded clang in addition to linker on osx
2019-09-08 14:46:25 +02:00
Andrew Kelley
229323e13a
fix suspensions inside for loops generating invalid LLVM IR
...
closes #3076
2019-09-07 17:37:17 -04:00
Andrew Kelley
d3cf040c90
Merge branch 'glibc-2.30'
...
closes #3098
2019-09-07 15:08:47 -04:00
Andrew Kelley
b21ad07767
update glibc ABI lists to 2.30
2019-09-07 15:04:09 -04:00
Andrew Kelley
45ab9d5fd6
update glibc headers to 2.30
2019-09-07 14:59:38 -04:00
Andrew Kelley
99fd42404a
update process_headers tool for glibc 2.30
2019-09-07 14:46:59 -04:00
Andrew Kelley
9a18db8a80
properly spill expressions with async function calls
2019-09-07 00:27:45 -04:00
Andrew Kelley
d1a98ccff4
implement spills when expressions used across suspend points
...
closes #3077
2019-09-07 00:13:12 -04:00
Andrew Kelley
9ca8d9e21a
fix await used in an expression generating bad LLVM
2019-09-07 00:13:12 -04:00
emekoi
9423d382fb
fixed compiler error for gcc 9.2.0
2019-09-06 19:20:25 -04:00
Andrew Kelley
7d303ae861
runtime safety for noasync function calls
...
See #3157
2019-09-06 13:08:44 -04:00
Andrew Kelley
0a3c6dbda9
implement noasync function calls
...
See #3157
2019-09-05 21:55:32 -04:00
Timon Kruiper
ca70ca7e26
Add compiler error when negating invalid type
2019-09-05 15:27:50 -04:00
Andrew Kelley
4a5bc89862
add -l as an alias for --library
2019-09-05 15:17:23 -04:00
Andrew Kelley
b564e7ca59
os: raise maximum file descriptor limit
...
Do a binary search for the maximum RLIMIT_NOFILE.
Patch lifted from node.js commit
6820054d2d42ff9274ea0755bea59cfc4f26f353
2019-09-05 15:09:13 -04:00
Andrew Kelley
2045b4d932
prefer result type casting to peer type resolution
...
See #2749
2019-09-05 14:56:52 -04:00
Andrew Kelley
8f0df86937
I'm pretty sure sp is the stack pointer on all ARM
2019-09-05 14:15:39 -04:00
Timon Kruiper
866c253e0e
Add compile error when shifting amount is not an int type
2019-09-05 13:10:39 -04:00
LemonBoy
8e3c56b912
Always resolve the struct field types
...
Packed structs used to skip the zero-sized types and trip some
assertions that expected the type reference not to be null.
Fixes #3143
2019-09-05 13:07:04 -04:00
LemonBoy
0107b19124
Resolve lazy values when checking for definedness
...
Fixes #3154
2019-09-05 13:09:43 -04:00
Jonathan Marler
9a358d2d33
Add Array support to @Type
2019-09-05 13:08:45 -04:00
Vesa Kaihlavirta
847a262efd
Shorten @field documentation and add an example
2019-09-05 13:07:04 -04:00
Michael Dusan
fe153ad2a4
stage1 enhance IR print
...
- print fn name in pass1
- replace scalar with enum IrPass for clarity
2019-09-05 13:06:10 -04:00
LemonBoy
fabf45f5fc
Add the noinline keyword for function declarations
2019-09-05 13:04:58 -04:00
Andrew Kelley
a7fd14096c
fix typo with tls initialization
...
I tested that hello world cross compiles to armv7 now.
closes #3167
2019-09-04 14:44:16 -04:00
Andrew Kelley
090f2ffb82
Merge pull request #3152 from Snektron/arm-support-improvement
...
Arm support improvement (part 1)
2019-09-04 14:39:36 -04:00
Timon Kruiper
e540e5b8ec
Implicit cast from enum literal to optional enum and implicit cast to payload of error union
2019-09-04 12:30:23 -04:00
Robin Voetter
df06976e73
Only check for TLS support on arm if TLS segment exists
2019-09-04 17:48:01 +02:00
Andrew Kelley
53a6aea216
Merge branch 'marler8997-typeBuiltin'
2019-09-04 11:12:24 -04:00
Andrew Kelley
ac7703f65f
fixups and add documentation for @Type
2019-09-04 11:12:14 -04:00
Robin Voetter
77d04c03e3
Implement remaining requested changes
...
- Replace @intCast with a checked version (std/debug.zig)
- Replace @intCast with i64() when casting from a smaller type (std/fs/file.zig)
- Replace `nakedcc` with appropriate calling convention for linking with c (std/os/linux/arm-eabi.zig)
- Only check if hwcap contains TLS when the hwcap field actually exists (std/os/linux/tls.zig)
2019-09-04 16:23:25 +02:00
Robin Voetter
6a76298740
Add missing clobbers on arm-eabi and arm64 syscall conventions
2019-09-04 15:59:51 +02:00
Robin Voetter
5308eb7045
Merge remote-tracking branch 'upstream/master' into arm-support-improvement
2019-09-04 15:55:54 +02:00
Jonathan Marler
b728cb6d4e
Add @Type builtin
2019-09-03 22:50:29 -06:00
Andrew Kelley
77a5f888be
emit a compile error if a test becomes async
...
See #3117
2019-09-03 22:09:47 -04:00
Andrew Kelley
6b27290c68
Merge branch 'Vexu-comment-in-array'
2019-09-03 21:51:23 -04:00
Andrew Kelley
8a7e2e3479
Merge branch 'comment-in-array' of https://github.com/Vexu/zig into Vexu-comment-in-array
2019-09-03 21:49:35 -04:00
Sahnvour
ce14c543d1
error message and test for alignment of variables of zero-bit types
2019-09-03 21:14:40 -04:00
Andrew Kelley
a4ce10df80
Merge pull request #3169 from Sahnvour/string_hash_map
...
Using StringHashMap everywhere it's needed
2019-09-03 20:30:26 -04:00
Andrew Kelley
42cc4a406b
Merge branch 'marler8997-fixSegfault'
2019-09-03 18:26:10 -04:00
Andrew Kelley
1862075652
fix union field ptr ir instruction
2019-09-03 18:25:00 -04:00
Andrew Kelley
a81e4351a2
Merge branch 'fixSegfault' of https://github.com/marler8997/zig into marler8997-fixSegfault
2019-09-03 18:15:01 -04:00
Sahnvour
9d6f236728
add fastpath for std.mem.eql and simplify std.hash_map.eqlString
...
this should also be friendlier to the optimizer
2019-09-03 23:56:04 +02:00
Sahnvour
f08c6e4fe6
changing occurrences of HashMap with []const u8 as keys for StringHashMap
2019-09-03 23:53:05 +02:00
Andrew Kelley
fc0f8d0359
zig build: make install prefix available to build.zig and
...
prevent accident of '/' showing up in application/library names
2019-09-03 16:19:10 -04:00
Andrew Kelley
be17a4b6c1
fix compiler crash in struct field pointers
...
when the llvm type has not been fully analyzed. This is a regression
from lazy values.
2019-09-03 14:51:34 -04:00
Andrew Kelley
e673d865fb
fix stack traces on macos when passing absolute path to root source file
...
The comment added by this commit is copied here:
For macOS stack traces, we want to avoid having to parse the compilation unit debug
info. As long as each debug info file has a path independent of the compilation unit
directory (DW_AT_comp_dir), then we never have to look at the compilation unit debug
info. If we provide an absolute path to LLVM here for the compilation unit debug info,
LLVM will emit DWARF info that depends on DW_AT_comp_dir. To avoid this, we pass "."
for the compilation unit directory. This forces each debug file to have a directory
rather than be relative to DW_AT_comp_dir. According to DWARF 5, debug files will
no longer reference DW_AT_comp_dir, for the purpose of being able to support the
common practice of stripping all but the line number sections from an executable.
closes #2700
2019-09-03 13:46:08 -04:00
Vesa Kaihlavirta
e9530ce97b
Fix addition direction, remove superfluous loop counter, add tests
2019-09-03 13:45:02 -04:00
Andrew Kelley
bdac2ba9dd
Merge branch 'mikdusan-issue.2485'
...
closes #2544
2019-09-03 10:09:26 -04:00
Andrew Kelley
aba67ecf44
rename test-compare-panic to test-stack-traces
2019-09-03 10:08:39 -04:00
Andrew Kelley
1fd24791a7
rename compare-panic to compare-stack-traces
2019-09-03 10:05:19 -04:00
Michael Dusan
a19e73d8ae
test: add compare-panic
...
`zig build test-compare-panic`
Create basic tests to compare panic output. The address field
is replaced by a symbolic constant and each expected output is
specific to os. Tests will only run for explicitly defined
platforms.
see also #2485
2019-09-03 09:59:43 -04:00
Andrew Kelley
d74b8567cf
omit prefix data for async functions sometimes
...
When `@frameSize` is never called, and `@asyncCall` on a runtime-known
pointer is never used, no prefix data for async functions is needed.
Related: #3160
2019-09-02 21:31:26 -04:00
Michael Dusan
00d82e34df
cmake: improve building without git repository
...
- quiet `fatal: not a git repository` message
- if git probe fails skip ZIG_VERSION modification
2019-09-02 21:36:16 -04:00
Andrew Kelley
058050f22c
Merge remote-tracking branch 'origin/master' into llvm9
2019-09-02 20:56:31 -04:00
Andrew Kelley
4a5b0cde13
fix const result loc, runtime if cond, else unreachable
...
Closes #2791 . See that issue for more details; I documented the
debugging process quite thoroughly on this one.
2019-09-02 20:28:25 -04:00
Nick Erdmann
5e874a89b9
std/os/uefi: fix ordering of packed bit fields
2019-09-02 22:31:59 +02:00
Nick Erdmann
8db41b7adb
std/os/uefi: add support for getting memory map
2019-09-02 22:10:50 +02:00
Andrew Kelley
ab4cba14c8
fix recursive call of await @asyncCall with struct return type
2019-09-02 14:35:41 -04:00
Nick Erdmann
03abc6edf4
std/os/uefi: add global_variable guid
2019-09-02 20:34:00 +02:00
Andrew Kelley
d291d3c8c0
fix using @typeOf on a generic function call
2019-09-02 13:07:44 -04:00
Andrew Kelley
0fe28855c5
add ability to specify darwin framework search dirs
2019-09-02 11:48:06 -04:00
Andrew Kelley
0c4d47c6d5
add regression test for already fixed bug
...
closes #2692
2019-09-01 23:35:58 -04:00
Robin Voetter
d62f7c6b60
Merge remote-tracking branch 'upstream/master' into arm-support-improvement
2019-09-01 23:45:51 +02:00
Robin Voetter
e7912dee9b
Fix up preadv, preadv2, pwritev and pwritev2
2019-09-01 16:10:36 +02:00
Robin Voetter
e9d795b025
Fix up seteuid and setegid
2019-09-01 12:08:02 +02:00
Robin Voetter
e39c93a2f3
Replace legacy 16-bit syscalls with 32-bit versions when appropriate
2019-09-01 11:54:57 +02:00
Andrew Kelley
8b1900e5df
Revert "Merge pull request #2991 from emekoi/mingw-ci"
...
This reverts commit ec7d7a5b14 , reversing
changes made to 81c441f885 .
It looks like this broke colors in Windows Command Prompt (#3147 )
and this method of detecting native C ABI isn't working well (#3121 ).
2019-09-01 00:33:02 -04:00
Andrew Kelley
ec6f15b0f5
fix @typeOf an async function call of generic fn with error union type
2019-09-01 00:27:22 -04:00
Michael Dusan
1f99899408
stage1 enhance IR print
...
- pass2 now prints missing instructions in a trailing fashion
- instruction struct name added to print as column 2
2019-08-31 22:42:58 -04:00
Andrew Kelley
5c3a9a1a3e
improvements to @asyncCall
...
* `await @asyncCall` generates better code. See #3065
* `@asyncCall` works with a real `@Frame(func)` in addition to
a byte slice. Closes #3072
* `@asyncCall` allows passing `{}` (a void value) as the result
pointer, which uses the result location inside the frame.
Closes #3068
* support `await @asyncCall` on a non-async function. This is in
preparation for safe recursion (#1006 ).
2019-08-31 18:50:16 -04:00
Andrew Kelley
a223063923
@typeOf now guarantees no runtime side effects
...
related: #1627
2019-08-31 11:00:31 -04:00
Andrew Kelley
6ab8b2aab4
support recursive async and non-async functions
...
which heap allocate their own frames
related: #1006
2019-08-30 20:06:02 -04:00
Andrew Kelley
2148943fff
Merge pull request #3139 from hspak/zig-fmt-nested-if
...
zig fmt: fix nested if
2019-08-30 15:48:07 -04:00
Robin Voetter
7a2b4cb9a1
Merge remote-tracking branch 'upstream/master' into arm-support-improvement
2019-08-30 21:37:46 +02:00
Andrew Kelley
fed5c12d9a
musl: fix alltypes.h and syscall.h not being correct
...
The previous
[instructions](https://github.com/ziglang/zig/wiki/Updating-libc ) for
updating musl libc headers had this (repeated for each architecture):
make DESTDIR=build-all/arm install-headers ARCH=arm
However musl's build system does not properly rebuild alltypes.h and
syscall.h from source, instead using whatever is cached from the
previous build. In the case of the previous time that I updated to musl
1.1.23, this happened to be the aarch64 architecture.
As a workaround, one can remove the obj/ directory to force rebuilding
this file. Now the instructions say this (repeated for each architecture):
rm -rf obj/ && make DESTDIR=build-all/arm install-headers ARCH=arm
This commit updates the resulting headers after this workaround is
applied and the process headers tool is run again.
2019-08-30 15:02:23 -04:00
Andrew Kelley
37ef490fc6
update process_headers.zig for latest zig
2019-08-30 15:01:37 -04:00
Andrew Kelley
d9fed5cdfd
align(@alignOf(T)) T does not force resolution of T
2019-08-30 14:53:44 -04:00
Michael Dusan
966670645a
fix stage1 to build on macOS + xcode/clang
2019-08-30 09:01:29 -04:00
Robin Voetter
ca2aa4880f
Merge remote-tracking branch 'upstream/master' into arm-support-improvement
2019-08-30 13:02:28 +02:00
Robin Voetter
4b8325f381
Remove unneeded os check
2019-08-30 13:02:15 +02:00
Robin Voetter
c1f8b201a1
Improve comments near un-implemented functionality
2019-08-30 12:58:44 +02:00
Hong Shick Pak
19964f5dc8
run new zig fmt and remove stale comment
2019-08-29 21:23:49 -07:00
Hong Shick Pak
9f4d44bc49
zig fmt: fix nested if
2019-08-29 21:10:26 -07:00
Andrew Kelley
10541c8fc8
Merge branch 'lazy-sizeof'
2019-08-29 22:44:21 -04:00
Andrew Kelley
e9a4bcbcc6
fix regressions
2019-08-29 22:44:07 -04:00
Andrew Kelley
03910925f0
await does not force async if callee is blocking
...
closes #3067
2019-08-29 21:51:37 -04:00
Andrew Kelley
8e93991634
avoid unnecessarily requiring alignment for array elem pointers
2019-08-29 16:25:58 -04:00
Andrew Kelley
0512beca9d
comparing against zero participates in lazy values
2019-08-29 14:46:22 -04:00
Andrew Kelley
d9f0446b1f
make @sizeOf lazy
2019-08-29 12:43:56 -04:00
Robin Voetter
2323da3a68
add __aeabi_read_tp
2019-08-29 18:12:58 +02:00
Andrew Kelley
94bbb46ca6
fix not fully resolving debug info for structs causing llvm error
2019-08-29 10:29:48 -04:00
Andrew Kelley
f7f8692730
fix not fully resolving debug info for structs causing llvm error
2019-08-29 10:24:24 -04:00
Shritesh
834a789bb9
Use LLVM path provided by homebrew
2019-08-29 10:19:35 -04:00
Robin Voetter
e4c262b804
Don't print line info if source is not available
2019-08-29 10:52:50 +02:00
Robin Voetter
108a51b110
fix issues with debug.zig
...
- Use sys_*stat*64 instead of sys_*stat* where appropriate
- Fix overflow when calculating atime, ctime and mtime on File.stat()
- Fix compilation error casting getEndPos to usize.
2019-08-29 10:34:05 +02:00
Robin Voetter
b3ac323a44
TLS initialization, clone definition and _start functionality
2019-08-29 01:14:43 +02:00
Robin Voetter
57de61084e
Make mmap use SYS_mmap2 if it exists
2019-08-29 00:55:22 +02:00
Robin Voetter
223b773e03
Add more syscall constants
2019-08-29 00:54:57 +02:00
Andrew Kelley
928ce5e326
Merge remote-tracking branch 'origin/master' into llvm9
2019-08-28 16:59:35 -04:00
Andrew Kelley
e8a9caa3dd
add suggestion to AutoHash compile error message
2019-08-28 14:38:55 -04:00
Andrew Kelley
af90da1531
fix implicit cast from zero sized array ptr to slice
...
closes #1850
2019-08-28 12:16:52 -04:00
Andrew Kelley
d5b3d97c23
Merge pull request #2760 from Vexu/fmt-comment-fix
...
Fix non-empty comments getting removed with empty comments
2019-08-28 12:01:08 -04:00
yvt
c98f792ff8
Improve the handling of zig fmt: off/on
...
This commit reworks the handling of `zig fmt: off/on`. A motivating
example is shown below:
const c = d;
// zig fmt: off
// comment
const a = b;
// zig fmt: on
Before processing the decl `const a = b;`, `renderRoot` looks for
`zig fmt: off` that appears between this decl and the previous one. If
it finds one, it searches for the next `zig fmt: on` that re-enables
reformatting (or EOF if none was found), and copies the input code
between `zig fmt: off` and `zig fmt: on` to the output stream. After
that, it proceeds to the next decl.
The important thing to notice here is that `renderTopLevelDecl` emits
line comment tokens that follow the decl. Therefore, when copying code,
we must be careful not to copy the line comment tokens that already have
been written to the output stream. The original code failed to take this
fact into consideration. It did skip `// zig fmt: off`, but not the
remaining ones. As a result, when the above example is fed as input, it
duplicated the line `// comment`.
2019-08-28 11:57:01 -04:00
Robin Voetter
50c37c75d1
add arm32 syscall conventions
2019-08-28 17:41:49 +02:00
Andrew Kelley
7139eef4cf
implement lazy values for error union types
...
closes #3129
2019-08-28 11:17:20 -04:00
Robin Voetter
32f4606cec
add arm32 linux bits definitions
2019-08-28 16:35:23 +02:00
Marc Tiehuis
ac477f3c9a
Merge pull request #3060 from Sahnvour/hashing
...
auto_hash with deep/shallow hashing
2019-08-28 21:25:50 +12:00
Andrew Kelley
47fcbfdc51
add regression test for already fixed bug
...
closes #3112
2019-08-27 17:39:06 -04:00
Andrew Kelley
f4519c520a
support self-referential struct through a slice of optional
...
by making optionals even more lazy
closes #1805
2019-08-27 16:55:58 -04:00
Andrew Kelley
c1fd7ed6e2
add regression test for struct with optional list of self
...
closes #1735
2019-08-27 14:06:17 -04:00
Andrew Kelley
428a2fdedd
better handle struct depends on itself via optional field
...
closes #1995
2019-08-27 13:59:18 -04:00
Andrew Kelley
e1b258f39f
add regression test for bug fixed by lazy values
...
closes #624
2019-08-27 13:44:04 -04:00
Marc Tiehuis
fbcdf78cbd
Simplify wyhash and improve speed
...
This removes the exposed stateless variant since the standard variant
has similar speed now.
Using `./benchmark --filter wyhash --count 1024`, the speed change has
changed from:
wyhash
iterative: 4093 MiB/s [6f76b0d5db7db34c]
small keys: 3132 MiB/s [28c2f43c70000000]
to
wyhash
iterative: 6515 MiB/s [673e9bb86da93ea4]
small keys: 10487 MiB/s [28c2f43c70000000]
2019-08-27 19:42:37 +02:00
Andrew Kelley
8fef23a525
add regression test for bug fixed by lazy values
...
closes #1310
2019-08-27 13:36:42 -04:00
Andrew Kelley
35a374efe0
Merge pull request #3115 from ziglang/fix-field-alignment-kludge
...
fix field alignment kludge by implementing lazy values
2019-08-27 13:02:31 -04:00
Andrew Kelley
d9ed55f017
fix not properly casting align values
...
and add check for alignment specified on enum fields
2019-08-27 12:54:50 -04:00
Andrew Kelley
7d34e55a71
add a TODO compile error for union field alignment syntax
...
See #3125
2019-08-27 10:45:28 -04:00
Andrew Kelley
ffac0b02e7
implement and test struct field explicit alignment
2019-08-27 10:14:11 -04:00
Marc Tiehuis
326b7b794b
Improve siphash performance for small keys by up to 30% ( #3124 )
...
This removes the partial buffer handling from the full slice api.
`./benchmark --filter siphash --count 1024`
old
siphash(1,3)
iterative: 3388 MiB/s [67532e53a0d210bf]
small keys: 1258 MiB/s [948c91176a000000]
siphash(2,4)
iterative: 2061 MiB/s [f792d39bff42f819]
small keys: 902 MiB/s [e1ecba6614000000]
new
siphash(1,3)
iterative: 3410 MiB/s [67532e53a0d210bf]
small keys: 1639 MiB/s [948c91176a000000]
siphash(2,4)
iterative: 2053 MiB/s [f792d39bff42f819]
small keys: 1074 MiB/s [e1ecba6614000000]
2019-08-27 20:13:57 +12:00
Andrew Kelley
a2e8ef77e2
fix regression in one of the doc examples
2019-08-26 22:50:12 -04:00
Andrew Kelley
db50cf7049
fix more compile error regressions
2019-08-26 22:38:45 -04:00
Andrew Kelley
1df75da918
remove no longer needed gcc8 workaround. add gcc9 workaround
...
Occasionally LLVM headers generate warnings with newer gcc versions and
since we use -Werror this has to be worked around.
2019-08-26 21:40:44 -04:00
Andrew Kelley
bad4b040cc
miscellaneous fixes regarding compile errors
2019-08-26 18:35:36 -04:00
Andrew Kelley
ca145a6d5a
fix regression in ir_get_ref
2019-08-26 15:43:39 -04:00
Andrew Kelley
ae65c236c5
fix regression with global variable assignment...
...
...with optional unwrapping with var initialized to undefined
2019-08-26 15:24:24 -04:00
Andrew Kelley
d316f70450
fix regression on struct field with undefined type
2019-08-26 14:01:59 -04:00
Andrew Kelley
73a7747a9c
fix some compile error regressions
2019-08-26 12:43:36 -04:00
Andrew Kelley
6569bfc85e
fix some std lib dependency loops
2019-08-26 11:23:25 -04:00
Andrew Kelley
e1a4bcbdfd
fix dependency loop errors with zig build
2019-08-26 10:43:07 -04:00
Andrew Kelley
ede0c22a67
make @alignOf lazily evaluate the target type
...
this case works now:
```zig
const Foo = struct {
field: Bar(@alignOf(*Foo)),
};
fn Bar(comptime alignment: u29) type {
return struct {
field: *align(alignment) Foo,
};
}
```
2019-08-26 10:03:30 -04:00
Andrew Kelley
b13af0750f
fix assertion tripped instead of reporting compile error
2019-08-25 21:45:11 -04:00
Andrew Kelley
720302a640
fix resolution detection of pointer types
2019-08-25 21:28:16 -04:00
Andrew Kelley
a7f3158185
behavior tests passing
2019-08-25 21:16:03 -04:00
Andrew Kelley
64e9b0ee46
make the zero-bit-ness of pointers lazy
...
this case works now:
```zig
const Foo = struct {
field: @typeOf(func).ReturnType,
};
fn func(self: *Foo) void {}
```
2019-08-25 20:27:56 -04:00
Andrew Kelley
8f41da2216
fix behavior test regressions with unions
2019-08-25 11:42:19 -04:00
Andrew Kelley
fa6c20a02d
hook up unions with lazy values
...
this case works now:
```zig
const Expr = union(enum) {
Literal: u8,
Question: *Expr,
};
```
2019-08-25 11:34:07 -04:00
Jonathan Marler
1b19c28c79
Fix issue 3058: zig build segfault
2019-08-24 10:47:27 -06:00
Sahnvour
90e921f7a7
wyhash: readd the stateful streaming version so that both are available
...
and rename the stateless one so that's it is not the default option
2019-08-24 15:37:47 +02:00
Sahnvour
4c882e731f
hash_map: adding a StringHashMap for convenience
2019-08-24 15:30:23 +02:00
Sahnvour
1498ccac2a
auto_hash: better generic hashing implementation
...
autoHash forbids slices as input
hash was added to handle all types from autoHash plus slices, with a specified strategy
2019-08-24 15:30:23 +02:00
Marc Tiehuis
50a80261dc
Merge pull request #3118 from ziglang/revert-crc-poly-api
...
std/hash: Revert crc32 api change
2019-08-24 20:47:45 +12:00
Marc Tiehuis
a610352271
std/hash: Revert crc32 api change
...
This is user specified and the user doesn't necessarily have to use one
of the provided polynomials declared hence we can't use an enum.
Thanks @daurnimator for catching this.
2019-08-24 19:05:05 +12:00
Andrew Kelley
d277a1196b
tracking these issues on github now
2019-08-23 17:54:01 -04:00
Andrew Kelley
e8bad1e12a
fix regression on @ptrCast
...
this case regressed and now fixed:
```zig
const a: ?*i32 = undefined;
const b: ?*f32 = @ptrCast(?*f32, a);
```
2019-08-23 17:39:56 -04:00
Andrew Kelley
101440c199
add lazy value support for optional types
...
this case works now:
```zig
const Node = struct {
node: ?*Node,
};
```
2019-08-23 17:14:51 -04:00
Andrew Kelley
f0034495fa
fix regression with simple pointer to self
2019-08-23 15:59:37 -04:00
Andrew Kelley
ac4dd9d665
better handling of lazy structs
...
this case works now:
```zig
const A = struct {
b_list_pointer: *const []B,
};
const B = struct {
a_pointer: *const A,
};
const b_list: []B = [_]B{};
const a = A{ .b_list_pointer = &b_list };
const obj = B{ .a_pointer = &a };
```
2019-08-23 15:54:51 -04:00
Andrew Kelley
be0a9a7277
pointer types lazily evaluate their element type
2019-08-23 15:05:15 -04:00
Andrew Kelley
1dd658d1d0
allow top level declarations to be lazy
...
this case now works:
```zig
const A = struct {
b: B,
};
const B = fn (A) void;
```
2019-08-23 14:07:34 -04:00
Andrew Kelley
20049caaba
add lazy value for fn prototypes
...
this case now works:
```zig
const Node = struct {
field: fn (*Node) *Node,
};
```
2019-08-23 13:28:26 -04:00
Andrew Kelley
3865b6ad8f
Merge remote-tracking branch 'origin/master' into fix-field-alignment-kludge
2019-08-23 11:43:37 -04:00
Andrew Kelley
ec2f9ef4e8
Merge pull request #3114 from Tetralux/align-on-struct-fields
...
parsing and rendering of align(N) on struct fields
2019-08-23 11:19:27 -04:00
Jonathan Marler
9322eee80a
Encapsulate bigint representation, assert on cast data loss
2019-08-23 11:14:08 -04:00
Tetralux
43587af01a
rendering of align(N) on struct fields
2019-08-22 22:58:38 +00:00
Tetralux
3ec10ea174
parsing of align(N) on struct fields
2019-08-22 22:58:02 +00:00
Andrew Kelley
79a4b7a236
fix regressions
2019-08-22 18:24:15 -04:00
Andrew Kelley
26b79ac90e
simple self-referential struct is working now
2019-08-22 14:46:26 -04:00
Andrew Kelley
0d6a6c76ea
add missing "referenced here" notes for lazy values
2019-08-22 12:56:35 -04:00
Andrew Kelley
8460d5617c
introduce lazy values
...
see #2174
2019-08-22 12:08:04 -04:00
Marc Tiehuis
0e75fef1de
Merge pull request #3106 from ziglang/hash-tooling-changes
...
Hash tooling changes
2019-08-21 21:54:12 -10:00
Andrew Kelley
efdbede7ab
breaking: remove field alignment kludge
...
This breaks behavior tests as well as compile error notes for generic
function calls. However it introduces better circular dependency compile
errors.
The next step is to add Lazy Values to fix the regressions.
2019-08-21 19:27:51 -04:00
Andrew Kelley
ec7d7a5b14
Merge pull request #2991 from emekoi/mingw-ci
...
mingw improvements
2019-08-21 12:29:42 -04:00
Marc Tiehuis
16fa255f48
Inline full slice hashing
...
This gives moderate speed improvements when hashing small keys.
The crc/adler/fnv inlining did not provide enough speed up to warrant
the change.
OLD:
wyhash
small keys: 2277 MiB/s [c14617a1e3800000]
siphash(1,3)
small keys: 937 MiB/s [b2919222ed400000]
siphash(2,4)
small keys: 722 MiB/s [3c3d974cc2800000]
fnv1a
small keys: 1580 MiB/s [70155e1cb7000000]
adler32
small keys: 1898 MiB/s [00013883ef800000]
crc32-slicing-by-8
small keys: 2323 MiB/s [0035bf3dcac00000]
crc32-half-byte-lookup
small keys: 218 MiB/s [0035bf3dcac00000]
NEW:
wyhash
small keys: 2775 MiB/s [c14617a1e3800000]
siphash(1,3)
small keys: 1086 MiB/s [b2919222ed400000]
siphash(2,4)
small keys: 789 MiB/s [3c3d974cc2800000]
fnv1a
small keys: 1604 MiB/s [70155e1cb7000000]
adler32
small keys: 1856 MiB/s [00013883ef800000]
crc32-slicing-by-8
small keys: 2336 MiB/s [0035bf3dcac00000]
crc32-half-byte-lookup
small keys: 218 MiB/s [0035bf3dcac00000]
2019-08-21 21:38:02 +12:00
Marc Tiehuis
7854a52a6b
Add iterative-only filter to hash benchmark
2019-08-21 21:02:24 +12:00
Marc Tiehuis
48410943cb
Add more hash functions to benchmark scripts
...
Changed CRC api so the polynomial is specified as an enum for simpler
construction.
2019-08-21 20:46:15 +12:00
Marc Tiehuis
c050ec4e57
Update hash/crypto benchmark scripts
2019-08-21 20:34:12 +12:00
Andrew Kelley
81c441f885
remove incorrect assert regarding 128-bit integers
...
LLVM incorrectly reports 8 as the alignment of i128 on x86_64 but it
correctly reports 16 as the alignment of i128 on aarch64.
closes #3101
2019-08-20 21:17:57 -04:00
Andrew Kelley
2f3ad48c9b
LLD patch: workaround for buggy MACH-O code
...
This reapplies 5ce1a965e0
to the embedded LLD.
2019-08-20 19:42:41 -04:00
Andrew Kelley
8bb6bf6818
update libcxx to 9.0.0-rc2
...
upstream commit 67a4a12d61bfb10b2410b53c5a43ef9b4a03de7d
2019-08-20 19:36:26 -04:00
Andrew Kelley
37a06f4dcf
update embedded LLD to 9.0.0-rc2
...
upstream commit 67a4a12d61bfb10b2410b53c5a43ef9b4a03de7d
2019-08-20 19:33:58 -04:00
Andrew Kelley
c0bd2eb398
update C headers to clang 9.0.0-rc2
...
upstream commit 67a4a12d61bfb10b2410b53c5a43ef9b4a03de7d
2019-08-20 19:16:06 -04:00
Andrew Kelley
5f3d59f0ac
Merge branch 'master' into llvm9
2019-08-20 19:09:52 -04:00
Andrew Kelley
3b5a8858c2
Merge branch 'euantorano-fix/3012-os-getrandom-fill-buffer'
...
Closes #3016
Closes #3012
Thanks @euantorano!
2019-08-20 15:54:09 -04:00
Andrew Kelley
9bf283c085
fixups
...
* getrandom libc prototypes had the wrong return type
* `total_read` local variable was unnecessary since the sub-slice
buffer has a length
* I was able to get rid of all the integer casts
* the err == 0 check can be a switch case
* add missing `return` statement
2019-08-20 15:25:30 -04:00
Euan Torano
79354243e3
fix os.getrandom logic to fill the entire buffer
2019-08-20 14:52:38 -04:00
Euan Torano
8c32c09807
Fix InStream.readNoEof
2019-08-20 14:52:10 -04:00
Andrew Kelley
c175e53564
add std.c.printf
2019-08-20 14:42:39 -04:00
Andrew Kelley
f0a141f799
Merge branch 'FireFox317-fix-issue-3030'
...
closes #3084
closes #3030
2019-08-20 14:42:02 -04:00
Andrew Kelley
276eb4402b
specify the target for the newest test case
2019-08-20 14:40:57 -04:00
Timon Kruiper
2addec8ea1
compiler error when variable in asm template cannot be found
2019-08-20 14:11:03 -04:00
Marc Tiehuis
2aa18b9097
Merge pull request #3090 from ziglang/fmt-internal
...
fmt changes
2019-08-19 19:48:05 -10:00
Andrew Kelley
3dbed54294
fix @bitCast of packed struct literal
...
closes #3042
2019-08-19 17:50:37 -04:00
Andrew Kelley
07c5e90601
Merge branch 'mikdusan-issue.3010'
...
closes #3022
closes #3010
thanks @mikdusan
2019-08-19 17:36:35 -04:00
Andrew Kelley
6bc520ab95
solve it a slightly different way
...
the error handling of result locations is a bit awkward but it should
basically be the same everywhere
2019-08-19 17:35:19 -04:00
Michael Dusan
24deb1a7fe
fix @bitCast segfault with literal array param
...
closes #3010
2019-08-19 17:24:14 -04:00
Aaron Klapatch
efc2237e5a
added documentation for field access to C pointers ( #3088 )
2019-08-19 16:47:16 -04:00
Andrew Kelley
d067a037cc
fix void array as a local variable initializer
...
Related: #1767
2019-08-19 15:58:31 -04:00
Andrew Kelley
44fb5275c1
fix array multiplication not setting parent value info
...
closes #3095
2019-08-19 14:46:12 -04:00
Andrew Kelley
3f7f520036
don't put libc on the elf linker line for objects
...
closes #3093
2019-08-19 12:33:36 -04:00
Marc Tiehuis
e0447c6ddd
std/fmt: Make FormatOptions arguments non-comptime
...
No need and should help avoid exessive function monomorphizaton.
2019-08-19 22:28:13 +12:00
Marc Tiehuis
98859c885e
std/fmt.zig: Pass full options struct to all internal functions
...
The fill specifier is now handled in some cases. The default fill of '0'
is now ' ' for integers and non-byte sequences.
2019-08-19 22:15:15 +12:00
Nick Erdmann
5a0275c247
fix error message when dependency requires position independent code
2019-08-18 19:33:25 -04:00
Andrew Kelley
ea1734773b
add compile error for async frames depending on themselves
2019-08-17 19:47:49 -04:00
Marc Tiehuis
6844dafeca
std/fmt: Move pointer parsing out of main state machine
...
This allows us to format a pointer with alignment/padding as we would
with any other format specifier.
e.g. {*:5}
2019-08-18 11:06:54 +12:00
Andrew Kelley
57b90d2d98
allow implicit cast of fn to async fn
...
it forces the fn to be async. closes #3079
2019-08-17 17:22:20 -04:00
Andrew Kelley
66a490c27c
detect non-async function pointer of inferred async function
...
closes #3075
2019-08-17 16:49:23 -04:00
Vexu
0ff396c34f
add compile error for incorrect atomic ordering in fence #3082
2019-08-17 16:05:41 -04:00
Andrew Kelley
4d8a6f6fea
fix compiler not checking alignment of function frames
...
closes #3086
2019-08-17 13:04:50 -04:00
Andrew Kelley
456a244d62
fix event loop regression on macos
2019-08-17 11:40:48 -04:00
Andrew Kelley
e24cc2e77b
std.event.Loop: fix not waking up after file system I/O
...
for single threaded event loops
2019-08-16 23:19:13 -04:00
Andrew Kelley
3dce41b61a
improvements to std lib for event-based I/O
2019-08-16 21:29:29 -04:00
Andrew Kelley
c39bb3ebc4
target: add missing switch case
2019-08-16 16:52:45 -04:00
Andrew Kelley
6529658ad8
Merge remote-tracking branch 'origin/master' into llvm9
2019-08-16 16:43:56 -04:00
Andrew Kelley
bf7b6fbbdb
add missing compile error for fn call bad implicit cast
...
when the function's return type handle is a pointer but the result
location's result value type handle is not a pointer
closes #3055
2019-08-16 16:30:24 -04:00
Andrew Kelley
cbca6586e7
add test for struct parameter to async function being copied
...
closes #1155
2019-08-16 13:56:26 -04:00
Andrew Kelley
5a2cbe239f
fix and test case for returning from suspend block
...
See #3063
2019-08-16 13:07:07 -04:00
Vexu
c3407ed097
Merge branch 'master' into comment-in-array
2019-08-16 20:02:47 +03:00
yvt
2cb1f93894
correct LLVM subarch names for arm
2019-08-16 08:46:18 -07:00
Andrew Kelley
13c584d325
add compile error for casting const frame to anyframe
...
See #3063
2019-08-16 11:38:41 -04:00
Andrew Kelley
cba3b8291a
codegen: LLVMConstSub instead of LLVMBuildSub in one place
2019-08-16 11:19:01 -04:00
Andrew Kelley
7798054b58
add tests for bad implicit casting of anyframe types
...
See #3063
2019-08-16 11:00:21 -04:00
Andrew Kelley
4ea2331e3d
add test for async call of generic function
...
See #3063
2019-08-16 10:54:45 -04:00
Andrew Kelley
5df89dafef
add test for wrong frame type used for async call
...
See #3063
2019-08-16 10:49:00 -04:00
Andrew Kelley
1254a453b9
add compile error for @Frame() of generic function
...
See #3063
2019-08-16 10:44:51 -04:00
Vexu
92a81252cb
Merge branch 'master' into fmt-comment-fix
2019-08-16 17:40:20 +03:00
Andrew Kelley
49c88e23af
zig fmt
2019-08-16 10:13:40 -04:00
Andrew Kelley
7874d5a40b
zig fmt: add more test cases
2019-08-16 10:11:53 -04:00
Vexu
2151f84d59
implement new async syntax in self-hosted compiler
2019-08-16 06:17:28 -07:00
Andrew Kelley
1e3b6816a8
note that -mllvm is unsupported
...
closes #3045
2019-08-15 22:57:06 -04:00
Andrew Kelley
ff7e826b82
fix crash with sometimes type not being resolved
2019-08-15 18:54:23 -04:00
Andrew Kelley
0b08ae581e
add assertion about control flow to fix gcc warning
2019-08-15 18:38:20 -04:00
Andrew Kelley
7e75e1075e
zig fmt
2019-08-15 18:19:04 -04:00
Andrew Kelley
8b97a1aee2
Merge pull request #3033 from ziglang/rewrite-coroutines
...
rework async function semantics
2019-08-15 14:01:01 -07:00
Andrew Kelley
d3672493cc
basic docs for new async/await semantics
2019-08-15 16:46:43 -04:00
Andrew Kelley
55f5cee86b
fix error return traces for async calls of blocking functions
2019-08-15 15:06:05 -04:00
Andrew Kelley
729807203a
force static libs for vendored dependencies
2019-08-15 14:34:52 -04:00
Andrew Kelley
13b5a4bf8c
remove cancel
2019-08-15 14:05:12 -04:00
Andrew Kelley
64c293f8a4
codegen for async call of blocking function
2019-08-14 12:52:20 -04:00
Andrew Kelley
f3f838cc01
add compile error for await in exported function
2019-08-14 11:22:12 -04:00
Andrew Kelley
7799423f24
rename behavior test files
2019-08-14 00:38:27 -04:00
Andrew Kelley
5749dc49d8
respect local variable alignment in async functions
2019-08-14 00:35:51 -04:00
Andrew Kelley
dd8c8c0802
get_struct_type accepts field alignment overrides
2019-08-13 18:14:38 -04:00
Andrew Kelley
5092634103
avoid the word "coroutine", they're "async functions"
2019-08-13 14:14:19 -04:00
Andrew Kelley
82d4ebe53a
organize TODOs
2019-08-13 13:28:05 -04:00
Andrew Kelley
12ff91c1c9
alignment of structs no longer depends on LLVM
...
fixes async function tests in optimized builds
2019-08-13 12:44:30 -04:00
Andrew Kelley
8a9289996a
Merge remote-tracking branch 'origin/master' into rewrite-coroutines
2019-08-13 11:39:32 -04:00
Andrew Kelley
98183e4743
flip the order of fields in error unions
...
to prepare for fixing u128 alignment issues
2019-08-13 11:33:01 -04:00
Andrew Kelley
24d5ec0783
fix async function frames not aligned enough
2019-08-11 22:35:12 -04:00
Andrew Kelley
911b1a0428
fix no-longer-correct nonnull attribute on merge err ret traces fn
2019-08-11 22:05:09 -04:00
Andrew Kelley
62c5bc6058
fix cancel invoking branch on undefined memory
2019-08-11 21:14:19 -04:00
Andrew Kelley
4d8d513e16
all tests passing
2019-08-11 19:53:10 -04:00
Andrew Kelley
3aed7de0c4
README: link to community projects
2019-08-11 16:09:23 -04:00
Andrew Kelley
af8c6ccb4b
fix canceling async functions which have error return tracing
2019-08-11 14:26:34 -04:00
Andrew Kelley
b87686dfa0
fix enum with one member and custom tag type
2019-08-11 13:43:44 -04:00
Andrew Kelley
1b83ee78a4
allow comptime_int to implicit cast to comptime_float
2019-08-11 12:01:02 -04:00
data-man
4bd4c5e06d
Fixed tiny typo in the math module (shr's description)
2019-08-11 08:15:42 -07:00
Nick Erdmann
70e62b8612
std/os/uefi: some more events
2019-08-11 15:50:03 +02:00
Nick Erdmann
a9b3700c6e
src/codegen: configure stack probes explicitly
2019-08-11 00:29:24 +02:00
Andrew Kelley
3f5c6d7a89
add test case for typical async/await usage
2019-08-10 18:03:36 -04:00
Andrew Kelley
77d098e92d
fix returning a const error from async function
2019-08-10 17:23:45 -04:00
Andrew Kelley
22428a7546
fix try in an async function with error union and non-zero-bit payload
2019-08-10 15:20:08 -04:00
Nick Erdmann
47ce736abe
std/os/uefi: add basic Event support
2019-08-10 19:14:47 +02:00
Nick Erdmann
9445b3f057
std/os/uefi: change type of Handle from @OpaqueType to *@OpaqueType
2019-08-10 19:14:31 +02:00
Andrew Kelley
b9d1d45dfd
fix combining try with errdefer cancel
2019-08-09 21:49:40 -04:00
Andrew Kelley
2e7f53f1f0
fix cancel inside an errdefer
2019-08-09 17:34:06 -04:00
Andrew Kelley
e6ebc41a07
add a little compile error to make Future Andy's life easier
2019-08-09 17:10:39 -04:00
Andrew Kelley
0bf6796b76
fix regression in std.math.min
...
closes #3035
2019-08-09 10:22:02 -04:00
Andrew Kelley
614cab5d68
fix passing string literals to async functions
2019-08-08 19:08:41 -04:00
Andrew Kelley
da56959a9a
closer to std lib event stuff working
2019-08-08 16:41:38 -04:00
Andrew Kelley
93840f8610
fix var args call on non-generic function
2019-08-08 15:34:41 -04:00
Andrew Kelley
cfe84423c9
fix segfault with var args
2019-08-08 15:13:05 -04:00
Andrew Kelley
bfa1d12fba
better compile errors when frame depends on itself
2019-08-08 13:44:57 -04:00
Andrew Kelley
8be95af480
add compile error for unable to determine async fn frame
2019-08-08 13:07:05 -04:00
Andrew Kelley
8d4cb85285
async functions in single threaded mode do not use atomic ops
2019-08-08 12:30:22 -04:00
Andrew Kelley
d813805f77
more debuggable safety for awaiting twice
2019-08-08 12:02:56 -04:00
Andrew Kelley
34bfdf193a
cancel, defer, errdefer all working as intended now
2019-08-08 11:37:49 -04:00
Andrew Kelley
e6ef00233e
Merge pull request #3025 from euantorano/fix/3015-std-os-window-rtlgenrandom
...
Fix #3015 - fix RtlGenRandom function signature
2019-08-07 14:21:54 -07:00
Euan Torano
f2bef0447a
Remove unneeded casts.
2019-08-07 22:19:25 +01:00
Sam Tebbs
8621e3b5bd
Don't emit clang error if source or filename pointer is null
2019-08-07 14:11:18 -07:00
Andrew Kelley
2cd5e55581
std.math.min: return a more restrictive type sometimes
2019-08-07 16:28:23 -04:00
Ryan Saunderson
8fcf21fefc
modify header precedence for zig cc, resolves intrinsics issues ( #3027 )
2019-08-07 10:51:30 -07:00
Andrew Kelley
e11cafbd4f
cancel works on non-pointers
2019-08-07 10:56:37 -04:00
Andrew Kelley
f587fa1cd7
clean up the bitcasting of awaiter fn ptr
2019-08-07 10:56:19 -04:00
Andrew Kelley
7e1fcb55b3
implement cancel
...
all behavior tests passing in this branch
2019-08-07 00:53:04 -04:00
Andrew Kelley
1afbb53661
fix awaiting when result type is a struct
2019-08-06 19:07:25 -04:00
Andrew Kelley
966c9ea63c
error return trace across suspend points
2019-08-06 18:47:09 -04:00
Andrew Kelley
17199b0879
passing the error return trace async function test
2019-08-06 18:29:56 -04:00
Andrew Kelley
400500a3af
improve async function semantics
...
* add safety panic for resuming a function which is returning, pending
an await
* remove IrInstructionResultPtr
* add IrInstructionReturnBegin. This does the early return in async
functions; does nothing in normal functions.
* `await` gets a result location
* `analyze_fn_async` will call `analyze_fn_body` if necessary.
* async function frames have a result pointer field for themselves
to access and one for the awaiter to supply before the atomic rmw.
when returning, async functions copy the result to the awaiter result
pointer, if it is non-null.
* async function frames have a stack trace pointer which is supplied by
the awaiter before the atomicrmw. Later in the frame is a stack trace
struct and addresses, which is used for its own calls and awaits.
* when awaiting an async function, if an early return occurred, the
awaiter tail resumes the frame.
* when an async function returns, early return does a suspend
(in IrInstructionReturnBegin) before copying
the error return trace data, result, and running the defers.
After the last defer runs, the frame will no longer be accessed.
* proper acquire/release atomic ordering attributes in async functions.
2019-08-06 16:53:22 -04:00
Euan Torano
2d25348f63
Fix function signature and use a loop to ensure buffer is filled.
2019-08-06 19:32:22 +01:00
Nick Erdmann
88fdb303ff
std/os/uefi: replace init() with default values
2019-08-06 18:06:18 +02:00
Benjamin Feng
23ee619fc5
Output token symbols similar to stage1
2019-08-05 21:37:16 -05:00
Benjamin Feng
b4172e5151
Humanize tokenized symbol names
2019-08-05 21:03:46 -05:00
Andrew Kelley
7f23dac6dc
update readme
2019-08-05 13:49:17 -04:00
Euan Torano
7b8c96612f
Fix #2993 - use getrandom on freebsd
2019-08-05 09:31:38 -07:00
Nick Erdmann
20ce0b9952
std/os/uefi: replace integer bit fields with packed structs
2019-08-05 18:26:13 +02:00
Euan T
8aa87ec441
Add misisng newline
2019-08-05 09:23:15 -07:00
Euan Torano
0157365872
Add missing S_IS* for NetBSD
2019-08-05 09:23:15 -07:00
Andrew Kelley
20f63e588e
async functions have error return traces where appropriate
...
however the traces are not merged on `await` or async function calls
yet.
When an async function has an error set or error union as its return
type, it has a `StackTrace` before the args in the frame, so that it is
accessible from `anyframe->T` awaiters. However when it does not have an
errorable return type, but it does call or await an errorable, it has a
stack trace just before the locals. This way when doing an `@asyncCall`
on an async function pointer, it can populate the args (which are after
the `StackTrace`) because it knows the offset of the args based only on
the return type.
This sort of matches normal functions, where a stack trace pointer could
be supplied by a parameter, or it could be supplied by the stack of the
function, depending on whether the function itself is errorable.
2019-08-05 03:10:14 -04:00
Andrew Kelley
dfe8c5a2e9
add a src() method to AstNode to aid debugging
2019-08-05 03:09:17 -04:00
Andrew Kelley
a7763c06f9
delete IrInstructionMarkErrRetTracePtr
...
this IR instruction is no longer needed
2019-08-05 00:44:39 -04:00
Andrew Kelley
0d8c9fcb18
support async functions with inferred error sets
2019-08-05 00:41:49 -04:00
Andrew Kelley
f27e5d439c
refactor logic for determining if there is a frame pointer
2019-08-04 20:44:52 -04:00
Andrew Kelley
b7c94be688
Merge remote-tracking branch 'origin/master' into rewrite-coroutines
2019-08-04 19:10:36 -04:00
Andrew Kelley
fbf21efd24
simpler, less memory intensive suspend/resume implementation
2019-08-04 18:58:14 -04:00
Andrew Kelley
042914de75
move state from ZigFn to CodeGen to save memory
2019-08-04 18:26:37 -04:00
Andrew Kelley
fa30ebfbe5
suspension points inside branching control flow
2019-08-04 18:24:10 -04:00
Nick Erdmann
b979fc1bcd
initial work torwards std lib support for uefi
2019-08-04 21:53:49 +02:00
Andrew Kelley
30466bccef
update CONTRIBUTING.md
2019-08-04 15:15:25 -04:00
Sahnvour
8c99a51993
Merge pull request #2797 from Sahnvour/hashing
...
hash algorithm improvements
2019-08-04 21:02:00 +02:00
Sahnvour
54255ee32e
autohash: force inlining of integer hashing so that the optimizer can see the fast path based on key's size which is known at comptime
...
otherwise it will always outline the call to hasher.update, resulting in much worse performance
2019-08-04 12:34:37 +02:00
Sahnvour
3faf5d3857
wyhash: stateless is faster for both iterative hashing and small keys.
2019-08-04 12:34:37 +02:00
Sahnvour
4b5172d287
move autoHash into its own module since it can be used with any hash function implementing a streaming interface
2019-08-04 12:34:37 +02:00
Sahnvour
5bf63bfbf1
make use of hashing streaming interface in autoHash
2019-08-04 12:34:05 +02:00
Sahnvour
8805a7b509
adapt http/headers.zig to wyhash's new interface
2019-08-04 12:34:05 +02:00
Marc Tiehuis
4c93ccab5a
Add throughput test program for hash functions
2019-08-04 12:34:05 +02:00
Marc Tiehuis
83dffc70af
Add iterative wyhash api
2019-08-04 12:34:05 +02:00
Sahnvour
c9ce43f59f
fix hashmap using strings as keys
2019-08-04 12:34:05 +02:00
Sahnvour
5bd407b278
use wyhash in std's hashmap, and improve autoHash to handle more types and behave more correctly
2019-08-04 12:34:05 +02:00
Sahnvour
6150da3df9
direct port of wyhash v2
...
also inspired by https://github.com/ManDeJan/zig-wyhash
2019-08-04 12:34:02 +02:00
Andrew Kelley
f01cb8cc16
Merge pull request #2998 from daurnimator/return-elf
...
std: return Elf object from constructors instead of filling in pointer
2019-08-04 00:21:38 -07:00
daurnimator
887eac0219
std: remove elf.auto_close_stream and elf.prealloc_file
2019-08-04 16:27:36 +10:00
Andrew Kelley
12924477a5
fix regression in calling extern functions
2019-08-03 20:33:16 -04:00
emekoi
59e2c87b4b
move windows abi detection to get_native_target
2019-08-03 18:40:27 -05:00
Andrew Kelley
87710a1cc2
implement @asyncCall which supports async function pointers
2019-08-03 16:17:42 -04:00
Andrew Kelley
5ce1a965e0
LLD patch: workaround for buggy MACH-O code
...
This reapplies 182cd0e4c0
to the embedded LLD.
2019-08-03 12:56:35 -04:00
Andrew Kelley
ffab950e0c
update embedded LLD to 9.0.0rc1
2019-08-03 12:56:35 -04:00
Andrew Kelley
63ebd9d12e
Merge remote-tracking branch 'origin/master' into llvm9
2019-08-03 12:39:15 -04:00
Andrew Kelley
5687323cd2
Merge pull request #2994 from euantorano/fix/1626-os-getRandomBytesDevURandom
...
Check if /dev/urandom is a character device
2019-08-02 23:55:43 -07:00
Euan T
08251fbc54
Omit system namespace.
...
Co-Authored-By: Andrew Kelley <andrew@ziglang.org >
2019-08-03 07:51:36 +01:00
Euan T
8e157ccb23
Update returned error return when not a character device.
...
Co-Authored-By: Andrew Kelley <andrew@ziglang.org >
2019-08-03 07:50:30 +01:00
Andrew Kelley
c879209661
add compile error for calling async function pointer
2019-08-03 02:40:38 -04:00
Andrew Kelley
e444e737b7
add runtime safety for resuming an awaiting function
2019-08-03 02:11:52 -04:00
daurnimator
521aaf3501
std: return Elf object from constructors instead of filling in pointer
2019-08-03 15:56:25 +10:00
Andrew Kelley
24d78177ee
add compile error for async call of function pointer
2019-08-03 01:06:14 -04:00
Christoffer Rasmussen
57830e43ee
Fix public function lookup
...
Previously it did not work, as lookup did not pass a correct parent type
to doLookup. Expected *?*Node, got ?*Node.
2019-08-02 21:48:30 -07:00
emekoi
102d3f30c4
accept unix style paths on windows-gnu
2019-08-02 19:39:33 -05:00
emekoi
f15ec9a59b
implemented runtime abi detetction for windows
2019-08-02 19:32:46 -05:00
Andrew Kelley
0920bb0872
implement async functions returning structs
2019-08-02 19:27:27 -04:00
Andrew Kelley
e68fee3984
docs: add atomicrmw operations list
2019-08-02 18:54:15 -04:00
Andrew Kelley
1823a5979a
Merge pull request #2985 from fengb/fix-build-references
...
Fix build references
2019-08-02 15:49:16 -07:00
Andrew Kelley
5bd330e76c
add heap allocated async function frame test
2019-08-02 16:32:24 -04:00
Andrew Kelley
b3b6a98451
Merge remote-tracking branch 'origin/master' into rewrite-coroutines
2019-08-02 16:31:43 -04:00
Andrew Kelley
f07f09a373
Merge branch 'master' into rewrite-coroutines
2019-08-02 16:13:36 -04:00
Andrew Kelley
b2d94f9af2
Merge branch 'assignment-result-loc'
...
With this merge, assignments participate in result location
semantics.
2019-08-02 16:10:45 -04:00
Andrew Kelley
d105769926
fix regressions regarding writing through const pointers
2019-08-02 16:09:40 -04:00
Andrew Kelley
9069ee957c
fix discarding function call results
2019-08-02 15:17:02 -04:00
Andrew Kelley
90e64bc620
fix cmpxchg with discarded result
2019-08-02 14:47:26 -04:00
Andrew Kelley
a5cb0f77d1
assignment participates in result location
...
fix one regression with optionals but there are more
2019-08-02 13:54:58 -04:00
Euan Torano
24fbd1f1d5
Add S_* values for freebsd.
2019-08-02 16:05:03 +01:00
Euan Torano
1583efda69
Fix call to S_ISCHR and implement for Mac
2019-08-02 15:55:56 +01:00
Euan Torano
c0c228b758
Check if /dev/urandom is a character device
2019-08-02 13:19:49 +01:00
Andrew Kelley
056c4e2c98
implement async await and return
2019-08-02 01:06:00 -04:00
Andrew Kelley
0f879d02a4
more passing coroutine tests
2019-08-01 19:14:48 -04:00
Andrew Kelley
1dd0c3d49f
fix calling an inferred async function
2019-08-01 16:41:30 -04:00
Andrew Kelley
e7ae4e4645
reimplement async with function splitting instead of switch
2019-08-01 16:08:52 -04:00
Andrew Kelley
6cb4cac5cd
disable behavior test for 128-bit cmpxchg
...
once #2883 is done this can be revisited
2019-08-01 03:36:03 -04:00
Andrew Kelley
38b5812c48
allow 128 bit cmpxchg on x86_64
2019-08-01 02:46:37 -04:00
Benjamin Feng
723aea8369
Default wasm-lib prefix to empty
2019-07-31 22:07:17 -05:00
Benjamin Feng
327abdba0b
More current style for error handling
2019-07-31 21:28:25 -05:00
Benjamin Feng
e40513e97f
Add builder.findProgram test and fix references
2019-07-31 21:26:39 -05:00
Andrew Kelley
dbdc4d62d0
improve support for anyframe and anyframe->T
...
* add implicit cast from `*@Frame(func)` to `anyframe->T` or `anyframe`.
* add implicit cast from `anyframe->T` to `anyframe`.
* `resume` works on `anyframe->T` and `anyframe` types.
2019-07-29 19:32:49 -04:00
Andrew Kelley
ceec2393cf
Merge pull request #2965 from Sahnvour/zig-stack-traces
...
Stage1 stack traces on windows
2019-07-29 17:50:11 -04:00
Sahnvour
c087525eda
pdb: improved stream reading performance, printing stack trace from a stage1 crash is now 10x faster
2019-07-29 23:40:18 +02:00
Sahnvour
05032c8693
coff & pdb: improved correctness of our implementation, it is now able to handle stage1's pdb and print its stack traces
2019-07-29 23:40:18 +02:00
Sahnvour
d08425a0a5
os: missing accessW since recent refactoring
2019-07-29 23:33:58 +02:00
Michael Dusan
bc982e65cf
fix std.fmt to handle std.SegmentedList
...
- add guards for use of prealloc_exp in SegmentedList
- define prealloc_exp even when invalid because std.fmt comptime
triggers lazy-init
- fix std.fmt to print arrays of length 0 as style "[0]<typename>"
because "<typename>@address" is n/a without address
2019-07-29 16:32:26 -04:00
Nick Erdmann
8736a5be2a
std/build.zig: fix stack checking option
2019-07-29 16:30:21 -04:00
Michael Dusan
7e436006be
fix std.rb.Node.getParent to return optional
...
closes #2962
2019-07-29 16:29:29 -04:00
Andrew Kelley
d694f298d8
Merge pull request #2958 from emekoi/mingw-cmake
...
fix backtraces on mingw
2019-07-29 16:27:35 -04:00
Marc Tiehuis
c47b75312d
Merge pull request #2969 from evangrayk/zero-width-structs
...
fix zero-width structs in zig.fmt.format
2019-07-29 19:19:47 +12:00
Evan Krause
a0ebfa64d9
support zero-sized structs in zig.fmt.format
2019-07-28 18:37:35 -07:00
Nick Erdmann
6e8ef5b6f2
std/build.zig: add checks for UEFI
2019-07-29 00:21:21 +02:00
Nick Erdmann
63d56c532d
src/target.cpp: UEFI improvements
2019-07-29 00:19:40 +02:00
emekoi
357fb4f143
avoid passing -static to msvc when static linking
2019-07-27 17:54:20 -05:00
emekoi
10b1017702
fixed backtraces when linking libc on mingw
2019-07-27 17:50:44 -05:00
Andrew Kelley
ee64a22045
add the anyframe and anyframe->T types
2019-07-26 19:52:35 -04:00
emekoi
5593c63e12
improved CMake file for MinGW
2019-07-26 16:26:01 -05:00
Joachim Henke
74abc5ad2f
avoid a register copy when fetching the stack pointer in _start
2019-07-26 17:12:42 -04:00
Andrew Kelley
018a89c7a1
async functions return void, no more GetSize resume block
2019-07-26 17:07:19 -04:00
Andrew Kelley
7b3686861f
@frameSize works via PrefixData
2019-07-25 22:24:01 -04:00
Andrew Kelley
538c0cd225
implement @frameSize
2019-07-25 15:05:55 -04:00
Andrew Kelley
70bced5dcf
implement @frame and @Frame
2019-07-25 01:47:56 -04:00
Andrew Kelley
ead2d32be8
calling an inferred async function
2019-07-25 00:03:06 -04:00
Andrew Kelley
9e11f67f0d
add test for previous commit
2019-07-24 15:05:39 -04:00
Michael Dusan
8e4f3a6f15
align src for IrInstructionArrayToVector
...
closes #2942
2019-07-24 15:04:32 -04:00
Andrew Kelley
e220812f2f
implement local variables in async functions
2019-07-24 02:59:51 -04:00
Andrew Kelley
19ee495750
add error for function with ccc indirectly calling async function
2019-07-23 19:35:41 -04:00
Andrew Kelley
7e9760de10
inferring async from async calls
2019-07-23 18:54:45 -04:00
Timon Kruiper
59850c1ce1
Fixed an integer overflow in zig fmt and added testcase
2019-07-23 14:51:30 -04:00
Vexu
57aa8997bd
fix escape sequence rendering
2019-07-23 14:49:19 -04:00
Andrew Kelley
317d1ecb2c
Merge remote-tracking branch 'origin/master' into rewrite-coroutines
2019-07-22 14:37:08 -04:00
Andrew Kelley
fcadeb50c0
fix multiple coroutines existing clobbering each other
2019-07-22 14:36:14 -04:00
Andrew Kelley
650e07ebd9
fix suspend at end of function
2019-07-22 13:04:22 -04:00
Andrew Kelley
16be70cbbf
compiler-rt: add __muldi3
2019-07-22 12:49:26 -04:00
Andrew Kelley
bc31c1280e
disable segfault handler when panicking
...
this prevents a segfault in stack trace printing to activate the
segfault handler.
2019-07-22 12:41:59 -04:00
Andrew Kelley
a3327f0fbd
fix usingnamespace analyzing the expression multiple times
2019-07-22 12:33:24 -04:00
Andrew Kelley
5b69a9cd83
disable segfault handler when panicking
...
this prevents a segfault in stack trace printing to activate the
segfault handler.
2019-07-22 12:15:16 -04:00
Andrew Kelley
d6d0bb0542
zig build: adjust DESTDIR logic
...
now if DESTDIR is provided then the default install prefix is /usr.
otherwise the default install prefix is still zig-cache directly.
DESTDIR is prepended to the prefix to match what make install does.
2019-07-22 10:45:59 -04:00
Andrew Kelley
32d0ac1355
fix wrong calling convention on async resume
2019-07-22 00:07:48 -04:00
Andrew Kelley
59bf9ca58c
implement async function parameters
2019-07-21 23:27:47 -04:00
Andrew Kelley
11bd50f2b2
implement coroutine resume
2019-07-21 20:54:08 -04:00
Andrew Kelley
78e03c466c
simple async function passing test
2019-07-21 19:56:37 -04:00
Andrew Kelley
77c2ac3fcd
zig build: support DESTDIR environment variable
...
closes #2929
2019-07-21 18:04:23 -04:00
Andrew Kelley
56c08eb302
returning from async fn adds bad resume safety
2019-07-21 17:17:44 -04:00
Andrew Kelley
6053ca4f69
fix not jumping to entry
2019-07-21 17:10:16 -04:00
Andrew Kelley
27a5f2c4fa
remove errors for async calling convention
2019-07-21 16:43:43 -04:00
Andrew Kelley
72e983670e
simple async function call working
2019-07-21 16:21:16 -04:00
Andrew Kelley
a2e1be0346
docs: don't try to run the undefined behavior example test
2019-07-20 13:59:18 -04:00
Andrew Kelley
2c1e955de7
always give the type to byval attribute
2019-07-20 13:32:50 -04:00
Andrew Kelley
54e716afdc
remove coroutines implementation and promise type
2019-07-19 18:18:44 -04:00
Andrew Kelley
05454123d4
update clang driver code to llvm9
...
upstream commit 1931d3cb20a00da732c5210b123656632982fde0
2019-07-19 18:07:31 -04:00
Andrew Kelley
f429f4dcab
Merge branch 'fengb-tokenize-ampamp'
...
closes #2723
closes #2660
2019-07-19 17:55:12 -04:00
Andrew Kelley
8ea8cff491
slightly simpler implementation
2019-07-19 17:54:06 -04:00
Benjamin Feng
111d3792e0
Docgen invalid for &&
2019-07-19 17:11:58 -04:00
Benjamin Feng
484f8a4cc2
Switch old switch / @TagType() to use inferred enums
2019-07-19 17:11:58 -04:00
Benjamin Feng
4708fb23c0
Generate parse error from &&
2019-07-19 17:11:58 -04:00
Benjamin Feng
d4ff27180b
Tokenize '&&' as AmpersandAmpersand
2019-07-19 17:11:58 -04:00
Andrew Kelley
af8661405b
fix usingnamespace
...
It used to be that usingnamespace was only allowed at top level. This
made it OK to put the state inside the AST node data structure. However,
now usingnamespace can occur inside any aggregate data structure, and
therefore the state must be in the TopLevelDeclaration rather than in
the AST node.
There were two other problems with the usingnamespace implementation:
* It was passing the wrong destination ScopeDecl, so it could cause an
incorrect error such as "import of file outside package path".
* When doing `usingnamespace` on a file that already had
`pub usingnamespace` in it would "steal" the usingnamespace, causing
incorrect "use of undeclared identifier" errors in the target file.
closes #2632
closes #2580
2019-07-19 16:56:44 -04:00
Andrew Kelley
70e05c67ce
update libcxx to llvm9
...
upstream commit 1931d3cb20a00da732c5210b123656632982fde0
2019-07-19 16:55:59 -04:00
Andrew Kelley
dab0cf6428
update libunwind to llvm9
...
upstream commit 1931d3cb20a00da732c5210b123656632982fde0
2019-07-19 16:54:00 -04:00
Andrew Kelley
2117fbdae3
update C headers to llvm9
...
upstream commit 1931d3cb20a00da732c5210b123656632982fde0
2019-07-19 16:50:45 -04:00
Andrew Kelley
1d07bbbef2
zig build: add valgrind cli options
2019-07-18 20:03:38 -04:00
Andrew Kelley
70da0762f7
better riscv syscalls
2019-07-18 18:15:50 -04:00
Michael Dusan
e5d032982e
closes #2916
2019-07-18 16:42:56 -04:00
Andrew Kelley
03a3b1ca39
riscv workarounds for llvm not having good asm integration
2019-07-18 15:20:58 -04:00
Andrew Kelley
a3854d042e
basic riscv support
...
llvm is giving me `error: couldn't allocate output register for
constraint '{a0}'` which is a bug that needs to be fixed upstream.
2019-07-18 15:03:21 -04:00
Andrew Kelley
07f0de6a8a
compiler-rt: add __muldi3
2019-07-18 13:54:22 -04:00
Andrew Kelley
afbf99c846
riscv musl: only add the +a feature
2019-07-18 12:28:24 -04:00
Andrew Kelley
d4ca337e6b
improvements to riscv support
2019-07-18 12:21:57 -04:00
Andrew Kelley
04ce5376a8
carry some upstream patches to musl to fix riscv inline asm
...
Upstream commits:
* 8eb49e0485fc547eead9e47200bbee6d81f391c1
* 2dcbeabd917e404a0dde0195388da401b849b9a4
* f0eb2e77b2132a88e2f00d8e06ffa7638c40b4bc
These will be in the next version of musl, so no harm carrying them
here.
2019-07-18 11:43:39 -04:00
Andrew Kelley
aaa4bf75d3
msvc libc: provide _fltused symbol
2019-07-17 18:11:03 -04:00
Andrew Kelley
e816d592e8
update zig codebase to llvm 9
2019-07-17 17:47:39 -04:00
Andrew Kelley
3879bebc37
WIN32 -> _WIN32
2019-07-17 16:10:54 -04:00
Andrew Kelley
95e04e3874
back to msvc as the default C ABI on Windows
...
Zig provides a libc for the GNU C ABI on Windows, and cannot (at least
yet) provide one for the MSVC C ABI. However when not linking libc,
zig has no problem targeting MSVC as the C ABI. And this should be the
default.
Related: #2911
2019-07-17 12:40:48 -04:00
dimenus
d64bd30690
fixed slice length in getEnvVarOwned
2019-07-17 12:13:50 -04:00
Andrew Kelley
8f92a49dfd
update to llvm9 trunk
2019-07-16 22:23:48 -04:00
Andrew Kelley
c0b4121ff2
libc headers before C language headers, and disable libunwind on arm32
2019-07-16 21:38:18 -04:00
Andrew Kelley
ec92739022
Merge branch 'update-musl'
...
closes #2601
2019-07-16 20:07:05 -04:00
Andrew Kelley
d994379173
update bundled musl source to 1.1.23
2019-07-16 19:54:14 -04:00
Andrew Kelley
f70ce707e2
update musl headers to musl v1.1.23
2019-07-16 19:02:51 -04:00
Vexu
34d2a1465c
Merge branch 'master' into fmt-comment-fix
2019-07-17 01:22:20 +03:00
Vexu
f8e753e19c
Merge branch 'master' into comment-in-array
2019-07-17 01:20:59 +03:00
Andrew Kelley
b1f8b53d20
rename internal names regarding usingnamespace
2019-07-16 16:20:54 -04:00
Andrew Kelley
158e2312ea
Merge branch 'JohnathanFL-master'
...
closes #2900
closes #2894
2019-07-16 13:14:11 -04:00
Andrew Kelley
23dd7f4527
organize the docs and some rewording
2019-07-16 13:13:21 -04:00
JohnathanFL
475a181028
Add multidimensional array example
2019-07-16 13:02:30 -04:00
Andrew Kelley
15ed47921f
Merge branch 'msvc-libc-2064' of https://github.com/dimenus/zig into dimenus-msvc-libc-2064
2019-07-16 12:51:02 -04:00
daurnimator
3a67c13b5d
cmake: allow user to select static vs dynamic LLVM
2019-07-16 12:33:13 -04:00
Andrew Kelley
9dcddc2249
retire the example/ folder, rename test-build-examples to "standalone"
...
closes #2759
2019-07-16 12:15:46 -04:00
Andrew Kelley
92e781baa1
fix documentation regarding mixing object files
...
closes #2905
2019-07-16 11:50:34 -04:00
Andrew Kelley
9a9a7daef0
Merge branch 'SamTebbs33-main-return'
2019-07-16 11:50:17 -04:00
Andrew Kelley
741c74e427
cleanups
2019-07-16 11:50:00 -04:00
Andrew Kelley
45cc488cef
Merge branch 'main-return-!u8' of https://github.com/SamTebbs33/zig into SamTebbs33-main-return
2019-07-16 11:27:11 -04:00
emekoi
0435026474
fixed size of ZigClangAPValue on mingw-w64
2019-07-16 09:34:02 -04:00
Andrew Kelley
68149f2039
fix gitattributes
2019-07-16 00:05:12 -04:00
Andrew Kelley
5345044edf
Merge branch 'hryx-translate-c-userland'
2019-07-16 00:01:31 -04:00
Andrew Kelley
776423bbf7
fix result location alignment in ir_render_call
2019-07-15 23:44:44 -04:00
Andrew Kelley
6fe3b20962
Merge branch 'translate-c-userland' of https://github.com/hryx/zig into hryx-translate-c-userland
2019-07-15 22:19:54 -04:00
Andrew Kelley
3f4abe97bd
Merge pull request #2892 from ziglang/install-with-zig-build
...
move some of the installation from cmake to zig build
2019-07-15 20:46:12 -04:00
Andrew Kelley
aff90c2252
avoid shipping junk files
...
I did a diff of the shipped file list with master branch and it looks
good after this commit.
2019-07-15 20:35:34 -04:00
Nick Erdmann
33eaaadd01
fix documentation of assert
2019-07-15 19:52:07 -04:00
Andrew Kelley
eaf545e24c
fix build on windows
2019-07-15 19:50:56 -04:00
Andrew Kelley
c3d20373ee
std.unicode.utf8ToUtf16Le: improve performance
...
on a simple test input:
original utf8ToUtf16Le: elapsed: 111384483 ns (111 ms)
new utf8ToUtf16Le: elapsed: 138570 ns (0 ms)
it's 800x faster in debug mode and ~4500x faster in release-fast mode.
this was slowing down installation of files on windows in build scripts.
2019-07-15 19:35:10 -04:00
Andrew Kelley
851a7288a9
mingw libc can link against ntdll
2019-07-15 18:25:13 -04:00
Andrew Kelley
49d1a4c562
move lib dirs to lib subdir
...
also start prefering NtDll API. so far:
* NtQueryInformationFile
* NtClose
adds a performance workaround for windows unicode conversion. but that
should probably be removed before merging
2019-07-15 17:54:50 -04:00
Andrew Kelley
51a3938b04
fix the build on macos
...
Stat structs gain methods to abstract over the platform differences with
regards to mtime, ctime, atime.
2019-07-15 12:28:39 -04:00
Andrew Kelley
0cd660462f
move install_files.h to not be generated code
2019-07-15 01:47:26 -04:00
Andrew Kelley
6237380b01
fix the build on linux
2019-07-15 01:45:26 -04:00
Andrew Kelley
b23ace27db
fix the build on windows
2019-07-15 01:45:26 -04:00
Andrew Kelley
aa170a7eff
implement std.fs.File.updateTimes for windows
2019-07-15 01:45:26 -04:00
Andrew Kelley
95fdff3feb
std.fs.updateFile: make path if necessary
2019-07-15 01:45:26 -04:00
Andrew Kelley
40a562f26d
cmake: fix incorrect dependencies
2019-07-15 01:45:26 -04:00
Andrew Kelley
6096dc5f94
move some of the installation from cmake to zig build
...
This moves the installation of shipped source files from large
CMakeLists.txt lists to zig build recursive directory installation.
On my computer a cmake `make install` takes 2.4 seconds even when it has
to do nothing, and prints a lot of unnecessary lines to stdout that say
"up-to-date: [some file it is installing]".
After this commit, the default output of `make` is down to 1
second, and it does not print any junk to stdout. Further, a `make
install` is no longer required and `make` is sufficient.
This closes #2874 .
It also closes #2585 . `make` now always invokes `zig build` for
installing files and libuserland.a, and zig's own caching system makes
that go fast.
2019-07-15 01:45:26 -04:00
Andrew Kelley
7d9ee5d6d5
Merge pull request #2882 from andersfr/hash-branch
...
Implementation of MurmurHash and CityHash
2019-07-13 20:08:18 -04:00
emekoi
1547692d18
fixed static linking on mingw-w64
2019-07-13 20:05:13 -04:00
Andrew Kelley
9c39d5720f
ir: add an assertion in phi analysis
2019-07-13 18:38:52 -04:00
Andrew Kelley
c0489abcdb
translate-c: fix incorrectly translated double function pointer
...
closes #2887
2019-07-13 12:38:10 -04:00
andersfr
69129c2e93
Intentional wraparound used +
2019-07-13 13:59:15 +02:00
andersfr
9684c99dd3
Proper use of @truncate instead of @intCast
2019-07-13 13:59:15 +02:00
andersfr
0619b525b9
Better testing and bugfix in hashUint* functions
2019-07-13 13:59:15 +02:00
andersfr
dfbe65e8cd
Ported CityHash and Murmur hashing algorithms to native zig
2019-07-13 13:59:15 +02:00
emekoi
bdfb31420a
fixed compilation on mingw-w64
2019-07-12 19:40:51 -04:00
Andrew Kelley
107e57484f
Merge pull request #2868 from ziglang/windows-libc
...
provide a libc for windows using mingw-w64
2019-07-12 18:12:27 -04:00
Andrew Kelley
39b850c6cf
mingw libc: delete dead linker code regarding using system libc
2019-07-12 18:10:53 -04:00
Andrew Kelley
3621d54e57
handle mingw libc defs better
...
also zig build handles --verbose and linkSystemLibrary better
2019-07-12 17:25:25 -04:00
Andrew Kelley
5a62ab3ef1
fix build.zig
2019-07-12 16:14:54 -04:00
Andrew Kelley
2f8983e2f6
update zig build system for mingw static lib conventions
2019-07-12 15:10:32 -04:00
Andrew Kelley
7b8ba871a9
mingw libc: solve the segfault having to do with destructors
...
* fixed --verbose-cc printing an extra "zig" before the rest of
the command line
* windows-gnu targets use libfoo.a, foo.o extensions to match mingw
conventions.
2019-07-12 14:44:34 -04:00
Andrew Kelley
4e58855a4a
translate-c: better detection of pointer to struct demoted to opaque
2019-07-12 12:11:26 -04:00
daurnimator
52f0300505
std: add new linux 5.2 constants
2019-07-12 11:52:32 -04:00
thomas
02b1aea291
fix typo in help text for bundle-compiler-rt
2019-07-12 10:23:39 -04:00
Andrew Kelley
d9c4c96bf2
add -Wno-pragma-pack when targeting windows-gnu
...
windows.h has files such as pshpack1.h which do #pragma packing,
triggering a clang warning. So for this target, this warning is
disabled.
this commit also improves the error message printed when no libc can be
used, printing the "zig triple" rather than the "llvm triple".
2019-07-11 23:48:13 -04:00
Michael Dusan
1766bd8a08
doc clarify struct size and ABI-alignment
2019-07-11 20:36:30 -04:00
Andrew Kelley
c7a976972f
funding: I've been accepted into the GitHub Sponsors program
2019-07-11 13:00:39 -04:00
Andrew Kelley
b4bbfe8c05
the msvc target abi will have to be solved a different way
2019-07-11 12:56:51 -04:00
Andrew Kelley
e0670557b4
fix windows not able to build mingw
2019-07-10 20:20:53 -04:00
Andrew Kelley
3714d524c3
add some more windows defs
2019-07-10 19:40:46 -04:00
Andrew Kelley
2bb93784c6
mingw: build and link mingwex.lib
...
zig can now cross compile hello.c targeting windows
2019-07-10 17:41:34 -04:00
dimenus
540a40e2d9
fixing non system library linking
2019-07-10 15:37:25 -05:00
Andrew Kelley
67f3bc9101
mingw: building and linking msvcrt-os.lib
2019-07-10 16:19:51 -04:00
Andrew Kelley
ea90a3a9a1
mingw: building and linking mingw32.lib
2019-07-10 14:13:00 -04:00
dimenus
e9331dc5cf
resolved #2064 & fixed hello_world libc build
2019-07-10 11:40:20 -05:00
Andrew Kelley
1c7f21852f
ship with mingw-w64 v6.0.0
...
See #514
2019-07-09 23:34:16 -04:00
Andrew Kelley
ae2345b742
zig build: add standardTargetOptions and deprecate setTarget
...
in favor of setTheTarget
2019-07-09 13:31:42 -04:00
Andrew Kelley
038946288c
Revert "fixed path with spaces in llvm-config ( #2854 )"
...
This reverts commit d23798a296 .
This caused build problems for several people.
2019-07-09 13:31:13 -04:00
Ian Lilley
d23798a296
fixed path with spaces in llvm-config ( #2854 )
...
* fixed path with spaces in llvm-config
2019-07-09 11:48:25 -04:00
Andrew Kelley
eebb00193d
zig build: install .pdb files along with binaries
...
closes #2848
2019-07-08 18:48:03 -04:00
Andrew Kelley
1d2fc446bd
cap getdents length argument to INT_MAX
...
the linux syscall treats this argument as having type int, so passing
extremely long buffer sizes would be misinterpreted by the kernel.
since "short reads" are always acceptable, just cap it down.
patch based on musl commit 3d178a7e2b75066593fbd5705742c5808395d90d
2019-07-08 17:52:28 -04:00
Andrew Kelley
fc9e28ea37
std.os.getrandom does a libc version check
...
closes #397
2019-07-08 14:42:28 -04:00
Andrew Kelley
4953e84902
Merge pull request #2847 from ziglang/glibc-abi-versioning
...
support glibc version as part of the target
2019-07-08 13:51:48 -04:00
Andrew Kelley
201033d83b
avoid dependency on linux/limits.h header
...
it was causing a problem on the CI
2019-07-08 11:38:14 -04:00
Andrew Kelley
8692c6fc0d
zero initialize target
...
Fixes glibc_version being set to garbage. I've made this mistake
before so this is an attempt to prevent future bugs. Zig doesn't
have zero-initialization, so are we being a hypocrite by using this
C feature? No, because C doesn't have the feature that forces you to
initialize all fields. That would have prevented this bug every single
time.
2019-07-08 02:10:26 -04:00
Andrew Kelley
f04782785f
fix not setting a target glibc version on non-linux
2019-07-07 19:24:44 -04:00
Andrew Kelley
56d8185650
expose glibc version in builtin
2019-07-07 17:56:43 -04:00
Andrew Kelley
3e36cad1c1
remove debug log
2019-07-07 17:56:43 -04:00
Andrew Kelley
336ddb8011
add -target-glibc to cli help and zig build
2019-07-07 17:56:43 -04:00
Andrew Kelley
7ccf7807b3
ability to target any glibc version
2019-07-07 17:56:08 -04:00
Andrew Kelley
3b97940fb3
add an update_glibc tool, delete dummy libc files
...
This is the beginning of supporting minimum GLIBC version as part of the
target. See #2509 for the motivation.
The dummy libc zig files are removed. A future commit will build them
on-the-fly, using the generated text files generated by the new tool,
which are checked into source control and distributed along with zig.
These generated text files are, together, 142KB (20KB gzipped).
Compare that to a naive bundling of the .abilist files, which would be
2.2MiB (375KB gzipped).
This is based on glibc 2.29.
2019-07-07 17:56:07 -04:00
Andrew Kelley
d39dcd6d9d
zig build: add setLibCFile API
2019-07-07 11:31:07 -04:00
Andrew Kelley
38ba412729
Merge pull request #2837 from daurnimator/linux-AT_
...
std: improvements to linux constants
2019-07-07 09:53:05 -04:00
Andrew Kelley
e12eb5e7f6
Merge pull request #2835 from hryx/de-keyword-anyerror
...
Make anyerror not a keyword
2019-07-07 09:44:48 -04:00
daurnimator
111e5ed0a2
std: MAP_FAILED is a libc concept on linux
2019-07-07 17:15:30 +10:00
daurnimator
e197968734
std: Make linux MAP_ definitions match kernel
2019-07-07 14:31:27 +10:00
daurnimator
7610d39413
std: Linux AT_ constants are the same across architectures
2019-07-07 14:11:43 +10:00
hryx
28b59a0be7
Remove reference to Keyword_anyerror in docgen
2019-07-06 18:19:04 -07:00
hryx
cce11a724c
Make anyerror not a keyword
2019-07-06 15:57:32 -07:00
SamTebbs33
b118806c69
Add implicit cast for *[N]T to [*c]T
2019-07-06 17:02:17 -04:00
Andrew Kelley
21c60922e3
Merge pull request #2823 from hryx/unicode-escape
...
Unicode escapes: support u{N...}
2019-07-06 13:14:43 -04:00
hryx
7f618184ad
Prevent unreachable when file ends with struct field
2019-07-06 13:09:07 -04:00
Andrew Kelley
9471f16c79
zig fmt ignores "zig fmt: off" directive for whitespace fixes
2019-07-05 15:09:22 -04:00
Andrew Kelley
4f43a4b30f
zig fmt: fix whitespace
...
closes #2819
closes #2825
2019-07-05 14:46:21 -04:00
Andrew Kelley
5b42c76951
code formatting
2019-07-05 14:14:25 -04:00
Andrew Kelley
273c2b5c25
docs: mention @unionInit in the union section
2019-07-05 14:10:50 -04:00
Andrew Kelley
3ad9349f09
add std.os.windows.subsystem
...
The original issue that #2445 wanted to fix was solved in the previous
commit. However it also exposed the subsystem in the standard library,
which is still useful. So that's done in this commit, and #2445 can be
closed.
2019-07-05 14:08:56 -04:00
Andrew Kelley
0d84d52e37
std.os.abort no longer calls msvcrt abort() when linking libc
...
closes #2071
2019-07-05 12:53:36 -04:00
hryx
e35d49c4d0
Unicode escapes: documentation and grammar
2019-07-04 22:52:17 -07:00
hryx
6bfa8546bb
Unicode escapes: stage1 tokenizer and behavior tests
2019-07-04 22:40:19 -07:00
hryx
8365a7aab4
Unicode escapes: stage2 tokenizer and parser test
2019-07-04 14:48:23 -07:00
Andrew Kelley
72800f176e
zig build: search upwards for build.zig file
...
closes #2587
2019-07-04 17:44:33 -04:00
Michael Dusan
47addd87ac
stage1: add missing help for --override-lib-dir
2019-07-04 15:36:34 -04:00
Andrew Kelley
a8b3b5f11c
zig build: install is now the default step; default prefix is zig-cache
...
closes #2817
2019-07-04 15:32:44 -04:00
Andrew Kelley
79e1fcfdda
Merge pull request #2787 from emekoi/fix-2768
...
forward error code in build.zig
2019-07-04 10:57:25 -04:00
SamTebbs33
f24b8f2a4a
Support returning !u8 from main
2019-07-04 14:26:05 +01:00
emekoi
9e3189f1f4
forward error code on non-exits
2019-07-03 23:48:42 -05:00
emekoi
d8135c9e6e
forward error code build.zig
2019-07-03 23:48:42 -05:00
Andrew Kelley
b109155528
Merge branch 'emekoi-impl-1107'
2019-07-04 00:35:47 -04:00
Andrew Kelley
96fd103073
improve the error message and test coverage
2019-07-04 00:35:28 -04:00
Andrew Kelley
bfe0bf695b
Merge branch 'impl-1107' of https://github.com/emekoi/zig into emekoi-impl-1107
2019-07-03 23:40:47 -04:00
Andrew Kelley
c2cf04086a
add docs for enum literals
...
closes #683
2019-07-03 23:09:58 -04:00
Andrew Kelley
d1cda00b36
workaround for no equality operator for enum literal and tagged union
2019-07-03 18:41:52 -04:00
Andrew Kelley
372b615ace
Merge branch 'timonkruiper-function-sections'
2019-07-03 15:47:40 -04:00
Andrew Kelley
4606baee07
add -ffunction-sections arg when building C objects
...
the other changes in this commit are minor tidying up
2019-07-03 15:46:27 -04:00
Andrew Kelley
2f4faf306d
Merge branch 'function-sections' of https://github.com/timonkruiper/zig into timonkruiper-function-sections
2019-07-03 14:43:33 -04:00
emekoi
a1b952f4b0
added tests for #1107 and a note in the reference
2019-07-03 13:12:14 -05:00
emekoi
53ca4118bd
added segfault handler support for windows
2019-07-03 14:02:48 -04:00
Andrew Kelley
a1359ac3ab
Merge branch 'rbscott-comptime-union-init'
2019-07-03 13:55:50 -04:00
Andrew Kelley
4bae87764f
update @unionInit to integrate with result location semantics
2019-07-03 13:40:40 -04:00
Andrew Kelley
9da054095c
Merge branch 'comptime-union-init' of https://github.com/rbscott/zig into rbscott-comptime-union-init
2019-07-03 11:26:55 -04:00
Andrew Kelley
9daf0140e5
add missing compile error for comptime continue inside runtime catch
...
See #2604
2019-07-02 21:14:42 -04:00
Andrew Kelley
b84ff1dd32
update the default panic handler on freestanding
...
Now the infinite loop has a `@breakpoint()` in there.
2019-07-02 19:44:49 -04:00
Andrew Kelley
57d6724186
Merge branch 'shawnl-has-field'
2019-07-02 16:53:08 -04:00
Andrew Kelley
df11512f85
fixups
2019-07-02 16:52:55 -04:00
Andrew Kelley
140335b99f
Merge branch 'has-field' of https://github.com/shawnl/zig into shawnl-has-field
2019-07-02 16:21:40 -04:00
Andrew Kelley
b05b5649df
print dir name on failure to write to cache dir
...
closes #2429
2019-07-02 16:11:05 -04:00
Andrew Kelley
04b32d6a8a
docs: mention the standard library documentation
...
also mention the FAQ in the README.
also link to the other documentation versions.
2019-07-02 15:21:58 -04:00
emekoi
9d42a40a9f
return FileNotFound for PATH_NOT_FOUND in DeleteFileW
2019-07-02 14:49:48 -04:00
Andrew Kelley
06733c3ff5
Merge pull request #2788 from emekoi/pdb-fix
...
fixed coff header parsing
2019-07-02 14:48:45 -04:00
Andrew Kelley
704444a6e3
improved logic on whether to include start files
2019-07-02 14:26:54 -04:00
Timon Kruiper
bbc0d440b8
Added ZigLLVMCreateTargetMachine and pass function-sections flag
...
Also added extra cache line
Added the ZigLVVMCreateTargetMachine to self hosted zig code
2019-07-02 19:54:29 +02:00
Andrew Kelley
7d4a0cfed0
enable segfault stack traces in stage1 compiler
2019-07-02 13:41:17 -04:00
Andrew Kelley
1a1598c58c
stack traces on segfault by default for linux-x86_64
...
closes #2355
2019-07-02 13:41:16 -04:00
Timon Kruiper
7586f613d5
Added function-section functionality
2019-07-01 17:49:08 +02:00
emekoi
2d85ff9465
added invalid switch prong error
...
added error for switch prong with different payloads and support for capturing payload on switch prongs with payloads of the same type
2019-07-01 00:27:55 -05:00
Marc Tiehuis
0dd2e93e4c
Update for new fmt.zig formatting
2019-06-30 22:25:03 +12:00
hryx
0e38f7215b
Define different struct size for APValue on Windows (thanks @Sahnvour)
2019-06-29 14:34:00 -07:00
emekoi
027517a0c9
added init function for Coff
2019-06-29 13:56:23 -05:00
emekoi
92b68c57b3
fix formatting
2019-06-29 13:21:27 -04:00
emekoi
8156a61de8
fix syntax highlighting
2019-06-29 13:21:27 -04:00
Michael Dusan
7a2b0cc9c4
fix stack escape in add_source_file()
2019-06-29 13:19:39 -04:00
hryx
247e567422
Don't return a slice pointing to a deceased stack address
2019-06-28 18:01:41 -07:00
hryx
102bf5200c
Fix string literal: not null-terminated (thanks @mikdusan)
2019-06-28 17:40:20 -07:00
emekoi
b780dee3e8
initialize sections in openSelfDebugInfoWindows
2019-06-28 18:22:02 -05:00
emekoi
fbb0c8d639
fixed debug info on windows
2019-06-28 17:59:34 -05:00
hryx
cc74bf5136
Translate IntegralCast; add stage2 test coverage
2019-06-27 23:12:33 -07:00
Andrew Kelley
4b7e04f75a
rename std/special/bootstrap.zig to std/special/start.zig
2019-06-28 02:00:56 -04:00
hryx
646268875e
Use new width format option
2019-06-27 22:16:31 -07:00
hryx
2060c7c39b
Merge branch 'master' into translate-c-userland
2019-06-27 22:12:34 -07:00
hryx
3e0ff32bd8
Separate with space instead of LF to prevent rendering excessive indentation
2019-06-27 21:17:27 -07:00
hryx
b4bd52cc51
Create and render big.Int from IntegerLiteral; group BinaryOperator
2019-06-27 21:02:48 -07:00
Andrew Kelley
ae72a98224
Merge pull request #2775 from SamTebbs33/alignment-docs
...
Add doc comments to alignment functions
2019-06-27 20:37:28 -04:00
Andrew Kelley
ff477361b0
Merge branch 'emekoi-root-import'
2019-06-27 19:16:24 -04:00
Andrew Kelley
69c7c5de09
fixups
...
* better detection for already seen packages
* "root" instead of "@root"
2019-06-27 19:15:33 -04:00
Andrew Kelley
fe2d89007b
Merge branch 'root-import' of https://github.com/emekoi/zig into emekoi-root-import
2019-06-27 18:38:28 -04:00
SamTebbs33
623dbb73df
Add check for power of 2 to std.mem.alignBackward
2019-06-27 22:23:09 +01:00
Andrew Kelley
0a0c11685f
fix for with null and T peer types and inferred result location type
...
See #2762
2019-06-27 17:22:35 -04:00
SamTebbs33
14abf0fda5
Add doc comments to alignment functions
2019-06-27 22:22:17 +01:00
Andrew Kelley
1b23c46138
fix switch with null and T peer types and inferred result location type
...
closes #2762
2019-06-27 16:54:19 -04:00
Andrew Kelley
d422d5753b
avoid std.debug.global_allocator in http headers tests
2019-06-27 15:38:40 -04:00
Andrew Kelley
8a251c411d
Merge branch 'daurnimator-http.headers'
2019-06-27 14:07:27 -04:00
Andrew Kelley
39112d9052
update format function for new std fmt changes
2019-06-27 14:06:29 -04:00
Andrew Kelley
ba29435f67
Merge branch 'http.headers' of https://github.com/daurnimator/zig into daurnimator-http.headers
2019-06-27 13:37:40 -04:00
Andrew Kelley
1ccf6a2c9e
compile error for using slice as array init expr type
...
when there are more than 0 elements.
closes #2764
2019-06-27 12:24:13 -04:00
Andrew Kelley
6cd3995754
Merge branch 'daurnimator-logging-allocator'
2019-06-27 12:05:12 -04:00
Andrew Kelley
0041e00a78
fixups
...
* move LoggingAllocator to its own file
* style conventions
* add documentation
* use `anyerror` instead of `error{}` for the stream
2019-06-27 12:04:14 -04:00
Andrew Kelley
c346b257bb
Merge branch 'logging-allocator' of https://github.com/daurnimator/zig into daurnimator-logging-allocator
2019-06-27 11:20:00 -04:00
Andrew Kelley
516b5e649f
better CLI error message for missing sub-architecture
2019-06-27 11:05:12 -04:00
Marc Tiehuis
3c914c63a5
Remove #2725 workaround
...
These were no longer being hit after the copy-elision branch was merged.
Closes #2725 .
2019-06-27 21:50:24 +12:00
Andrew Kelley
6c195ede54
add test case for defer modifying return value before returned
...
See #961
2019-06-26 23:25:53 -04:00
Vexu
de369de312
fix comments getting removed after empty comments
2019-06-27 02:00:30 +03:00
Andrew Kelley
01ff0d4d62
Merge pull request #2602 from ziglang/copy-elision-3
...
result location mechanism (part of no-copy semantics)
2019-06-26 18:29:19 -04:00
Vexu
0063953d16
added better test cases
2019-06-27 00:30:34 +03:00
Andrew Kelley
517bdea754
fix incorrectly omitting variable declarations
...
in non-debug modes
2019-06-26 16:27:24 -04:00
Andrew Kelley
3085d29af8
Merge remote-tracking branch 'origin/master' into copy-elision-3
2019-06-26 14:44:01 -04:00
Andrew Kelley
5cd4753bea
add missing error code for DeleteFileW
2019-06-26 14:32:19 -04:00
Andrew Kelley
33f996bb16
all tests passing on linux
2019-06-26 14:00:44 -04:00
Luna
07c0d484ee
net: quickfix on non-existing Address.family
2019-06-26 13:24:51 -04:00
Vexu
22194efe68
Merge branch 'master' into comment-in-array
2019-06-26 20:06:12 +03:00
Vexu
7325f80bb2
improved comment indentation in arrays
2019-06-26 20:03:38 +03:00
Andrew Kelley
32c6f643ae
disable building self hosted compiler in test suite
...
Rather than fixing regressions with deprecated coroutines, I'm going
to let them regress more until #2377 is solved.
2019-06-26 12:42:08 -04:00
Andrew Kelley
ff737cc648
fix peer type resolution: unreachable, error set, unreachable
2019-06-26 12:31:51 -04:00
Vexu
fa42c99d82
fixed IfTypeExpr parsing
2019-06-26 11:04:34 -04:00
Andrew Kelley
e79e8993e6
Merge pull request #2750 from cartr/thumbv4-aeabi
...
compiler-rt: Support thumb versions older than armv6
2019-06-26 11:03:42 -04:00
Carter Sande
f9e26d9871
compiler-rt: use more idiomatic switch syntax
2019-06-25 22:56:09 -07:00
Andrew Kelley
b4e40cb59a
fix peer type resolution with null
2019-06-26 00:36:24 -04:00
Andrew Kelley
fd4c5f54f0
all compile error tests passing
2019-06-25 19:03:56 -04:00
Andrew Kelley
0a77325916
fix several compile error test regressions
2019-06-25 18:06:03 -04:00
Andrew Kelley
da68aec339
fix infinite loop when error in peer resolution
2019-06-25 16:04:01 -04:00
Andrew Kelley
cb55803a59
fix implicit cast vector to array
2019-06-25 13:57:45 -04:00
Andrew Kelley
c61e0a078c
fix union init with void payload
...
all std lib tests passing now
2019-06-25 11:31:38 -04:00
Marc Tiehuis
f5af349bd6
Merge pull request #2714 from ziglang/fmt-overhaul
...
Add positional, precision and width support to std.fmt
2019-06-25 20:15:33 +12:00
hryx
8435351581
Escape C string literals
2019-06-24 22:37:19 -07:00
Carter Sande
cd02630da8
compiler-rt: Support thumb versions older than armv6
...
Add versions of __aeabi_memset and __aeabi_memclr which do not use mov
instructions between low registers, as this is unsupported on thumbv4t
and thumbv5.
2019-06-24 22:32:50 -07:00
Marc Tiehuis
08e8d30dd6
Add parsing of fill and alignment in std.format
...
These options are now available to use when printing, however nothing
currently makes use of these.
2019-06-25 17:11:18 +12:00
Vexu
f6d83ba918
fixed comment formatting in arrays and fn params
2019-06-25 01:12:28 +03:00
Michael Dusan
de2b0cd722
fix compile error when building zig w/ clang
...
errors as reported on macOS w/ Xcode 10.1, 10.2 and 11.0:
src/ir.cpp:23285:16: error: variable 'bits' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
} else if (float_type->id == ZigTypeIdFloat)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ir.cpp:23288:13: note: uninitialized use occurs here
switch (bits) {
^~~~
src/ir.cpp:23285:12: note: remove the 'if' if its condition is always true
} else if (float_type->id == ZigTypeIdFloat)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ir.cpp:23281:18: note: initialize the variable 'bits' to silence this warning
unsigned bits;
2019-06-24 16:25:18 -04:00
Michael Dusan
3021e5ca67
align (vector -> array) store to result location
2019-06-24 14:52:57 -04:00
hryx
f845994839
transBinaryOperator: Add, Sub
2019-06-23 17:17:21 -07:00
hryx
69b90e0681
transStringLiteral
2019-06-23 15:06:16 -07:00
hryx
b2e06c3bf4
Observe translate mode in stage2
2019-06-23 14:32:45 -07:00
Andrew Kelley
24400d5882
Merge branch 'shawnl-simd2'
2019-06-23 17:14:28 -04:00
Andrew Kelley
7f4de2dfdb
remove stray abort
2019-06-23 17:14:10 -04:00
Andrew Kelley
b2cbc59e4c
Merge branch 'simd2' of https://github.com/shawnl/zig into shawnl-simd2
2019-06-23 17:10:33 -04:00
emekoi
ca3660f6bf
increase stack size for mingw
2019-06-23 16:51:12 -04:00
hryx
226a23d977
stage1: always render space after fn like stage2
2019-06-23 12:46:17 -07:00
hryx
c423697c78
Merge branch 'master' into translate-c-userland
2019-06-23 12:31:22 -07:00
hryx
1c86a191da
Fix order of tokens; omit 'pub' for fn types
2019-06-23 01:03:28 -07:00
Andrew Kelley
020d5b529e
compile error tests only for debug mode
2019-06-23 02:06:57 -04:00
hryx
4c8b460fec
Fix recursive self-referential block
2019-06-22 22:30:15 -07:00
Andrew Kelley
036cc48a82
Merge remote-tracking branch 'origin/master' into copy-elision-3
2019-06-23 01:29:48 -04:00
Andrew Kelley
5e58aa4884
uncomment passing std lib tests
...
these ones getting skipped need to get fixed before merging the branch
2019-06-23 01:29:18 -04:00
Andrew Kelley
38568318a0
fix some legacy coroutine stuff
2019-06-23 00:41:11 -04:00
Andrew Kelley
9153b17c92
Merge pull request #2733 from emekoi/write-strings
...
various fixes for mingw
2019-06-22 23:51:21 -04:00
emekoi
f1c57a7f84
supress warnings for format strings on msys64
2019-06-22 20:21:48 -05:00
emekoi
3ac9e3c888
make string literal const on windows
2019-06-22 19:54:11 -05:00
hryx
4ae95d7ffc
Translate assignment BinaryOperator statements
2019-06-22 17:29:36 -07:00
hryx
6325ffc3f1
Assign undefined literal (instead of null) when no init value
2019-06-22 17:29:10 -07:00
Andrew Kelley
7e303fa28f
fix another crash
2019-06-22 19:02:59 -04:00
Andrew Kelley
2b1695b1b0
fix std.json regression
2019-06-22 18:54:27 -04:00
Andrew Kelley
86f362ce8e
elide redundant safety check when switching on tagged unions
2019-06-22 16:18:42 -04:00
Shawn Landden
71e014caec
stage1: add @sin @cos @exp @exp2 @ln @log2 @log10 @fabs @floor @ceil @trunc @round
...
and expand @sqrt
This revealed that the accuracy of ln is not as good as the current algorithm in
musl and glibc, and should be ported again.
v2: actually include tests
v3: fix reversal of in and out arguments on f128M_sqrt()
add test for @sqrt on comptime_float
do not include @nearbyInt() until it works on all targets.
2019-06-22 14:34:34 -05:00
Sahnvour
987c209b40
heap: make one global instance of DirectAllocator
...
it is now stateless, so the de/init are not necessary anymore
2019-06-22 14:10:53 -04:00
Andrew Kelley
3c4b255a3c
fix implicit cast fn call result to optional in field result
2019-06-22 13:37:13 -04:00
Andrew Kelley
65997f816b
Merge remote-tracking branch 'origin/master' into copy-elision-3
2019-06-22 01:19:06 -04:00
Gray Olson
be51511d29
Update langref.html.in
2019-06-22 01:15:47 -04:00
Andrew Kelley
726674b2bd
fix ArenaAllocator
2019-06-22 01:13:10 -04:00
Andrew Kelley
b5f9033d82
uncomment passing std lib tests
2019-06-21 19:29:34 -04:00
Andrew Kelley
727af307c6
fix return result loc and then switch with range...
...
...implicit casted to error union
2019-06-21 18:21:12 -04:00
Andrew Kelley
ff6d563b04
fix implicit cast to optional to error union to return result loc
2019-06-21 17:49:54 -04:00
Andrew Kelley
5441f77672
fix implicit cast bitcast result to error union by returning
2019-06-21 16:54:46 -04:00
Andrew Kelley
142e77abbb
fix extern functions returning byval structs
2019-06-21 14:44:49 -04:00
Andrew Kelley
48ccf427af
fix nested orelse and nested catch
2019-06-21 14:06:01 -04:00
Andrew Kelley
4299cd4446
blocks have result location semantics
2019-06-21 13:16:55 -04:00
Shawn Landden
ebde2ff899
stage1: update fn_key_eql() for @mulAdd() on vectors
2019-06-21 08:44:20 -05:00
Marc Tiehuis
948dc7b304
Link formatting workaround to issue
2019-06-21 20:23:53 +12:00
Marc Tiehuis
11526b6e9d
breaking: Add positional, precision and width support to std.fmt
...
This removes the odd width and precision specifiers found and replacing
them with the more consistent api described in #1358 .
Take the following example:
{1:5.9}
This refers to the first argument (0-indexed) in the argument list. It
will be printed with a minimum width of 5 and will have a precision of 9
(if applicable).
Not all types correctly use these parameters just yet. There are still
some missing gaps to fill in. Fill characters and alignment have yet to
be implemented.
2019-06-21 20:11:15 +12:00
Andrew Kelley
4f21dc8a80
fix regression with zero sized array
...
thanks mikdusan!
2019-06-21 00:58:18 -04:00
Andrew Kelley
708f153288
BRANCH_TODO file moved to the pull request comments
2019-06-20 22:39:13 -04:00
Andrew Kelley
0498bd40d9
fix loops with multiple break statements
2019-06-20 22:38:40 -04:00
Matthew Murray
2cbcf3f38b
Fix absFloat
2019-06-20 19:34:22 -04:00
Michael Dusan
60b1cf2a83
fix macOS stack trace regression
...
f8f054b354 exposes the issue where
macho symbol `__mh_execute_header` is weak exported with an extra
underscore and stack traces fail due to invalid header magic.
related #2700
2019-06-20 19:29:25 -04:00
Andrew Kelley
237233b04b
fix coroutines
2019-06-20 18:27:04 -04:00
Andrew Kelley
057b105fad
one more test passing
2019-06-20 18:03:55 -04:00
Andrew Kelley
3c541d7be3
fix peer result loc fn call with comptime condition
2019-06-19 23:52:51 -04:00
Andrew Kelley
6217b401f9
fix labeled break inside comptime if inside runtime if
2019-06-19 23:39:49 -04:00
Andrew Kelley
78eeb6e9ae
fix double getelementptr of runtime global
2019-06-19 22:29:39 -04:00
Andrew Kelley
04c25efe11
Merge remote-tracking branch 'origin/master' into copy-elision-3
2019-06-19 19:01:28 -04:00
Andrew Kelley
4ffab5b85f
fix optional pointer to size zero struct
2019-06-19 18:47:02 -04:00
Andrew Kelley
c7dc03fcb1
fix try not setting error code on result location
2019-06-19 17:07:05 -04:00
Andrew Kelley
96931228af
fix comptime test error for empty error set
2019-06-19 16:29:46 -04:00
Andrew Kelley
974db231a0
fix extraneous nested union field instruction
2019-06-19 16:16:47 -04:00
Andrew Kelley
e36680d3bd
fix detection of unable to evaluate constant expression
2019-06-19 15:18:51 -04:00
Andrew Kelley
b588a803bf
fix comptime modification of const struct field
2019-06-19 14:35:59 -04:00
Shawn Landden
39ad072a84
test: include muladd.zig in behavior tests
2019-06-19 12:07:02 -05:00
Shawn Landden
fce2d2d18b
stage1: add support for @mulAdd fused-multiply-add for floats and vectors of floats
...
Not all of the softfloat library is being built....
Vector support is very buggy at the moment, but should work when the bugs are fixed.
(as I had the same code working with another vector function, that hasn't been merged yet).
2019-06-19 12:07:02 -05:00
Shawn Landden
bbfb53d524
c: add fma and fmaf
2019-06-19 12:07:02 -05:00
Andrew Kelley
79671efd3a
fix inline loop behavior with variable result loc
2019-06-18 17:43:05 -04:00
Andrew Kelley
e27da17ff2
back to many behavioral tests passing
2019-06-18 17:07:27 -04:00
joachimschmidt557
381c6a38b1
Correct the isEmpty function
...
Integrate isEmpty into the tests for std.atomic.Queue
Fix wrong test
Oops
Simpler checking
2019-06-18 16:31:06 -04:00
Andrew Kelley
77e0c53613
fix problem with inferred error set return result
2019-06-18 15:00:19 -04:00
Andrew Kelley
f90d17cc4d
fix bitcast
2019-06-18 14:44:25 -04:00
Andrew Kelley
077f9df15b
more miscellaneous fixes
...
when will it end
2019-06-18 14:30:17 -04:00
Jonathan Marler
c7bcf1a447
Fix windows create process retry/path search
2019-06-18 13:19:06 -04:00
Andrew Kelley
3ca4925709
Merge branch 'kristate-you-are-banned-please-fuck-off'
...
closes #2701
2019-06-18 11:32:31 -04:00
Andrew Kelley
9050a07540
when resolving slice types, might need to...
...
...resolve alignment if custom alignment is provided
fixes #2689
2019-06-18 11:31:05 -04:00
Andrew Kelley
8ed88280a6
Revert "fixes resolving aligment of child type in slice"
...
This reverts commit aa60d2a688 .
The copyright ownership of this 10 line patch is under dispute.
See #2701 for details. So I'll revert it and then fix it myself without
looking at this patch.
2019-06-18 11:18:53 -04:00
Andrew Kelley
fdc6e0af05
fix zero length array literal casted to slice
2019-06-18 10:49:21 -04:00
Boris
99112b5d4a
fix tiny typo in langref.html.in
2019-06-18 10:01:48 -04:00
Andrew Kelley
e5a0414b05
misc fixes
2019-06-17 21:55:14 -04:00
Andrew Kelley
4e182c7e9e
inferred comptime array inits
2019-06-17 17:46:03 -04:00
Andrew Kelley
0568000844
fix function calls
2019-06-17 17:12:06 -04:00
Andrew Kelley
74250e434e
inferred comptime union inits
2019-06-17 16:27:45 -04:00
Jonathan Marler
21dff1c4e2
Remove duplicate exe name with zig run
2019-06-17 14:10:10 -04:00
Andrew Kelley
b025193de5
inferred comptime values rather than elided scopes
...
because of this example:
```zig
export fn entry(b: bool) usize {
var runtime = [1]i32{3};
comptime var i: usize = 0;
inline while (i < 2) : (i += 1) {
const result = if (i == 0) [1]i32{2} else runtime;
}
comptime {
return i;
}
}
```
The problem is that the concept of "resetting" a result location,
introduced in the previous commit, cannot handle elision scopes.
This concept is inherently broken with inline loops.
2019-06-17 13:31:19 -04:00
Marc Tiehuis
d5d0942a0d
Small cleanup of fmt.zig
...
Use inferred enum literals and split the large test case up.
2019-06-17 13:00:00 -04:00
Josh Wolfe
50c8a93a5e
mem.concat
2019-06-17 01:41:33 -04:00
daurnimator
6ce2a03985
std: add gimli permutation to crypto
2019-06-16 22:55:38 -04:00
Timon Kruiper
72029c2fc8
Added HashInt to function calls AutoHash\nFixes issue 2669
2019-06-16 14:36:23 -04:00
Shawn Landden
4d3356435f
stage1: check for null in buf_len and buf_ptr
...
follow up for f4b8850002
2019-06-16 14:26:38 -04:00
Andrew Kelley
f4b8850002
fix type info crash on extern lib name
2019-06-16 14:14:57 -04:00
Jimmi HC
aa60d2a688
fixes resolving aligment of child type in slice
2019-06-16 00:03:43 -04:00
Andrew Kelley
9564c05cd5
better result location handling of inline loops
2019-06-15 19:19:13 -04:00
Andrew Kelley
6bf193af19
better result location semantics with optionals and return locations
...
somewhere along this branch, #1901 has been fixed.
2019-06-15 12:28:21 -04:00
Andrew Kelley
60025a3704
Merge remote-tracking branch 'origin/master' into copy-elision-3
2019-06-15 10:34:04 -04:00
Andrew Kelley
7c5ceb0c4c
standard library integrates with knowledge of stripped debug info
2019-06-14 18:45:41 -04:00
Andrew Kelley
362c79140f
expose builtin.strip_debug_info
...
zig code now can be made aware that it will not have any debug
information available at runtime.
2019-06-14 18:18:43 -04:00
Andrew Kelley
f8f054b354
fix @export for arrays not respecting the symbol name
...
Previously, the symbol name parameter of `@export` would be ignored for
variables, and the variable name would be used for the symbol name.
Now it works as expected.
See #2679
2019-06-14 17:23:24 -04:00
Andrew Kelley
42ea2d0d1c
fix @export for arrays and allow sections on extern variables
...
previously `@export` for an array would panic with a TODO message.
now it will do the export. However, it uses the variable's name
rather than the name passed to `@export`. Issue #2679 remains open
for that problem.
2019-06-14 15:28:52 -04:00
Andrew Kelley
acf16b5fb3
uncomment more passing tests
2019-06-14 13:32:04 -04:00
Andrew Kelley
7c074b8516
fix peer result locs with switch
2019-06-14 11:41:53 -04:00
Andrew Kelley
2ba29a1907
fix peer result location with error code and payload
2019-06-14 11:01:38 -04:00
Andrew Kelley
fdaca1b5f3
fix a couple more test regressions
2019-06-13 20:30:39 -04:00
Andrew Kelley
eaf74f4f96
fix bitcast packed struct to integer and back
2019-06-13 20:24:10 -04:00
Andrew Kelley
57347aacd7
fix atomic builtin functions
2019-06-13 20:01:25 -04:00
Andrew Kelley
24cfa3534f
allow comptime array literals casted to slices
2019-06-13 16:51:26 -04:00
Andrew Kelley
3cbe827464
fix behavior for nested array literals
...
new compile error for trying to cast runtime array literals to slices
2019-06-13 16:25:35 -04:00
Andrew Kelley
efb064449f
fix runtime initialize array elem and then implicit cast to slice
2019-06-13 13:31:15 -04:00
Jonathan Marler
9e8db5b750
Remove const on argsAlloc
2019-06-13 11:42:17 -04:00
Josh Wolfe
82ab006e58
HashMap.getValue()
2019-06-13 11:41:34 -04:00
Jonathan Marler
8a2c2da805
Handle putNoClobber errors
2019-06-13 01:56:12 -04:00
Josh Wolfe
80fa871f4a
Add HashMap apis that assert the common case
...
* putNoClobber() for put()
* removeAssertDiscard() for remove()
2019-06-13 00:17:12 -04:00
Andrew Kelley
ca0988e1d0
comment out the behavior tests that are failing
2019-06-12 22:19:56 -04:00
Andrew Kelley
b552e68c14
fix result loc implicit casting optionals and error unions
...
```zig
pub fn openHandle(handle: i32) File {
return File{ .handle = handle };
}
pub fn getStdErr() anyerror!File {
return openHandle(1);
}
```
2019-06-12 22:13:18 -04:00
Andrew Kelley
cdf14baa45
fix double nested peer result locations
...
```zig
export fn entry(x: bool) i32 {
return if (x)
if (x) a else b
else
if (x) c else d;
}
```
2019-06-12 21:46:04 -04:00
Andrew Kelley
0d62c92947
fix declref not writing to result loc
...
```zig
const a: i32 = 0;
const b: i32 = 1;
const c: i32 = 2;
const d: i32 = 3;
export fn entry(x: bool) i32 {
return if (x)
if (x)
a
else if (x)
b
else
c
else
d;
}
```
2019-06-12 19:43:24 -04:00
Andrew Kelley
e6fa2ee706
fix nested peer result locs with no memory loc
...
```zig
export fn entry2(c: bool) i32 {
return if (c)
i32(0)
else if (c)
i32(1)
else
i32(2);
}
```
```llvm
define i32 @entry2(i1) #2 !dbg !35 {
Entry:
%c = alloca i1, align 1
store i1 %0, i1* %c, align 1
call void @llvm.dbg.declare(metadata i1* %c, metadata !41 , metadata !DIExpression()), !dbg !42
%1 = load i1, i1* %c, align 1, !dbg !43
br i1 %1, label %Then, label %Else, !dbg !43
Then: ; preds = %Entry
br label %EndIf3, !dbg !45
Else: ; preds = %Entry
%2 = load i1, i1* %c, align 1, !dbg !46
br i1 %2, label %Then1, label %Else2, !dbg !46
Then1: ; preds = %Else
br label %EndIf, !dbg !47
Else2: ; preds = %Else
br label %EndIf, !dbg !47
EndIf: ; preds = %Else2, %Then1
%3 = phi i32 [ 1, %Then1 ], [ 2, %Else2 ], !dbg !47
br label %EndIf3, !dbg !45
EndIf3: ; preds = %EndIf, %Then
%4 = phi i32 [ 0, %Then ], [ %3, %EndIf ], !dbg !45
ret i32 %4, !dbg !48
}
```
2019-06-12 18:08:56 -04:00
Andrew Kelley
1526d89711
fix @bitCast with runtime scalar and dest result loc var
2019-06-12 15:02:46 -04:00
Andrew Kelley
35352e0f48
fix alignment problem with @bitCast result location
2019-06-12 13:49:57 -04:00
Andrew Kelley
278c7a2bc3
fix @bitCast regressions
2019-06-12 13:42:21 -04:00
emekoi
3ed6acd2d2
fixed infinite loop when caching packages
2019-06-11 19:19:44 -05:00
Andrew Kelley
ce5d50e4ed
fix runtime if nested inside comptime if
2019-06-11 18:26:01 -04:00
emekoi
e12c7d88b2
made root package available to itself
2019-06-11 16:06:24 -05:00
emekoi
4ea7685a5b
made root package available to all other packages
2019-06-11 16:05:56 -05:00
Andrew Kelley
b3a4ec1bd2
fix returning scalar values
...
```zig
export fn entry1() i32 {
return bar();
}
```
```llvm
define i32 @entry1() #2 !dbg !35 {
Entry:
%0 = call fastcc i32 @bar(), !dbg !39
ret i32 %0, !dbg !41
}
```
2019-06-11 16:04:04 -04:00
Andrew Kelley
e1d14e73b5
fix @bitCast semantics when there is no parent result loc
2019-06-11 15:44:06 -04:00
Andrew Kelley
60c3861805
temporarily simplify test_runner.zig
...
so that this branch can start passing behavior tests. after the tests
pass, go back and undo the changes in this commit
2019-06-11 14:46:46 -04:00
Nicholas Walton
fcc0728a35
Update langref.html.in
...
Missing an "it"
2019-06-11 14:37:15 -04:00
Andrew Kelley
0ac566892d
fix for loop index variable not in scope
2019-06-11 14:15:58 -04:00
Andrew Kelley
515092210f
fix not checking return value of resolving result
2019-06-11 13:48:53 -04:00
Andrew Kelley
1c2e889820
fix struct and array init when result casted to anyerror!?T
...
previous commit message is incorrect, it was only for
anyerror!T
2019-06-11 13:44:09 -04:00
Andrew Kelley
fc8d881240
fix struct and array init when result casted to anyerror!?T
2019-06-11 13:27:01 -04:00
Andrew Kelley
06f307ff77
fix implicit casting return value struct/arary init to optional
2019-06-11 12:19:57 -04:00
daurnimator
43d52fa4c5
std: add std.http.Headers field
...
Based on lua-http's data structure
2019-06-11 22:54:40 +10:00
hryx
0f545e5a2b
transReturnStmt
2019-06-10 23:06:54 -07:00
Andrew Kelley
a431a73dab
fixes for crashes and compile errors
2019-06-11 01:24:55 -04:00
Andrew Kelley
b053a65573
fix comptime variables
2019-06-11 00:36:03 -04:00
Andrew Kelley
7411a88d5f
fix comptime function calls
2019-06-11 00:27:10 -04:00
Andrew Kelley
33371ab55c
Merge remote-tracking branch 'origin/master' into copy-elision-3
2019-06-11 00:09:58 -04:00
Andrew Kelley
d504318f2e
remove the final legacy stack allocation
2019-06-10 23:54:28 -04:00
Andrew Kelley
f6d4e2565e
use result loc for ref instruction
2019-06-10 23:51:43 -04:00
Andrew Kelley
a0427d29e4
fix peer result locations in the face of unreachable
...
```zig
export fn entry() void {
var nothing: ?*i32 = null;
var whatever = if (nothing) |x1| i32(1) else unreachable;
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%nothing = alloca i32*, align 8
%whatever = alloca i32, align 4
store i32* null, i32** %nothing, align 8, !dbg !45
call void @llvm.dbg.declare(metadata i32** %nothing, metadata !39 , metadata !DIExpression()), !dbg !45
%0 = load i32*, i32** %nothing, align 8, !dbg !46
%1 = icmp ne i32* %0, null, !dbg !46
br i1 %1, label %OptionalThen, label %OptionalElse, !dbg !46
OptionalThen: ; preds = %Entry
call void @llvm.dbg.declare(metadata i32** %nothing, metadata !43 , metadata !DIExpression()), !dbg !46
store i32 1, i32* %whatever, align 4, !dbg !47
br label %OptionalEndIf, !dbg !46
OptionalElse: ; preds = %Entry
tail call fastcc void @panic(%"[]u8"* @1, %builtin.StackTrace* null), !dbg !48
unreachable, !dbg !48
OptionalEndIf: ; preds = %OptionalThen
call void @llvm.dbg.declare(metadata i32* %whatever, metadata !44 , metadata !DIExpression()), !dbg !49
ret void, !dbg !50
}
```
2019-06-10 23:25:43 -04:00
Andrew Kelley
4582ec518f
result location semantics for vector to array
...
```zig
export fn entry() void {
var x: @Vector(4, i32) = undefined;
var y: [4]i32 = x;
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%x = alloca <4 x i32>, align 16
%y = alloca [4 x i32], align 4
%0 = bitcast <4 x i32>* %x to i8*, !dbg !47
call void @llvm.memset.p0i8.i64(i8* align 16 %0, i8 -86, i64 16, i1 false), !dbg !47
call void @llvm.dbg.declare(metadata <4 x i32>* %x, metadata !39 , metadata !DIExpression()), !dbg !47
%1 = load <4 x i32>, <4 x i32>* %x, align 16, !dbg !48
%2 = bitcast [4 x i32]* %y to <4 x i32>*, !dbg !48
store <4 x i32> %1, <4 x i32>* %2, align 16, !dbg !48
call void @llvm.dbg.declare(metadata [4 x i32]* %y, metadata !45 , metadata !DIExpression()), !dbg !49
ret void, !dbg !50
}
```
2019-06-10 19:49:24 -04:00
Andrew Kelley
9a324ecb42
result loc semantics for loading packed struct pointer to packed struct
...
```zig
export fn entry() void {
var x = foo();
var ptr = &x.b;
var y = ptr.*;
}
const Foo = packed struct {
a: u24 = 1,
b: Bar = Bar{},
};
const Bar = packed struct {
a: u4 = 2,
b: u4 = 3,
};
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%x = alloca %Foo, align 1
%ptr = alloca i32*, align 8
%y = alloca %Bar, align 1
call fastcc void @foo(%Foo* sret %x), !dbg !55
call void @llvm.dbg.declare(metadata %Foo* %x, metadata !39 , metadata !DIExpression()), !dbg !56
%0 = getelementptr inbounds %Foo, %Foo* %x, i32 0, i32 0, !dbg !57
store i32* %0, i32** %ptr, align 8, !dbg !57
call void @llvm.dbg.declare(metadata i32** %ptr, metadata !51 , metadata !DIExpression()), !dbg !58
%1 = load i32*, i32** %ptr, align 8, !dbg !59
%2 = load i32, i32* %1, align 1, !dbg !60
%3 = lshr i32 %2, 24, !dbg !60
%4 = trunc i32 %3 to i8, !dbg !60
%5 = bitcast %Bar* %y to i8*, !dbg !60
store i8 %4, i8* %5, !dbg !60
call void @llvm.dbg.declare(metadata %Bar* %y, metadata !54 , metadata !DIExpression()), !dbg !61
ret void, !dbg !62
}
```
2019-06-10 19:11:34 -04:00
Andrew Kelley
65f6ea66f4
result loc semantics for @sliceToBytes and @bytesToSlice
2019-06-10 18:34:27 -04:00
Andrew Kelley
ee3f7e20f6
result location semantics for cmpxchg
2019-06-10 17:49:36 -04:00
Andrew Kelley
b9c033ae1a
result location semantics for error union wrapping an error
2019-06-10 17:28:25 -04:00
tgschultz
34a22a85ca
altered all instances of readInt* in std.io (and std.debug) to consume the minimum byte size required instead of @sizeOf().
2019-06-10 17:10:35 -04:00
Andrew Kelley
4f085b8d2c
result location semantics for error union wrapping a payload
2019-06-10 16:55:07 -04:00
Ryan Liptak
05e92a51aa
Use std.math.isPowerOfTwo across std lib
2019-06-10 16:42:39 -04:00
Andrew Kelley
eaa9d8bdac
result location semantics for optional wrap
2019-06-10 16:20:13 -04:00
Andrew Kelley
c362895116
result location semantics for slices
...
```zig
export fn entry() void {
var buf: [10]u8 = undefined;
const slice1: []const u8 = &buf;
const slice2 = buf[0..];
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%buf = alloca [10 x i8], align 1
%slice1 = alloca %"[]u8", align 8
%slice2 = alloca %"[]u8", align 8
%0 = bitcast [10 x i8]* %buf to i8*, !dbg !46
call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 -86, i64 10, i1 false), !dbg !46
call void @llvm.dbg.declare(metadata [10 x i8]* %buf, metadata !39 , metadata !DIExpression()), !dbg !46
%1 = getelementptr inbounds %"[]u8", %"[]u8"* %slice1, i32 0, i32 0, !dbg !47
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %buf, i64 0, i64 0, !dbg !47
store i8* %2, i8** %1, align 8, !dbg !47
%3 = getelementptr inbounds %"[]u8", %"[]u8"* %slice1, i32 0, i32 1, !dbg !47
store i64 10, i64* %3, align 8, !dbg !47
call void @llvm.dbg.declare(metadata %"[]u8"* %slice1, metadata !44 , metadata !DIExpression()), !dbg !48
%4 = getelementptr inbounds %"[]u8", %"[]u8"* %slice2, i32 0, i32 0, !dbg !49
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %buf, i64 0, i64 0, !dbg !49
store i8* %5, i8** %4, align 8, !dbg !49
%6 = getelementptr inbounds %"[]u8", %"[]u8"* %slice2, i32 0, i32 1, !dbg !49
store i64 10, i64* %6, align 8, !dbg !49
call void @llvm.dbg.declare(metadata %"[]u8"* %slice2, metadata !45 , metadata !DIExpression()), !dbg !50
ret void, !dbg !51
}
```
2019-06-10 15:49:45 -04:00
Andrew Kelley
17b1ac5d03
result location semantics for @bitCast
...
```zig
export fn entry() void {
var x = @bitCast(f32, foo());
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%x = alloca float, align 4
%0 = bitcast float* %x to %Foo*, !dbg !42
call fastcc void @foo(%Foo* sret %0), !dbg !42
call void @llvm.dbg.declare(metadata float* %x, metadata !39 , metadata !DIExpression()), !dbg !43
ret void, !dbg !44
}
```
2019-06-10 12:24:19 -04:00
Andrew Kelley
1a51bf6304
hook up result locations for union initializations
...
```zig
export fn entry() void {
var x = Foo{ .bar = bar() };
}
```
```llvm
define void @entry() #2 !dbg !44 {
Entry:
%x = alloca %Foo, align 4
%0 = getelementptr inbounds %Foo, %Foo* %x, i32 0, i32 1, !dbg !68
store i1 true, i1* %0, align 1, !dbg !68
%1 = getelementptr inbounds %Foo, %Foo* %x, i32 0, i32 0, !dbg !68
%2 = bitcast { i32, [4 x i8] }* %1 to %Bar*, !dbg !68
call fastcc void @bar(%Bar* sret %2), !dbg !68
call void @llvm.dbg.declare(metadata %Foo* %x, metadata !48 , metadata !DIExpression()), !dbg !69
ret void, !dbg !70
}
```
2019-06-10 11:15:32 -04:00
Andrew Kelley
12b2950bf2
Merge pull request #2424 from daurnimator/single-linked-list
...
Add SinglyLinkedList
2019-06-10 09:54:03 -04:00
hryx
84e479d94f
(broken) local var decls, integer literals (part)
2019-06-09 23:35:48 -07:00
daurnimator
b0648bfbd3
std.heap.ArenaAllocator: use singly linked list
2019-06-10 15:41:40 +10:00
daurnimator
ddf7942aaa
std: Add singly linked list
2019-06-10 15:41:40 +10:00
daurnimator
ed41d10a06
std: existing LinkedList is actually a TailQueue
2019-06-10 15:41:40 +10:00
Andrew Kelley
b7811d3269
whitespace cleanup
2019-06-10 00:45:24 -04:00
Andrew Kelley
9c2ed8d103
Merge pull request #2525 from daurnimator/uring
...
std: linux uring kernel interfaces
2019-06-10 00:43:47 -04:00
SamTebbs33
6c160b8856
Add check for null body in if, for and while
2019-06-10 00:41:33 -04:00
daurnimator
4565f50efe
std: add linux kernel definitions for io_uring
2019-06-10 14:40:54 +10:00
daurnimator
ae604b4464
std: add linux kernel_rwf type and preadv2+pwritev2
2019-06-10 14:40:54 +10:00
daurnimator
a712a5515d
std: testing.expectEqual on structs now works
2019-06-10 14:39:44 +10:00
Andrew Kelley
39bc82561a
fix array literal syntax
2019-06-10 00:39:40 -04:00
daurnimator
ebedc99ac1
std: add math.isPowerOfTwo
2019-06-10 14:39:40 +10:00
Andrew Kelley
af35b73b99
Merge branch 'sfc64' of https://github.com/Sahnvour/zig into Sahnvour-sfc64
2019-06-10 00:38:58 -04:00
Andrew Kelley
5017a1d895
fix build on macos
2019-06-10 00:35:27 -04:00
Andrew Kelley
4e2b2822f1
inferred array size of array literals works
2019-06-09 19:55:15 -04:00
Andrew Kelley
3a4b749c8a
Merge remote-tracking branch 'origin/master' into copy-elision-3
2019-06-09 19:44:01 -04:00
Andrew Kelley
b735764898
different array literal syntax when inferring the size
...
old syntax: []i32{1, 2, 3}
new syntax: [_]i32{1, 2, 3}
closes #1797
2019-06-09 19:26:32 -04:00
Andrew Kelley
59fe13772f
result loc semantics for array initialization
...
```zig
export fn entry() void {
var x = [3]Bar{ bar(), bar(), Bar{ .y = 12 } };
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%x = alloca [3 x %Bar], align 4
%0 = getelementptr inbounds [3 x %Bar], [3 x %Bar]* %x, i64 0, i64 0, !dbg !48
call fastcc void @bar(%Bar* sret %0), !dbg !48
%1 = getelementptr inbounds [3 x %Bar], [3 x %Bar]* %x, i64 0, i64 1, !dbg !49
call fastcc void @bar(%Bar* sret %1), !dbg !49
%2 = getelementptr inbounds [3 x %Bar], [3 x %Bar]* %x, i64 0, i64 2, !dbg !50
%3 = bitcast %Bar* %2 to i8*, !dbg !50
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %3, i8* align 4 bitcast (%Bar* @0 to i8*), i64 4, i1 false), !dbg !50
call void @llvm.dbg.declare(metadata [3 x %Bar]* %x, metadata !39 , metadata !DIExpression()), !dbg !51
ret void, !dbg !52
}
```
2019-06-09 12:03:15 -04:00
Andrew Kelley
3ec766abe3
remove ResultLocField dead code
2019-06-09 10:46:13 -04:00
Sahnvour
69d9f322ee
implementation of the Sfc64 RNG from PractRand
2019-06-09 15:25:21 +02:00
Sahnvour
8e0670198b
allow comptime_int in math.shl and math.shr
2019-06-09 14:44:41 +02:00
markfirmware
10e33b3536
grammar
2019-06-09 01:34:13 -04:00
Jonathan Pentecost
ad064b4a0b
docs: update for else example
...
Updates: #2614
2019-06-08 22:58:31 -04:00
hryx
586c36dd1d
Restore fn decls removed during conflict
2019-06-08 17:02:00 -07:00
hryx
ad0f0562d8
Merge branch 'master' into translate-c-userland
2019-06-08 16:23:27 -07:00
hryx
ed5b8335b5
(broken) translate Paren type
2019-06-08 16:09:25 -07:00
hryx
1692a76d28
transImplictCastExpr: LValueToRValue
2019-06-08 15:57:43 -07:00
hryx
1f82c7ba22
transCStyleCastExpr
2019-06-08 15:54:15 -07:00
Andrew Kelley
771e88951a
result location mechanism for struct initialization
...
```zig
export fn entry() void {
const static = Foo{
.x = 9,
.bar = Bar{ .y = 10 },
};
const runtime = foo(true);
}
fn foo(c: bool) Foo {
return Foo{
.x = 12,
.bar = if (c) bar1() else bar2(),
};
}
fn bar1() Bar {
return Bar{ .y = 34 };
}
fn bar2() Bar {
return Bar{ .y = 56 };
}
```
```llvm
@0 = internal unnamed_addr constant %Foo { i32 9, %Bar { i32 10 } }, align 4
@1 = internal unnamed_addr constant %Bar { i32 34 }, align 4
@2 = internal unnamed_addr constant %Bar { i32 56 }, align 4
define void @entry() #2 !dbg !35 {
Entry:
%runtime = alloca %Foo, align 4
call void @llvm.dbg.declare(metadata %Foo* @0, metadata !39 , metadata !DIExpression()), !dbg !50
call fastcc void @foo(%Foo* sret %runtime, i1 true), !dbg !51
call void @llvm.dbg.declare(metadata %Foo* %runtime, metadata !49 , metadata !DIExpression()), !dbg !52
ret void, !dbg !53
}
define internal fastcc void @foo(%Foo* nonnull sret, i1) unnamed_addr #2 !dbg !54 {
Entry:
%c = alloca i1, align 1
store i1 %1, i1* %c, align 1
call void @llvm.dbg.declare(metadata i1* %c, metadata !60 , metadata !DIExpression()), !dbg !61
%2 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 0, !dbg !62
store i32 12, i32* %2, align 4, !dbg !62
%3 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 1, !dbg !64
%4 = load i1, i1* %c, align 1, !dbg !65
br i1 %4, label %Then, label %Else, !dbg !65
Then: ; preds = %Entry
call fastcc void @bar1(%Bar* sret %3), !dbg !66
br label %EndIf, !dbg !64
Else: ; preds = %Entry
call fastcc void @bar2(%Bar* sret %3), !dbg !67
br label %EndIf, !dbg !64
EndIf: ; preds = %Else, %Then
ret void, !dbg !68
}
define internal fastcc void @bar1(%Bar* nonnull sret) unnamed_addr #2 !dbg !69 {
Entry:
%1 = bitcast %Bar* %0 to i8*, !dbg !73
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %1, i8* align 4 bitcast (%Bar* @1 to i8*), i64 4, i1 false), !dbg !73
ret void, !dbg !73
}
define internal fastcc void @bar2(%Bar* nonnull sret) unnamed_addr #2 !dbg !75 {
Entry:
%1 = bitcast %Bar* %0 to i8*, !dbg !76
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %1, i8* align 4 bitcast (%Bar* @2 to i8*), i64 4, i1 false), !dbg !76
ret void, !dbg !76
}
!39 = !DILocalVariable(name: "static", scope: !40 , file: !5 , line: 2, type: !41 )
!49 = !DILocalVariable(name: "runtime", scope: !40 , file: !5 , line: 6, type: !41 )
```
2019-06-08 18:51:31 -04:00
Shawn Landden
720ed74413
add bcmp implementation as LLVM 9 now emits those
...
The optimizer will now convert calls to memcmp into a calls to bcmp
in some circumstances. Users who are building freestanding code (not
depending on the platform’s libc) without specifying -ffreestanding may
need to either pass -fno-builtin-bcmp, or provide a bcmp function.
http://llvm.org/docs/ReleaseNotes.html#non-comprehensive-list-of-changes-in-this-release
2019-06-08 17:24:30 -04:00
Shritesh Bhattarai
404e4b0268
docs: add comment about for else and break
2019-06-08 16:21:46 -04:00
Andrew Kelley
52eb347188
hook up result locs for try
2019-06-08 01:16:19 -04:00
Andrew Kelley
a2fff2628f
hook up peer result locs to orelse keyword
2019-06-08 01:09:19 -04:00
Andrew Kelley
b1efba0c70
hook up peer result locs to catch
...
```zig
export fn entry() void {
var x = crap() catch bar();
}
```
```llvm
define void @entry() #2 !dbg !40 {
Entry:
%0 = alloca { i16, %Foo }, align 4
%x = alloca %Foo, align 4
call fastcc void @crap({ i16, %Foo }* sret %0), !dbg !50
%1 = getelementptr inbounds { i16, %Foo }, { i16, %Foo }* %0, i32 0, i32 0, !dbg !51
%2 = load i16, i16* %1, align 2, !dbg !51
%3 = icmp ne i16 %2, 0, !dbg !51
br i1 %3, label %UnwrapErrError, label %UnwrapErrOk, !dbg !51
UnwrapErrError: ; preds = %Entry
call fastcc void @bar(%Foo* sret %x), !dbg !52
br label %UnwrapErrEnd, !dbg !51
UnwrapErrOk: ; preds = %Entry
%4 = getelementptr inbounds { i16, %Foo }, { i16, %Foo }* %0, i32 0, i32 1, !dbg !51
%5 = bitcast %Foo* %4 to i8*, !dbg !51
%6 = bitcast %Foo* %x to i8*, !dbg !51
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %6, i8* align 4 %5, i64 4, i1 false), !dbg !51
br label %UnwrapErrEnd, !dbg !51
UnwrapErrEnd: ; preds = %UnwrapErrOk, %UnwrapErrError
ret void, !dbg !53
}
```
2019-06-07 17:37:29 -04:00
Andrew Kelley
2b0a1b7b14
hook up result locs to for loops
...
```zig
export fn entry() void {
var buf: [10]u8 = undefined;
var x = for (buf) |x| break foo() else bar();
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%buf = alloca [10 x i8], align 1
%i = alloca i64, align 8
%x = alloca %Foo, align 4
%0 = bitcast [10 x i8]* %buf to i8*, !dbg !51
call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 -86, i64 10, i1 false), !dbg !51
call void @llvm.dbg.declare(metadata [10 x i8]* %buf, metadata !39 , metadata !DIExpression()), !dbg !51
store i64 0, i64* %i, align 8, !dbg !52
call void @llvm.dbg.declare(metadata i64* %i, metadata !44 , metadata !DIExpression()), !dbg !52
br label %ForCond, !dbg !52
ForCond: ; preds = %Entry
%1 = load i64, i64* %i, align 8, !dbg !52
%2 = icmp ult i64 %1, 10, !dbg !52
br i1 %2, label %ForBody, label %ForElse, !dbg !52
ForBody: ; preds = %ForCond
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %buf, i64 0, i64 %1, !dbg !52
call void @llvm.dbg.declare(metadata i8* %3, metadata !45 , metadata !DIExpression()), !dbg !53
call fastcc void @foo(%Foo* sret %x), !dbg !54
br label %ForEnd, !dbg !55
ForElse: ; preds = %ForCond
call fastcc void @bar(%Foo* sret %x), !dbg !56
br label %ForEnd, !dbg !52
ForEnd: ; preds = %ForElse, %ForBody
call void @llvm.dbg.declare(metadata %Foo* %x, metadata !46 , metadata !DIExpression()), !dbg !57
ret void, !dbg !58
}
```
2019-06-07 15:58:18 -04:00
Andrew Kelley
ede3436b08
hook up peer result locs to while bool and optional
2019-06-07 15:48:28 -04:00
Andrew Kelley
ec8d8a9774
hook up while on error unions with result locations
...
```zig
export fn entry() void {
var c: anyerror!i32 = 1234;
var x = while (c) |y| break foo() else |e| bar();
}
```
```llvm
define void @entry() #2 !dbg !39 {
Entry:
%c = alloca { i16, i32 }, align 4
%x = alloca %Foo, align 4
%0 = bitcast { i16, i32 }* %c to i8*, !dbg !56
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 bitcast ({ i16, i32 }* @0 to i8*), i64 8, i1 false), !dbg !56
call void @llvm.dbg.declare(metadata { i16, i32 }* %c, metadata !43 , metadata !DIExpression()), !dbg !56
br label %WhileCond, !dbg !57
WhileCond: ; preds = %Entry
%1 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 0, !dbg !58
%2 = load i16, i16* %1, align 2, !dbg !58
%3 = icmp ne i16 %2, 0, !dbg !58
br i1 %3, label %WhileElse, label %WhileBody, !dbg !58
WhileBody: ; preds = %WhileCond
%4 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 1, !dbg !57
call void @llvm.dbg.declare(metadata i32* %4, metadata !50 , metadata !DIExpression()), !dbg !57
call fastcc void @foo(%Foo* sret %x), !dbg !59
br label %WhileEnd, !dbg !60
WhileElse: ; preds = %WhileCond
%5 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 0, !dbg !61
call void @llvm.dbg.declare(metadata i16* %5, metadata !51 , metadata !DIExpression()), !dbg !61
call fastcc void @bar(%Foo* sret %x), !dbg !61
br label %WhileEnd, !dbg !57
WhileEnd: ; preds = %WhileElse, %WhileBody
call void @llvm.dbg.declare(metadata %Foo* %x, metadata !52 , metadata !DIExpression()), !dbg !62
ret void, !dbg !63
}
```
2019-06-07 15:22:21 -04:00
Andrew Kelley
0e8b65c537
hook up peer result locs to if optional and if err
2019-06-07 14:49:26 -04:00
Andrew Kelley
ec17f4ebbe
fix behavior for peer result locs with one prong unreachable
2019-06-07 14:20:35 -04:00
Andrew Kelley
5784631fab
update the default macos version min to 10.14
2019-06-07 12:20:02 -04:00
Andrew Kelley
786f3cdd13
ci: let's try a new build of llvm+clang on 10.14
2019-06-07 12:07:23 -04:00
Andrew Kelley
4c222a482f
fix behavior for non sret fn calls
2019-06-07 11:51:50 -04:00
Andrew Kelley
76a3938d69
no-copy semantics for peer result function calls
...
```zig
export fn entry() void {
var c = true;
var x = if (c) foo() else bar();
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%c = alloca i1, align 1
%x = alloca %Foo, align 4
store i1 true, i1* %c, align 1, !dbg !47
call void @llvm.dbg.declare(metadata i1* %c, metadata !39 , metadata !DIExpression()), !dbg !48
%0 = load i1, i1* %c, align 1, !dbg !49
br i1 %0, label %Then, label %Else, !dbg !49
Then: ; preds = %Entry
call fastcc void @foo(%Foo* sret %x), !dbg !50
br label %EndIf, !dbg !51
Else: ; preds = %Entry
call fastcc void @bar(%Foo* sret %x), !dbg !52
br label %EndIf, !dbg !51
EndIf: ; preds = %Else, %Then
call void @llvm.dbg.declare(metadata %Foo* %x, metadata !42 , metadata !DIExpression()), !dbg !53
ret void, !dbg !54
}
```
2019-06-07 11:34:47 -04:00
Andrew Kelley
fb5e03b983
Merge pull request #2628 from emekoi/error-unexpected
...
windows.unexpectedError prints a human friendly string
2019-06-06 12:37:51 -04:00
Andrew Kelley
a682b0acb6
Merge pull request #2630 from squeek502/hashmap-pow2
...
std.HashMap: optimize by taking advantage of power of two capacity
2019-06-06 12:26:27 -04:00
Ryan Liptak
8f4229a61c
std.HashMap: use std.math.ceilPowerOfTwo
2019-06-05 23:36:51 -07:00
Ryan Liptak
656ac43735
std.HashMap: optimize indexing by avoiding modulo operator
...
x % y can be optimized if y is a power of two by doing x & (y-1) instead. HashMap already enforces power of two capacity, so we can take advantage of this optimization.
2019-06-05 23:26:48 -07:00
emekoi
26613bfa01
switched to fixed-length buffer for error messages
2019-06-05 17:34:58 -05:00
emekoi
0288034c2f
fixed mismatched types
2019-06-05 15:30:01 -05:00
emekoi
ddfab40e30
updated std.c.{freebsd, netbsd} to usingnamespace
2019-06-05 16:06:21 -04:00
emekoi
0aabfb09f9
removed duplicate definitions
2019-06-05 14:57:20 -05:00
emekoi
b74bcc9d76
windows.unexpectedError prints a human friendly string
2019-06-05 14:42:36 -05:00
mrkishi
fdddd13106
add cache-control headers to tarballs on ci
2019-06-04 23:25:24 -04:00
Andrew Kelley
ca989a95d3
Merge pull request #2617 from squeek502/ceil-power-of-two
...
std.math: Add ceilPowerOfTwo and ceilPowerOfTwoPromote
2019-06-04 23:24:34 -04:00
Ryan Liptak
a0d66fa1e6
std.math: Clarify ceilPowerOfTwo inputs and disallow zero as an input
2019-06-04 15:49:27 -07:00
Andrew Kelley
b19b1c1298
no-copy semantics for switch expressions
...
```zig
export fn entry() void {
var c: i32 = 1234;
var x = switch (c) {
1 => u8(1),
2...4 => u16(2),
else => u32(3),
};
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%c = alloca i32, align 4
%x = alloca i32, align 4
store i32 1234, i32* %c, align 4, !dbg !44
call void @llvm.dbg.declare(metadata i32* %c, metadata !39 , metadata !DIExpression()), !dbg !44
%0 = load i32, i32* %c, align 4, !dbg !45
%1 = icmp sge i32 %0, 2, !dbg !46
%2 = icmp sle i32 %0, 4, !dbg !46
%3 = and i1 %1, %2, !dbg !46
br i1 %3, label %SwitchRangeYes, label %SwitchRangeNo, !dbg !46
SwitchRangeYes: ; preds = %Entry
br label %SwitchEnd, !dbg !45
SwitchElse: ; preds = %SwitchRangeNo
br label %SwitchEnd, !dbg !45
SwitchProng: ; preds = %SwitchRangeNo
br label %SwitchEnd, !dbg !45
SwitchEnd: ; preds = %SwitchProng, %SwitchElse, %SwitchRangeYes
%4 = phi i32 [ 2, %SwitchRangeYes ], [ 3, %SwitchElse ], [ 1, %SwitchProng ], !dbg !45
store i32 %4, i32* %x, align 4, !dbg !45
call void @llvm.dbg.declare(metadata i32* %x, metadata !42 , metadata !DIExpression()), !dbg !47
ret void, !dbg !48
SwitchRangeNo: ; preds = %Entry
switch i32 %0, label %SwitchElse [
i32 1, label %SwitchProng
], !dbg !45
}
```
2019-06-04 14:47:01 -04:00
Nick Erdmann
d83b15febf
src/ast_render.cpp: fix rendering of character literals <= 0x0f
2019-06-04 13:00:41 -04:00
LemonBoy
291aaee977
Stop the musl builder from skipping necessary files
...
The code assumed that the architecture-specific bits, found in the arch/
subfolder, were only overrides for the generic .c files.
Changed the logic to always include the whole architecture-specific
implementations and discard the generic ones, this way we won't exclude
files with no .c counterpart.
2019-06-04 12:45:02 -04:00
Timon Kruiper
fd771ea9fb
Added LineComment support when MultiLines are used in ArrayInit
...
also added the corresponding testcase
2019-06-04 12:44:50 -04:00
Andrew Kelley
7eb82b8651
std.os.mmap: update doc comments for previous commits
2019-06-04 12:31:20 -04:00
Andrew Kelley
a608ebaa50
Merge pull request #2581 from LemonBoy/misc-stuff
...
Miscellaneous stdlib changes
2019-06-04 12:30:38 -04:00
Andrew Kelley
8e109aec6b
Merge pull request #2620 from LemonBoy/debug-stuff
...
Small changes to debug info emitter
2019-06-04 11:58:09 -04:00
LemonBoy
80cd142c96
Propagate DIFlags to LLVM
2019-06-04 09:05:33 +02:00
LemonBoy
ebe921e48f
Make void a signed type
...
Follow the convention set by C so that lldb stops complaining about it.
2019-06-04 09:05:12 +02:00
Andrew Kelley
057b96006b
fix the rest of the ir_build_alloca_src callsites
...
except for switch expressions
2019-06-03 22:21:50 -04:00
Andrew Kelley
a32abcd365
no-copy semantics for if optional and if error union
...
if expressions no longer introduce a stack allocation.
```zig
export fn entry() void {
var x: anyerror!i32 = 1234;
if (x) |i| {} else |e| {}
}
```
```llvm
define void @entry() #2 !dbg !39 {
Entry:
%x = alloca { i16, i32 }, align 4
%0 = bitcast { i16, i32 }* %x to i8*, !dbg !52
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 bitcast ({ i16, i32 }* @0 to i8*), i64 8, i1 false), !dbg !52
call void @llvm.dbg.declare(metadata { i16, i32 }* %x, metadata !43 , metadata !DIExpression()), !dbg !52
%1 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %x, i32 0, i32 0, !dbg !53
%2 = load i16, i16* %1, align 2, !dbg !53
%3 = icmp ne i16 %2, 0, !dbg !53
br i1 %3, label %TryElse, label %TryOk, !dbg !53
TryOk: ; preds = %Entry
%4 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %x, i32 0, i32 1, !dbg !53
call void @llvm.dbg.declare(metadata i32* %4, metadata !50 , metadata !DIExpression()), !dbg !53
br label %TryEnd, !dbg !53
TryElse: ; preds = %Entry
%5 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %x, i32 0, i32 0, !dbg !53
call void @llvm.dbg.declare(metadata i16* %5, metadata !51 , metadata !DIExpression()), !dbg !53
br label %TryEnd, !dbg !53
TryEnd: ; preds = %TryElse, %TryOk
ret void, !dbg !54
}
```
2019-06-03 21:53:32 -04:00
Andrew Kelley
143d6ada8f
no-copy semantics for for loops
...
Note that only the index variable requires a stack allocation, and the
memcpy for the element is gone.
```zig
export fn entry() void {
var buf: [10]i32 = undefined;
for (buf) |x| {}
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%buf = alloca [10 x i32], align 4
%i = alloca i64, align 8
%0 = bitcast [10 x i32]* %buf to i8*, !dbg !47
call void @llvm.memset.p0i8.i64(i8* align 4 %0, i8 -86, i64 40, i1 false), !dbg !47
call void @llvm.dbg.declare(metadata [10 x i32]* %buf, metadata !39 , metadata !DIExpression()), !dbg !47
store i64 0, i64* %i, align 8, !dbg !48
call void @llvm.dbg.declare(metadata i64* %i, metadata !45 , metadata !DIExpression()), !dbg !48
br label %ForCond, !dbg !48
ForCond: ; preds = %ForBody, %Entry
%1 = load i64, i64* %i, align 8, !dbg !48
%2 = icmp ult i64 %1, 10, !dbg !48
br i1 %2, label %ForBody, label %ForEnd, !dbg !48
ForBody: ; preds = %ForCond
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %buf, i64 0, i64 %1, !dbg !48
call void @llvm.dbg.declare(metadata i32* %3, metadata !46 , metadata !DIExpression()), !dbg !49
%4 = add nuw i64 %1, 1, !dbg !48
store i64 %4, i64* %i, align 8, !dbg !48
br label %ForCond, !dbg !48
ForEnd: ; preds = %ForCond
ret void, !dbg !50
}
```
2019-06-03 21:40:56 -04:00
Andrew Kelley
d4054e35fe
while loops
...
Note that neither the payload capture variable nor the error capture
variable require a stack allocation.
```zig
export fn entry() void {
var c: anyerror!i32 = 1234;
while (c) |hi| {} else |e| {}
}
```
```llvm
define void @entry() #2 !dbg !39 {
Entry:
%c = alloca { i16, i32 }, align 4
%0 = bitcast { i16, i32 }* %c to i8*, !dbg !52
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 bitcast ({ i16, i32 }* @0 to i8*), i64 8, i1 false), !dbg !52
call void @llvm.dbg.declare(metadata { i16, i32 }* %c, metadata !43 , metadata !DIExpression()), !dbg !52
br label %WhileCond, !dbg !53
WhileCond: ; preds = %WhileBody, %Entry
%1 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 0, !dbg !54
%2 = load i16, i16* %1, align 2, !dbg !54
%3 = icmp ne i16 %2, 0, !dbg !54
br i1 %3, label %WhileElse, label %WhileBody, !dbg !54
WhileBody: ; preds = %WhileCond
%4 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 1, !dbg !53
call void @llvm.dbg.declare(metadata i32* %4, metadata !50 , metadata !DIExpression()), !dbg !53
br label %WhileCond, !dbg !53
WhileElse: ; preds = %WhileCond
%5 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 0, !dbg !55
call void @llvm.dbg.declare(metadata i16* %5, metadata !51 , metadata !DIExpression()), !dbg !55
ret void, !dbg !56
}
```
2019-06-03 20:56:22 -04:00
Andrew Kelley
b6108eed52
fix alignment of consts
2019-06-03 19:11:41 -04:00
Andrew Kelley
eb8a132d23
var types, alignment, and comptime
2019-06-03 17:46:58 -04:00
Andrew Kelley
735543d502
add missing ir_expr_wrap calls
2019-06-03 15:44:53 -04:00
Ryan Liptak
9bed6e1bf9
std.math: Add ceilPowerOfTwo and ceilPowerOfTwoPromote
...
Closes #2426
2019-06-02 22:09:22 -07:00
tgschultz
3eca5a42e6
fixed Deserializer.alignToByte() and added test coverage
2019-06-01 20:34:10 -04:00
LemonBoy
46cbed621b
Move dl_iterate_phdr to os.zig
2019-05-31 11:59:53 +02:00
LemonBoy
4b30e40a91
Remove length restriction in mmap wrapper
2019-05-31 11:48:42 +02:00
Shritesh Bhattarai
6d73e5de05
doc: recommend optional pointers for nullptrs instead of allowzero
2019-05-31 02:26:19 -04:00
Andrew Kelley
ccce3d8526
no-copy semantics for function forwarding
...
```zig
fn foo() Foo {
return bar();
}
```
```llvm
define internal fastcc void @foo(%Foo* nonnull sret) unnamed_addr #2 !dbg !48 {
Entry:
call fastcc void @bar(%Foo* sret %0), !dbg !52
ret void, !dbg !54
}
```
2019-05-31 01:36:57 -04:00
Andrew Kelley
461382ae94
no-copy semantics for function call init var and literal
...
```zig
export fn entry() void {
var x = foo();
}
const Foo = struct {
x: i32,
};
fn foo() Foo {
return Foo{
.x = 1234,
};
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%x = alloca %Foo, align 4
call fastcc void @foo(%Foo* sret %x), !dbg !45
call void @llvm.dbg.declare(metadata %Foo* %x, metadata !39 , metadata !DIExpression()), !dbg !46
ret void, !dbg !47
}
define internal fastcc void @foo(%Foo* nonnull sret) unnamed_addr #2 !dbg !48 {
Entry:
%1 = bitcast %Foo* %0 to i8*, !dbg !52
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %1, i8* align 4 bitcast (%Foo* @0 to i8*), i64 4, i1 false), !dbg !52
ret void, !dbg !52
}
```
2019-05-31 01:08:16 -04:00
Andrew Kelley
8aba0643a5
peer result locations with mixed runtime/comptime
...
```zig
export fn entry() void {
var c = true;
var a = u8(4);
const x = if (c) a else u32(8);
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%c = alloca i1, align 1
%a = alloca i8, align 1
%x = alloca i32, align 4
store i1 true, i1* %c, align 1, !dbg !45
call void @llvm.dbg.declare(metadata i1* %c, metadata !39 , metadata !DIExpression()), !dbg !46
store i8 4, i8* %a, align 1, !dbg !47
call void @llvm.dbg.declare(metadata i8* %a, metadata !42 , metadata !DIExpression()), !dbg !48
%0 = load i1, i1* %c, align 1, !dbg !49
br i1 %0, label %Then, label %Else, !dbg !49
Then: ; preds = %Entry
%1 = load i8, i8* %a, align 1, !dbg !50
%2 = zext i8 %1 to i32, !dbg !50
br label %EndIf, !dbg !51
Else: ; preds = %Entry
br label %EndIf, !dbg !51
EndIf: ; preds = %Else, %Then
%3 = phi i32 [ %2, %Then ], [ 8, %Else ], !dbg !51
store i32 %3, i32* %x, align 4, !dbg !51
call void @llvm.dbg.declare(metadata i32* %x, metadata !43 , metadata !DIExpression()), !dbg !52
ret void, !dbg !53
}
```
2019-05-31 00:54:10 -04:00
Andrew Kelley
3702c278e3
local consts with comptime init exprs
...
```zig
export fn entry() void {
const x = if (true) u8(4) else u32(8);
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
call void @llvm.dbg.declare(metadata i8* @0, metadata !39 , metadata !DIExpression()), !dbg !41
ret void, !dbg !42
}
```
2019-05-31 00:22:12 -04:00
Andrew Kelley
95d9835898
no-copy semantics for nested if
...
```zig
export fn entry() void {
var c = true;
var x = if (c) u8(4) else if (c) u16(100) else u32(10);
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%c = alloca i1, align 1
%x = alloca i32, align 4
store i1 true, i1* %c, align 1, !dbg !44
call void @llvm.dbg.declare(metadata i1* %c, metadata !39 , metadata !DIExpression()), !dbg !45
%0 = load i1, i1* %c, align 1, !dbg !46
br i1 %0, label %Then2, label %Else, !dbg !46
Else: ; preds = %Entry
%1 = load i1, i1* %c, align 1, !dbg !47
br i1 %1, label %Then, label %Else1, !dbg !47
Then: ; preds = %Else
br label %EndIf, !dbg !48
Else1: ; preds = %Else
br label %EndIf, !dbg !48
Then2: ; preds = %Entry
br label %EndIf3, !dbg !49
EndIf: ; preds = %Else1, %Then
%2 = phi i32 [ 100, %Then ], [ 10, %Else1 ], !dbg !48
br label %EndIf3, !dbg !49
EndIf3: ; preds = %EndIf, %Then2
%3 = phi i32 [ 4, %Then2 ], [ %2, %EndIf ], !dbg !49
store i32 %3, i32* %x, align 4, !dbg !49
call void @llvm.dbg.declare(metadata i32* %x, metadata !42 , metadata !DIExpression()), !dbg !50
ret void, !dbg !51
}
```
2019-05-30 23:25:37 -04:00
Andrew Kelley
a4aca78722
no-copy semantics for if expr
...
```zig
export fn entry() void {
var c = true;
var x = if (c) u8(4) else u32(10);
}
```
```llvm
define void @entry() #2 !dbg !35 {
Entry:
%c = alloca i1, align 1
%x = alloca i32, align 4
store i1 true, i1* %c, align 1, !dbg !44
call void @llvm.dbg.declare(metadata i1* %c, metadata !39 , metadata !DIExpression()), !dbg !45
%0 = load i1, i1* %c, align 1, !dbg !46
br i1 %0, label %Then, label %Else, !dbg !46
Then: ; preds = %Entry
br label %EndIf, !dbg !47
Else: ; preds = %Entry
br label %EndIf, !dbg !47
EndIf: ; preds = %Else, %Then
%1 = phi i32 [ 4, %Then ], [ 10, %Else ], !dbg !47
store i32 %1, i32* %x, align 4, !dbg !47
call void @llvm.dbg.declare(metadata i32* %x, metadata !42 , metadata !DIExpression()), !dbg !48
ret void, !dbg !49
}
```
2019-05-30 23:16:11 -04:00
Andrew Kelley
5e1003bc81
no-copy semantics for basic runtime function call variable init
...
```zig
export fn entry() void {
var x: Foo = foo();
}
```
```llvm
define void @entry() #2 !dbg !37 {
Entry:
%x = alloca %Foo, align 4
call fastcc void @foo(%Foo* sret %x), !dbg !48
call void @llvm.dbg.declare(metadata %Foo* %x, metadata !41 , metadata !DIExpression()), !dbg !49
ret void, !dbg !50
}
```
2019-05-30 17:11:14 -04:00
Andrew Kelley
0ccd91faea
Merge pull request #2593 from LemonBoy/aarch64-stuff
...
Fix some syscalls on arm64
2019-05-30 15:48:22 -04:00
Andrew Kelley
78f32259da
default struct field initialization expressions
...
closes #485
2019-05-30 15:46:11 -04:00
Andrew Kelley
7878f9660f
dep tokenizer: run zig fmt and move exports to canonical location
2019-05-30 12:07:55 -04:00
Andrew Kelley
5954d5235f
Merge pull request #2182 from mikdusan/issue.2046
...
new .d file parser for stage1 compiler
2019-05-30 11:53:08 -04:00
LemonBoy
51fc375b0d
Correct flag definitions for arm64
2019-05-30 17:05:39 +02:00
LemonBoy
477ee9c8b9
Fix some syscalls on arm64
2019-05-30 16:28:33 +02:00
Andrew Kelley
8ca294c430
update load dynamic library test for std lib changes
2019-05-30 00:04:11 -04:00
tgschultz
8eaf1387c7
Fix fmt.zig handling of slices of slices
...
Discovered while calling testing.expectError on an error union with payload [][]const u8. Even though the payload was not going to be printed, the current format handling caused a compile error anyway because it couldn't be casted to []const u8. The new handling treats a []u8 as a string but otherwise treats the slice as a pointer.
2019-05-29 20:46:08 -04:00
tgschultz
f9e7bd2682
std.meta/trait: def/definition => decl/declaration
...
TypeInfo: defs/Definition => decls/Declarations
2019-05-29 20:43:07 -04:00
Andrew Kelley
01a4897da5
improve the libc of wasm32-freestanding target
...
* introduce wasm32-freestanding-musl .h files to fix
conflicts with stddef.h and errno.h
* fix an issue with zig build system regarding installation of
webassembly libraries
* add implementations to zig's libc:
- strcmp
- strncmp
- strerror
- strlen
See #514
2019-05-29 20:32:27 -04:00
Shawn Landden
4188faeac5
stage1: AstNodes cannot be casted, but are rather accessed via a union.
...
Unlike IrInstruction[Foo]s, which all start with:
IrInstruction base;
AstNodes do not work like this, and instead use a pointer to their
specializations. The code assumed otherwise.
2019-05-29 20:21:07 -04:00
Timon Kruiper
4e1f3a9ba3
Correct formatting for multiline string in arrays
2019-05-29 19:56:28 -04:00
Andrew Kelley
7bfae39c5c
Merge branch 'NBonaparte-linuxdynlib'
2019-05-29 19:49:10 -04:00
NBonaparte
e716c9ba4b
build_examples: reenable load_dynamic_library
2019-05-29 19:48:36 -04:00
NBonaparte
dab1dc79a7
LinuxDynLib: remove MAP_LOCKED flag
2019-05-29 19:48:36 -04:00
Andrew Kelley
345501a72d
Merge pull request #2567 from emekoi/fix-dynlib
...
remove allocator from DynLib
2019-05-29 19:41:16 -04:00
Andrew Kelley
c66a747045
Merge pull request #2546 from LemonBoy/sigaltstack
...
Add sigaltstack syscall for Linux
2019-05-29 19:38:01 -04:00
Andrew Kelley
bfc86776d5
run zig fmt to update use to usingnamespace
2019-05-29 19:09:58 -04:00
Andrew Kelley
8a4ee5942b
zig fmt: fix 2 bugs of mangling source files
2019-05-29 19:09:58 -04:00
Andrew Kelley
b7a82288ad
change use to usingnamespace
...
See #2014
`use` syntax is still accepted for now. `zig fmt` automatically
updates code. After a release cycle the old syntax will be removed.
2019-05-29 19:09:58 -04:00
hryx
3e14f86f9e
Implement missing clang functions from last commit
2019-05-29 15:33:44 -07:00
Andrew Kelley
9a7cf73b3b
main: set subsystem in zig builtin when explicitly provided
2019-05-29 18:18:18 -04:00
Andrew Kelley
6dbaae4c46
Merge branch 'emekoi-builtin-subsystem'
2019-05-29 17:14:34 -04:00
Andrew Kelley
3819654c39
codegen: initialize subsystem
2019-05-29 16:55:02 -04:00
Andrew Kelley
1ab0ac3ea2
cleanups for windows subsystem in builtin.zig
2019-05-29 16:55:02 -04:00
emekoi
b461e600e2
set subsystem to null if not on windows or uefi
2019-05-29 16:55:01 -04:00
emekoi
6bc5b07e3e
try to resolve TargetSubSystemAuto to actual subsystem
2019-05-29 16:55:01 -04:00
emekoi
fb5dc28921
added subsystem to builtin.zig
2019-05-29 16:54:59 -04:00
LemonBoy
b8d1060f0a
Add missing sigaltstack definition for darwin
2019-05-29 22:38:14 +02:00
LemonBoy
399e026cc0
Add sigaltstack wrapper in os.zig
2019-05-29 22:38:14 +02:00
Andrew Kelley
7017388e9e
Merge branch 'LemonBoy-use-struct-pt2'
2019-05-29 16:32:16 -04:00
Andrew Kelley
1ccbd1fb67
use works on unions and enums in addition to structs
2019-05-29 16:31:49 -04:00
Andrew Kelley
9891c4f30d
Merge branch 'use-struct-pt2' of https://github.com/LemonBoy/zig into LemonBoy-use-struct-pt2
2019-05-29 15:48:49 -04:00
Michael Dusan
2975bdc684
add review changes
...
- use std.heap.c_allocator
- use @panic instead of unreachable
- use extern enum for tokenizer result type
2019-05-29 14:39:13 -04:00
Andrew Kelley
f9ada1cfba
Merge pull request #2530 from gonzus/gonzus/improve-clang-zig
...
Add declarations missing from clang.zig
2019-05-29 10:47:23 -04:00
Andrew Kelley
b66438eb80
no "use of undeclared identifer" in dead comptime branches
2019-05-28 18:19:27 -04:00
LemonBoy
528c151a55
Reject undefined as type
...
Make analyze_type_expr behave like ir_resolve_type when the user tries
to use `undefined` as a type.
Closes #2436
2019-05-28 18:02:57 -04:00
LemonBoy
a169d844c7
Warn the user if run/test is paired with emit options
2019-05-28 17:50:28 -04:00
LemonBoy
048169cbea
Avoid a crash when there are no namespace components
...
Fixes #2500
2019-05-28 17:49:37 -04:00
Andrew Kelley
9d16839420
fix invalid LLVM IR generated for ?*void const casts
...
closes #2578
2019-05-28 16:11:36 -04:00
Andrew Kelley
508fdfea72
link to contributing in readme
2019-05-28 14:53:01 -04:00
Andrew Kelley
a37ea5acf3
extract CONTRIBUTING.md from README.md
2019-05-28 14:50:02 -04:00
Andrew Kelley
8a65478801
Create FUNDING.yml
2019-05-28 14:36:03 -04:00
LemonBoy
e2c2263434
Move __zig_fail_unwrap locals on stack
2019-05-28 13:02:45 -04:00
Andrew Kelley
568dc56232
Merge branch 'LemonBoy-guard-pages-in-threads'
2019-05-28 12:47:10 -04:00
Andrew Kelley
c518b7b8bf
thread.spawn: bubble up mprotect error.OutOfMemory
2019-05-28 12:46:44 -04:00
LemonBoy
381f845287
Add a guard page for each thread
2019-05-28 18:26:38 +02:00
LemonBoy
594366a482
Fix os.mprotect signature
2019-05-28 18:25:48 +02:00
emekoi
f2b64fd18f
updated dynamic libraries to new std
2019-05-28 11:18:30 -05:00
Gonzalo Diethelm
6547468af6
clang.zig cleanup #9 : rename arg0 to self
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
8d50d4f3fc
clang.zig cleanup #8 : add missing consts
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
b639447263
clang.zig cleanup #7 : add missing struct
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
f4b4ea402e
clang.zig cleanup #6 : move block around
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
fd9e63da53
clang.zig cleanup #5 : add missing enums
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
7f1dd05fa7
clang.zig cleanup #4 : move block around
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
5df2e791c2
clang.zig cleanup #3 : move block around
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
abf97cc232
clang.zig cleanup #2 : move block around
2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
333c050a1d
clang.zig cleanup #1 : move block around
2019-05-28 18:05:07 +02:00
Gonzalo Diethelm
775a25b7fd
Add declarations missing from clang.zig
2019-05-28 18:05:07 +02:00
emekoi
b8cd4b18b0
remove unneed allocator from DynLib
2019-05-28 10:34:35 -05:00
LemonBoy
bcdbd8d169
Add sigaltstack syscall
2019-05-28 15:22:19 +02:00
hryx
e632c2ade3
(broken) port a bunch of stuff from stage1 translate-c
2019-05-27 23:55:48 -07:00
Andrew Kelley
d1b6f29d22
Merge pull request #2523 from shritesh/wasmdoc
...
docs: wasm
2019-05-27 22:37:15 -04:00
hryx
b558d0996a
expr: DeclRefExpr
2019-05-27 19:20:23 -07:00
emekoi
3f302594b8
respect subsystem flag in all cases
2019-05-27 22:15:33 -04:00
Andrew Kelley
f924fbddcf
Merge pull request #2552 from Sahnvour/issue-2543
...
gen-h: do not output visibility macros when the build is static
2019-05-27 21:51:34 -04:00
hryx
e07888e54c
expr: FunctionToPointerDecay & ArrayToPointerDecay for ImplicitCastExpr
2019-05-27 18:18:27 -07:00
Andrew Kelley
2c0280ba08
improve the stack check CLI options
...
See #2526
2019-05-27 20:59:19 -04:00
hryx
22299869ba
Prevent infinite recursion
2019-05-27 17:54:40 -07:00
hryx
e1f3eec9cc
Merge branch 'master' into translate-c-userland
2019-05-27 17:24:21 -07:00
Andrew Kelley
3fccc07479
self-hosted translate-c: fix bad memory arena references
2019-05-27 20:22:15 -04:00
Michael Dusan
d4b241c14e
new .d file parser for C compilation
...
- wip for #2046
- clang .d output must be created with `clang -MV` switch
- implemented in Zig
- hybridized for zig stage0 and stage1
- zig test src-self-hosted/dep_tokenizer.zig
2019-05-27 19:47:10 -04:00
Andrew Kelley
f68d8060ec
Merge pull request #2526 from LemonBoy/arch-format-osx
...
Build archives using the K_DARWIN format when targeting osx
2019-05-27 19:25:58 -04:00
Andrew Kelley
6a56091213
Merge pull request #2527 from ziglang/posix-layer
...
rework the API layers between the standard library and the operating system
2019-05-27 19:21:17 -04:00
hryx
2aa1c5da5d
Remove unused local struct type
2019-05-27 15:58:21 -07:00
LemonBoy
d110818cfe
Trigger rebuild on sr.ht
2019-05-28 00:12:09 +02:00
hryx
3bbee1ba2e
expr: BitCast for ImplicitCastExpr
2019-05-27 14:38:09 -07:00
Andrew Kelley
3640303ce1
freebsd fixes
2019-05-27 17:28:59 -04:00
Andrew Kelley
af4b8eb6c0
windows does not integrate cleanly with libc
2019-05-27 15:55:15 -04:00
Andrew Kelley
86bb7e5984
fixes for windows to build self hosted compiler
2019-05-27 15:55:15 -04:00
Andrew Kelley
5de07ab721
revert hello world examples. macos tests passing
2019-05-27 15:48:31 -04:00
Andrew Kelley
db0a5e7516
darwin: add missing error handling
2019-05-27 15:14:35 -04:00
Andrew Kelley
b3dc1c380d
use close$NOCANCEL on darwin
2019-05-27 14:41:13 -04:00
Andrew Kelley
13265cf7c7
std.fs: fix error set regressions on linux
2019-05-27 14:32:12 -04:00
Andrew Kelley
06435535d3
fixes for darwin
2019-05-27 14:12:50 -04:00
Andrew Kelley
f1610f6c1d
nanosleep: move windows logic to std.time
2019-05-27 12:16:32 -04:00
Andrew Kelley
abf959a0c9
fix debug builds of WASI
2019-05-27 02:16:05 -04:00
Andrew Kelley
fda7e0bb01
std lib fixes for zig build on windows
2019-05-27 02:00:39 -04:00
Shawn Landden
5a91dbc16c
allow const to be passed to @hasField()
...
Actually include the tests I wrote
2019-05-27 00:38:36 -05:00
Andrew Kelley
129714d077
more fixes for windows and wasi
2019-05-27 01:35:58 -04:00
Andrew Kelley
6be79d79aa
fixes for Windows and WASI
2019-05-27 00:48:56 -04:00
Andrew Kelley
0c6ab61b22
tests passing on linux
2019-05-26 23:35:26 -04:00
hryx
9c437f9032
var decl: ImplicitCastExpr
2019-05-26 19:14:50 -07:00
hryx
1a8f8c6262
var decl: init node
2019-05-26 17:36:47 -07:00
hryx
c79b8aeaef
var decl: threadlocal
2019-05-26 17:05:49 -07:00
Andrew Kelley
2b42e910bf
behavior tests passing on Linux
2019-05-26 19:56:37 -04:00
hryx
99f0b28d39
var decl: mut_token, create child scope
2019-05-26 16:51:25 -07:00
hryx
fceedada5c
WIP translate var decl
2019-05-26 15:43:13 -07:00
Andrew Kelley
44a049e01e
more cleanup. down to just the @hasDecl builtin
2019-05-26 18:32:45 -04:00
Andrew Kelley
2f040a23c8
clean up references to os
2019-05-26 18:32:44 -04:00
Andrew Kelley
7cb6279ac0
clean up references to posix
2019-05-26 18:32:44 -04:00
Andrew Kelley
ca6debcaf4
starting to fix the regressions
2019-05-26 18:32:44 -04:00
Andrew Kelley
3d61e42282
rename "posix" to "bits"
2019-05-26 18:32:44 -04:00
Andrew Kelley
17b0166e00
do Jay's suggestion with posix/os API naming & layout
2019-05-26 18:32:44 -04:00
Andrew Kelley
2def23063f
more progress. moving windows API layer to its own file
2019-05-26 18:32:44 -04:00
Andrew Kelley
daae7e1f5a
more progress on posix API layer
...
see #2380
2019-05-26 18:32:43 -04:00
Andrew Kelley
67726e36b0
extract posix functions from std/os.zig to std/os/posix.zig
...
See #2380
2019-05-26 18:32:40 -04:00
Andrew Kelley
df7aa9a4f0
allow implicit optional pointer to optional c_void pointer
2019-05-26 17:55:20 -04:00
Andrew Kelley
269a53b6af
introduce @hasDecl builtin function
...
closes #1439
2019-05-26 16:21:03 -04:00
Andrew Kelley
21ed939117
support enum literals implicit casting to tagged unions
2019-05-26 12:59:30 -04:00
Sahnvour
99ee0608f7
gen-h: do not output visibility macros when the build is static
2019-05-25 14:17:59 +02:00
Sahnvour
c89b522233
test: slightly better output for failure of tests based on text comparison
2019-05-25 13:43:52 +02:00
LemonBoy
86b3007b94
Reject slices in use expressions
...
Co-Authored-By: emekoi <emekankurumeh@outlook.com >
2019-05-24 13:20:44 +02:00
Robert Scott
9b7ad12481
Implement @unionInit
2019-05-24 01:48:45 -07:00
Shritesh Bhattarai
b618a0b866
doc: wasm: embedded->host
2019-05-22 09:37:37 -07:00
Shritesh Bhattarai
9e65a144fa
docs: clarify why wasm_allocator should be used
2019-05-22 07:43:17 -07:00
LemonBoy
f67ca20655
Make use work with arbitrary structs
2019-05-21 17:07:40 +02:00
LemonBoy
7987202243
Fix signedness mismatch in comparison
2019-05-20 23:14:49 +02:00
LemonBoy
266b2de150
Remove macos-specific linking hacks
2019-05-20 23:09:25 +02:00
LemonBoy
f5657b5552
Build archives using the K_DARWIN format when targeting osx
2019-05-20 17:04:00 +02:00
Marc Tiehuis
163a8e98bc
std.fmt.parse_float: Fix exponent calculation
...
This was incorrectly translated as a u64. binary_exponent is an
unadjusted value so can be negative. In becomes unconditionally positive
when adding the bias.
2019-05-20 17:28:17 +12:00
Shritesh Bhattarai
3b6fc3fdc7
docs: wasm
2019-05-19 19:32:28 -07:00
emekoi
1c73c08298
ran zig fmt on stdlib
2019-05-19 16:33:31 -04:00
LemonBoy
6672ee9eb3
Fix too eager comptime evaluation of error ptr
2019-05-19 15:53:32 -04:00
LemonBoy
b660134a18
Use the correct scope for use
...
use expressions outside the top-level scope now work as intended.
2019-05-19 00:32:49 -04:00
Andrew Kelley
860684cc2f
Merge pull request #2516 from LemonBoy/32bfix
...
More 32bit fixes for stdlib
2019-05-19 00:31:16 -04:00
LemonBoy
0a3aec020a
Fix load/store of non-integer fields in packed struct
2019-05-18 19:59:47 -04:00
LemonBoy
232bc1bdee
Remove more 64bit-centric assumptions from stdlib
2019-05-18 11:08:04 +02:00
LemonBoy
6957927194
Fix some test cases to run on 32bit systems
2019-05-18 10:59:56 +02:00
LemonBoy
51aaa02679
VDSO calls must use the C CC
2019-05-16 22:10:38 -04:00
Andrew Kelley
2eba779af5
stage1 tokenizer: add more missing break statements
2019-05-16 16:50:24 -04:00
SamTebbs33
87901baa28
Add break after digit_value check in TokenizeStateCharCode
2019-05-16 16:49:26 -04:00
Andrew Kelley
e09c05f689
Merge branch 'shawnl-builtins'
2019-05-16 16:38:06 -04:00
Andrew Kelley
80983ca1ca
fixups to the previous commit
2019-05-16 16:37:58 -04:00
Shawn Landden
1fdb24827f
breaking changes to all bit manipulation intrinsics
...
* `@clz`, `@ctz`, `@popCount`, `@bswap`, `@bitreverse` now
have a type parameter
* rename @bitreverse to @bitReverse
* rename @bswap to @byteSwap
Closes #2119
Closes #2120
2019-05-16 16:37:58 -04:00
Shritesh Bhattarai
56a905c7d1
docgen: add lib codeblock type and use it for wasm32-freestanding
2019-05-16 14:58:10 -04:00
Andrew Kelley
8468ff0fe1
Merge pull request #2507 from ziglang/wasm-libs
...
improvements to build-lib use case of WebAssembly
2019-05-16 14:31:54 -04:00
Andrew Kelley
978fab817c
the wasm freestanding _start function is return value void
2019-05-16 14:19:13 -04:00
Andrew Kelley
81e960eb74
improvements to build-lib use case of WebAssembly
...
* build-exe does include the startup code that supplies _start for the
wasm32-freestanding target. Previously this did not occur because
of logic excluding "freestanding".
* build-lib for wasm32-freestanding target gets linked by LLD. To avoid
infinite recursion, compiler_rt and zig libc are built as objects
rather than libraries.
- no "lib" prefix and ".wasm" extension instead of ".a". Rather than
build-lib foo.zig producing "libfoo.a", now it produces "foo.wasm".
* go back to using `.o` extension for webassembly objects
* zig libc only provides _start symbol for wasm when linking libc.
2019-05-16 13:56:56 -04:00
Andrew Kelley
07d0aee11a
clang C API wrapper: small progress
2019-05-16 12:55:45 -04:00
daurnimator
e30cd800e2
std: update linux syscalls to 5.1
2019-05-16 12:38:40 -04:00
Andrew Kelley
6b36b756eb
fix static builds of zig from requiring c compiler
...
to be installed when linking libc.
When zig links against libc, it requires a dynamic linker path.
Usually this can be determined based on the architecture and operating
system components of the target. However on some systems this is not
correct; because of this zig checks its own dynamic linker.
When zig is statically linked, this information is not available, and so
it resorts to using cc -print-filename=foo to find the dynamic linker
path.
Before this commit, Zig incorrectly exited with an error if there was
no c compiler installed. Now, Zig falls back to the dynamic linker
determined based on the arch and os when no C compiler can be found.
2019-05-15 21:50:56 -04:00
Shritesh Bhattarai
b64e6cb813
change wasm obj ext to .wasm
2019-05-15 20:41:22 -04:00
Andrew Kelley
14cdb01f35
improvements to zig's implementation of libc and WebAssembly
...
* rename std/special/builtin.zig to std/special/c.zig
not to be confused with @import("builtin") which is entirely
different, this is zig's multi-target libc implementation.
* WebAssembly: build-exe is for executables which have a main().
build-lib is for building libraries of functions to use from,
for example, a web browser environment.
- for now pass --export-all for libraries when there are any
C objects because we have no way to detect the list of exports
when compiling C code.
- stop passing --no-entry for executables. if you want --no-entry
then use build-lib.
* make the "musl" ABI the default ABI for wasm32-freestanding.
* zig provides libc for wasm32-freestanding-musl.
2019-05-15 20:14:58 -04:00
Andrew Kelley
3aa43dc31c
update libclang C API wrapper
2019-05-15 11:57:55 -04:00
LemonBoy
787fd0f1be
Fix off-by-one error in LEB128 parsing
2019-05-15 11:11:16 -04:00
Andrew Kelley
057a5d4898
slice types no longer have field access
...
* fix crash when doing field access of slice types. closes #2486
* remove the deprecated Child property from slice types
* add -Dskip-non-native build option to build script
2019-05-14 21:21:59 -04:00
Andrew Kelley
5a57610039
clean up code now that #769 is implemented
2019-05-14 19:23:31 -04:00
Andrew Kelley
e93a05b6e4
switching on error sets makes new error set for capture values
...
closes #769
2019-05-14 19:11:37 -04:00
Andrew Kelley
c08c222d5e
fix regression on switch capture value for multiple cases
2019-05-14 18:25:14 -04:00
Andrew Kelley
df4f77024e
else value when switching on error set has
...
optional capture value which is subset.
see #769
2019-05-14 18:06:57 -04:00
LemonBoy
6536b409df
Don't emit DW_TAG_lexical_block for VarDecls
2019-05-14 14:34:49 -04:00
Marc Tiehuis
b64cee2ec2
Merge pull request #2482 from ziglang/linux-elf-read
...
Mmap debug info on linux
2019-05-14 16:43:21 +12:00
LemonBoy
08d41da916
Fix formatting for multiline asm expressions
2019-05-13 12:20:11 -04:00
Andrew Kelley
66d86eccbe
Merge branch 'LemonBoy-asm-cc'
2019-05-13 12:16:17 -04:00
Andrew Kelley
7330a6102f
cache_add_dep_file: handle ErrorFileNotFound specially
2019-05-13 12:15:55 -04:00
Andrew Kelley
f3db3b3c13
Merge branch 'asm-cc' of https://github.com/LemonBoy/zig into LemonBoy-asm-cc
2019-05-13 12:10:21 -04:00
LemonBoy
a038ef3570
Assemble asm files using CC
...
Stuffing all the files together and compiling the resulting blob with
the main program is a terrible idea.
Some files, namely the .S ones, must be run trough the C preprocessor
before assembling them (#2437 ).
Beside that the aggregate may be mis-compiled due to the presence of
some flags that affect the following code.
For example let's consider two files, a.s and b.s
a.s
```
fn1:
ret
.data
data1:
.word 0
```
b.s
```
fn2:
ret
```
Now, fn1 and fn2 will be both placed in the .text section as intended if
the two files are compiled separately. But if we merge them the `.data`
flag ends up placing fn2 in the wrong section!
This fixes a nasty crash where musl's memset ended up in the
non-executable data segment, leading to too many hours of
head-scratching.
2019-05-13 16:41:07 +02:00
Marc Tiehuis
c4d1597f50
Mmap debug info on linux
...
Closes #907 .
2019-05-13 20:04:25 +12:00
Andrew Kelley
c1793d6106
zig fmt on the standard library
2019-05-12 12:56:01 -04:00
Andrew Kelley
ed5a6d74ad
Merge pull request #2405 from hryx/stage2-recursive-parser
...
Recursive stage2 parser
2019-05-12 12:53:10 -04:00
hryx
173142b16a
Undo parse2 import
2019-05-12 03:24:48 -07:00
hryx
0d629421c9
Recursive rewrite of stage2 parser, final sync
2019-05-12 02:10:27 -07:00
hryx
3a3a738478
Recursive rewrite of stage2 parser, part 3
2019-05-12 02:01:45 -07:00
hryx
3787f34286
Merge branch 'master' into rebased
2019-05-12 02:00:49 -07:00
Tyler Philbrick
16aee1f58a
Fix memory leak in parser tests
...
The `arena` instance being used bythe parse tree was valid and
pointed to valid memory, but existed as a local variable inside the
stack frame of the `parse` function (the `const arena`), which was never
stored anywhere before leaving the scope.
This meant that code above the `parse` function saw a valid instance of
an `ArenaAllocator` that pointed to the same backing memory, but didn't
posess any of the local state built up after the call to `parseRoot`,
basically the caller saw an empty arena.
This meant that when `deinit` was called, it saw an Arena with 0
allocations in it's `buffer_list` and wasn't able to destroy any of the
memory. This caused it to leak and caused FailingAllocator to balk.
The fix is to make sure the parse tree is using the same instance of
ArenaAllocator as is reported up the call stack, the one inside the
`Tree{}` object. I'm not sure why that field is marked with a comment
to remove it, as it's used by the `std.ast.Tree.deinit()` function, but
this change seems to solve the problem.
2019-05-12 01:54:30 -07:00
hryx
4e28c2571d
Recursive rewrite of stage2 parser, part 1
2019-05-12 01:52:16 -07:00
Andrew Kelley
edcc7c72d1
Merge pull request #2459 from LemonBoy/enum-num-um-m
...
Signed types for enum tags
2019-05-11 20:38:13 -04:00
LemonBoy
d210628c91
Amend the error messages
2019-05-11 21:29:55 +02:00
LemonBoy
b05e8d46ec
Change the enum value allocation strategy
2019-05-11 21:29:53 +02:00
LemonBoy
655794f44f
amend type_is_valid_extern_enum_tag
2019-05-11 21:29:00 +02:00
LemonBoy
c766f3f9ca
Support signed types as enum tags
2019-05-11 21:28:58 +02:00
LemonBoy
917bd4192d
Validate enum tag for extern enum
...
The C specification mandates the enum to be compatible with signed char,
signed int or unsigned int.
2019-05-11 21:27:58 +02:00
Jimmi Holst Christensen
6cf7fb1177
fixes #2235
2019-05-11 20:51:59 +02:00
Jimmi Holst Christensen
ba3d18a80e
added grammar rule for enum literal to docs
2019-05-11 20:26:41 +02:00
Jimmi Holst Christensen
e5a0e21a53
Merge branch 'master' of github.com:ziglang/zig
2019-05-11 20:12:08 +02:00
Jimmi Holst Christensen
fb3b943b07
added tests for global variable declaration syntax
2019-05-11 20:11:56 +02:00
Andrew Kelley
32efa68f90
Merge pull request #2449 from Sahnvour/directallocator
...
Rework of windows' DirectAllocator
2019-05-11 13:04:20 -04:00
Jimmi Holst Christensen
b2a196e01d
Merge branch 'master' of github.com:ziglang/zig
2019-05-11 18:49:23 +02:00
Jimmi Holst Christensen
c051904903
Fixed parser for extern threadlocal variables
2019-05-11 18:48:52 +02:00
Andrew Kelley
10e9d47b49
stage2 translate-c: implement functions with no prototype
...
stage1 translate-c actually has this wrong. When exporting a function,
it's ok to use empty parameters. But for prototypes, "no prototype"
means that it has to be emitted as a function that accepts anything,
e.g. extern fn foo(...) void;
See #1964
2019-05-11 12:09:11 -04:00
Andrew Kelley
2ef2f9d71f
Merge pull request #2475 from LemonBoy/linux-wo-vdso
...
Fix clock_gettime on systems without VDSO
2019-05-11 12:01:52 -04:00
Sahnvour
cd537f822b
Use unprotected heap when in single_threaded mode.
2019-05-11 16:41:13 +02:00
Sahnvour
a2d5b0fabe
Implement Windows' DirectAllocator on top of VirtualAlloc and VirtualFree.
2019-05-11 16:41:13 +02:00
daurnimator
3d93c89fc5
std: the failing allocator didn't actually count allocations
...
Add a field '.allocations' to actually track the number of allocations.
Additionally, only increment '.deallocations' when memory is freed
2019-05-11 09:55:41 -04:00
LemonBoy
6756e545f4
Fix more corner cases in LEB128 parsing
2019-05-11 09:54:48 -04:00
LemonBoy
1b23348f30
linux: Minor zig fmt induced reformatting
2019-05-11 10:34:22 +02:00
LemonBoy
715d808f14
linux: Fix clock_gettime on systems w/o VDSO
2019-05-11 10:33:41 +02:00
Andrew Kelley
5f4c3e6557
stage2 translate-c: simple function definitions
...
See #1964
2019-05-10 23:35:46 -04:00
Andrew Kelley
dbb5da14f4
stage2 translate-c: builtin types and pub
...
See #1964
2019-05-10 17:56:00 -04:00
Andrew Kelley
82219b1fd5
translate-c: better handling of restore points
2019-05-10 17:44:47 -04:00
Andrew Kelley
2933d6b848
add test case for previous commit
...
closes #2467
2019-05-10 16:57:37 -04:00
Andrew Kelley
fee0e6c8b9
fix hang for some compile errors
...
see #2467
2019-05-10 16:39:50 -04:00
Andrew Kelley
a6f7a9ce2b
translate-c: we have our first test of self-hosted
...
See #1964
2019-05-10 16:03:54 -04:00
Michael Dusan
d065f297ab
stage1: compile error for loop expr val ignored
...
closes #2460
2019-05-10 10:05:40 -04:00
Jimmi HC
6b10f03b4a
Fixes and simplifications for stage 1 parser
2019-05-10 16:09:58 +02:00
Andrew Kelley
bcf4d20289
Merge pull request #2465 from LemonBoy/builtins-for-wasm
...
A few builtins for wasm
2019-05-10 08:44:27 -04:00
LemonBoy
1606dae728
Fix erroneous test case
...
The *Mem variants cannot return EndOfStream and are generally unsafe to
use.
Proper order of checks, try both the variants and make sure they return
the same error/result.
Run the leb128.zig tests.
2019-05-10 08:40:36 -04:00
LemonBoy
7fb55ce2bb
compiler-rt: Add __ashrti3
2019-05-10 13:26:33 +02:00
LemonBoy
fbffece1b5
compiler-rt: Add __lshrti3
2019-05-10 13:26:33 +02:00
LemonBoy
7db2aa1c25
compiler-rt: Add __ashlti3
2019-05-10 13:26:33 +02:00
Andrew Kelley
1c0223899c
translate-c: progress on self-hosted function prototypes
...
See #1964
2019-05-10 01:24:00 -04:00
Andrew Kelley
f8b7ea119f
Merge pull request #2461 from LemonBoy/dwarf-leb128
...
Fix minor bug in LEB128 parsing
2019-05-09 20:14:20 -04:00
Andrew Kelley
09cff0d2bd
fix translate-c regression
...
introduced in eb65410b62
2019-05-09 20:11:56 -04:00
LemonBoy
8cc4eaea9f
Use matching types when parsing fields
2019-05-10 00:44:24 +02:00
LemonBoy
4d8f96dd88
Fix minor bug in LEB128 parsing
2019-05-10 00:41:05 +02:00
Andrew Kelley
eea2de108d
translate-c: progress on self-hosted function prototypes
...
See #1964
2019-05-09 16:52:30 -04:00
Andrew Kelley
214625587c
translate-c: use C API for builtin types
...
See #1964
2019-05-09 15:46:48 -04:00
Andrew Kelley
010963ce43
stage1: make some asserts print source location
2019-05-09 14:52:06 -04:00
Andrew Kelley
c459edac18
compile error for attempt to cast enum literal to error
...
closes #2203
2019-05-09 13:18:13 -04:00
Andrew Kelley
72899da44b
fix std.os.copyFile
...
closes #2454
2019-05-09 13:05:06 -04:00
Andrew Kelley
eb65410b62
translate-c: enough C tokenization/parsing to handle shifting in macros
...
See #2451
2019-05-09 12:48:38 -04:00
Andrew Kelley
62065a9aea
translate-c: handle int to ptr and ptr to int casting
...
See #2451
2019-05-09 12:17:23 -04:00
Andrew Kelley
a7346ea49f
fix build on macOS
...
Sadly due to a workaround for LLD linker limitations on macOS
we cannot put libuserland into an .a file; instead we have to use object
files. Again due to linker limitations, bundling compiler_rt.o into
another relocatable object also doesn't work. So we're left with
disabling stack probing on macOS for the stage1 self-hosted code.
These workarounds could all be removed if the macos support in the LLD
linker improved, or if Zig project had its own linker that did not have
these issues.
2019-05-08 22:45:49 -04:00
Andrew Kelley
4b9e12be50
Merge pull request #2452 from LemonBoy/more-more-builtins
...
More more builtins
2019-05-08 22:24:12 -04:00
Andrew Kelley
46e1c34fcf
self-hosted translate-c progress on function decls
...
See #1964
2019-05-08 22:05:59 -04:00
Andrew Kelley
9bbd71c9ab
add --bundle-compiler-rt function to link options
...
and use it when building libuserland.a
The self-hosted part of stage1 relies on zig's compiler-rt, and so we
include it in libuserland.a.
This should potentially be the default, but for now it's behind a linker
option.
self-hosted translate-c: small progress on translating functions.
2019-05-08 20:51:49 -04:00
Andrew Kelley
3bd5c16f39
stage1: remove unneeded extern function
2019-05-08 19:33:57 -04:00
Andrew Kelley
e3542196c0
translate-c: NULL pointers translate to null
...
See #1967
2019-05-08 19:21:54 -04:00
Andrew Kelley
9c12237d2d
std.debug: fix stack trace iteration code
...
Previously, the stack trace iteration code was using the number of
frames collected as the number of frames to print, not recognizing the
fixed size of the buffer. So it would redundantly print items, matching
the total number of frames ever collected.
Now the iteration code is limited to the actual stack trace frame count,
and will not print duplicate frames.
Closes #2447
Closes #2151
2019-05-08 19:11:01 -04:00
Andrew Kelley
a4aee8b24d
C pointers support if and orelse
...
See #1967
2019-05-08 18:47:14 -04:00
LemonBoy
4208fa9ad9
compiler-rt: add __floatsitf
2019-05-09 00:25:50 +02:00
LemonBoy
383b8a032e
compiler-rt: Add __aeabi_unwind_cpp_pr{0,1,2}
2019-05-09 00:07:46 +02:00
LemonBoy
2dce137d92
compiler-rt: Add __extendsfdf2
...
Add AEABI builtin __aeabi_f2d
2019-05-09 00:07:46 +02:00
LemonBoy
2be066d057
compiler-rt: Add __floatdidf
...
Add AEABI builtin __aeabi_l2d
2019-05-08 23:57:09 +02:00
LemonBoy
d4434dfb67
compiler-rt: Add __floatundidf & __floatunsidf
...
Add AEABI builtins __aeabi_ul2d, __aeabi_ui2d
2019-05-08 23:57:09 +02:00
LemonBoy
92fd2df054
compiler-rt: Add __truncdfsf2
...
Add AEABI builtin __aeabi_d2f
2019-05-08 23:57:09 +02:00
Andrew Kelley
0099583bd3
C pointers support .? operator
...
see #1967
2019-05-08 17:39:00 -04:00
LemonBoy
c00167e91a
compiler-rt: More division intrinsics
2019-05-08 22:30:20 +02:00
LemonBoy
917103710e
compiler-rt: Add __floatsidf & __floatsisf
...
Also add their AEABI aliases, __aeabi_i2f & __aeabi_i2d
2019-05-08 22:26:54 +02:00
Andrew Kelley
50bbb34594
C pointers support null
...
See #1967
2019-05-08 16:06:34 -04:00
LemonBoy
be7cacfbbe
Implement stack probes for x86/x86_64
...
Enabled on non-Windows systems only since it already requires stack
probes.
2019-05-08 12:36:54 -04:00
Sahnvour
d665948dcf
Duplicate windows's DirectAllocator as HeapAllocator, which it is in reality.
2019-05-08 18:19:36 +02:00
Marc Tiehuis
24ee765318
Merge pull request #2448 from markfirmware/patch-1
...
Update README.md
2019-05-08 23:32:49 +12:00
markfirmware
b083ef18e3
Update README.md
2019-05-08 05:11:21 -04:00
Andrew Kelley
9c0596e627
Merge pull request #2427 from LemonBoy/linux-tls
...
Proper support for TLS on linux
2019-05-07 12:26:26 -04:00
Andrew Kelley
097a62555e
Merge pull request #2439 from LemonBoy/fixes-fixes-fixes
...
A batch of miscellaneous fixes
2019-05-07 12:26:02 -04:00
LemonBoy
043bd71621
Add ARCH_SET_* definitions for x86_64
2019-05-07 13:19:38 +02:00
LemonBoy
b1db696c10
Less error messages
...
Decrease the overall size of the binary, programming errors are caught
with unreachable.
2019-05-07 13:09:20 +02:00
LemonBoy
2f041239cb
Always initialize the TLS
2019-05-07 13:09:20 +02:00
LemonBoy
cfcf02489d
std: Implement on-demand TLS allocation
2019-05-07 13:09:19 +02:00
LemonBoy
d8ab301aa8
std: Implement TLS support for Linux
...
Tested on x86_64, i386, ARM, AARCH64
2019-05-07 13:09:18 +02:00
LemonBoy
4ab7b459df
Avoid endless recursion in __extendhfsf2
...
On some platforms the conversion ended up creating a dangerous recursive
loop that ate all the stack.
The conversion to f16 is also pointless since we're operating on the raw
bits anyway.
2019-05-07 11:47:23 +02:00
LemonBoy
94b504c9e4
Fix float comparison result in __aeabi_{f,d}cmp*
2019-05-07 11:47:23 +02:00
LemonBoy
a3beda27fc
Add missing cast to usize
2019-05-07 11:47:23 +02:00
Andrew Kelley
7432fb04d6
Merge pull request #2354 from LemonBoy/iterate_phdr_impl
...
dl_iterate_phdr implementation
2019-05-06 15:48:37 -04:00
LemonBoy
939ec878a0
Fix edge case in addXf3
...
The operands may be zero, use the wrapping operators and avoid a
spurious integer-overflow error.
2019-05-06 21:41:08 +02:00
LemonBoy
60242e96df
Fix definition of epoll_* struct on non x86_64 arches
2019-05-06 21:39:02 +02:00
Shawn Landden
d1f9b8184d
docs for @hasField
2019-05-06 11:58:04 -05:00
Shawn Landden
c19bdc2d37
stage1: add @hasField() built-in
...
This was quite straight-forward
Closes : #1439
2019-05-06 11:52:47 -05:00
LemonBoy
a095db0df7
Add a test case
2019-05-06 18:30:49 +02:00
Andrew Kelley
7a41af2632
Merge pull request #2422 from tgschultz/stdlib-packed-int-array
...
Added PackedIntArray, PackedIntSlice to std
2019-05-05 15:25:17 -04:00
LemonBoy
07dfccf967
Review
2019-05-05 13:00:20 +02:00
Andrew Kelley
5d347c01cf
Merge pull request #2374 from LemonBoy/fileszoff-reform
...
Make io offsets/sizes u64 instead of usize
2019-05-04 15:20:42 -04:00
Andrew Kelley
6a34da963b
Merge branch 'LemonBoy-stdlib-32b'
2019-05-04 15:19:14 -04:00
Andrew Kelley
09cbcf8841
std lib sleep APIs: add doc comments and no @intCast
...
The sleep APIs are now documented as having spurious wakeups and no
precision of timing guaranteed. They also cannot fail. This commit makes
the entire range of u64 legal values to pass to std.os.time.sleep and
std.os.time.posixSleep. Values that do not fit in the native system APIs
will cause a sleep for the longest possible duration and then be handled
as a spurious wakeup.
2019-05-04 15:16:39 -04:00
Andrew Kelley
70a9ee3dd6
Merge branch 'stdlib-32b' of https://github.com/LemonBoy/zig into LemonBoy-stdlib-32b
2019-05-04 14:46:35 -04:00
Andrew Kelley
6f0aa801c8
Merge pull request #2404 from squeek502/hash-map-ensure-cap
...
std.HashMap: add public ensureCapacity fn
2019-05-04 14:13:18 -04:00
Andrew Kelley
21c8d57fca
Merge pull request #2326 from daurnimator/sendmmsg
...
Add sendmmsg syscall wrapper
2019-05-04 14:05:55 -04:00
tgschultz
14a00d3825
zig fmt
2019-05-04 16:19:26 +00:00
tgschultz
8c28b59605
Added ability to specify endianess of PackedInt(Array/Slice)
2019-05-04 16:17:12 +00:00
tgschultz
27ed525e03
zig fmt
2019-05-04 13:31:53 +00:00
LemonBoy
98bc2b73bf
Implement failsafe logic for posixSleep
...
Now we'll sleep for the specified amount of time even though the number
of seconds doesn't fit in a `isize` field.
2019-05-04 09:03:01 +02:00
LemonBoy
b612512bb5
std: Remove some assumptions about the host platform
...
The stdlib is now 32-bit friendly.
2019-05-04 08:44:26 +02:00
Ryan Liptak
cf8dde2d68
std.HashMap: cleanup ensureCapacity + add test
...
- Cleaned up some comments
- Removed the "is power of two" check from optimizedCapacity since the * 5 / 3 is unlikely to end up with a power of two, so it's a wasted check the majority of the time
- Made ensureCapacity/ensureCapacityExact increment the modification count if they resize the hash map so that we can catch resizes while iterating, which would likely break the iterator state
2019-05-03 21:15:00 -07:00
tgschultz
4dfd1f54db
Ugh. I updated these but forgot to git add.
2019-05-04 03:08:33 +00:00
tgschultz
7dc71cdc4a
and again
2019-05-04 02:39:55 +00:00
tgschultz
3e3bdd577c
Fixed some comments
2019-05-04 02:38:16 +00:00
tgschultz
e2fd37e75b
Added PackedIntArray, PackedIntSlice to std
2019-05-04 00:28:51 +00:00
Shritesh Bhattarai
f4798297de
wasi: Implement read and write with err checking
2019-05-03 17:35:42 -04:00
LemonBoy
2f3b461703
compiler-rt: Add __modsi3, __umodsi3
2019-05-03 17:12:33 -04:00
LemonBoy
1be4e87f0b
compiler-rt: Add __moddi3, __divdi3
2019-05-03 17:12:33 -04:00
LemonBoy
077216b582
Address the comments of the first review round
2019-05-03 22:42:45 +02:00
Andrew Kelley
584dd2863a
Merge pull request #2409 from shritesh/wasi_native
...
WASI std: implement native os.exit and os.abort
2019-05-03 16:24:00 -04:00
Shritesh Bhattarai
f86b8e4535
WasmAllocator: compileError on non-wasm arch
2019-05-03 16:21:33 -04:00
Shritesh Bhattarai
2f39da7cdd
docgen: show -target command line argument
2019-05-03 15:56:33 -04:00
Shritesh Bhattarai
5c04c22bcc
docgen: support wasm and wasi
2019-05-03 15:56:33 -04:00
Andrew Kelley
f6937db7d6
remove redundant information from README
2019-05-03 14:48:56 -04:00
Andrew Kelley
bd9c629c4c
always respect threadlocal for variables with external linkage
...
Previously if you had, for example:
extern "c" threadlocal var errno: c_int;
This would turn errno into a normal variable for --single-threaded
builds. However for variables with external linkage, there is an ABI
to uphold.
This is needed to make errno work for DragonFly BSD. See #2381 .
2019-05-03 14:39:54 -04:00
Andrew Kelley
8cda4fd73a
docs: remove @setGlobalLinkage section
...
`@setGlobalLinkage` was removed with #462 . The not-yet-implemented
proposal for external weak symbols is #1917 .
2019-05-03 13:38:24 -04:00
Benjamin Feng
8d58dc715b
Switch wasm export-all to only values marked exports
2019-05-03 13:23:02 -04:00
daurnimator
fca3e3a73f
std: add std.ArrayList.orderedRemove
2019-05-03 01:54:49 -04:00
Andrew Kelley
3552180143
optimize @memset with undefined
...
When using `@memset` to set bytes to `undefined`, Zig notices this
case and does a single Valgrind client request rather than N.
Speeds up all allocators in safe modes.
Closes #2388
2019-05-03 01:25:03 -04:00
Ryan Liptak
13a7b8586a
std.HashMap: make ensureCapacityExact private
2019-05-02 17:43:51 -07:00
Ryan Liptak
26591d4f22
std.HashMap: add putAssumeCapacity fn
2019-05-02 17:42:38 -07:00
Ryan Liptak
4d42275d03
std.HashMap: make ensureCapacity optimize for the expected count, add ensureCapacityExact
2019-05-02 17:01:30 -07:00
Shritesh Bhattarai
a530a111a5
wasi: remove posix-y exit
2019-05-02 11:33:10 -05:00
Shritesh Bhattarai
84682eb862
wasi: implement os.exit
2019-05-02 11:26:33 -05:00
Shritesh Bhattarai
6fb677c4f6
wasi: native os.abort
2019-05-02 11:25:25 -05:00
Andrew Kelley
f8117a0799
docs: update for shared libraries
2019-05-02 12:00:16 -04:00
Ryan Liptak
0afa2d040a
make std.HashMap.ensureCapacity round up to the nearest power of two
2019-05-02 00:58:26 -07:00
Marc Tiehuis
f950ec0c16
Merge pull request #2397 from ziglang/std.math
...
Review std/math and update documentation
2019-05-02 19:05:26 +12:00
Marc Tiehuis
3370e60dd9
std.math: Correct math.nan usage in cos
2019-05-02 19:03:49 +12:00
Ryan Liptak
8b7c59a414
std.HashMap: add public ensureCapacity fn
2019-05-01 23:46:52 -07:00
Dong-hee Na
c00c18de6a
main: change --enable-pic and --disable-pic to -fPIC and -fno-PIC
2019-05-01 16:11:08 -04:00
Andrew Kelley
6e4f69a54a
docgen: add exe_build_err tag
2019-05-01 15:34:36 -04:00
Andrew Kelley
54a93e5393
docs: add note to @setRuntimeSafety
2019-05-01 15:09:03 -04:00
Marc Tiehuis
40fe6afdad
Don't install zig_cpp lib for stage2 target
...
Missed in last commit. See #2220 .
2019-05-01 21:01:34 +12:00
Marc Tiehuis
89d71a960b
std.math: Add documentation for all functions and algorithm sources
2019-05-01 18:37:46 +12:00
Marc Tiehuis
f94964cd05
std.math: Add upstream changes/fixes and simplify go derived code
...
This also starts the documentation effort for the math/ subdirectory.
The intent is to use this as a somewhat representative test-case for any
work on the documentation generator.
2019-05-01 18:13:33 +12:00
Shritesh Bhattarai
7bbc8eb16c
wasi: import all core exports
2019-04-30 23:53:17 -04:00
Shritesh Bhattarai
f53abf4063
wasi: import all constants and their types
2019-04-30 22:58:41 -04:00
Andrew Kelley
bb0c5f7a2f
Merge pull request #2392 from shritesh/wasi_clock
...
wasi: implement timestamp
2019-04-30 21:52:26 -04:00
Shritesh Bhattarai
d395ed2d40
wasi: implement timestamp
2019-04-30 20:43:43 -05:00
Shritesh Bhattarai
0ce05fa621
wasi: import clock and timestamp function/types
2019-04-30 20:06:39 -05:00
Shritesh Bhattarai
1fabd6bbf3
wasi: implement getRandomBytes
2019-04-30 20:50:41 -04:00
Andrew Kelley
79a139ac63
Merge pull request #2390 from shritesh/wasi_env
...
wasi: add getEnvMap
2019-04-30 19:52:20 -04:00
Shritesh Bhattarai
0a693b70e4
wasi: use mem.separate instead
2019-04-30 18:43:43 -05:00
Shritesh Bhattarai
20458f56d8
wasi: add getEnvMap
2019-04-30 18:18:20 -05:00
Shritesh Bhattarai
8e700bf92a
wasi: import environ_get and environ_sizes_get
2019-04-30 16:35:27 -05:00
Andrew Kelley
9dfd24a334
add test case to cover solved bug
...
closes #2114
2019-04-30 14:17:16 -04:00
Marc Tiehuis
81767a658d
Don't install stage2 artifacts
...
Fixes #2220 .
2019-04-30 12:13:41 -04:00
Andrew Kelley
b4f8d68e2e
translate-c: fix using wrong enum
...
closes #2385
2019-04-30 03:14:45 -04:00
daurnimator
fd056752da
std: add sendmmsg on linux
2019-04-30 16:47:09 +10:00
Andrew Kelley
a7f99c8ee9
self-hosted translate-c: iterate over top level decls
...
See #1964
2019-04-30 00:21:45 -04:00
Shritesh Bhattarai
01365be82f
WASI: implement argsAlloc and argsFree ( #2364 )
...
* wasi: change URL to canon WASI-core.md
* wasi: import args_get and args_sizes_get
* wasi: Implement argsAlloc and argsFree
* test return value for wasi arg syscalls
* wasi: return unexpectedErrorPosix in argsAlloc
* wasi: Add TODO for ArgIterator
2019-04-29 21:54:30 -04:00
LemonBoy
77383f968d
translate-c: Emit @ptrCast + @alignPtr sequence
...
Avoid producing Zig code that doesn't compile due to mismatched
alignments between pointers.
Always emit a @alignOf instead of hardcoding the alignment value
returned by LLVM for portability sake of the generated code.
2019-04-29 21:30:19 -04:00
LemonBoy
b1a61a6d51
compiler-rt: Add __mulodi4
2019-04-29 18:55:20 -04:00
Andrew Kelley
d2328ac71a
Merge pull request #2372 from LemonBoy/aeabi_idiv
...
compiler-rt: Add __divsi3, __aeabi_idiv
2019-04-29 18:54:21 -04:00
Andrew Kelley
75d42ace31
Merge branch 'squeek502-readme-std-lib'
2019-04-29 18:25:49 -04:00
Andrew Kelley
360ab8310b
readme: expand Developing Zig section into Contributing section
2019-04-29 18:25:27 -04:00
Andrew Kelley
fe80c15c4b
Merge branch 'readme-std-lib' of https://github.com/squeek502/zig into squeek502-readme-std-lib
2019-04-29 17:38:03 -04:00
Matt Stancliff
a4e506510b
Fix crash due to command line argument parsing
...
zig --help -> ok
zig --help --c-source -> ok
zig --c-source --help -> crash [fixed]
'i' was being incremented without regard for the 'argc' limit, so
we were running off the end of 'argv'.
2019-04-29 17:34:23 -04:00
Andrew Kelley
e3452ba21b
json tests do not need this prefix anymore
2019-04-29 14:04:31 -04:00
Andrew Kelley
da28811c50
enable more json tests
...
I think it was a mistake that these weren't getting automatically run by
the test suite.
2019-04-29 14:02:19 -04:00
Andrew Kelley
4b6f350369
DirectAllocator: move if > 0 condition above @memcpy
...
Minor improvement to 3c13aa17 as noted by daurnimator
2019-04-29 13:48:15 -04:00
Shawn Landden
3c13aa178b
std.heap: do not excessively call mmap, and munmap in direct allocator
2019-04-29 13:47:24 -04:00
Andrew Kelley
8afa1e800b
fix build (unused function warning)
...
d3c88a89 needed some #ifdefs shuffled around
2019-04-29 13:18:16 -04:00
LemonBoy
4e241263ff
compiler-rt: Add __divmodsi4, __aeabi_idivmod
2019-04-29 19:17:48 +02:00
LemonBoy
738562e990
compiler-rt: Add __divsi3, __aeabi_idiv
2019-04-29 19:17:48 +02:00
Andrew Kelley
d3c88a8949
Merge pull request #2139 from emekoi/lib-on-mingw
...
implement linking to libc on mingw
2019-04-29 13:16:41 -04:00
LemonBoy
9902b604cb
Fix generation of container initializers
...
The code creates temporary ConstExprValue with global_refs set to
nullptr and that's carried over to the final value. Doing so prevents
the deduplication mechanism to work correctly, causing all sorts of
runtime crashes.
Fixes #1636
Fixes #1608 (Even though it was already fixed by #1991 )
2019-04-28 13:13:42 -04:00
LemonBoy
fbcc559cdb
Make io offsets/sizes u64 instead of usize
...
Decouple the concepts of address-space size and file size.
Closes #637
2019-04-28 18:07:40 +02:00
emekoi
6057513cc7
fixed visibility of zig_libc_cc_print_file_name
2019-04-27 16:17:07 -05:00
Ryan Liptak
205e501e42
std.fmt: add max_depth to avoid infinite recursion from self-references
2019-04-27 11:20:10 -04:00
daurnimator
bc1840e18f
Revert "std: Add mem.nativeIntToBig and mem.nativeIntToLittle"
...
This reverts commit 211f0a2226 .
The functions `mem.nativeToBig` and `mem.nativeToLittle` already existed.
2019-04-27 11:18:53 -04:00
emekoi
66f3ef06e8
fixed syntax error
2019-04-27 11:16:33 -04:00
daurnimator
ad7927a748
std: add LoggingAllocator prototype
2019-04-27 15:36:53 +10:00
emekoi
dfada0cc77
added static_crt_dir to libc file
2019-04-27 00:24:26 -05:00
Shritesh Bhattarai
d02489fd9a
fix missing semicolon
2019-04-26 21:01:20 -04:00
Andrew Kelley
2d6520d5d4
zig fmt is built directly into stage1 rather than child process
...
Previously, `zig fmt` on the stage1 compiler (which is what we currently
ship) would perform what equates to `zig run std/special/fmt_runner.zig`
Now, `zig fmt` is implemented with the hybrid zig/C++ strategy outlined
by #1964 .
This means Zig no longer has to ship some of the stage2 .zig files, and
there is no longer a delay when running `zig fmt` for the first time.
2019-04-26 20:46:28 -04:00
Andrew Kelley
ac3946620c
Merge pull request #2357 from squeek502/heap-shrink-large-align
...
DirectAllocator: reduce the amount of redundant memcpy calls on Windows
2019-04-26 19:34:24 -04:00
Shritesh Bhattarai
efc5122fb6
docgen: properly close tags for skipped execs
2019-04-26 19:33:33 -04:00
Ryan Liptak
6936f0514f
readme: Fix filepath to test file when testing std lib changes
2019-04-26 14:14:48 -07:00
Andrew Kelley
28071ac637
self-hosted translate-c emits a hello world AST
...
Also breaking std lib API change: the return value of
std.zig.parse returns `*ast.Tree` rather than `ast.Tree`.
See #1964
2019-04-26 15:43:36 -04:00
Andrew Kelley
c82acdbb9e
clean up test output
...
After 4df2f3d74f test names have the word "test" in them so the
redundant word is removed from test runner. Also move the prefix/suffix
to where it logically belongs in the fully qualified symbol name.
2019-04-26 15:10:13 -04:00
Andrew Kelley
1d95fdaf6e
Fix path canonicalization when $HOME has a trailing slash
2019-04-26 14:37:26 -04:00
LemonBoy
9ec4ccc68f
Do not invoke UB in BigInt shr operations
...
Shifting a value of type T by an amount that's greater or equal to the
size of the type itself is UB.
Spotted by @tgschultz
2019-04-26 14:24:35 -04:00
rylmovuk
4df2f3d74f
Change symbol name of tests in codegen
...
Tests now have the symbol name of the format `test "<name>"` in order
to be more easily distinguished from functions with similar names.
See issue #2267 .
2019-04-26 14:23:56 -04:00
Ryan Liptak
afc33f00ee
heap: fixup style of realloc memory copies
2019-04-25 13:41:19 -07:00
Ryan Liptak
57f545eed8
std.heap.DirectAllocator: reduce the amount of redundant memcpy calls on Windows
...
Previously the memory would be copied to a different aligned address in some cases where the old offset could have been used. This fixes it so that it will always try to use the old offset when possible, and only uses a different offset if the old one is truly invalid (not aligned or not enough space to store the alloc at the old offset).
2019-04-25 13:35:45 -07:00
Andrew Kelley
92d9cef071
Merge pull request #2332 from ziglang/translate-c-userland
...
beginnings of implementing translate-c in userland
2019-04-25 08:35:28 -04:00
Andrew Kelley
17ffe166c2
add preliminary windows support to std.io.COutStream
2019-04-25 00:24:25 -04:00
Andrew Kelley
e1bf74fca3
translate-c: put -x c back in there, it's necessary
2019-04-25 00:06:58 -04:00
Andrew Kelley
535d419590
translate-c: self-hosted implementation can detect C errors
...
See #1964
2019-04-25 00:06:58 -04:00
Andrew Kelley
712274997e
translate-c: unify API for self-hosted and C++ translate-c
...
See #1964
2019-04-25 00:06:57 -04:00
Andrew Kelley
976080462c
translate-c: a little closer to self-hosted implementation
2019-04-25 00:06:54 -04:00
Andrew Kelley
56e07622c6
Merge pull request #2312 from squeek502/heap-shrink-large-align
...
fix heap allocators when shrinking an object but growing its alignment
2019-04-24 23:44:28 -04:00
Shawn Landden
8ef7f6febb
remove Shebang (#!) support
...
Closes: #2165
2019-04-24 23:34:19 -04:00
Andrew Kelley
fb2acaff06
@sizeOf returns 0 for comptime types
...
This defines `@sizeOf` to be the runtime size of a type, which means
that it is zero for types such as comptime_int, type, and (enum
literal).
See #2209
2019-04-24 22:31:53 -04:00
vegecode
733c547a65
compiler-rt: Add missing import of test for comparesf2
2019-04-24 21:16:03 -04:00
vegecode
01168e1577
compiler-rt: add aeabi_dcmp, comparedf2
2019-04-24 21:15:39 -04:00
LemonBoy
e4825dbd77
Other
2019-04-24 20:54:17 +02:00
LemonBoy
12eff09ff4
Expose Elf32_Dyn and Elf64_Dyn
2019-04-24 20:54:05 +02:00
LemonBoy
074ddf1ac6
Implementation of dl_phdr_info
2019-04-24 20:53:46 +02:00
Andrew Kelley
ad994c9642
Merge pull request #2296 from LemonBoy/translate-c-stuff
...
Handle implicit casts in translate-c
2019-04-24 14:43:46 -04:00
Wink Saville
7bafe2e490
Fix alignment of macro FIND_AND_ADD_CLANG_LIB
2019-04-24 14:42:08 -04:00
hryx
06bf918436
Sync grammar with spec
...
- Remove rule LabeledExpr
- Add rule CurlySuffixExpr
2019-04-24 14:38:56 -04:00
Michael Dusan
5de934810f
add -fvisibility-inlines-hidden
...
On macOS building with Xcode/clang the linker complains loudly when
symbol visibility is inconsistent. This option syncs visibilty setting
of both LLVM and Zig.
2019-04-24 14:37:14 -04:00
Andrew Kelley
ed41955522
build libuserland in cross compilation mode
...
Previously libuserland was being built for the native target,
which could depend on native CPU features such as AVX. The
CI infrastructure is intending to create binaries that are
widely compatible and do not make use of specific CPU features.
There could be something to gain from enabling native CPU features
sometimes, by introducing a new cmake configuration option, but
since it's planned to eventually ship self-hosted rather than stage1,
I don't think it really matters.
closes #2348
2019-04-24 14:13:55 -04:00
Jimmi Holst Christensen
e4a86d4653
Merge pull request #2351 from ziglang/fixed-2346
...
fixes #2346
2019-04-24 18:42:55 +02:00
Jimmi HC
1a2e02e267
fixed #2356
...
const_ptr_pointee_unchecked did not take into account that if the
pointer is zero sized, then const_val->data.x_ptr.special would be
ConstPtrSpecialInvalid. This commit fixes this by also checking
that the child type of the pointer only have one possible value
and just returns that value.
2019-04-24 15:04:58 +02:00
Jimmi Holst Christensen
e553ade090
Merge pull request #2335 from hryx/no-tag-expr-for-struct
...
Allow tag expr for enum but not struct
2019-04-24 14:53:54 +02:00
Andrew Kelley
3bc361178c
Merge pull request #2344 from LemonBoy/dbg-things
...
Minor debug things
2019-04-23 10:15:53 -04:00
LemonBoy
374d16793f
Go one instruction before the return address
...
The return address may not point to an area covered by the debug infos
so we hope for the best and decrement the address so that it points to
the caller instruction.
2019-04-23 10:05:46 +02:00
LemonBoy
b095e33667
Fix silly typo
2019-04-23 09:57:57 +02:00
LemonBoy
57ec183c09
Fix reading of signed leb128 values
2019-04-23 09:57:22 +02:00
LemonBoy
70c2e86da3
Add translation from pointer to boolean
2019-04-22 22:23:41 +02:00
LemonBoy
a44ad08954
Add some zig_panic for 80-bit float codepaths
2019-04-22 22:23:41 +02:00
LemonBoy
9ea600b634
Correct rendering of AST Char literals
2019-04-22 22:23:41 +02:00
LemonBoy
8d05330cf7
More precise translation of char literals
2019-04-22 22:23:41 +02:00
LemonBoy
ab424bbb35
translate-c: Add test for implicit casts
2019-04-22 22:23:41 +02:00
LemonBoy
69bc5fd04d
translate-c: Pointer to/from integral conversion
2019-04-22 22:16:30 +02:00
LemonBoy
d3dd49c403
translate-c: Support for integer to boolean conversions
2019-04-22 22:16:29 +02:00
Ryan Liptak
8ce130de3c
Bump up FixedBufferAllocator test memory to account for new tests
2019-04-22 02:25:57 -07:00
Ryan Liptak
b3598163df
std.heap.DirectAllocator: Fix aligned reallocs on Windows
2019-04-22 02:20:01 -07:00
hryx
5765cbd2de
Allow tag expr for enum but not struct
2019-04-22 00:14:51 -07:00
Ryan Liptak
af7daae26b
readme: Simplify instructions for making changes to the standard library
2019-04-21 21:53:35 -07:00
Ryan Liptak
e64c0dee35
readme: Add instructions for making changes to the standard library
...
Closes #2324
2019-04-21 15:21:19 -07:00
emekoi
0f8fc3b924
fixed stack protector issues
2019-04-21 14:13:48 -04:00
daurnimator
211f0a2226
std: Add mem.nativeIntToBig and mem.nativeIntToLittle
...
To be used where `htons`, `htonl`, etc. would be used in C.
It's useful to have a function that returns a number directly for use in initialisers.
2019-04-21 14:04:01 -04:00
daurnimator
217b95da31
std: add msghdr_const
...
As `iovec_const` is to `iovec`, `msghdr_const` is to `msghdr`
2019-04-21 21:53:24 +10:00
daurnimator
9babcac7a6
std: improve msghdr definition
2019-04-21 21:50:48 +10:00
Ryan Liptak
66020856b2
fix heap allocators when shrinking an object but growing its alignment
2019-04-20 23:56:39 -07:00
vegecode
bb25f212b3
compiler-rt: add aeabi_fcmp, comparesf2
2019-04-21 00:12:21 -04:00
tgschultz
22f5e5fd3e
Fixes DirectAllocator Windows implementation to call HeapFree when new_size == 0
2019-04-20 14:04:09 -04:00
Andrew Kelley
b864fe7e23
Merge branch 'LemonBoy-dwarfy'
2019-04-20 13:49:02 -04:00
Andrew Kelley
9b83fe6b4c
fixup and zig fmt
2019-04-20 13:48:38 -04:00
Andrew Kelley
907a7068ce
Merge branch 'dwarfy' of https://github.com/LemonBoy/zig into LemonBoy-dwarfy
2019-04-20 13:32:59 -04:00
LemonBoy
c2542bb7b7
Recover symbol infos from DWARF sections
2019-04-20 10:35:39 +02:00
Ryan Liptak
1030cc97ca
fix DirectAllocator not unmapping unused pages on large alignments
...
Fixes #2306
2019-04-20 02:21:42 -04:00
emekoi
f4c5fa7ff4
renamed add_gnu_link_args
2019-04-20 00:12:33 -05:00
Raul Leal
d44d2784e6
zig-fmt: allow comptime blocks in containers ( #2308 )
...
* zig-fmt: allow comptime blocks in containers
* add test for comptime block in container
2019-04-19 15:27:42 -04:00
LemonBoy
0286be127e
Fix parseFormValueConstant
...
Signed/unsigned confusion made the code fail an assertion sometimes.
2019-04-19 19:59:14 +02:00
LemonBoy
19b8278f91
translate-c: Convert char literals
2019-04-19 11:50:30 +02:00
LemonBoy
6d95c5d15c
translate-c: Parse float/double literals
2019-04-19 11:50:30 +02:00
LemonBoy
1fda44cbc8
translate-c: support conversion to/from fp types
2019-04-19 11:50:30 +02:00
Matt Stancliff
3b6a4fe4cd
Fix test in langref to assert against modified var
2019-04-18 16:14:30 -04:00
Andrew Kelley
a10a1efc83
ci: fix accidentally shipping zig0.exe
2019-04-17 20:27:13 -04:00
Andrew Kelley
ff3cdbc3a0
stage1 assertions always on, and have stack traces
2019-04-17 15:58:20 -04:00
Andrew Kelley
4ad7d09ba5
build: rename zig1 to zig0 to avoid confusion with stage1
2019-04-17 14:09:18 -04:00
Andrew Kelley
bc2d60c11f
Merge pull request #2295 from ziglang/stage1-hybrid
...
stage1 is now a hybrid of C++ and Zig
2019-04-17 00:24:51 -04:00
Andrew Kelley
da8403bcdd
build.zig: libuserland expects to against libc
2019-04-16 19:13:46 -04:00
Andrew Kelley
89763c9a0d
stage1 is now a hybrid of C++ and Zig
...
This modifies the build process of Zig to put all of the source files
into libcompiler.a, except main.cpp and userland.cpp.
Next, the build process links main.cpp, userland.cpp, and libcompiler.a
into zig1. userland.cpp is a shim for functions that will later be
replaced with self-hosted implementations.
Next, the build process uses zig1 to build src-self-hosted/stage1.zig
into libuserland.a, which does not depend on any of the things that
are shimmed in userland.cpp, such as translate-c.
Finally, the build process re-links main.cpp and libcompiler.a, except
with libuserland.a instead of userland.cpp. Now the shims are replaced
with .zig code. This provides all of the Zig standard library to the
stage1 C++ compiler, and enables us to move certain things to userland,
such as translate-c.
As a proof of concept I have made the `zig zen` command use text defined
in userland. I added `zig translate-c-2` which is a work-in-progress
reimplementation of translate-c in userland, which currently calls
`std.debug.panic("unimplemented")` and you can see the stack trace makes
it all the way back into the C++ main() function (Thanks LemonBoy for
improving that!).
This could potentially let us move other things into userland, such as
hashing algorithms, the entire cache system, .d file parsing, pretty
much anything that libuserland.a itself doesn't need to depend on.
This can also let us have `zig fmt` in stage1 without the overhead
of child process execution, and without the initial compilation delay
before it gets cached.
See #1964
2019-04-16 19:12:20 -04:00
Andrew Kelley
4c03746926
Revert "DirectAllocator: on windows, use HeapFree instead of HeapReAlloc to free memory."
...
This reverts commit 71bb8cd537 .
This broke the CI on Windows.
2019-04-16 19:11:37 -04:00
Andrew Kelley
b29241fc08
docs: update intro text
2019-04-16 14:23:58 -04:00
Michael Dusan
611d4bc6a1
stage1: const_values_equal support tagged union
2019-04-16 13:55:23 -04:00
Andrew Kelley
52caf311bb
Merge pull request #2286 from shritesh/wasm_alloc
...
WasmAllocator: WebAssembly Memory Allocator
2019-04-16 13:27:56 -04:00
Shritesh Bhattarai
0c28a18d96
WasmAllocator: cleanup
2019-04-16 12:23:45 -05:00
Sahnvour
71bb8cd537
DirectAllocator: on windows, use HeapFree instead of HeapReAlloc to free memory.
2019-04-16 13:18:21 -04:00
Andrew Kelley
4e2f6ebf39
freestanding target adds -ffrestanding to cc parameters
...
closes #2287
2019-04-16 12:06:14 -04:00
Andrew Kelley
3226b5315e
translate-c: move some code to the C API
...
See #1964
2019-04-16 04:32:48 -04:00
Andrew Kelley
f488f3fd03
remove workaround for LLD bug
...
Zig's embedded LLD now has a patch to resolve the deadlock race
condition, and the patch is getting upstreamed too, so this
closes #2283 .
2019-04-16 03:58:15 -04:00
Andrew Kelley
c8b60538ed
add patch to LLD to fix deadlock race condition in wasm linker
...
Patch is getting upstreamed here: https://reviews.llvm.org/D60757
And so this patch can be removed with LLVM 9.0.0.
2019-04-16 03:56:46 -04:00
Shritesh Bhattarai
4235982fe6
fmt wasm_allocator
2019-04-16 01:42:11 -05:00
Shritesh Bhattarai
aa3f31ac0a
wasm: add WasmAllocator
2019-04-16 01:40:16 -05:00
Shritesh Bhattarai
f2119f9961
wasm: WasmAllocator that uses fixed 64kb pages
2019-04-15 21:21:46 -05:00
Andrew Kelley
0a280b6062
update std.os.page_size for WebAssembly
2019-04-15 21:20:41 -04:00
Andrew Kelley
6692cbbe18
disable threads when linking WebAssembly to work around an LLD bug
...
See #2283
2019-04-15 20:41:50 -04:00
Andrew Kelley
579dd74114
fix Debug mode when error return tracing is off
...
Previously the code for generating a panic crash expected
one of the parameters to be the error return trace. Now
it does not expect that parameter when g->have_err_ret_tracing
is false.
Closes #2276
2019-04-15 20:17:06 -04:00
Shritesh Bhattarai
f5d84250a3
wasi: switch to "standard" wasi_unstable module fn
2019-04-15 18:44:33 -04:00
Andrew Kelley
3b8a85c941
Merge pull request #2281 from shritesh/wasm_module
...
Support wasm module imports
2019-04-15 18:05:46 -04:00
Shritesh Bhattarai
a0d2185199
wasm: add wasm-import-module attr to extern
2019-04-15 17:00:04 -05:00
Shritesh Bhattarai
9465c6d538
link: exemption for wasm instead of wasi
2019-04-15 16:59:34 -05:00
Andrew Kelley
5cb18e9c6f
translate-c: move some code to the C API
...
See #1964
2019-04-15 00:32:27 -04:00
Shritesh Bhattarai
cc8cf94cb2
Update wasm tiers ( #2272 )
...
* tier update: wasm32=2, wasm64=4
2019-04-14 11:29:22 -04:00
Andrew Kelley
27253f09b6
organize how the single threaded option is passed around
2019-04-14 11:01:01 -04:00
Andrew Kelley
63a970a548
Merge pull request #2268 from shritesh/wasi
...
wasm: preliminary WASI OS support
2019-04-14 10:45:30 -04:00
Shritesh Bhattarai
0f1d92e2cf
wasm: force single threaded
2019-04-14 10:21:48 -04:00
Shritesh Bhattarai
94e0871603
wasi: don't pass --no-entry to linker
2019-04-14 00:03:32 -05:00
Shritesh Bhattarai
ecd0f89254
wasi: better extern wasi logic
2019-04-13 23:49:02 -05:00
Shritesh Bhattarai
93d43d4529
wasi: add std/os/wasi{,/core}.zig to CMakeLists.txt
2019-04-13 22:51:18 -05:00
Shritesh Bhattarai
22960a5fdf
wasi: better comments
2019-04-13 22:45:31 -05:00
Shritesh Bhattarai
a2d8f03092
support extern "wasi" functions
2019-04-13 22:28:58 -05:00
Shritesh Bhattarai
93528be6b1
wasi: sigabrt at panic
2019-04-13 21:54:50 -05:00
Shritesh Bhattarai
fe9cd0b4bc
wasi: use __wasi_proc_exit instead of posix.exit
2019-04-13 21:36:53 -05:00
Andrew Kelley
68d7e4a1b6
better handle quota of setEvalBranchQuota
...
Now that c58b802034 has removed
the "top of the comptime stack" requirement, the branch quota
can be modified somewhere other than the top of the comptime stack.
This means that the quota of a parent IrExecutable has to be
modifiable by an instruction in the child.
Closes #2261
2019-04-13 16:55:59 -04:00
Duncan
a43fd7a550
Add favicon to langref.html
2019-04-13 16:20:33 -04:00
Andrew Kelley
4a2ccd6fb8
Merge pull request #2266 from bnoordhuis/fix-cache-lseek-ebadf
...
don't close cache manifest file prematurely
2019-04-13 16:17:12 -04:00
Shritesh Bhattarai
72bcd5a4a5
WIP: hello world
2019-04-13 15:15:39 -05:00
Ben Noordhuis
93e89b3b7e
don't close cache manifest file prematurely
...
ErrorInvalidFormat is not a fatal error so don't close the cache
manifest file right away but instead let cache_final() handle it.
Fixes the following (very common) warning when running the test suite:
Warning: Unable to write cache file [..]: unexpected seek failure
The seek failure is an lseek() system call that failed with EBADF
because the file descriptor had already been closed.
2019-04-13 12:33:29 +02:00
Ben Noordhuis
ea5518f69e
make os_file_close poison file handle after close
...
This helps track down use-after-close bugs.
2019-04-13 12:31:49 +02:00
Andrew Kelley
9d229791c6
translate-c: move some code to the C API
...
See #1964
2019-04-12 14:39:12 -04:00
Shritesh Bhattarai
63f2e96eea
wasm: use .wasm ext for exe
2019-04-12 13:17:59 -04:00
Andrew Kelley
6284a4c534
translate-c: move some code to the C API
...
See #1964
2019-04-12 03:56:38 -04:00
Andrew Kelley
f860493f23
translate-c: move some code to the C API
...
See #1964
2019-04-12 03:12:22 -04:00
Andrew Kelley
6f34d08aed
translate-c: move some code to the C API
...
See #1964
2019-04-11 23:38:41 -04:00
Shritesh Bhattarai
5f8dbcac06
wasm: disable error ret tracing
2019-04-11 16:37:40 -04:00
Andrew Kelley
b960f1d922
translate-c: move some code to the C API
...
See #1964
2019-04-11 15:33:26 -04:00
Andrew Kelley
4172fe986e
readme: separate powerpc 32 and 64 bit in the support table
2019-04-11 15:22:15 -04:00
Andrew Kelley
3ce024dd85
A bunch of fixes for the DWARF parser ( #2254 )
...
* Correct parsing of DWARF line_info section
* Fix reading of udata/sdata encoded attributes
* Add definition for DW_AT_alignment
Even though it's been standardized in DWARF5 some compilers produce it
anyway for DWARF4 infos too.
* Fix reading of reference attributes
* Distinguish between absolute/relative addresses
2019-04-11 14:34:13 -04:00
Andrew Kelley
a895c59971
delete unused function
...
missed by 27cd830ec8
2019-04-11 14:33:43 -04:00
Matthew Iannucci
27cd830ec8
Add initial support for iOS targets ( #2237 )
...
* Add iOS C int sizes... try to hack in iOS DebugInfo
* Get rid of ios link check for now
* Remove macos linkversion check
2019-04-11 13:15:17 -04:00
LemonBoy
51eb4ebec1
Distinguish between absolute/relative addresses
2019-04-11 15:41:42 +02:00
Marc Tiehuis
b59c65e986
Merge pull request #2102 from ziglang/big.int-additions
...
Add big.Rational type to std
2019-04-11 22:54:19 +12:00
LemonBoy
38492b2ea4
Fix reading of reference attributes
2019-04-11 10:36:15 +02:00
LemonBoy
29ec409b52
Add definition for DW_AT_alignment
...
Even though it's been standardized in DWARF5 some compilers produce it
anyway for DWARF4 infos too.
2019-04-11 10:36:15 +02:00
LemonBoy
795b3e9b68
Fix reading of udata/sdata encoded attributes
2019-04-11 10:36:15 +02:00
Andrew Kelley
dff201540f
translate-c: move some code to the C API
...
See #1964
2019-04-11 03:59:12 -04:00
LemonBoy
8f5753ba9f
Fix normalization of right-shifted BigInt at CT
...
The pointer value for the `digits` field was being treated as if it were
a limb.
Fixes #2225
2019-04-11 03:49:15 -04:00
Marc Tiehuis
78af62a19a
Pack big.Int sign and length fields
...
This effectively takes one-bit from the length field and uses it as the
sign bit. It reduces the size of an Int from 40 bits to 32 bits on a
64-bit arch.
This also reduces std.Rational from 80 bits to 64 bits.
2019-04-11 19:36:35 +12:00
Marc Tiehuis
87d8ecda46
Fix math.big.Int divN/gcdLehmer and fuzz-test failures
2019-04-11 19:36:35 +12:00
Marc Tiehuis
30788a98b1
Handle zero-limb trailing div case in big.Int
2019-04-11 19:36:35 +12:00
Marc Tiehuis
d3e1f32362
Small fixes for big.Rational and corrections for gcdLehmer
...
The int div code still causes some edge cases to fail right now.
2019-04-11 19:36:35 +12:00
Marc Tiehuis
b3ecdfd7bf
Fix big.Int toString maybe-null allocator
2019-04-11 19:36:35 +12:00
Marc Tiehuis
5f4fcd5030
Add initial big.Rational type
2019-04-11 19:36:35 +12:00
Marc Tiehuis
ea1d2a2409
Add read-only, non-allocating Int for internal constants
...
A constant Int is one which has a value of null for its allocator field.
It cannot be resized or have its limbs written. Any attempt made to
write to it will be caught with a runtime panic.
2019-04-11 19:36:35 +12:00
Andrew Kelley
e309ad884a
fix outdated/incorrect docs for @truncate
...
closes #2234
2019-04-10 23:00:53 -04:00
Andrew Kelley
a4c7e4c4eb
__muloti4 does not need the ABI workaround on Windows
...
Fixes 128-bit integer multiplication on Windows.
closes #2250
2019-04-10 22:33:33 -04:00
Shritesh Bhattarai
13798d26c7
pass exec_path to zig run
2019-04-10 20:07:35 -04:00
Shritesh Bhattarai
666e879925
Build compiler_rt for WASM exe
2019-04-10 19:14:19 -04:00
Andrew Kelley
a71bfc249d
compiler-rt: better way to do the ABI required on Windows
...
This removes the compiler_rt.setXmm0 hack. Instead, for
the functions that use i128 or u128 in their parameter and
return types, we use `@Vector(2, u64)` which generates
the LLVM IR `<2 x i64>` type that matches what Clang
generates for `typedef int ti_int __attribute__ ((mode (TI)))`
when targeting Windows x86_64.
2019-04-10 18:47:14 -04:00
LemonBoy
60e2a04322
Correct parsing of DWARF line_info section
2019-04-10 23:30:41 +02:00
Andrew Kelley
52934851f2
compiler_rt: @divTrunc rather than @divFloor in muloti4
2019-04-10 16:29:10 -04:00
vegecode
aff2e47821
compiler-rt: correct use_thumb_1 flag
...
The flag is for generating correct arm-thumb interwork veneers in the
assembly code __aeabi_{memcpy,memset,etc} functions.
Armv6m only does thumb code generation regardless of whether arm or
thumb is selected and armv6t2 uses the newer thumb 2 set. All other
versions that zig supports pre-armv7 need the veneers and hence the
flag. Armv5 is actually armv5t.
Relevant code from clang/lib/Basic/Targets/Arm.cpp
```c
bool ARMTargetInfo::isThumb() const {
return ArchISA == llvm::ARM::ISAKind::THUMB;
}
bool ARMTargetInfo::supportsThumb() const {
return CPUAttr.count('T') || ArchVersion >= 6;
}
bool ARMTargetInfo::supportsThumb2() const {
return CPUAttr.equals("6T2") ||
(ArchVersion >= 7 && !CPUAttr.equals("8M_BASE"));
}
```
Also see
http://www.llvm.org/svn/llvm-project/llvm/trunk/lib/Target/ARM/ARM.td
2019-04-10 12:35:16 -04:00
Andrew Kelley
dea1027f97
doc comments for parameters in std.mem.Allocator
2019-04-09 17:43:49 -04:00
Jay Weisskopf
cca02a4cf8
Update README headline to match website
2019-04-09 00:31:39 -04:00
Jay Weisskopf
98fa065de7
docs: Underline link when hovering over it
...
In addition to the pointer, this gives some visual feedback to the user
that the element is interactive. This is a very common style pattern
across the web.
2019-04-09 00:31:25 -04:00
Andrew Kelley
bddbbef32b
Release 0.4.0
2019-04-08 15:41:41 -04:00
Jimmi Holst Christensen
43e219b0d9
Merge branch 'master' of github.com:ziglang/zig
2019-04-08 05:30:32 +02:00
Jimmi Holst Christensen
f86ea797ba
Import 1607.zig to behavior.zig
2019-04-08 05:30:27 +02:00
Ryan Liptak
6a78b315b2
Fix std.HashMap.remove returning incorrect KV
...
Now returns a copy of the removed kv instead of a pointer to the removed kv. The removed kv gets overwritten when shifting the hash map after the removal, so returning a pointer to it will have another kv's values in it after the return.
This bug had some nasty downstream effects in things like BufSet and BufMap where delete would free a still in-use KV and leave the actually removed KV un-free'd.
2019-04-07 15:47:09 -04:00
Andrew Kelley
6715c54cc6
Merge pull request #2205 from kristate/zig-backport-issue532
...
stage1: create ir.cpp specific `analyze_type_expr`
2019-04-07 15:32:02 -04:00
kristopher tate
fae0c35195
test/compile_errors.zig: add regression test for ziglang/zig#532 ;
2019-04-07 10:37:43 +09:00
kristopher tate
627b52fe65
src/ir.cpp: don't call-out to analyze_type_expr;
...
replaces `analyze_type_expr` with `ir_analyze_type_expr`
2019-04-07 10:37:43 +09:00
Jimmi Holst Christensen
7c38651a65
Merge branch 'master' of github.com:ziglang/zig
2019-04-07 03:19:08 +02:00
Jimmi Holst Christensen
6960cd156a
Added regression test for #1607 . fixes #1607
2019-04-07 03:18:51 +02:00
Andrew Kelley
77c2036159
Merge pull request #2200 from ziglang/fix-1726
...
fixed #1726
2019-04-06 12:49:00 -04:00
Jimmi Holst Christensen
65cf5a8e44
removed todo comment and added test
2019-04-06 11:04:55 +02:00
Jimmi Holst Christensen
3109c89850
fixed 1726
2019-04-06 10:56:07 +02:00
Andrew Kelley
f00adb47f5
ir: avoid dependency on isnan
...
there's a simple way to check for nan that does not need this header.
hryx on IRC reported that Linux Mint based on ubuntu 16.04, kernel
4.15.0, x86_64 did not have the isnan function.
2019-04-06 01:03:30 -04:00
Andrew Kelley
974977f12f
docgen: add a space between the header and the section symbol
2019-04-05 23:12:25 -04:00
Andrew Kelley
83390bdfdd
fix dereferencing a zero bit type
...
Before only u0 was special cased in handling a dereference;
now all zero bit types are handled the same way. Dereferencing
a pointer to a zero bit type always gives a comptime-known
result.
This previously had been failing on master branch but went unnoticed
because until 846f72b57c the CI server was mistakenly not actually
running the single-threaded tests with --single-threaded.
This fixes the standard library tests with --single-threaded
--release-fast.
2019-04-05 20:18:26 -04:00
Shritesh Bhattarai
3854bb9198
wasm: Pass --allow-undefined and --export-all to the linker
2019-04-05 18:46:11 -04:00
Shritesh Bhattarai
66fab05eba
build: usageAndErr clean exit ( #2194 )
...
* build: usageAndErr clean exit
2019-04-05 18:38:11 -04:00
Shritesh Bhattarai
895e6eabc2
Fix getCurrentId test for pthreads ( #2197 )
...
* Fix getCurrentId test for pthreads
2019-04-05 18:12:46 -04:00
vegecode
d72239d339
Add divdf3 to compiler_rt
...
Also adds __aeabi_ddiv for arm32 targets
2019-04-05 18:10:19 -04:00
Andrew Kelley
1f9ebf49f8
ci: stop doing the branch redirect thing
...
Now that we have https://ziglang.org/download/index.json
See #1046
2019-04-05 17:33:58 -04:00
Andrew Kelley
f6be6ace1f
docgen: allow urls to have numbers
2019-04-05 17:33:58 -04:00
Andrew Kelley
fd65cdc55a
fix incorrect Thread.getCurrentId test
...
Documentation comments copied here:
On Linux, it is possible that the thread spawned with `spawnThread`
finishes executing entirely before the clone syscall completes. In this
case, `std.os.Thread.handle` will return 0 rather than the
no-longer-existing thread's pid.
2019-04-05 16:06:35 -04:00
Andrew Kelley
c47c2a2f2a
stage1: fix debug builds on macOS
2019-04-05 15:39:00 -04:00
Andrew Kelley
846f72b57c
zig build: support single-threaded builds
...
and fix the zig test suite not setting the --single-threaded flag
2019-04-05 14:54:37 -04:00
Andrew Kelley
a5b47bc2c2
docs: update @typeInfo definition and clarify field order
2019-04-05 12:38:15 -04:00
Shritesh Bhattarai
2f236e6efb
fmt: support trailing comma after var_args
2019-04-05 12:27:13 -04:00
Shritesh Bhattarai
6cc2d3938e
support comptime_int in formatInt{,Value}
2019-04-05 11:11:04 -04:00
Jay Weisskopf
3cce56af99
docs: Use section symbol §, not paragraph symbol ¶
...
A header may cover more than one paragraph, so a section symbol is more appropriate.
https://en.wikipedia.org/wiki/Section_sign
2019-04-05 11:09:38 -04:00
vegecode
c24a49a1a7
Fixes to divsf3 ( #2186 )
...
* Fixes to divsf3
Embarrassingly failed to notice a section that was unchanged from where
it was copied from mulXf3.zig. The test cases for this function series
div{s,d,t}f3 are very incomplete and don't exercise all code paths.
Remove unnecessary switch from divsf3 left during development from when
I tried to make it generic to support f32, f64, and f128 in one go.
Make runtime safety dependent on whether a test is being run.
* divsf3: switch plus to minus
2019-04-05 11:04:46 -04:00
Shawn Landden
aecbd1892a
Simplify math.isnan
...
We can just rely on the builtin behavior.
2019-04-05 11:03:57 -04:00
Andrew Kelley
1dc6751721
fix NaN comparing equal to itself
...
This was broken both in comptime code and in runtime code.
closes #1174
2019-04-04 22:07:15 -04:00
emekoi
0bd4901a17
fixed linking of system libraries on mingw
2019-04-04 21:07:02 -05:00
emekoi
6cc443ee45
added code for linking libc on mingw
2019-04-04 19:51:55 -05:00
emekoi
ecd2332bb5
made lld flags on windows consistent
2019-04-04 19:51:55 -05:00
Shritesh Bhattarai
8e6ff8d615
fmt: format multi line only on trailing comma ( #2184 )
...
* fmt: format multi line only on trailing comma
2019-04-04 19:33:32 -04:00
Andrew Kelley
5866dfe4d9
Merge pull request #2109 from emekoi/fix-mingw
...
fixed libc command on mingw
2019-04-04 15:55:40 -04:00
Andrew Kelley
be0f656c21
fix @divFloor returning incorrect value and add __modti3
...
Closes #2152
See #1290
2019-04-04 15:45:37 -04:00
vegecode
12c4ab3927
Add divsf3 to compiler rt
2019-04-04 15:38:09 -04:00
Andrew Kelley
7dd1e0fc2b
docs: add Variables section
...
closes #1927
2019-04-04 12:26:47 -04:00
Andrew Kelley
c195d645e4
add regression test for #1025
...
closes #1025
2019-04-04 01:45:18 -04:00
Andrew Kelley
947c87b558
threads: fix using unmapped memory in some cases
...
as pointed out in #musl IRC, the memory for the fs register address
value needs to be taken into account in the mmap call.
2019-04-04 01:36:01 -04:00
hryx
e827b9661b
zig fmt: Prevent for-else on same line when body is interrupted by LF
2019-04-04 01:31:39 -04:00
hryx
cec8c8678a
zig fmt: Fix regression in for-else ( #2178 )
2019-04-04 01:31:39 -04:00
Andrew Kelley
90b6eab05a
docs: complete the documentation for extern struct
...
closes #1522
2019-04-04 01:23:41 -04:00
Andrew Kelley
e4d595a8ba
fix thread local variables for non- position independent code
...
This fixes comes thanks to Rich Felker from the musl libc project,
who gave me this crucial information:
"to satisfy the abi, your init code has to write the same value
to that memory location as the value passed to the [arch_prctl]
syscall"
This commit also changes the rules for when to build statically
by default. When building objects and static libraries, position
independent code is disabled if no libraries will be dynamically
linked and the target does not require position independent code.
closes #2063
2019-04-04 01:08:26 -04:00
Ruslan Prokopchuk
70ae3222b5
handle LibExeObjStep.disable_gen_h
...
It is sometimes useful to skip generating of the header file (e.g. https://github.com/ziglang/zig/issues/2173 ), and zig compiler provides an option `--disable-gen-h` to control that behaviour. However, setting `lib.disable_gen_h = true` in a typical `build.zig` didn't append the option to arguments. This commit fixes it and adds a convenient `setDisableGenH` setter.
2019-04-03 18:31:25 -04:00
Andrew Kelley
4795f161e6
Merge pull request #2175 from tgschultz/stdlib-serialization-minor_changes
...
Minor changes to serializer/deserializer
2019-04-03 18:13:25 -04:00
Andrew Kelley
b60f2d0c9f
langref: rework the theming and layout
...
* Instead of the only color scheme being dark, the language reference
now has a light theme by default, and respects the user's light/dark
preference via prefers-color-scheme media query. Most browsers don't
support this yet, so we just have to wait patiently for the future to
arrive. closes #2172 .
* Instead of a side bar index, the index is inline with the rest of the
content. This is simpler and more friendly to all user agents, and means
we don't need the media query for mobile devices. It also makes
back-references work, so now headers link to the table of contents
and the table of contents links to headers.
2019-04-03 17:39:07 -04:00
tgschultz
fe33d8ea14
Changes as suggested by andrewrk
2019-04-03 20:05:24 +00:00
Andrew Kelley
692086f898
ci: add missing cache control headers and update download/index.json
2019-04-03 16:04:24 -04:00
tgschultz
ba774c5697
(De)serializer now uses enum instead of bool to determine packing mode (byte/bit).
...
Optional is initialized in a more straight-forward way by deserializer.
2019-04-03 15:47:46 +00:00
Andrew Kelley
85edf55b73
Merge pull request #2135 from ziglang/decouple-llvm-types
...
decouple llvm types from zig types
2019-04-02 23:17:17 -04:00
Andrew Kelley
025a1475c4
emit better debug info for enums
...
fixes llvm assertion when building for windows
2019-04-02 19:40:33 -04:00
Andrew Kelley
6a7b75b73c
fix LLVM assertion failures
2019-04-02 19:09:25 -04:00
Andrew Kelley
15bd4aa54f
fix setting union body twice
2019-04-02 18:43:25 -04:00
Andrew Kelley
e9dc504141
avoid tripping assertion for setting struct body twice
2019-04-02 18:31:19 -04:00
Andrew Kelley
d577dde636
passing all tests
2019-04-02 18:31:19 -04:00
Andrew Kelley
9780fd59f0
put the alignment hack in for unions too. fixes std tests
2019-04-02 18:31:19 -04:00
Andrew Kelley
cb0241fe44
behavior tests passing again
2019-04-02 18:31:19 -04:00
Andrew Kelley
4c38a8cce1
more regression fixes. empty test passes again
2019-04-02 18:31:19 -04:00
Andrew Kelley
5aee17e888
regression fixes and fix packed struct abi size
2019-04-02 18:31:19 -04:00
Andrew Kelley
ddb8aa73f5
more regression fixes
2019-04-02 18:31:18 -04:00
Andrew Kelley
30b2fb2fb5
bug fixes
2019-04-02 18:31:18 -04:00
Andrew Kelley
d7bc7635c0
put the hack from master branch back in
2019-04-02 18:31:18 -04:00
Andrew Kelley
d3f2fe2cef
remove the lazy value stuff
...
let's try to keep this branch to solving one problem at a time
2019-04-02 18:31:18 -04:00
Andrew Kelley
3dc8448680
introduce lazy values
...
but I think it's a bad idea, so I'm going to back out the change
2019-04-02 18:31:18 -04:00
Andrew Kelley
ee5064c053
decouple llvm types from zig types
...
Not tested yet, but it builds.
This closes #761 , and lays the groundwork for fixing the remaining
false positive "foo depends on itself" bugs, such as #624 .
It also lays the groundwork for implementing ability to specify
alignment of fields (#1512 ).
2019-04-02 18:31:17 -04:00
Andrew Kelley
2f96c55095
fix cache hash regression
...
fixes "warning: unexpected seek failure"
fix regression introduced by 27e31f0475
the fd should be closed only if returning with an error
2019-04-02 15:29:16 -04:00
Andrew Kelley
0cccba71d4
better error message when os_file_overwrite fails
2019-04-02 15:21:08 -04:00
Shawn Landden
27e31f0475
fix fd leak in stage1 cacheing code
2019-04-02 12:27:14 -04:00
Andrew Kelley
3c27d9c25a
Merge pull request #2147 from emekoi/fix1940
...
added error for implicit cast from *const T to *[1]T.
2019-04-01 11:35:03 -04:00
Andrew Kelley
3199792ade
Merge pull request #2150 from vegecode/armv7m-compiler-rt
...
Armv7m compiler rt
2019-04-01 11:31:57 -04:00
hryx
c76d51de97
zig fmt: Allow one-line for loops
2019-04-01 11:31:00 -04:00
Shritesh Bhattarai
d645500883
fmt: fix first line comment indent in struct init
2019-03-31 22:33:32 -04:00
vegecode
bfbfb7b3b0
Remove inline keywords in addXf3.zig pending #2154
2019-03-31 21:00:36 -05:00
hryx
0563e8e1d4
Always write a multiline struct literal if a field expr is multiline
2019-03-31 21:09:56 -04:00
emekoi
b7aa289ae4
fixed broken casts in std
2019-03-31 16:47:34 -05:00
emekoi
4a64f26627
added error for implicit cast from *const T to *[1]T. credit: @kristate
2019-03-31 16:47:34 -05:00
Michael Dusan
aa794eb621
fix zig run to accept executable args
...
The `--` double-hyphen is now used to end further `zig` processing
of command line options. All arguments after `--` will be passed
on to the executable. eg. `--help` will be passed on.
`zig run foo.zig -- --help`
closes #2148
2019-03-31 17:01:11 -04:00
vegecode
937ff0cb6a
Add all __aeabi functions (C versions) who alias currently existing functions to compiler-rt
2019-03-31 15:54:02 -05:00
vegecode
779137be41
Add __aeabi_{f,d}neg and __neg{s,d,X}f2 to compiler-rt
2019-03-31 15:54:02 -05:00
vegecode
38c2093500
Add __aeabi_{f,d}{add,sub} and __{add,sub}{s,d}f3 to compiler-rt
2019-03-31 15:54:02 -05:00
vegecode
310f91fb4f
Add __aeabi_mem{cmp,clr,set,cpy,move} to compiler-rt
2019-03-31 15:54:02 -05:00
vegecode
e89b704293
Add memcmp to builtins
2019-03-31 15:54:02 -05:00
hryx
a4afacd182
Veritcally align array literal columns
2019-03-31 14:27:10 -04:00
Andrew Kelley
25ac2fe8cd
fix anon enum literal used with switch on union(enum)
...
closes #2141
closes #2142
2019-03-31 12:43:21 -04:00
MateuszOkulus
62af701804
Remove binary and octal float literals from documentation.
...
Part of #2093
2019-03-31 10:49:55 -04:00
Andrew Kelley
90a78866db
Merge pull request #2112 from shritesh/param_decl_doc_comments
...
Add doc_comments to param decl
2019-03-30 19:22:28 -04:00
Shritesh Bhattarai
b0d89cfe3f
fmt: Fix param decl test
2019-03-30 14:58:18 -05:00
Shritesh Bhattarai
efa751c339
Add doc_comments to param decl
2019-03-30 14:50:08 -05:00
emekoi
8fdf8b6972
fixed libc command on mingw
2019-03-29 23:16:17 -05:00
Rohlem
5703ab1d0c
fix std.ascii type error and inverted logic
...
previously:
```
...\lib\zig\std\ascii.zig:203:20: error: unable to perform binary not operation on type 'comptime_int'
return c | ~0b00100000;
^
```
2019-03-29 12:18:42 -04:00
Rohlem
a824a8c687
add std.ascii to std.std test "std"
2019-03-29 12:18:42 -04:00
Shawn Landden
d494a5f4cf
fix tests for math.mulWide
2019-03-29 12:17:48 -04:00
Shawn Landden
66f13ba807
stage1: better error message when comparing against null
...
Closes : #2104
2019-03-28 15:54:44 -04:00
Shawn Landden
85d1885375
std.mulWide() whose return is twice as wide
2019-03-28 15:51:10 -04:00
Andrew Kelley
64b2cf776c
implement target_c_type_size_in_bits for WASI
2019-03-27 16:08:45 -04:00
Andrew Kelley
fbe9233aa7
Merge pull request #2107 from shawnl/arm64
...
fix build on arm64
2019-03-27 13:11:01 -04:00
emekoi
cf4e9a27c5
removed static build flags on mingw
2019-03-27 12:49:26 -04:00
Shawn Landden
084724c689
use __ARM_EABI__, not __arm__
...
This is sort of pedantic and old OABI systems are unlikely to ever run zig.
2019-03-27 01:18:58 +00:00
Shawn Landden
65e234adfd
fix build on arm64
2019-03-27 01:14:29 +00:00
Shritesh Bhattarai
85575704a4
Use linux.exit_group if not single threaded
2019-03-26 17:49:20 -04:00
Shritesh Bhattarai
5942797000
fmt: check for extra newline at end of file
...
`anything_changed` checks if `source_index` == `source.len`
Fixes #2074
2019-03-26 13:26:00 -04:00
Shawn Landden
51be449a57
std.ascii: respond to review
...
This won't generate as much mode in debug mode, as it doesn't check for overflow.
2019-03-26 12:00:55 -04:00
Andrew Kelley
1d09cdaa6a
munmap allows address 0
...
fixes test suite regression on macOS from previous commit
2019-03-25 16:04:25 -04:00
Andrew Kelley
5eaead6a56
implement allowzero pointer attribute
...
closes #1953
only needed for freestanding targets.
also adds safety for `@intToPtr` when the address is zero.
2019-03-25 12:55:45 -04:00
Andrew Kelley
3306e43984
add compile error test for invalid enum literal implicit cast
...
See #683
2019-03-24 18:51:24 -04:00
Andrew Kelley
da9d8a6ecf
implement peer type resolution for enum literals
...
See #683
2019-03-24 18:47:36 -04:00
Andrew Kelley
aff7b38838
make switch expressions allow enum literal types
...
See #683
2019-03-24 01:15:21 -04:00
Andrew Kelley
a736dfe6a1
implement implicit cast from enum literal to enum
...
See #683
2019-03-24 00:55:55 -04:00
Andrew Kelley
d0551db5cd
introduce the enum literal type
...
see #683
2019-03-24 00:44:18 -04:00
Andrew Kelley
64dddd7afe
add compile error for ignoring error
...
closes #772
2019-03-23 19:33:00 -04:00
Andrew Kelley
6a9c32f759
add regression tests for a bug fixed by an older commit
...
closes #1914
2019-03-23 19:01:51 -04:00
Andrew Kelley
4d50bc3f8d
add peer type resolution for *const T and ?*T
...
closes #1298
2019-03-23 18:48:12 -04:00
Andrew Kelley
89953ec83d
character literals: allow unicode escapes
...
also make the documentation for character literals more clear.
closes #2089
see #2097
2019-03-23 17:35:21 -04:00
Andrew Kelley
55cb9ef138
docs: clarify NaN, inf, -inf
...
closes #2089
2019-03-23 15:25:38 -04:00
Andrew Kelley
3e9697bb35
remove octal and hex floats from the language
...
closes #2093
This is technically a breaking change but I would be
surprised if anyone was actually using this feature.
2019-03-23 14:04:52 -04:00
Andrew Kelley
14d416f83b
parse_f128.c: fix whitespace
2019-03-23 13:46:50 -04:00
Andrew Kelley
d83836825f
add mulXf3 to compiler-rt
...
this adds the following functions to compiler-rt:
* `__mulsf3`
* `__muldf3`
* `__multf3`
See #1290
2019-03-22 17:46:49 -04:00
Andrew Kelley
324cbb9864
stage1: implement get_dynamic_linker for riscv
2019-03-22 17:12:41 -04:00
Andrew Kelley
e9f066acae
fix macos build instructions in readme and fix warning
2019-03-22 16:57:41 -04:00
Shawn Landden
b76398c993
std: add ascii with C ASCII character classes
...
Does NOT look at the locale the way the C functions do.
int isalnum(int c);
int isalpha(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int isascii(int c);
int isblank(int c);
int toupper(int c);
int tolower(int c);
Tested to match glibc (when using C locale) with this program:
const c = @cImport({
// See https://github.com/ziglang/zig/issues/515
@cDefine("_NO_CRT_STDIO_INLINE", "1");
@cInclude("stdio.h");
@cInclude("string.h");
@cInclude("ctype.h");
});
const std = @import("std");
const ascii = std.ascii;
const abort = std.os.abort;
export fn main(argc: c_int, argv: **u8) c_int {
var i: u8 = undefined;
i = 0;
while (true) {
if (ascii.isAlNum(i) != (c.isalnum(i) > 0)) { abort(); }
if (ascii.isAlpha(i) != (c.isalpha(i) > 0)) { abort(); }
if (ascii.isCtrl(i) != (c.iscntrl(i) > 0)) { abort(); }
if (ascii.isDigit(i) != (c.isdigit(i) > 0)) { abort(); }
if (ascii.isGraph(i) != (c.isgraph(i) > 0)) { abort(); }
if (ascii.isLower(i) != (c.islower(i) > 0)) { abort(); }
if (ascii.isPrint(i) != (c.isprint(i) > 0)) { abort(); }
if (ascii.isPunct(i) != (c.ispunct(i) > 0)) { abort(); }
if (ascii.isSpace(i) != (c.isspace(i) > 0)) { abort(); }
if (ascii.isUpper(i) != (c.isupper(i) > 0)) { abort(); }
if (ascii.isXDigit(i) != (c.isxdigit(i) > 0)) { abort(); }
if (i == 255) { break; }
i += 1;
}
_ = c.printf(c"Success!\n");
return 0;
}
2019-03-22 16:25:56 -04:00
Andrew Kelley
6272847917
Merge pull request #2094 from ziglang/f128-decimal-literal
...
float literals now parse using musl's 128 bit float code
2019-03-22 16:21:56 -04:00
Andrew Kelley
02767690e0
get rid of restrict; it's not supported by MSVC
2019-03-22 16:08:19 -04:00
Andrew Kelley
71c78cc9cf
avoid quad float literal syntax for MSVC
2019-03-22 16:06:18 -04:00
Andrew Kelley
4615ed5ea0
float literals now parse using musl's 128 bit float code
...
fixes float literals not having 128 bit precision
2019-03-22 14:56:03 -04:00
Matt Stancliff
1ca78e39e4
Fix typos around pointer usage
2019-03-22 14:10:17 -04:00
Andrew Kelley
127bb124a0
Merge pull request #2091 from ziglang/bigint-print-fix
...
Fix bigint_append_buf
2019-03-22 10:23:18 -04:00
Andrew Kelley
3560f61c16
Merge pull request #2087 from ziglang/float-parsing
...
fix some hex literal parsing bugs
2019-03-22 10:16:46 -04:00
Marc Tiehuis
a3f42a5fe1
Fix compile-error test case for large integer type
2019-03-23 00:20:03 +13:00
Marc Tiehuis
6f90d2c209
Fix bigint_append_buf
...
All current usages use base 10 and have a limb length of 1, hence why
we weren't hitting this error in practice.
2019-03-22 22:10:51 +13:00
Jimmi Holst Christensen
23af502d04
Updated langref to newest grammar
2019-03-22 09:01:30 +01:00
Marc Tiehuis
e3b70fe4ba
Simplify hex-float parsing code
2019-03-22 17:11:57 +13:00
Andrew Kelley
d04a1456df
hex float parsing: solve another case
...
this works now: 0x1.edcb34a235253948765432134674fp-1
2019-03-21 16:35:18 -04:00
Andrew Kelley
af509c68b0
fix parsing of large hex float literals
...
closes #2083
2019-03-21 16:17:29 -04:00
Andrew Kelley
b5cc92f163
ci: more quoting
2019-03-21 10:05:14 -04:00
Andrew Kelley
246304125a
add documentation for zig test
...
closes #1518
2019-03-20 23:50:22 -04:00
Andrew Kelley
bf4701562c
ci: add FreeBSD to download page
2019-03-20 23:19:18 -04:00
Andrew Kelley
b7fb63d696
ci: apt-get update before install as a workaround
2019-03-20 19:05:47 -04:00
Andrew Kelley
15c316b0d8
add docs for assembly and fix global assembly parsing
...
Previously, global assembly was parsed expecting it to have
the template syntax. However global assembly has no inputs,
outputs, or clobbers, and thus does not have template syntax.
This is now fixed.
This commit also adds a compile error for using volatile
on global assembly, since it is meaningless.
closes #1515
2019-03-20 19:00:23 -04:00
Andrew Kelley
3c7555cb67
Merge remote-tracking branch 'origin/llvm8'
2019-03-20 13:34:07 -04:00
Andrew Kelley
2fdf69bc40
Merge pull request #2079 from Sahnvour/issue-2050
...
Fixes c_ABI tests on windows
2019-03-20 00:11:11 -04:00
Sahnvour
d669db7673
c_abi: activate tests on windows
2019-03-19 22:41:27 +01:00
Sahnvour
27d5e1f36c
c_abi: add some tests for int and float parameter passing potentially using both registers and stack
2019-03-19 22:09:12 +01:00
Andrew Kelley
ac34841270
build.zig: allow run() on non-native target artifacts
2019-03-19 17:08:50 -04:00
Sahnvour
c17b1635ca
c_abi: when compiling for x86_64, differenciate between system V and windows ABI
2019-03-19 22:08:19 +01:00
Andrew Kelley
9801a1df6a
disable all C warnings when building musl
2019-03-19 15:04:39 -04:00
Andrew Kelley
3c36929603
zig targets prints the available libcs
2019-03-19 15:04:29 -04:00
Andrew Kelley
af9ac0d548
better buffer length for formatIntUnsigned
...
see #1358
2019-03-19 10:11:28 -04:00
Jimmi Holst Christensen
e508b85746
Updated parser to newest grammar
2019-03-19 10:36:37 +01:00
Andrew Kelley
1b25dcde96
freebsd ci: disable not working stuff
2019-03-19 00:53:36 -04:00
Andrew Kelley
fd2993578d
ci: freebsd tests docs
2019-03-19 00:05:59 -04:00
Andrew Kelley
b44ff4ca8e
freebsd ci: install wget and set -x -e
2019-03-18 23:44:29 -04:00
Andrew Kelley
0c6e687436
start producing freebsd binaries
2019-03-18 23:37:48 -04:00
Andrew Kelley
567175f833
add documentation for Memory
...
closes #1904
2019-03-18 21:40:24 -04:00
Andrew Kelley
fca83876d8
workaround for Ubuntu/Debian bug
...
see #2076
2019-03-18 20:56:46 -04:00
Andrew Kelley
85256521ba
fix translate-c regression
2019-03-18 20:09:27 -04:00
Andrew Kelley
a581f4f0e2
Merge remote-tracking branch 'origin/master' into llvm8
2019-03-18 20:03:23 -04:00
Andrew Kelley
db0e188f0e
update macos static build for llvm8
2019-03-18 18:36:35 -04:00
Andrew Kelley
1b801bdbae
pass explicit frame pointer args when compiling C code
2019-03-18 16:59:48 -04:00
Andrew Kelley
a17bf219c6
Merge pull request #2069 from ziglang/glibc-assert-translation
...
Implemented enough of translate-c to translate assert
2019-03-18 14:43:17 -04:00
Andrew Kelley
7dfbeca13e
libc: separate linux headers from musl/glibc
2019-03-18 13:47:59 -04:00
Jimmi Holst Christensen
9171e7a7c1
More work on ignoring values correctly
2019-03-18 14:55:57 +01:00
Andrew Kelley
6acabd6b57
when linking msvcrt, also link ntdll.lib
...
See #2073
2019-03-17 14:14:05 -04:00
Andrew Kelley
c8453454e1
add missing std lib file rb.zig to cmakelists.txt
2019-03-17 13:52:45 -04:00
Sahnvour
ae9b90cf6e
print a message instead of returning an error when debug info comes from a source file not found (for example compiled on another computer)
2019-03-16 15:34:14 +01:00
Sahnvour
704dfaaabf
avoid reading LineBlockFragmentHeader at all if the address is not in range, thus simplifying code and improving speed of execution
2019-03-16 15:34:14 +01:00
Sahnvour
094d40fb1a
allow pdb modules to have no C13 data, this happens if the module is stripped
2019-03-16 15:34:14 +01:00
Sahnvour
0d4a5c40bc
correct padding handling between std.pdb.ModInfo entries in DbiStream
2019-03-16 15:34:14 +01:00
Andrew Kelley
6abe6dbfe4
enable issue_339 test on macos
...
closes #1126
2019-03-16 01:18:46 -04:00
Andrew Kelley
6d6195424d
add regression test for invalid multiple dereferences
...
closes #1042
2019-03-16 00:23:18 -04:00
Andrew Kelley
c40448eb9a
add compile error for wrong type with use
...
closes #1557
2019-03-16 00:18:10 -04:00
Andrew Kelley
4a5cd0b895
fix while continue block not checking for ignored expression
...
closes #957
2019-03-15 23:52:11 -04:00
Andrew Kelley
01fb421031
fix regressions on Windows from previous commit
2019-03-15 18:57:07 -04:00
Andrew Kelley
9c13e9b7ed
breaking changes to std.mem.Allocator interface API
...
Before, allocator implementations had to provide `allocFn`,
`reallocFn`, and `freeFn`.
Now, they must provide only `reallocFn` and `shrinkFn`.
Reallocating from a zero length slice is allocation, and
shrinking to a zero length slice is freeing.
When the new memory size is less than or equal to the
previous allocation size, `reallocFn` now has the option
to return `error.OutOfMemory` to indicate that the allocator
would not be able to take advantage of the new size.
For more details see #1306 . This commit closes #1306 .
This commit paves the way to solving #2009 .
This commit also introduces a memory leak to all coroutines.
There is an issue where a coroutine calls the function and it
frees its own stack frame, but then the return value of `shrinkFn`
is a slice, which is implemented as an sret struct. Writing to
the return pointer causes invalid memory write. We could work
around it by having a global helper function which has a void
return type and calling that instead. But instead this hack will
suffice until I rework coroutines to be non-allocating. Basically
coroutines are not supported right now until they are reworked as
in #1194 .
2019-03-15 17:57:21 -04:00
Jimmi HC
5ae400fb39
fixed void cast and added the last tests
2019-03-15 19:11:46 +01:00
Andrew Kelley
4090fe81f6
Merge pull request #2068 from ziglang/workaround-for-2043
...
workaround for #2043
2019-03-15 11:19:21 -04:00
Jimmi Holst Christensen
a77b2a0810
Implemented enough of translate-c to translate assert
...
This required the following
* __extention__
* ({})
* Fixing if (0) ; else ;
2019-03-15 16:12:41 +01:00
Jimmi Holst Christensen
3ef9b899e4
workaround for #2043
2019-03-15 11:17:21 +01:00
Akuli
b1c8c79733
Add /lib/x86_64-linux-gnu or similar to default system library search paths
...
this makes compiling with libraries like zlib and ncurses easier
2019-03-14 14:51:24 -04:00
Andrew Kelley
080dd27157
breaking: fix @typeInfo handling of global error set type
...
`builtin.TypeInfo.ErrorSet` is now `?[]Error`
instead of `struct{errors:[]Error}`.
closes #1936
2019-03-14 11:57:56 -04:00
Andrew Kelley
e861da03f9
macho linking: always -dynamic for non-static-libs
2019-03-14 00:07:05 -04:00
Andrew Kelley
862ac42a6e
ignore -lm on darwin because it's handled by libSystem
2019-03-13 23:44:38 -04:00
Andrew Kelley
927efe5f42
force windows to link against dynamic msvcrt
...
See #2064
2019-03-13 23:35:58 -04:00
Andrew Kelley
20c36949e1
fix target_requires_pic and reloc_mode
...
disable failing thread local variable test.
see #2063
2019-03-13 23:15:34 -04:00
Andrew Kelley
5d2edac12d
breaking: remove --static; add -dynamic
...
`--static` is no longer an option. Instead, Zig makes things as static
as possible by default. `-dynamic` can be used to choose a dynamic
library rather than a static one.
`--enable-pic` is a new option. Usually it will be enabled
automatically, but in the case of build-exe with no dynamic libraries
on Linux or freestanding, Zig chooses off by default.
closes #1703
closes #1828
2019-03-13 19:50:41 -04:00
Andrew Kelley
85d0f0d45b
fix @setRuntimeSafety not able to override release modes
2019-03-13 14:46:53 -04:00
Andrew Kelley
d213708333
this empty import workaround no longer necessary
2019-03-13 14:13:09 -04:00
Andrew Kelley
284f6baf1c
remove nios2 from list of libc targets
2019-03-13 13:33:00 -04:00
Andrew Kelley
0588fed15f
add documentation for pub
...
closes #1727
2019-03-13 13:05:23 -04:00
Andrew Kelley
54edbc6815
Merge remote-tracking branch 'origin/master' into llvm8
2019-03-13 12:56:58 -04:00
Andrew Kelley
d495dcc3c9
zig test respects --output-dir parameter
2019-03-13 12:35:10 -04:00
Andrew Kelley
4e40bd8633
add documentation for @"" syntax
...
closes #1614
2019-03-13 12:01:32 -04:00
LemonBoy
49838a9f3e
Fix generation of comptime slices
...
By erasing the global_refs field we'd trip any codepath using
const_values_equal_ptr to figure if two slices were different.
2019-03-13 11:35:05 -04:00
emekoi
1ed38a682e
added z3 and fixed dynamic linker on mingw
2019-03-13 10:37:53 -04:00
Andrew Kelley
26b0d34361
Merge pull request #2055 from ziglang/musl
...
support musl for all compatible targets
2019-03-13 01:01:26 -04:00
Andrew Kelley
c73cd05468
musl: remove files that have case conflicts
2019-03-13 01:00:12 -04:00
Andrew Kelley
235ded6265
fix gitattributes
2019-03-12 18:40:31 -04:00
Andrew Kelley
cf699ee068
don't resolve dynamic linker for static executables
2019-03-12 18:28:32 -04:00
Andrew Kelley
9741b2aab4
avoid a string that is too long for msvc
2019-03-12 18:09:40 -04:00
Andrew Kelley
5570bc986b
remove accidental swap file
2019-03-12 17:44:03 -04:00
Andrew Kelley
62486c35a4
ability to build musl from source
...
bundles musl 1.1.21
See #514
2019-03-12 17:32:32 -04:00
Andrew Kelley
5734b7a37a
building musl start files from source
2019-03-12 13:18:52 -04:00
Andrew Kelley
b7c331eb61
add musl headers
2019-03-12 10:30:12 -04:00
Andrew Kelley
761356209b
add test cases to cover switching on u0 values
...
closes #1563
2019-03-11 19:42:07 -04:00
Andrew Kelley
1a94dec50e
docs: finish initial documentation for implicit casts
...
closes #1514
2019-03-11 19:34:58 -04:00
Sahnvour
9b99356551
translate-c: additional test case for integer suffixes on 0
2019-03-11 16:36:27 -04:00
Andrew Kelley
f2ca2ace09
zig build: do a better job of detecting system paths
...
See #2041
2019-03-11 15:22:05 -04:00
Andrew Kelley
a909efae9f
Merge branch 'daurnimator-valgrind'
2019-03-11 13:42:54 -04:00
Andrew Kelley
d633dcd07a
remove the valgrind integration with std.mem.Allocator
...
See #1837
2019-03-11 13:34:51 -04:00
Andrew Kelley
5362ca204f
Merge branch 'valgrind' of https://github.com/daurnimator/zig into daurnimator-valgrind
2019-03-11 13:27:04 -04:00
Andrew Kelley
80e5af2be2
Merge pull request #2049 from ziglang/problematic-mtime-detection
...
stage1 caching system: detect problematic mtimes
2019-03-11 12:47:55 -04:00
Andrew Kelley
9efa18f687
enable C ABI tests on macOS
2019-03-11 12:21:30 -04:00
Andrew Kelley
e1fbb24d64
add test for spawning child process with empty environment
...
thanks to BenoitJGirard for pointing out the child process
implementation needs 3 extra null bytes in #2031
2019-03-11 11:56:08 -04:00
Andrew Kelley
b4e6e301e1
Merge branch 'fix-1600'
...
closes #2036
2019-03-11 11:09:55 -04:00
Andrew Kelley
1d5e349a52
ir: fix handling of OnePossibleValueInvalid
...
this is the poison value which means a compile error has
already been reported
2019-03-11 11:09:15 -04:00
Jimmi HC
bcbb2650c5
check for type_has_one_possible_value and added correct caching to TypeInfo
2019-03-11 10:55:43 -04:00
Jimmi Holst Christensen
357813b193
added tests
2019-03-11 10:55:43 -04:00
Jimmi Holst Christensen
2d7f0ca387
fixed enum to union code
2019-03-11 10:55:10 -04:00
Jimmi Holst Christensen
5a52613caf
use cached const_void_val
2019-03-11 10:55:10 -04:00
Jimmi Holst Christensen
29accac74c
removed wild tab
2019-03-11 10:55:10 -04:00
Jimmi Holst Christensen
8eedec4f93
fixed #1600
2019-03-11 10:55:04 -04:00
Andrew Kelley
3ff0e8bd96
Revert "docgen: --cache off for tests"
...
This reverts commit 0a8a7a57e7 .
This workaround is no longer necessary.
2019-03-11 10:35:42 -04:00
Andrew Kelley
6a5c2b249d
Revert "use unique test source names for test-gen-h"
...
This reverts commit 264b03d570 .
This workaround is no longer necessary.
2019-03-11 10:35:39 -04:00
Andrew Kelley
895fab156a
fix build on windows
2019-03-11 10:35:04 -04:00
Andrew Kelley
3a6f19de48
stage1 caching system: detect problematic mtimes
...
closes #2045
2019-03-11 10:26:08 -04:00
Marc Tiehuis
83b79522d2
Mark third-party dependencies as vendored
2019-03-11 08:16:50 -04:00
Andrew Kelley
4cb55d3af6
Merge remote-tracking branch 'origin/master' into llvm8
2019-03-10 18:07:28 -04:00
Andrew Kelley
fec4555476
fix inconsistent type information of optional C pointers
...
solves an assertion failure in LLVM
2019-03-10 18:02:59 -04:00
Andrew Kelley
918dbd4551
std.zig: this is no longer a keyword
2019-03-10 15:55:54 -04:00
Matt Whiteside
b63b3dc756
Add elf riscv32 and elf riscv64 as options in getLDMOption during construction of link job.
2019-03-10 15:06:17 -04:00
Sahnvour
fa9fcab620
translate-c: add support for integer suffixes on 0 (zero) litteral inside macro definitions
2019-03-10 14:56:35 -04:00
Andrew Kelley
3cdd2c0bdd
Merge remote-tracking branch 'origin/master' into llvm8
2019-03-10 13:48:06 -04:00
Andrew Kelley
0a8a7a57e7
docgen: --cache off for tests
2019-03-09 11:29:15 -05:00
Andrew Kelley
264b03d570
use unique test source names for test-gen-h
2019-03-09 09:52:33 -05:00
Andrew Kelley
8369ddb09c
glibc: add missing linux header
2019-03-09 01:24:30 -05:00
Andrew Kelley
8624379c71
Merge pull request #2038 from ziglang/caching
...
breaking changes to zig build API and improved caching
2019-03-09 01:17:36 -05:00
Andrew Kelley
a45807db22
disable flaky event test until post coroutine rewrite
2019-03-09 01:15:18 -05:00
Andrew Kelley
94e52dba85
fix docgen and fix unnecessarily adding .root suffix to objects
2019-03-09 01:00:45 -05:00
Andrew Kelley
5046aa9403
fix running things with zig build on Windows
...
Windows doesn't have rpaths for DLLs so we instead add
search paths to Path environment variable when running
an executable that depends on DLLs built with zig build.
2019-03-09 00:42:14 -05:00
Andrew Kelley
85d23e68ee
fix .d file parsing and string literal ast rendering
2019-03-08 23:40:39 -05:00
Andrew Kelley
91955dee58
breaking changes to zig build API and improved caching
...
* in Zig build scripts, getOutputPath() is no longer a valid function
to call, unless setOutputDir() was used, or within a custom make()
function. Instead there is more convenient API to use which takes
advantage of the caching system. Search this commit diff for
`exe.run()` for an example.
* Zig build by default enables caching. All build artifacts will go
into zig-cache. If you want to access build artifacts in a convenient
location, it is recommended to add an `install` step. Otherwise
you can use the `run()` API mentioned above to execute programs
directly from their location in the cache. Closes #330 .
`addSystemCommand` is available for programs not built with Zig
build.
* Please note that Zig does no cache evicting yet. You may have to
manually delete zig-cache directories periodically to keep disk
usage down. It's planned for this to be a simple Least Recently
Used eviction system eventually.
* `--output`, `--output-lib`, and `--output-h` are removed. Instead,
use `--output-dir` which defaults to the current working directory.
Or take advantage of `--cache on`, which will print the main output
path to stdout, and the other artifacts will be in the same directory
with predictable file names. `--disable-gen-h` is available when
one wants to prevent .h file generation.
* `@cImport` is always independently cached now. Closes #2015 .
It always writes the generated Zig code to disk which makes debug
info and compile errors better. No more "TODO: remember C source
location to display here"
* Fix .d file parsing. (Fixes the MacOS CI failure)
* Zig no longer creates "temporary files" other than inside a
zig-cache directory.
This breaks the CLI API that Godbolt uses. The suggested new invocation
can be found in this commit diff, in the changes to `test/cli.zig`.
2019-03-08 23:23:11 -05:00
John Schmidt
dd34c21779
PriorityQueue: add bulk insertion methods
2019-03-08 14:23:05 -05:00
Jay Weisskopf
cddc77dd97
Remove glibc compat shim with restrictive license
...
Unlike the other glibc source code checked into the repo, `csu/init.c`
did not have a license clause that allowed linking without restrictions.
`_IO_stdin_used` is the only symbol in the file and appears to be a 20
year old compatibility shim for the glibc 2.0 ABI. Obsolete in 2.1.
2019-03-08 08:46:06 -05:00
Andrew Kelley
1e634a384c
Merge branch 'glibc'
...
See #514
2019-03-07 16:55:31 -05:00
Andrew Kelley
2bb6825baa
fix passing invalid argument -NDEBUG
2019-03-07 16:53:44 -05:00
Andrew Kelley
3d2c48e4c9
disable some tests until coroutine rewrite is finished
2019-03-07 16:11:00 -05:00
Andrew Kelley
46242c4d38
fix -mllvm command line option regression
2019-03-07 16:08:25 -05:00
Andrew Kelley
bbbcf16ef9
fix linking glibc: caching static libs and
...
handle linking pthread, rt, dl, m better
2019-03-07 15:50:49 -05:00
Andrew Kelley
2caf39c961
fix .d file processing and use -MV to quote spaces
2019-03-07 14:30:50 -05:00
Andrew Kelley
431b3b2459
fix windows build
2019-03-07 13:32:43 -05:00
Andrew Kelley
197311d7dd
windows and uefi don't have dynamic linkers
2019-03-07 13:25:17 -05:00
Andrew Kelley
4d8467fafc
better behavior when cache dir unavailable
...
and choose different manifest dir for local cache to avoid
conflict with zig build
2019-03-07 13:16:52 -05:00
Andrew Kelley
e2ce00f272
fix regressions on macos
2019-03-07 13:04:10 -05:00
Andrew Kelley
ffaa4f0a87
dynamic_linker_path can be null on some targets
2019-03-07 12:21:27 -05:00
Andrew Kelley
ce76de35f1
multi-arch glibc headers
2019-03-07 12:16:10 -05:00
Andrew Kelley
189fba4390
process headers tool
2019-03-07 09:15:43 -05:00
Sahnvour
5469e3e3c1
missed change when switching TypeInfo to use comptime_int
...
fixes #2030
2019-03-06 15:27:56 -05:00
Andrew Kelley
ccdef8c0fb
cross compile glibc startup files
2019-03-06 13:22:36 -05:00
Andrew Kelley
697b1233f0
support other architectures for glibc startup files
2019-03-06 12:10:03 -05:00
Andrew Kelley
b554f6294f
add popcountdi2 to compiler_rt
2019-03-05 23:09:00 -05:00
Andrew Kelley
ba144b366c
build libunwind.a from source and link it
2019-03-05 22:45:41 -05:00
Andrew Kelley
5cecb5e479
libcxx headers 8.0.0rc3
2019-03-05 22:42:35 -05:00
Andrew Kelley
bc8c4ec608
libunwind 8.0.0rc3
2019-03-05 22:42:14 -05:00
Andrew Kelley
e2f4df6065
std.os.changeCurDir no longer needs an allocator
2019-03-05 18:43:39 -05:00
Andrew Kelley
4c386436ea
support glibc dl, m, pthread, rt
2019-03-05 18:17:22 -05:00
Andrew Kelley
e06da10838
fix translate-c
2019-03-05 16:12:19 -05:00
Andrew Kelley
55a0016221
dynamic linker path is independent from libc installation
2019-03-05 16:00:28 -05:00
Andrew Kelley
0d10ab0680
stop linking against gcc files
2019-03-05 14:37:32 -05:00
Andrew Kelley
dd263eccb7
support crtbegin.o and crtend.o when using explicit libc
2019-03-05 14:12:46 -05:00
Andrew Kelley
c5fdea59d3
building glibc from source
2019-03-05 13:26:59 -05:00
Andrew Kelley
aeb16010f3
initial glibc support
2019-03-04 22:15:53 -05:00
Andrew Kelley
0714e19598
Merge remote-tracking branch 'origin/master' into llvm8
2019-03-04 08:24:56 -05:00
Andrew Kelley
9c5852aa86
fix slice of C pointer
...
closes #2002
2019-03-03 13:04:04 -05:00
Andrew Kelley
e3b275fa47
fix build.zig not respecting --static
...
closes #2027
2019-03-03 12:35:09 -05:00
Andrew Kelley
d0d615d819
fix const initialization of optional C pointer to null
2019-03-03 10:47:06 -05:00
sjdh02
74c123cd0a
fix check for 64-bit arm platforms with new targets
2019-03-03 10:04:08 -05:00
Andrew Kelley
e402455704
rename std lib files to new convention
2019-03-02 16:46:04 -05:00
Andrew Kelley
f7835000b6
@returnAddress and @frameAddress return usize now
2019-03-02 15:34:58 -05:00
Andrew Kelley
ea5cedced1
fix @typeName on slices
...
closes #2026
2019-03-02 14:31:27 -05:00
Sahnvour
4bac22e888
all integers returned by @typeInfo are now comptime_int
2019-03-02 14:27:37 -05:00
Andrew Kelley
67b4de33d2
compile error for import outside package path
...
closes #2024
there's a new cli option `--main-pkg-path` which you can use to choose
a different root package directory besides the one inferred from the
root source file
and a corresponding build.zig API:
foo.setMainPkgPath(path)
2019-03-02 10:38:27 -05:00
Andrew Kelley
99b6429a89
disable tests which are tripping an llvm assertion
...
See #2019
2019-03-02 08:44:18 -05:00
Andrew Kelley
764205ac13
better error message for -target windows CLI
...
closes #1169
2019-03-01 18:42:09 -05:00
Andrew Kelley
bed81089e1
Merge pull request #2020 from ziglang/kill-namespace-type
...
remove the (namespace) type and make every file an empty struct
2019-03-01 18:07:46 -05:00
Andrew Kelley
9c47bf68fa
gen-h: respect @export
2019-03-01 17:52:17 -05:00
Andrew Kelley
fc17b8ee8b
remove unused function
2019-03-01 17:36:43 -05:00
Andrew Kelley
26128396f3
gen-h: use the bare type names for now
2019-03-01 17:36:08 -05:00
Andrew Kelley
e8dad62441
fix docs typo
2019-03-01 17:23:27 -05:00
Andrew Kelley
5f7d9c5845
@typeInfo for structs and opaque types is the bare name
2019-03-01 17:15:58 -05:00
Andrew Kelley
a7ddcabb50
fix type names
2019-03-01 15:49:52 -05:00
Andrew Kelley
582fdc2869
fix dependency loops, pub, tests, use decls, root source
...
* fix dependency loop detection
- closes #679
- closes #1500
* fix `pub`
* fix tests
* fix use decls
* main package file gets a special "" namespace path
2019-03-01 15:35:29 -05:00
Marc Tiehuis
c4887d7f54
Use bitwise-and instead of modulo in __zig_return_error
...
Avoids emitting compiler-rt div calls on some targets.
2019-03-01 08:23:11 -05:00
Andrew Kelley
76b4e49178
add mprotect syscall
2019-02-28 20:11:36 -05:00
Andrew Kelley
faf76032f1
fix "use" decls
2019-02-28 15:54:09 -05:00
Andrew Kelley
02f3a834b0
struct types get fully qualified names
...
and function symbol names become fully qualified
2019-02-28 15:40:57 -05:00
Andrew Kelley
382a155191
web assembly is a tier 3 target now
...
avr should be listed as tier 4. it's not a default target of LLVM
2019-02-28 14:18:55 -05:00
Andrew Kelley
0fd64e6c69
stage2: update for changes regarding sub-architecture
2019-02-28 14:10:45 -05:00
Andrew Kelley
fa3d89674a
update clang C headers to 8.0.0rc3
2019-02-28 13:52:17 -05:00
Andrew Kelley
182cd0e4c0
LLD patch: workaround for buggy MACH-O code
...
This reapplies 00902ff9b0
to the embedded LLD.
2019-02-28 12:54:11 -05:00
Andrew Kelley
5768fcb085
update embedded LLD to 8.0.0rc3
2019-02-28 12:53:08 -05:00
Andrew Kelley
5424b4320d
remove namespace type; files are empty structs
...
closes #1047
2019-02-28 10:11:32 -05:00
Andrew Kelley
6bc19b437c
updates to build with llvm 8.0.0rc3
2019-02-28 09:55:27 -05:00
Andrew Kelley
ea73b8e2b8
update clang driver code to 8.0.0rc3
2019-02-28 09:27:07 -05:00
Andrew Kelley
2dcf1a2392
Merge remote-tracking branch 'origin/master' into llvm8
2019-02-28 09:19:18 -05:00
Andrew Kelley
9753e87545
fix incorrect use of printf in previous commit
2019-02-27 20:09:07 -05:00
Andrew Kelley
3bfacf071e
print the command that failed when C source code fails to build
...
also respect the --color arg when building C code
2019-02-27 16:02:07 -05:00
Andrew Kelley
14ca0fd493
uefi os: better auto detection of subsystem
2019-02-27 09:30:48 -05:00
Andrew Kelley
d093f51f16
stage1: fix unused function error on freebsd and netbsd
...
closes #2012
closes #2013
2019-02-27 08:40:54 -05:00
Andrew Kelley
c59ce046a0
windows returns EINVAL for fopen when there is an asterisk in the name
...
closes #508
2019-02-26 23:02:57 -05:00
Andrew Kelley
22dd0db9bf
improve docs for unions and switching on tagged unions
...
closes #1943
2019-02-26 22:57:01 -05:00
Andrew Kelley
0d48011f5e
fix stage1 zig fmt on macos
2019-02-26 21:33:46 -05:00
Andrew Kelley
557983e502
fix handling when there are multiple externs and
...
an export in the same object
closes #529
2019-02-26 19:43:12 -05:00
Andrew Kelley
763357c9c3
add test coverage for type used as switch case
...
closes #996
2019-02-26 19:41:36 -05:00
Andrew Kelley
d5fc826437
add test coverage for binary OR on error sets
...
closes #1074
2019-02-26 19:34:22 -05:00
Andrew Kelley
1d7e5479b0
fix .gitignore file and add commit missing std lib file
2019-02-26 18:33:27 -05:00
Andrew Kelley
4563f6b424
add builder.addFmt API and use it to test stage1 zig fmt
...
closes #1968
2019-02-26 18:10:40 -05:00
Andrew Kelley
6365f5a9f3
introduce sys_include_dir for when sys/* files are not with stdlib.h
2019-02-26 17:26:34 -05:00
Andrew Kelley
33174f11ef
fix regressions on Windows
2019-02-26 16:24:32 -05:00
Andrew Kelley
ade10387a5
breaking changes to the way targets work in zig
...
* CLI: `-target [name]` instead of `--target-*` args.
This matches clang's API.
* `builtin.Environ` renamed to `builtin.Abi`
- likewise `builtin.environ` renamed to `builtin.abi`
* stop hiding the concept of sub-arch. closes #1526
* `zig targets` only shows available targets. closes #438
* include all targets in readme, even those that don't
print with `zig targets` but note they are Tier 4
* refactor target.cpp and make the naming conventions
more consistent
* introduce the concept of a "default C ABI" for a given
OS/Arch combo. As a rule of thumb, if the system compiler
is clang or gcc then the default C ABI is the gnu ABI.
2019-02-26 15:58:10 -05:00
Andrew Kelley
1ec1097bd3
use -nostdinc and sometimes -nolibc when compiling C code
2019-02-26 14:59:36 -05:00
John Schmidt
0eed72d687
Add priority queue
2019-02-26 13:21:11 -05:00
Andrew Kelley
6fd2816431
use -nostdinc++ when compiling C code
2019-02-26 10:15:48 -05:00
Andrew Kelley
3932b6474e
use -nobuiltininc when compiling c code
2019-02-26 08:16:03 -05:00
Andrew Kelley
82fafca375
fix the libc compile error tests to only run on linux
2019-02-25 21:46:32 -05:00
Andrew Kelley
7571db05de
fix incorrectly trying to memset at comptime
...
closes #718
2019-02-25 20:33:40 -05:00
Andrew Kelley
4b7e285b76
add a regression test for #704
...
closes #704
2019-02-25 20:18:35 -05:00
Andrew Kelley
152db27146
better error message when forgetting to link against libc
...
closes #1698
2019-02-25 20:09:18 -05:00
Andrew Kelley
3ca861c7dd
add a compile error note when C import fails and not linking libc
...
closes #558
2019-02-25 19:31:30 -05:00
Andrew Kelley
0f54728cf0
fix not finding libgcc_s when looking for native libc
...
closes #2011
2019-02-25 19:10:48 -05:00
Andrew Kelley
aab8e13529
add docs for zero bit types and pointers to zero bit types
...
closes #1561
2019-02-25 18:31:37 -05:00
Andrew Kelley
39605a7965
delete incorrect TODO comment
...
The code path is tested by behavior tests.
Thanks to various contributors, but mostly Marc Tiehuis,
bigint.cpp now has full coverage.
closes #405
2019-02-25 16:36:18 -05:00
Andrew Kelley
7b8c5578c6
fix infinite recursion in type_has_one_possible_value
...
closes #2006
2019-02-25 16:28:23 -05:00
Andrew Kelley
33cbb29def
zig build: 2 improvements
...
* `linkLibrary` will make the target depend on libc if the source does
* when building C source file(s), don't try to generate .h files
2019-02-25 14:27:03 -05:00
Andrew Kelley
6003b1ea70
Merge pull request #2005 from ziglang/c-source
...
first class support for compiling C code
2019-02-25 14:11:54 -05:00
Andrew Kelley
0d4db8828a
@cImport works with --cache on
...
We pass -MD -MF args to clang when doing `@cImport`, which
gives us a complete list of files that the C code read from.
Then we add these to the cache. So even when using `@cImport`
Zig's caching system remains perfect. This is a proof of concept
for the mechanism that the self-hosted compiler will use to
watch and rebuild files.
2019-02-25 14:03:36 -05:00
Andrew Kelley
525c2eaf5d
building DLLs on Windows works better
2019-02-25 13:34:25 -05:00
Andrew Kelley
e76ce2c1d0
first class support for compiling C code
...
New CLI parameter: --c-source [options] [file]
It even works with `--cache on` when there are transitive dependencies.
Instead of `builder.addCExecutable`, use `builder.addExecutable` and pass
`null` for the root source file. Then use `builder.addCSourceFile`,
which takes the path to the C code, and a list of C compiler args.
Be sure to linkSystemLibrary("c") if you want libc headers to be
available.
Merge TestStep into LibExeObjStep. That was long overdue.
2019-02-25 11:45:00 -05:00
Andrew Kelley
e5d4862e14
Merge pull request #2003 from ziglang/zig-cc
...
add `zig cc` command to act like a C compiler
2019-02-24 16:28:49 -05:00
Andrew Kelley
8c2c6368f9
zig cc: work around clang calling GetCommandLine on Windows
2019-02-24 15:31:02 -05:00
Andrew Kelley
bcca76b3c4
zig cc: remove "polly" which was an undefined symbol on macos
2019-02-24 13:37:41 -05:00
Andrew Kelley
a77a17e2c2
add zig cc command to act like a C compiler
...
closes #490
2019-02-24 12:53:28 -05:00
Andrew Kelley
98869edb8b
fix zig fmt arg0 handled incorrectly
2019-02-23 20:25:33 -05:00
Andrew Kelley
00d8f4a1bb
introduce std.debug.captureStackTrace
...
and fix the implementation of writeStackTrace
it was printing the first frame in the wrong place
2019-02-23 13:19:06 -05:00
Andrew Kelley
6fd8d455bc
better libc detection ( #1996 )
...
* better libc detection
This introduces a new command `zig libc` which prints
the various paths of libc files. It outputs them to stdout
in a simple text file format that it is capable of parsing.
You can use `zig libc libc.txt` to validate a file.
These arguments are gone:
--libc-lib-dir [path] directory where libc crt1.o resides
--libc-static-lib-dir [path] directory where libc crtbegin.o resides
--msvc-lib-dir [path] (windows) directory where vcruntime.lib resides
--kernel32-lib-dir [path] (windows) directory where kernel32.lib resides
Instead we have this argument:
--libc [file] Provide a file which specifies libc paths
This is used to pass a libc text file (which can be generated with
`zig libc`). So it is easier to manage multiple cross compilation
environments.
`--cache on` now works when linking against libc.
`ZigTarget` now has a bool field `is_native`
Better error messaging when you try to link against libc or use
`@cImport` but the various paths cannot be found. It should also be
faster.
* save native_libc.txt in zig-cache
This avoids having to detect libc at runtime on every invocation.
2019-02-23 09:35:56 -05:00
Andrew Kelley
52bb71867d
implement vector negation
...
also fix vector behavior tests, they weren't actually testing
runtime vectors, but now they are.
See #903
2019-02-22 13:28:57 -05:00
Andrew Kelley
2fe8a0831f
add regression test for bitcast to array
...
closes #421
2019-02-22 11:09:17 -05:00
Andrew Kelley
d0c39895aa
docs for packed structs
...
closes #1513
2019-02-22 10:56:49 -05:00
Andrew Kelley
0c5f897904
fix @bitCast when src/dest types have mismatched handle_is_ptr
...
* separate BitCast and BitCastGen instructions
* closes #991
* closes #1934
* unrelated: fix typo in docs (thanks gamester for pointing it out)
2019-02-22 08:49:27 -05:00
Andrew Kelley
cbce61a209
better field access of types which have one possible value
...
* When you do field access of a type which only has one possible
value, the result is comptime-known.
* StorePtr instructions which operate on pointers to types which
only have one possible value, the result is a comptime no-op.
closes #1554
2019-02-21 16:09:14 -05:00
Andrew Kelley
1066004b79
better handling of arrays in packed structs
...
* Separate LoadPtr IR instructions into pass1 and pass2 variants.
* Define `type_size_bits` for extern structs to be the same as
their `@sizeOf(T) * 8` and allow them in packed structs.
* More helpful error messages when trying to use types in
packed structs that are not allowed.
* Support arrays in packed structs even when they are not
byte-aligned.
* Add compile error for using arrays in packed structs when the
padding bits would be problematic. This is necessary since
we do not have packed arrays.
closes #677
2019-02-21 14:44:14 -05:00
Andrew Kelley
2bb795dc45
@sliceToBytes works at comptime
...
closes #262
2019-02-21 10:07:11 -05:00
Andrew Kelley
db31c2524d
extern structs support comptime bitcasting
2019-02-21 08:46:43 -05:00
Andrew Kelley
3ee9d06cbd
packed structs support comptime bitcasting
...
* `type_size_store` is no longer a thing. loading and storing a pointer
to a value may dereference up to `@sizeOf(T)` bytes, even for
integers such as `u24`.
* fix `types_have_same_zig_comptime_repr` to not think that the
same `ZigTypeId` means the `ConstExprValue` neccesarily has the
same representation.
* implement `buf_write_value_bytes` and `buf_read_value_bytes` for
`ContainerLayoutPacked`
closes #1120
2019-02-20 22:40:41 -05:00
daurnimator
7bbccfc7f3
Use valgrind marks from Allocator
2019-02-21 11:43:09 +11:00
Andrew Kelley
079728752e
deduplicate compile errors for undeclared identifiers
...
closes #111
2019-02-20 08:04:46 -05:00
daurnimator
d68ae35c11
std: when a FixedBufferAllocator is initialised, set the buffer to undefined
2019-02-20 16:52:23 +11:00
daurnimator
da7880b4cf
std: Add valgrind module
2019-02-20 16:52:20 +11:00
Andrew Kelley
067968c57f
Merge branch 'matthew-mcallister-slice-deref-failure'
2019-02-19 15:35:00 -05:00
Andrew Kelley
c8ce351ec9
pull request fixups
2019-02-19 15:34:44 -05:00
Andrew Kelley
1034af40f9
Merge branch 'slice-deref-failure' of https://github.com/matthew-mcallister/zig into matthew-mcallister-slice-deref-failure
2019-02-19 15:27:10 -05:00
LemonBoy
400006bbe7
Prevent crash in tagged enums rendering ( #1986 )
...
* Prevent crash in tagged enums rendering
* Add a test case
2019-02-19 15:18:57 -05:00
Andrew Kelley
db74832e40
valgrind client requests for undefined values
...
with this change, when you assign undefined, zig emits a few
assembly instructions to tell valgrind that the memory is undefined
it's on by default for debug builds, and disabled otherwise. only
support for linux, darwin, solaris, mingw on x86_64 is currently
implemented.
--disable-valgrind turns it off even in debug mode.
--enable-valgrind turns it on even in release modes.
It's always disabled for compiler_rt.a and builtin.a.
Adds `@import("builtin").valgrind_support` which lets code know
at comptime whether valgrind client requests are enabled.
See #1989
2019-02-19 12:07:56 -05:00
Andrew Kelley
c9fb5240d6
remove --no-rosegment workaround now that valgrind bug is fixed
...
See #896
Zig 0.3.0+ and Valgrind 3.14+ do not need the workaround.
2019-02-19 08:39:36 -05:00
Andrew Kelley
007a260cda
Merge branch 'kristate-zig-backport-issue1944'
2019-02-18 18:12:02 -05:00
Andrew Kelley
ea3d9d5c53
add test for 74bdc1d1f8
2019-02-18 18:11:30 -05:00
Andrew Kelley
b0ceea1831
zig fmt: fix infix operator before multiline string literal
2019-02-18 18:11:12 -05:00
kristopher tate
74bdc1d1f8
src/analyze.cpp: default to using param_node upon callconv error;
2019-02-18 17:57:24 -05:00
John Schmidt
99adda9df5
Some function doc tweaks ( #1961 )
...
* Add docs for the inline function attribute
* Remove outdated comment
Seems like a leftover from when implicit returns were around.
* Consistent terminology
2019-02-18 17:53:41 -05:00
Andrew Kelley
043090020f
docs: shadowing
...
closes #1245
2019-02-18 17:49:26 -05:00
Andrew Kelley
8922008dec
docs: note top level declarations are order-independent
...
closes #1244
2019-02-18 17:41:55 -05:00
Andrew Kelley
28bf768883
export _mh_execute_header with weak linkage
...
* also fix extern variables with initialiaztion values to generate runtime code
* remove the workaround in example/shared_library/mathtest.zig
* introduce the ability for global variables to have Weak and LinkOnce
linkage
* fix `@export` to work for non-functions. this code needs to be
audited though.
* fix comptime ptrcast not keeping bigger alignment
* fix linker warnings when targeting darwin
closes #1903
2019-02-18 16:47:30 -05:00
Andrew Kelley
74a335c4cc
Merge branch 'emekoi-fix-1711'
2019-02-18 13:12:03 -05:00
Andrew Kelley
7a84fe79b9
pull request fixups
2019-02-18 13:05:26 -05:00
emekoi
9b3013d2f6
make @enumToInt work on union(enum)
...
closes #1711
2019-02-18 11:43:45 -05:00
Jimmi HC
d2fb95af88
Fixed std.testing.expectEqual
2019-02-18 17:22:14 +01:00
LemonBoy
e280dce30f
Translate parameterless C functions ( #1978 )
...
Both FunctionNoProto and FunctionProto are subclasses of FunctionType,
the only difference is that the former is parameterless.
2019-02-18 10:26:45 -05:00
LemonBoy
7d762648a4
Add align attribute for params pointers
2019-02-18 09:52:18 -05:00
Andrew Kelley
74d9593d85
README: add NetBSD to support table
2019-02-18 00:13:18 -05:00
Andrew Kelley
3e586264e5
Merge pull request #1972 from coypoop/netbsd
...
Add NetBSD support
2019-02-18 00:10:31 -05:00
Andrew Kelley
39207fa1d4
Merge pull request #1963 from matthew-mcallister/dedup-compile-log-warning
...
Deduplicate compile log statement warnings
2019-02-17 23:53:43 -05:00
Quetzal Bradley
7e54954052
fix openWriteNoClobber and add test
2019-02-17 23:21:45 -05:00
Matthew McAllister
c70ee9177e
Check for duped error messages in compile tests
2019-02-17 15:33:28 -08:00
Matthew McAllister
51783510b9
Deduplicate compile log statement warnings
2019-02-17 14:02:37 -08:00
Maya Rashish
b93405c24b
Don't provide a bogus definition of EVFILT_USER
2019-02-17 23:50:30 +02:00
Andrew Kelley
de18ece294
Merge pull request #1975 from BenoitJGirard/master
...
Fix std.math.powi so powi(x, +-0) = 1 for any x.
2019-02-17 15:00:17 -05:00
Benoit Jauvin-Girard
fcf65f06c4
Fix std.math.powi so powi(x, +-0) = 1 for any x.
2019-02-17 14:52:40 -05:00
LemonBoy
6cf38369d2
Silence gcc8 class-memaccess warnings
...
Use an explicit cast to tell gcc we know what we're doing.
2019-02-17 14:40:01 -05:00
BenoitJGirard
6daa041932
Merge pull request #2 from ziglang/master
...
Refreshing fork.
2019-02-17 14:38:55 -05:00
Maya Rashish
2878efee86
Undo local, unneeded patch
2019-02-17 14:14:17 +02:00
Maya Rashish
8d2a902945
freebsd: fix pointer cast in mmap
2019-02-17 02:25:37 -05:00
Maya Rashish
bc10382ec1
Add NetBSD support
...
Mostly picking the same paths as FreeBSD.
We need a little special handling for crt files, as netbsd uses its
own (and not GCC's) for those, with slightly different names.
2019-02-17 09:17:34 +02:00
Andrew Kelley
db9c1b0528
Merge branch 'sjdh02-master'
2019-02-17 00:33:43 -05:00
Andrew Kelley
4a0bb62584
fixups
2019-02-17 00:29:58 -05:00
sjdh02
fd61a084e4
fix BufferedInStream not reading delayed input
2019-02-16 21:19:49 -06:00
Matthew McAllister
91989e70ba
Fix lvalue dereference type checking
...
Previously, if a dereference instruction was an lvalue, it would fail to
typecheck that the value being dereferenced was indeed a pointer.
Although a little clunky, this change obviates the need for redundant
type checks scattered about the analysis.
2019-02-16 17:37:47 -08:00
Andrew Kelley
c3c92ca8b1
translate-c: 4 more functions using C decls
...
See #1964
2019-02-16 19:48:39 -05:00
Andrew Kelley
2dfa76a1a7
fix regressions from previous commit when building with clang
2019-02-16 16:17:30 -05:00
Andrew Kelley
356cfa08f4
translate-c: proof of concept for transitioning to userland
...
See #1964
2019-02-16 15:26:44 -05:00
Andrew Kelley
bd52d81dc3
README: direct link to Download & Documentation at the top
2019-02-16 14:36:52 -05:00
Andrew Kelley
f4c5bcfea5
refactor translate-c - no more using namespace clang
...
this is in preparation for #1964
2019-02-16 14:09:00 -05:00
Andrew Kelley
f57182456d
Merge pull request #1898 from Sahnvour/translate-c-arrays
...
Translate c arrays
2019-02-16 14:07:41 -05:00
Andrew Kelley
a97362e677
fmt_runner: remove redundant check
2019-02-16 12:24:02 -05:00
Andrew Kelley
ba56f365c8
bring zig fmt to stage1
2019-02-16 00:53:32 -05:00
Marc Tiehuis
77a4e7b374
Merge pull request #1958 from ziglang/parse-float
...
Add float parsing support to std
2019-02-16 15:04:37 +13:00
emekoi
5736a9c6a9
removed hidden union tag in release modes
2019-02-15 20:02:09 -05:00
Andrew Kelley
a05e224150
typecheck the panic function
...
this adds the prototype of panic to @import("builtin")
and then uses it to do an implicit cast of the panic
function to this prototype, rather than redoing all the
implicit cast logic.
closes #1894
closes #1895
2019-02-15 19:19:28 -05:00
Andrew Kelley
7293e012d7
breaking: fix @sizeOf to be alloc size rather than store size
...
* Fixes breaches of the guarantee that `@sizeOf(T) >= @alignOf(T)`
* Fixes std.mem.secureZero for integers where this guarantee previously
was breached
* Fixes std.mem.Allocator for integers where this guarantee previously
was breached
Closes #1851
Closes #1864
2019-02-15 18:05:50 -05:00
Andrew Kelley
567c9b688e
Merge pull request #1965 from ziglang/c-pointer-type
...
implement C pointers
2019-02-15 02:20:42 -05:00
Andrew Kelley
ee5e196f88
add test for truncate on comptime integers
...
closes #703
2019-02-15 02:02:19 -05:00
Andrew Kelley
99b19adeb3
stage2: fix windows regressions
2019-02-14 23:46:53 -05:00
Andrew Kelley
71d7100aa8
darwin: fix pointer cast in mmap
2019-02-14 23:38:14 -05:00
Marc Tiehuis
170ec504ec
Use official llvm mirror for compiler-rt commit ref
2019-02-15 17:37:55 +13:00
Marc Tiehuis
18ad50970f
Make parseFloat stricter in what it accepts as input
2019-02-15 17:32:13 +13:00
Andrew Kelley
e025c70166
stage2: fix llvm.zig with opaque types back to single-item pointer
2019-02-14 23:17:11 -05:00
Andrew Kelley
d6e0d82c32
translate-c: back to *c_void for opaque types
...
See #1059
2019-02-14 23:09:31 -05:00
Andrew Kelley
d5bbd74871
allow C pointers to have alignment
...
clang/gcc support pointer alignment attribute:
https://clang.llvm.org/docs/AttributeReference.html#align-value
2019-02-14 20:04:13 -05:00
Andrew Kelley
cc7060d0d9
compile error for C pointer with align attribute
...
See #1059
2019-02-14 20:02:29 -05:00
Andrew Kelley
973a93d43b
add docs for C pointers
2019-02-14 19:03:04 -05:00
Andrew Kelley
df87044fd6
omit nonnull attribute for C pointers
...
See #1059
2019-02-14 16:10:12 -05:00
Andrew Kelley
6769183a9d
fix implicit cast error unions with non-optional to optional pointer
...
and update self hosted compiler for C pointers
See #1059
2019-02-14 15:48:28 -05:00
Andrew Kelley
52c03de5c2
add missing compile error for OpaqueType inside structs/unions
...
closes #1862
2019-02-14 13:07:51 -05:00
Andrew Kelley
e03c770145
compile error tests for implicit C pointer casting
...
See #1059
2019-02-14 12:28:50 -05:00
Andrew Kelley
c58b802034
remove the "top of the comptime stack" compile error
...
It's still best practice to put `@setEvalBranchQuota` at the top of
the comptime stack, but as Jimmi notes in #1949 , when a function
can be called at comptime and also can be the top of the comptime stack,
this compile error is fundamentally unsound.
So now it's gone.
closes #1949
2019-02-14 10:51:59 -05:00
Andrew Kelley
a4e32d9fb1
ci: freebsd: remove '.git' from URL as per upstream suggestion
...
https://todo.sr.ht/~sircmpwn/dispatch.sr.ht/24#comment-1465
2019-02-14 09:46:08 -05:00
Andrew Kelley
59de24817e
runtime safety check for casting null to pointer
...
see #1059
2019-02-14 01:09:33 -05:00
Andrew Kelley
d4d2718bca
comptime detection of casting null to pointer
...
See #1059
2019-02-14 00:40:39 -05:00
Jimmi Holst Christensen
2911eb34de
Added error for nesting vectors
2019-02-13 12:19:08 +01:00
Marc Tiehuis
de7c55145a
Add parseFloat support to json.zig
2019-02-14 00:12:00 +13:00
Marc Tiehuis
c34ce6878e
Add parseFloat to std.fmt
...
This is not intended to be the long-term implementation as it doesn't
provide various properties that we eventually will want (e.g.
round-tripping, denormal support). It also uses f64 internally so the
wider f128 will be inaccurate.
2019-02-14 00:07:51 +13:00
Jimmi Holst Christensen
53297a1bd0
We already support vector bit operators, so let's test it
2019-02-13 11:40:32 +01:00
Jimmi Holst Christensen
c7b9ab985c
Merge branch 'master' of github.com:ziglang/zig
2019-02-13 11:31:20 +01:00
Jimmi Holst Christensen
c221b29c9d
We already support vector on floats, so let's test it
2019-02-13 11:31:13 +01:00
Marc Tiehuis
cf007e37b9
Add f128 support for fabs, isinf, isnan, inf and nan functions
2019-02-13 23:27:23 +13:00
Marc Tiehuis
be861a85c8
compiler-rt: Add __addtf3, __subtf3 and __truncdfhf2
...
Allows addition/subtraction of f128 and narrowing casts to f16 from
larger float types.
2019-02-13 23:24:52 +13:00
Matthew McAllister
0b3db784f1
Enable compileLog to display slices
2019-02-13 02:00:02 -05:00
Andrew Kelley
5699ab5e77
C pointers: errors for nested pointer casting regarding null
...
See #1059
2019-02-12 18:20:00 -05:00
Andrew Kelley
270933b1e9
compile error test for casting integer to c pointer
...
when the int has more bits than pointers
See #1059
2019-02-12 10:25:21 -05:00
Andrew Kelley
6f05e8d1be
implicit casting between C pointer and optional non-C pointer
...
See #1059
2019-02-12 01:38:11 -05:00
Andrew Kelley
285e2f62ba
disallow C pointers to non-C-ABI-compatible element types
...
See #1059
2019-02-12 00:51:06 -05:00
Andrew Kelley
0abe6d668e
C pointers: delete dead code in ir_num_lit_fits_in_other_type
2019-02-12 00:39:08 -05:00
Andrew Kelley
069fc1a269
peer type resolution with C pointers
...
See #1059
2019-02-11 19:21:59 -05:00
Andrew Kelley
57a7ab0d33
comptime support for pointer arithmetic with hard coded addresses
2019-02-11 19:12:01 -05:00
Andrew Kelley
90b8cd4a45
add C pointer type to @typeInfo
...
See #1059
2019-02-11 16:07:40 -05:00
Andrew Kelley
342bca7f46
C pointer comparison and arithmetic
...
See #1059
2019-02-11 15:31:09 -05:00
Andrew Kelley
d9e01be973
translate-c: use C pointer type everywhere
...
See #1059
2019-02-11 14:56:59 -05:00
Andrew Kelley
4a1b910e03
zig fmt: support C pointers
...
See #1059
2019-02-11 14:07:19 -05:00
Andrew Kelley
43df49cb35
README: move i386-macosx to Tier 4
...
See #1930
2019-02-11 12:59:33 -05:00
Andrew Kelley
661fc79fba
langref: update grammar with c pointers
...
See #1059
2019-02-10 12:02:56 -05:00
Andrew Kelley
7a8f391b0f
avoid needlessly creating global constants
...
This deletes some legacy cruft, and produces leaner object files.
Example:
```
var x: i32 = 1234;
export fn entry() i32 {
return x;
}
```
This produces:
```
@x = internal unnamed_addr global i32 1234, align 4
@0 = internal unnamed_addr constant i32* @x, align 8
```
and @0 is never even used. After this commit, @0 is not produced.
This fixes a bug: Zig was creating invalid LLVM IR when one of these
globals that shouldn't exist takes the address of a thread local
variable. In LLVM 8.0.0rc2, it would produce a linker error. But
probably after my bug report is solved it will be caught by the IR
verifier.
https://bugs.llvm.org/show_bug.cgi?id=40652
2019-02-10 11:07:00 -05:00
Andrew Kelley
bcbcb2e9ff
Merge remote-tracking branch 'origin/master' into llvm8
2019-02-10 11:03:17 -05:00
Andrew Kelley
8e68d43ad3
avoid needlessly creating global constants
...
This deletes some legacy cruft, and produces leaner object files.
Example:
```
var x: i32 = 1234;
export fn entry() i32 {
return x;
}
```
This produces:
```
@x = internal unnamed_addr global i32 1234, align 4
@0 = internal unnamed_addr constant i32* @x, align 8
```
and @0 is never even used. After this commit, @0 is not produced.
This fixes a bug: Zig was creating invalid LLVM IR when one of these
globals that shouldn't exist takes the address of a thread local
variable. In LLVM 8.0.0rc2, it would produce a linker error. But
probably after my bug report is solved it will be caught by the IR
verifier.
https://bugs.llvm.org/show_bug.cgi?id=40652
2019-02-10 10:58:00 -05:00
Jimmi HC
2f9fedabf0
testing.expectEqual use expected type as the type of actual
...
This allows for impl casts
2019-02-10 12:43:49 +01:00
Andrew Kelley
73e8e46257
casting between C pointers and normal pointers
...
See #1059
2019-02-10 01:11:40 -05:00
Andrew Kelley
b8cbe3872e
added C pointer type and implicit int-to-ptr for this type
...
See #1059
2019-02-10 00:14:30 -05:00
Andrew Kelley
caf672c495
@truncate: comptime 0 when target type is 0 bits
...
also if the dest type is a comptime_int, then treat it
as an implicit cast.
also compile error for attempting to truncate undefined
closes #1568
2019-02-09 21:38:34 -05:00
Andrew Kelley
31be1ddf09
docs: add threadlocal keyword to grammar
2019-02-09 20:57:45 -05:00
Andrew Kelley
34eb9f18ac
fix not updating debug info type of optional error sets
...
There's an unfortunate footgun in the current design of error sets.
The debug info type for every error set is the same as the debug info
type of the global error set, which is essentially an enum forward
declaration. The problem is that when we "replace" the forward
declaration with the final value, once we know all the possible errors,
we have to update the pointers of every error set.
So the footgun is that if you ever copy the debug info type of the
global error set, you have to add the address of the pointer to a list
of pointers that need to be updated once we "replace" the forward
declaration. I activated the footgun when I introduced the optimization
that `?anyerror` types are the same size as `anyerror` types (using 0 as
the null value), because I introduced a pointer copy of the global error
set debug info type, but forgot to add it to the list.
I'm sure that there is a better way to code this, which does not have
the footgun, but this commit contains only a fix, not a reworking of the
logic.
closes #1937
2019-02-09 20:41:26 -05:00
Andrew Kelley
1864acd326
Merge remote-tracking branch 'origin/master' into llvm8
2019-02-09 18:57:39 -05:00
Andrew Kelley
ca8580ece1
Merge branch 'vector-int-add-safety'
2019-02-09 16:24:41 -05:00
Andrew Kelley
373e21bb56
implement vector math safety with ext and trunc
2019-02-09 16:24:29 -05:00
Andrew Kelley
0a7bdc0077
implement vector addition with safety checking
...
this would work if @llvm.sadd.with.overflow supported
vectors, which it does in trunk. but it does not support
them in llvm 7 or even in llvm 8 release branch.
so the next commit after this will have to do a different
strategy, but when llvm 9 comes out it may be worth coming
back to this one.
2019-02-09 14:44:33 -05:00
Andrew Kelley
a8a63feba7
docgen: update for threadlocal keyword
2019-02-09 00:28:12 -05:00
Andrew Kelley
052800e952
zig fmt: support threadlocal
2019-02-09 00:19:24 -05:00
Andrew Kelley
d6f2af378a
fix docs
...
broken by c2db077574
2019-02-08 19:38:16 -05:00
Andrew Kelley
46ddd5f5f4
fix compiler assertion failure when returning value from test
...
closes #1935
2019-02-08 19:23:46 -05:00
Andrew Kelley
c2db077574
std.debug.assert: remove special case for test builds
...
Previously, std.debug.assert would `@panic` in test builds,
if the assertion failed. Now, it's always `unreachable`.
This makes release mode test builds more accurately test
the actual code that will be run.
However this requires tests to call `std.testing.expect`
rather than `std.debug.assert` to make sure output is correct.
Here is the explanation of when to use either one, copied from
the assert doc comments:
Inside a test block, it is best to use the `std.testing` module
rather than assert, because assert may not detect a test failure
in ReleaseFast and ReleaseSafe mode. Outside of a test block, assert
is the correct function to use.
closes #1304
2019-02-08 18:23:38 -05:00
John Schmidt
be6d022257
Make ThreadSafeFixedBufferAllocator alias FixedBufferAllocator when --single-threaded
...
Fixes #1910
2019-02-07 23:21:37 -05:00
Andrew Kelley
48c1e235cb
update clang headers to 8.0.0rc2
2019-02-07 18:49:42 -05:00
Andrew Kelley
00902ff9b0
LLD patch: workaround for buggy MACH-O code
...
This reapplies 1a1414fc42
to the embedded LLD.
2019-02-07 17:08:25 -05:00
Andrew Kelley
3e08b3a4f8
update embedded LLD to 8.0.0rc2
2019-02-07 17:07:18 -05:00
Andrew Kelley
f330eebe4b
fix using the result of @intCast to u0
...
closes #1817
2019-02-07 16:02:45 -05:00
Andrew Kelley
91baa574a5
build: update Findllvm.cmake for llvm 8
2019-02-07 12:24:55 -05:00
Andrew Kelley
f8ba50f5ed
build: make sure LLVM is exactly correct
...
* check the version to be the correct major version
* ensure that it has all the default targets enabled
2019-02-07 12:22:04 -05:00
Andrew Kelley
a94304d3e4
Merge remote-tracking branch 'origin/master' into llvm8
2019-02-07 12:21:20 -05:00
Andrew Kelley
7843c96df8
build: make sure LLVM is exactly correct
...
* check the version to be the correct major version
* ensure that it has all the default targets enabled
2019-02-07 12:18:01 -05:00
Andrew Kelley
2b2bf53a49
better error message when LLVM does not understand a triple
2019-02-07 11:40:56 -05:00
Andrew Kelley
a0590bda29
Merge branch 'kristate-zig-backport-std.mem.join'
2019-02-07 10:56:30 -05:00
Andrew Kelley
38a7716194
fixups
2019-02-07 10:55:23 -05:00
Andrew Kelley
130f422742
Merge branch 'zig-backport-std.mem.join' of https://github.com/kristate/zig into kristate-zig-backport-std.mem.join
2019-02-07 10:43:14 -05:00
Andrew Kelley
7fc99c33bd
Merge branch 'kristate-zig-backport-std.os.path'
2019-02-07 00:49:06 -05:00
Andrew Kelley
36bade5c56
fixups, and modify std.mem.join and std.os.path.resolve API
...
* zig fmt
* std.mem.join takes a slice of slices instead of var args
* std.mem.join takes a separator slice rather than byte,
and always inserts it. Previously it would not insert the separator
if there already was one, violating the documented behavior.
* std.mem.join calculates exactly the correct amount to allocate
and has no call to allocator.shrink()
* bring back joinWindows and joinPosix and the corresponding tests.
it is intended to be able to call these functions from any OS.
* rename std.os.path.resolveSlice to resolve (now resolve takes
a slice of slices instead of var args)
2019-02-07 00:42:41 -05:00
Andrew Kelley
c804ae2d6b
Merge branch 'zig-backport-std.os.path' of https://github.com/kristate/zig into kristate-zig-backport-std.os.path
2019-02-06 22:53:34 -05:00
Andrew Kelley
8a5d3e2eaf
Merge pull request #1924 from ziglang/tls
...
Implement Thread Local Variables
2019-02-06 20:21:13 -05:00
Andrew Kelley
89ffb58197
implement Thread Local Storage on Windows
2019-02-06 18:32:41 -05:00
Andrew Kelley
d2602b442e
require running std lib tests coherently
...
this should actually improve CI times a bit too
See the description at the top of std/os/startup.zig (deleted in this
commit) for a more detailed understanding of what this commit does.
2019-02-06 14:32:20 -05:00
Andrew Kelley
b1775ca168
thread local storage working for linux x86_64
2019-02-06 13:48:04 -05:00
Andrew Kelley
3abf293a84
doc/targets.md has moved to the github wiki
...
https://github.com/ziglang/zig/wiki/How-to-Add-Support-For-More-Targets
2019-02-06 11:53:09 -05:00
tgschultz
20e2d8da61
Fixed Serializer and BitOutStream when used with streams that have empty error sets.
2019-02-06 00:06:27 -05:00
Andrew Kelley
fd28b9d501
Merge pull request #1919 from Sahnvour/windows-childprocess
...
Better behaviour of ChildProcess under windows.
2019-02-05 21:03:33 -05:00
Sahnvour
6860db66fe
Typo: use the joined path to try executables available from PATH.
2019-02-05 23:13:17 +01:00
Sahnvour
a9faace8b4
Notify failure to create a process when the executable is not found even in PATH.
2019-02-05 23:12:54 +01:00
Sahnvour
075fda3c73
translate-c: add tests. Commented for now as the output is currently empty until #646 is fixed.
2019-02-05 20:36:57 +01:00
Andrew Kelley
ac4e38226b
docs: clarify passing aggregate types as parameters
2019-02-05 10:28:56 -05:00
Jimmi Holst Christensen
4010f6a11d
Added support for vector wrapping mult and sub
...
* I also merged the code that generates ir for add, sub, and mult
2019-02-05 09:57:11 -05:00
Andrew Kelley
06be65a602
fix vector debug info tripping LLVM assertion
2019-02-04 22:16:16 -05:00
Andrew Kelley
d974afde1d
fix vector debug info tripping LLVM assertion
2019-02-04 22:14:35 -05:00
Andrew Kelley
f32f7a937f
Merge remote-tracking branch 'origin/master' into llvm8
2019-02-04 21:26:50 -05:00
Andrew Kelley
8c6fa982cd
SIMD: array to vector, vector to array, wrapping int add
...
also vectors and arrays now use the same ConstExprVal representation
See #903
2019-02-04 20:30:00 -05:00
Andrew Kelley
2828a9695f
Merge branch 'kristate-zig-backport-std.mem.separate'
2019-02-04 15:27:44 -05:00
Andrew Kelley
67bd45f0cf
adjustments to std.mem split / separate
...
* rename std.mem.split to std.mem.tokenize
* add future deprecation notice to docs
* (unrelated) add note to std.os.path.resolve docs
* std.mem.separate - assert delimiter.len not zero
* fix implementation of std.mem.separate to respect the delimiter
* separate the two iterators to different structs
2019-02-04 15:24:06 -05:00
Andrew Kelley
f44ce7836a
Merge branch 'zig-backport-std.mem.separate' of https://github.com/kristate/zig into kristate-zig-backport-std.mem.separate
2019-02-04 13:29:17 -05:00
Andrew Kelley
dfbc063f79
std.mem.Allocator.create replaced with better API
...
`std.mem.Allocator.createOne` is renamed to `std.mem.Allocator.create`.
The problem with the previous API is that even after copy elision,
the initalization value passed as a parameter would always be a copy.
With the new API, once copy elision is done, initialization
functions can directly initialize allocated memory in place.
Related:
* #1872
* #1873
2019-02-03 16:13:28 -05:00
Matthew McAllister
c90c256868
Fix slice concatenation
...
This was causing an underflow error
2019-02-02 22:22:00 -05:00
Andrew Kelley
9b8e23934b
introduce --single-threaded build option
...
closes #1764
This adds another boolean to the test matrix; hopefully it does not
inflate the time too much.
std.event.Loop does not work with this option yet. See #1908
2019-02-01 18:05:54 -05:00
Matthew McAllister
8bedb10939
Fix runtime assignment to comptime aggregate field
...
This was causing a segfault
2019-02-01 17:14:12 -05:00
Andrew Kelley
ae1ebe09b7
add compile errror for @bitCast when bit counts mismatch
...
fixes invalid LLVM IR from previous commit
2019-02-01 14:06:51 -05:00
Andrew Kelley
bbe857be96
Merge pull request #1775 from tgschultz/stdlib-serialization
...
Added serialization, bitstreams, traits for int sign, TagPayloadType, some fixes to std
2019-02-01 13:05:34 -05:00
Andrew Kelley
8d32d25619
Merge branch 'emekoi-windows-mutex'
2019-02-01 12:22:55 -05:00
Andrew Kelley
bfc1772d8e
fixups
2019-02-01 12:22:21 -05:00
Andrew Kelley
8d3eb25e92
Merge branch 'windows-mutex' of https://github.com/emekoi/zig into emekoi-windows-mutex
2019-02-01 10:21:16 -05:00
Andrew Kelley
7a4ed10981
darwin: fix incorrect timeval struct type
...
closes #1648
I also added some more extern functions for darwin time functions,
although nothing depends on them currently.
2019-01-31 18:57:53 -05:00
Andrew Kelley
28873e7622
os.cpp: fix regression on Windows from 59c050e7
2019-01-31 16:52:59 -05:00
Andrew Kelley
545064c1d9
introduce vector type for SIMD
...
See #903
* create with `@Vector(len, ElemType)`
* only wrapping addition is implemented
This feature is far from complete; this is only the beginning.
2019-01-30 23:39:25 -05:00
Andrew Kelley
169a789b34
fix test after merging ad8381e0d2
...
this test slipped through due to branching
2019-01-30 16:12:30 -05:00
Andrew Kelley
59c050e7ff
collapse os_file_mtime into os_file_open_r and check for directory
...
This is a manual merge of kristate's pull request #1754 , due to
conflicts + a couple fixups.
closes #1754
2019-01-30 16:06:18 -05:00
Matthew McAllister
ad8381e0d2
Move tokenizer error location to offending char
...
Previously, it pointed to the start of the current token, but this made
it difficult to tell where the error occurred when it was, say, in the
middle of a string.
2019-01-30 14:02:01 -05:00
Andrew Kelley
ecb0cb661a
darwin time code: don't cast to int until the end
...
See #1648
2019-01-30 02:53:59 -05:00
Andrew Kelley
9ca94bbba5
fix freebsd ci from previous commit
2019-01-30 02:53:50 -05:00
Andrew Kelley
581edd643f
backport copy elision changes
...
This commit contains everything from the copy-elision-2
branch that does not have to do with copy elision directly,
but is generally useful for master branch.
* All const values know their parents, when applicable, not
just structs and unions.
* Null pointers in const values are represented explicitly,
rather than as a HardCodedAddr value of 0.
* Rename "maybe" to "optional" in various code locations.
* Separate DeclVarSrc and DeclVarGen
* Separate PtrCastSrc and PtrCastGen
* Separate CmpxchgSrc and CmpxchgGen
* Represent optional error set as an integer, using the 0 value.
In a const value, it uses nullptr.
* Introduce type_has_one_possible_value and use it where applicable.
* Fix debug builds not setting memory to 0xaa when storing
undefined.
* Separate the type of a variable from the const value of a variable.
* Use copy_const_val where appropriate.
* Rearrange structs to pack data more efficiently.
* Move test/cases/* to test/behavior/*
* Use `std.debug.assertOrPanic` in behavior tests instead of
`std.debug.assert`.
* Fix outdated slice syntax in docs.
2019-01-29 22:30:30 -05:00
Andrew Kelley
9c328b4291
simpler implementation of && and || hints
...
This accomplishes the same goal, but with less changes, so that
I can backport copy elision stuff easier.
2019-01-29 22:29:56 -05:00
Sahnvour
f0d35d78b6
translate-c: avoid array concatenation if the init node is empty, for clarity.
2019-01-26 16:47:11 +01:00
Sahnvour
584cb1fcfe
translate-c: only detect ints as negative if they are signed.
2019-01-26 15:53:19 +01:00
Sahnvour
b2662e443d
translate-c: correct array concatenation for incomplete C array initializers.
2019-01-26 15:41:23 +01:00
Sahnvour
dd5450e7b9
translate-c: get real child type of array type for incomplete initializers and/or multi-dimensional arrays.
2019-01-26 15:39:38 +01:00
kristopher tate
5bf9ffdc5b
Hint at use of and/or when &&/|| is improperly used ( #1886 )
2019-01-25 21:10:40 +01:00
Andrew Kelley
1411df4e27
update to llvm8 trunk. all tests passing
2019-01-24 09:31:00 -05:00
Andrew Kelley
87f5bed11f
Merge remote-tracking branch 'origin/master' into llvm8
2019-01-22 20:10:34 -05:00
tharvik
3bec3b9f9b
llvm-config sanity check
2019-01-21 15:58:54 -05:00
Andrew Kelley
aee973829d
Merge branch 'kristate-zig-backport-issue1883'
2019-01-20 14:09:46 -05:00
Andrew Kelley
1357bc7430
add test case for previous commit
2019-01-20 14:09:17 -05:00
kristopher tate
0d1ce1fb5f
src/analyze.cpp: return type entry for ZigTypeIdPointer if it points to ZigTypeIdOpaque
...
ref: ziglang/zig#1883
2019-01-20 17:08:35 +09:00
Andrew Kelley
c968d8756c
Merge pull request #1885 from Sahnvour/master
...
Fixed source lines printing of stack traces on windows.
2019-01-18 13:32:01 -05:00
Sahnvour
a60ecdc681
Hopefully fixed #1503 (at least improved) line accuracy of stack traces on windows.
2019-01-18 10:35:00 +01:00
Sahnvour
5ab8db7b3e
removed unnecessary cast
2019-01-18 10:35:00 +01:00
Andrew Kelley
404c87b06a
fix incorrect parameter names for std.math.atan2
2019-01-14 18:11:17 -05:00
emekoi
3ff9ab332c
fixed type signature
2019-01-11 09:56:37 -06:00
emekoi
51fff9fa82
fixed initializer and typos
2019-01-11 09:56:36 -06:00
emekoi
35d93d22db
removed nullables
2019-01-11 09:56:36 -06:00
emekoi
9385127052
changed pointer types
2019-01-11 09:56:35 -06:00
emekoi
bb31695fbf
fixed mutex on windows
2019-01-11 09:56:35 -06:00
emekoi
207fa3849c
moved to InitializeCriticalSection to init
2019-01-11 09:56:34 -06:00
emekoi
25d7f5b654
switching back to EnterCriticalSection
2019-01-11 09:56:34 -06:00
emekoi
aaae2f5705
switching from EnterCriticalSection to TryEnterCriticalSection
2019-01-11 09:56:33 -06:00
emekoi
99f44219bc
updated structs
2019-01-11 09:56:33 -06:00
emekoi
b61bce254c
added mutex for windows
2019-01-11 09:56:32 -06:00
Andrew Kelley
3b2eeb839b
Merge remote-tracking branch 'origin/master' into llvm8
2019-01-09 10:44:57 -05:00
Andrew Kelley
5864d92b40
when rendering llvm const values, ensure the types align
...
the representation of the const expr val in zig, and the
type that we tell LLVM it is.
2019-01-09 10:43:48 -05:00
Andrew Kelley
027a0c46ae
Merge remote-tracking branch 'origin/master' into llvm8
2019-01-08 16:50:16 -05:00
Andrew Kelley
1ca983dbd7
translate-c: update to llvm8
2019-01-08 16:49:52 -05:00
Andrew Kelley
4d5d0d3ada
@typeInfo: more correct return type info
2019-01-08 14:40:56 -05:00
Andrew Kelley
aa65b94671
fix debug info for function pointers
...
found when testing against LLVM 8
see https://bugs.llvm.org/show_bug.cgi?id=40198
2019-01-08 11:53:51 -05:00
Andrew Kelley
013c7b24d2
Merge pull request #1874 from ziglang/issue-1866
...
Fix #1866
2019-01-06 14:00:34 -05:00
Jimmi HC
da08525bb3
Removed oops comments
2019-01-06 18:02:00 +01:00
Jimmi HC
97702988d1
Added test case
2019-01-06 17:58:00 +01:00
Jimmi HC
55e95daf54
Fixed issue where TypeInfo would use types from a prev CodeGen instance
...
When doing multible codegen passes (such as building
compiler_rt and then something else) the TypeInfo cache code would point
to types from the prev code gen (such as the prev 'bool' type), giving
us errors like "expected type 'bool', but found type 'bool'"
This disabling of caching might have a performance hit, but correctness is better than
speed, so let's have this for now, until someone optimizes this
correctly (probably in stage2)
2019-01-06 17:53:34 +01:00
Jimmi HC
e410b1f915
Implemented buf_read_value_bytes for ZigTypeIdArray
...
* Only for x_array.special == ConstArraySpecialNone
2019-01-06 17:49:24 +01:00
Jimmi HC
db92891587
Respect the type system instead of ConstExprValue when getting field
2019-01-06 17:48:31 +01:00
Marcio
5f26d1dddb
freebsd: fix wrong call to clock_getres ( #1871 )
...
Reported-by: daurnimator
2019-01-05 13:34:47 -05:00
vegecode
1f08be4d7f
Mark comptime int hardcoded address pointee as a run time variable #1171 ( #1868 )
...
* Mark comptime int hardcoded address as a run time variable #1171
* test case for dereferencing hardcoded address intToPtr
2019-01-04 17:34:21 -05:00
Marcio Giaxa
5c2a1055a0
freebsd: add sockaddr structs
2019-01-04 16:31:57 -05:00
Marcio Giaxa
4d9547ff2e
freebsd: implement clock related functions
...
- clock_gettime
- clock_getres
2019-01-04 16:31:57 -05:00
Marcio Giaxa
1e781a30f6
freebsd: add clock const definitions
2019-01-04 16:31:57 -05:00
vegecode
f6cd68386d
@bitreverse intrinsic, part of #767 ( #1865 )
...
* bitreverse - give bswap behavior
* bitreverse, comptime_ints, negative values still not working?
* bitreverse working for negative comptime ints
* Finished bitreverse test cases
* Undo exporting a bigint function. @bitreverse test name includes ampersand
* added docs entry for @bitreverse
2019-01-02 16:47:47 -05:00
Andrew Kelley
036a49e97d
Merge remote-tracking branch 'origin/master' into llvm8
2019-01-01 18:36:12 -05:00
alexander
6df8e4bca7
Add DIFlagStaticMember flag to functions.
...
Prevents LLVM from generating debug info for
struct member functions with a pointer as the
first parameter as though the first parameter
were the implicit "this" pointer from C++.
2018-12-30 12:57:49 -05:00
Andrew Kelley
d8b6fa9134
Merge pull request #1859 from mgxm/fbsd2
...
Progress towards tier 1 support for FreeBSD x86_64
2018-12-29 12:49:23 -05:00
Marcio Giaxa
2e08bd6be4
ci: update freebsd manifest
2018-12-28 15:36:43 -02:00
Marcio Giaxa
4ff23b668a
tests: remove freebsd from the test matrix
...
- Manually add all the native tests to CI manifest.
2018-12-28 11:38:58 -02:00
Andrew Kelley
c464ecf3bf
Merge pull request #1857 from vegecode/boolean-switch
...
Switching on bools with duplicate and missing value detection: Issue …
2018-12-27 18:14:33 -05:00
alexander
64061cc1bf
Test cases for compiler error and working behavior for switching on booleans
2018-12-27 13:46:32 -06:00
Andrew Kelley
aaef6259c3
allow not having libc include paths and doing @cImport
2018-12-26 20:44:06 -05:00
Marcio Giaxa
c29cae76b0
tests: add FreeBSD to the test matrix
2018-12-26 22:44:13 -02:00
Andrew Kelley
2b7e29f791
Merge branch 'nebulaeonline-nebulaeonline'
...
Zig gains the UEFI OS target
2018-12-26 15:26:53 -05:00
Andrew Kelley
a918ce26b8
fixups
2018-12-26 15:25:54 -05:00
alexander
4a1f0e1418
Switching on bools with duplicate and missing value detection: Issue 1768
2018-12-26 10:44:25 -06:00
nebulaeonline
f49b45b00f
tabs to space fix. thanks visual studio.
2018-12-24 14:01:35 -05:00
Marcio Giaxa
52be7d7404
freebsd: fix flags for opening files
...
Prior to this fix, the compare-outputs test suite was showing a strange
behavior, the tests always stopped between tests 6-8 and had a stack track
similar to each other.
```
Test 8/68 compare-output multiple files with private function (ReleaseSmall)...OK
/usr/home/mgxm/dev/zig/zig-cache/source.zig:7:2: error: invalid token: '&'
}&(getStdOut() catch unreachable).outStream().stream;
^
The following command exited with error code 1:
```
With the wrong O_* flags, the source code was being written in append mode which
resulted in an invalid file
```zig
use @import("foo.zig");
use @import("bar.zig");
pub fn main() void {
foo_function();
bar_function();
}&(getStdOut() catch unreachable).outStream().stream;
stdout.print("OK 2\n") catch unreachable;
}
fn privateFunction() void {
printText();
}
```
2018-12-24 11:45:55 -02:00
nebulaeonline
28cd337d1f
fixed formatting in options display
2018-12-24 07:49:15 -05:00
Marcio Giaxa
de473d4423
freebsd: implement std.os.time.sleep
2018-12-24 10:27:08 -02:00
nebulaeonline
7dcee99510
fixed stricmp/strcasecmp between windows/posix
2018-12-23 23:59:59 -05:00
nebulaeonline
51baea184b
Yet another git user error remnant fixed
2018-12-23 23:46:45 -05:00
nebulaeonline
480061d2c9
git user error fix
2018-12-23 23:09:07 -05:00
nebulaeonline
e0af3d7b50
Merge branch 'nebulaeonline' of https://github.com/nebulaeonline/zig into nebulaeonline
2018-12-23 22:56:20 -05:00
nebulaeonline
fdea12b2d9
msvc subsystem option handling; added uefi os type
2018-12-23 22:44:02 -05:00
nebulaeonline
39d32ee40a
Altered SUBSYSTEM option handling when linking in msvc mode; Added preliminary UEFI support.
2018-12-23 22:21:32 -05:00
Marcio Giaxa
682815f6e9
freebsd: remove syscall and use libc
...
Use libc interface for:
- getdents
- kill
- openat
- setgid
- setuid
2018-12-23 23:30:31 -02:00
Marcio Giaxa
773bf80133
Merge branch 'master' into fbsd2
2018-12-23 23:21:59 -02:00
Andrew Kelley
c0e391e94a
self-hosted: add hurd os to switch
2018-12-23 18:30:13 -05:00
Andrew Kelley
75d142c3c7
llvm8: fix ZigLLVMCreateFunction
2018-12-23 18:22:30 -05:00
Andrew Kelley
280187031a
tests: make type info tests not depend on builtin.Os enum
2018-12-23 18:03:22 -05:00
Andrew Kelley
94424e3fa6
test: remove type info test dependency on builtin.Os enum
2018-12-23 17:40:38 -05:00
Andrew Kelley
16b8467a5e
llvm8: fix build errors
2018-12-23 17:36:41 -05:00
Andrew Kelley
c00216701c
Merge remote-tracking branch 'origin/master' into llvm8
2018-12-23 17:04:26 -05:00
Andrew Kelley
45081c1e9c
hello world example can use const instead of var
2018-12-23 13:57:37 -05:00
Andrew Kelley
218a4d4b30
comptime: ability to @ptrCast to an extern struct and read fields
2018-12-22 23:06:30 -05:00
Andrew Kelley
f301474531
self-hosted: add DeviceBusy as a BuildError
2018-12-21 23:01:21 -05:00
Andrew Kelley
0eba5b6744
I observed open() return EBUSY on linux
...
when trying to open for writing a tty fd that is already opened with
screen
2018-12-21 19:50:21 -05:00
Marcio Giaxa
c26f543970
freebsd: fix Stat mode type
2018-12-21 15:04:55 -02:00
Andrew Kelley
56fedbb524
translate-c: --verbose-cimport prints clang command
2018-12-20 19:56:24 -05:00
Marcio Giaxa
c156d51d55
freebsd: remove system linker hack
2018-12-20 21:44:18 -02:00
Marcio Giaxa
a6f33e3dc5
freebsd: add realpath to freebsd/index.zig
2018-12-20 21:05:31 -02:00
Marcio Giaxa
46a0f60e4c
freebsd: use realpath() to resolve symbolic links
2018-12-20 20:57:58 -02:00
Marcio
ac1b2a3c73
Merge pull request #1 from myfreeweb/fbsd2
...
Fix dirent/stat, add preadv
2018-12-20 22:55:14 +00:00
Greg V
76efc462e7
Add preadv/pwritev on FreeBSD
2018-12-20 23:55:44 +03:00
Greg V
054c7ab18a
Fix stat/timespec definitions for FreeBSD
2018-12-20 23:54:09 +03:00
myfreeweb
fa6c7c1303
Use Ninja in .builds/freebsd.yml
...
It's faster and doesn't require manually getting the number of CPUs
2018-12-20 15:15:25 -05:00
tgschultz
f35ba34a88
Removed allocator from Linux version DynLib. Added dynamic_library.zig to std test list.
2018-12-20 14:49:34 -05:00
Andrew Kelley
8cf3543c80
Merge branch 'mgxm-srtht_fbsd'
2018-12-20 14:18:22 -05:00
Andrew Kelley
2a776ed8a8
ci: only run the debug behavior tests for FreeBSD
2018-12-20 14:18:02 -05:00
Marcio Giaxa
4840600988
ci: add sr.ht build manifest for FreeBSD
2018-12-20 12:40:05 -05:00
Andrew Kelley
459045aa40
Merge branch 'kristate-zig-backport-issue1832'
2018-12-20 12:36:30 -05:00
Andrew Kelley
0f54194e6a
fixups
2018-12-20 12:36:15 -05:00
kristopher tate
fb81b1978b
tests: re: 79db394;
...
ref: ziglang/zig#1832
2018-12-20 22:53:54 +09:00
kristopher tate
39567e8b50
src/analyze.cpp: support alignOf(struct T) aligned member inside struct T;
...
ref: ziglang/zig#1832
2018-12-20 22:53:54 +09:00
Andrew Kelley
8768816d69
std.io: call the idiomatic std.mem.readInt functions
...
I originally called the Slice variants to work around
comptime code not supporting `@ptrCast`, but I fixed that
in 757d0665 so now the workaround is no longer needed.
2018-12-19 17:48:21 -05:00
Marcio Giaxa
e5b4748101
freebsd: initial stack trace
...
Stack trace is partially working, with only a few symbols missing. Uses
the same functions that we use in Linux to get the necessary debug info.
2018-12-19 18:42:00 -02:00
Marcio Giaxa
9900f94afe
freebsd: use sysctl to get the current executable path
...
FreeBSD doesn't mount procfs as default on the base system, so we can't
depend on it to get the current path, In this case, we use sysctl(3) to
retrieves the system information and get the same information.
- CTL_KERN: High kernel limits
- KERN_PROC: Return selected information about specific running
processes.
- KERN_PROC_PATHNAME: The path of the process
- Process ID: a process ID of -1 implies the current process.
2018-12-19 18:42:00 -02:00
Marcio Giaxa
1811e7e6c9
freebsd: remove getrandom dependency from libc
...
The system call getrandom(2) just landed on FreeBSD 12, so if we want to
support some earlier version or at least FreeBSD 11, we can't depend on
the system call.
2018-12-19 18:42:00 -02:00
Marcio Giaxa
11ced4f99d
freebsd: use libc interface instead system calls
...
Remove all syscalls references
* dup2()
* chdir()
* execve()
* fork()
* getcwd()
* isatty()
* readlink()
* mkdir()
* mmap()
* munmap()
* read()
* rmdir()
* symlink()
* pread()
* write()
* pwrite()
* rename()
* open()
* close()
* lseek()
* exit()
* unlink()
* waitpid()
* nanosleep()
* setreuid()
* setregid()
* raise()
* fstat()
* pipe()
* added pipe2() extern c fn
2018-12-19 18:42:00 -02:00
Marcio Giaxa
6cfcdbde2b
freebsd: link against libc++
...
All supported versions of FreeBSD have libc++ in the base system.
2018-12-19 18:42:00 -02:00
Marcio Giaxa
1fc56b82ad
freebsd: link against libc
...
Since the stable kernel ABI is through libc #1759
2018-12-19 18:42:00 -02:00
Marcio Giaxa
0273fbf710
freebsd: add access
2018-12-19 18:42:00 -02:00
Marcio Giaxa
5ea37f6e8c
freebsd: add getdirentries
2018-12-19 18:41:59 -02:00
Marcio Giaxa
666b153144
freebsd: remove syscall files
2018-12-19 18:41:40 -02:00
Jimmi Holst Christensen
a7670e80a4
Added formatting of function pointers ( #1843 )
2018-12-19 10:07:35 -05:00
Jimmi Holst Christensen
45e72c0b39
Fixed intToPtr to fn type when the address is hardcoded ( #1842 )
...
* Fixed intToPtr to fn type
* Added test
* Import inttoptr.zig in behavior.zig
2018-12-19 09:39:18 -05:00
Jimmi Holst Christensen
260c3d9cc0
formatType can now format comptime_int
2018-12-19 11:50:29 +01:00
Andrew Kelley
f6a02a427f
README: clarify self-hosted status
2018-12-18 15:55:00 -05:00
Andrew Kelley
e077a44656
ir: delete dead code
2018-12-18 15:48:26 -05:00
Andrew Kelley
f75262b79f
fix comptime pointer reinterpretation array index offset
...
closes #1835
2018-12-17 11:05:50 -05:00
Andrew Kelley
5a68c60023
ci: update msys packages before installing
2018-12-16 12:32:20 -05:00
Andrew Kelley
757d0665ae
implement comptime pointer cast
...
closes #955
closes #1835
2018-12-16 12:08:14 -05:00
Josh Wolfe
7533d1b14c
mem foreign functions call the native ones
...
this reduces the amount of implementation to change for #1835
2018-12-16 11:59:29 -05:00
Andrew Kelley
624c74af6f
ci: install openssl on windows
2018-12-16 11:22:33 -05:00
Andrew Kelley
82bf1eb7a1
docs: fix alphabetical sorting of builtin functions
2018-12-14 20:21:23 -05:00
Andrew Kelley
0afb868684
Merge branch 'suirad-windows-wide-imports'
2018-12-13 18:50:11 -05:00
Andrew Kelley
fff6e47125
fixups
2018-12-13 17:13:10 -05:00
Andrew Kelley
457f03e37d
Merge branch 'windows-wide-imports' of https://github.com/suirad/zig into suirad-windows-wide-imports
2018-12-13 15:57:24 -05:00
Andrew Kelley
e98ba5fc40
add mem.readVarInt, fix InStream.readVarInt, fix stack traces
...
fixes a regression from b883bc8
2018-12-13 06:38:14 -05:00
Andrew Kelley
6395cf8d6b
fix mistakes introduced in b883bc8
2018-12-13 06:07:39 -05:00
Andrew Kelley
7417f2e4b3
freebsd: fix issues with syscalls
2018-12-13 00:33:13 -05:00
Andrew Kelley
d770333827
freebsd: fix os_self_exe_path function and update std lib
2018-12-12 22:28:15 -05:00
Andrew Kelley
b883bc873d
breaking API changes to all readInt/writeInt functions & more
...
* add `@bswap` builtin function. See #767
* comptime evaluation facilities are improved to be able to
handle a `@ptrCast` with a backing array.
* `@truncate` allows "truncating" a u0 value to any integer
type, and the result is always comptime known to be `0`.
* when specifying pointer alignment in a type expression,
the alignment value of pointers which do not have addresses
at runtime is ignored, and always has the default/ABI alignment
* threw in a fix to freebsd/x86_64.zig to update syntax from
language changes
* some improvements are pending #863
closes #638
closes #1733
std lib API changes
* io.InStream().readIntNe renamed to readIntNative
* io.InStream().readIntLe renamed to readIntLittle
* io.InStream().readIntBe renamed to readIntBig
* introduced io.InStream().readIntForeign
* io.InStream().readInt has parameter order changed
* io.InStream().readVarInt has parameter order changed
* io.InStream().writeIntNe renamed to writeIntNative
* introduced io.InStream().writeIntForeign
* io.InStream().writeIntLe renamed to writeIntLittle
* io.InStream().writeIntBe renamed to writeIntBig
* io.InStream().writeInt has parameter order changed
* mem.readInt has different parameters and semantics
* introduced mem.readIntNative
* introduced mem.readIntForeign
* mem.readIntBE renamed to mem.readIntBig and different API
* mem.readIntLE renamed to mem.readIntLittle and different API
* introduced mem.readIntSliceNative
* introduced mem.readIntSliceForeign
* introduced mem.readIntSliceLittle
* introduced mem.readIntSliceBig
* introduced mem.readIntSlice
* mem.writeInt has different parameters and semantics
* introduced mem.writeIntNative
* introduced mem.writeIntForeign
* mem.writeIntBE renamed to mem.readIntBig and different semantics
* mem.writeIntLE renamed to mem.readIntLittle and different semantics
* introduced mem.writeIntSliceForeign
* introduced mem.writeIntSliceNative
* introduced mem.writeIntSliceBig
* introduced mem.writeIntSliceLittle
* introduced mem.writeIntSlice
* removed mem.endianSwapIfLe
* removed mem.endianSwapIfBe
* removed mem.endianSwapIf
* added mem.littleToNative
* added mem.bigToNative
* added mem.toNative
* added mem.nativeTo
* added mem.nativeToLittle
* added mem.nativeToBig
2018-12-12 20:35:04 -05:00
Wink Saville
634d11ab28
Add add compiler_rt routines for float to signed integer conversion
...
And add std.math.f128_* constants.
The routines are:
__fixdfdi, __fixdfsi, __fixdfti,
__fixsfdi, __fixsfsi, __fixsfti,
__fixtfdi, __fixtfsi, __fixtfti.
These all call fixint which is a generic zig function that does the
conversion:
pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t
There are also a set tests:
__fixdfdi_test, __fixdfsi_test, __fixdfti_test,
__fixsfdi_test, __fixsfsi_test, __fixsfti_test,
__fixtfdi_test, __fixtfsi_test, __fixtfti_test.
2018-12-12 00:21:42 -05:00
BenoitJGirard
f0ec308e26
Merge pull request #1 from ziglang/master
...
Refresh from original.
2018-12-11 20:06:13 -05:00
Jay Weisskopf
5f5364ad73
font-family fallbacks for unsupported system-ui
2018-12-11 01:44:48 -05:00
Jay Weisskopf
57113bab2f
docs: Prefer system-ui font-family
...
system-ui is a new generic font-family for matching the font used in the operating system's native user interface. E.g. Roboto on Android, San Francisco on macOS, Segoe UI on Windows, etc.
https://caniuse.com/#search=system-ui
2018-12-11 01:44:48 -05:00
Henry Nelson
68b0fce62f
Document explicitly ignoring expression values
2018-12-11 01:42:54 -05:00
tgschultz
1a8570403f
Minor doc-comment fix.
2018-12-09 20:59:51 -06:00
tgschultz
1188da926f
Minor change to custom (de)serializer to allow them to be defined outside of the struct and aliased inside it. This will enable alternate generic serializers (i.e. one that follows pointers) on a struct-by-struct basis.
2018-12-09 20:52:16 -06:00
Andrew Kelley
1b0f4d5976
implement compile error note for function parameter type mismatch
2018-12-05 15:32:25 -05:00
Jimmi Holst Christensen
518ff33e64
Allow packages in TestStep
2018-12-05 14:10:09 +01:00
Andrew Kelley
9ac838c8e3
LLD patch: allow non-allocated sections to go into allocated sections
...
Patch submitted upstream: https://reviews.llvm.org/D55276
2018-12-04 11:42:22 -05:00
Andrew Kelley
3a1612a0f5
std.debug: fix some issues with freestanding debug info
2018-12-02 23:46:45 -05:00
Andrew Kelley
5c3b8cb365
expose std.debug.DwarfInfo and delete unused function
2018-12-02 20:08:06 -05:00
Andrew Kelley
a436d2ab8c
std.debug.printSourceAtAddressDwarf
...
which works in freestanding mode
2018-12-02 19:34:11 -05:00
Andrew Kelley
4292ed9571
std.debug.StackIterator
2018-12-02 18:54:04 -05:00
Andrew Kelley
a40d160a5c
introduce std.io.SeekableStream
...
Relevant #764
dwarf debug info is modified to use this instead of std.os.File
directly to make it easier for bare metal projects to take advantage
of debug info parsing
2018-12-02 18:36:18 -05:00
Andrew Kelley
6f5e7ee09c
make std.unicode.Utf8Iterator public
2018-12-01 02:14:17 -05:00
Andrew Kelley
a9eab69b58
zig build: addStaticExecutable
2018-12-01 01:21:59 -05:00
tgschultz
8423bd423b
Added explicit test for #1810 issue to io_test.zig.
2018-11-30 15:02:10 -06:00
tgschultz
5936bdf8a4
Fixed readBits to cast errors to the correct errorset. See #1810 for why this wasn't caught earlier.
2018-11-30 14:50:17 -06:00
tgschultz
b6489ff90a
Increased range of bitwidths tested by "serialize/deserialize Int" tests. Added tests for float inf and NaN.
2018-11-30 14:50:17 -06:00
tgschultz
1ab66f3b55
Added serialization, bitstreams, traits for integer sign, TagPayloadType
2018-11-30 14:50:17 -06:00
Suirad
cf266ff80a
Update tests
2018-11-30 02:15:33 -06:00
Suirad
e8e6ae57d4
Find CI env variables
2018-11-30 02:08:34 -06:00
Suirad
1fa2217c10
Simplify implementation
2018-11-30 02:08:34 -06:00
Suirad
24592d0216
Add more padding to parse buffer
2018-11-30 02:08:34 -06:00
Suirad
0abd5520bd
Platform specific tests
2018-11-30 02:08:34 -06:00
Suirad
5dfca87a65
Update windows imports
2018-11-30 02:08:33 -06:00
Jimmi Holst Christensen
823969a5a4
Implemented new more flexible readLineFrom ( #1801 )
2018-11-29 22:38:39 +01:00
Andrew Kelley
b29769532b
ci: workaround azure quirk for windows too
2018-11-29 14:54:23 -05:00
kristopher tate
1e60ca4b75
stage2: update std.os.path.join method signature;
...
stage2: take 2;
2018-11-30 03:52:28 +09:00
kristopher tate
2b78a90424
std.os.path: remove dependance on std.mem.join;
...
std/os/child_process.zig: windows
test/cli.zig: godbolt;
doc/docgen.zig
2018-11-30 03:52:27 +09:00
kristopher tate
ff1b2889f3
std.mem: split: test for multiple seperator bytes;
2018-11-30 02:17:15 +09:00
Andrew Kelley
bbdc12891b
ci: workaround azure quirk with set -x
2018-11-29 11:05:56 -05:00
kristopher tate
6a1a2898b1
std.mem: remove varargs on join to stop excessive inlined code;
...
join was preducing inline code for every unique call causing code bloat
2018-11-30 00:53:52 +09:00
dbandstra
53766e7a3a
make parseUnsigned handle types <8 bits wide
2018-11-29 09:53:43 -05:00
daurnimator
4ecb3ceafb
Add std.LinkedList.concat
2018-11-29 09:44:24 -05:00
Andrew Kelley
7005ec5efe
Revert "Add math min/max for Float and Value"
...
This reverts commit 078a0a6999 .
On closer inspection, I'm not sure these values for float min/max
make sense. Why is it max instead of true_max? Why isn't it positive
and negative infinity?
Let's discuss further before committing to these changes.
2018-11-29 09:33:47 -05:00
Jimmi Holst Christensen
f74320d56d
Implemented getOrPutValue which wraps getOrPut
2018-11-29 09:10:15 +01:00
Wink Saville
078a0a6999
Add math min/max for Float and Value
2018-11-28 23:13:12 -05:00
Andrew Kelley
c54fe0d3ae
work around to support debian's fork of llvm 7.0.1
...
it has a patch that adds an OS type, breaking the public API
this commit avoids depending on the last os type enum item,
but retains the safety assertion checks.
closes #1788
2018-11-28 22:58:52 -05:00
Josh Wolfe
11e8afb37c
fix child_process piped streams not getting closed
2018-11-28 18:33:55 -05:00
Andrew Kelley
57f44eb2bd
Merge branch 'freebsd2'
...
Tier 2 support for FreeBSD
2018-11-27 21:06:35 -05:00
Andrew Kelley
dd2450b1b2
tier 2 support for freebsd
2018-11-27 20:56:43 -05:00
Andrew Kelley
e3bf40742d
Merge branch 'master' into freebsd2
2018-11-27 20:36:44 -05:00
Sahnvour
1fb15be05f
stack traces: fix for windows
2018-11-27 20:34:55 -05:00
Andrew Kelley
3c4965a616
readme: update support table
2018-11-27 11:27:45 -05:00
daurnimator
2baf0e2ffc
add std.math.IntFittingRange
2018-11-27 10:19:06 -05:00
Andrew Kelley
6bbe4cf9f7
Merge branch 'winksaville-Fix-pushToParent-to-work-for-arrays-of-Objects'
2018-11-27 00:53:09 -05:00
Andrew Kelley
a5b79017a3
fix regression from d5648d26
...
thanks Wink Saville for the test case.
2018-11-27 00:52:32 -05:00
Andrew Kelley
7818550edc
Merge branch 'Fix-pushToParent-to-work-for-arrays-of-Objects' of https://github.com/winksaville/zig into winksaville-Fix-pushToParent-to-work-for-arrays-of-Objects
2018-11-27 00:45:46 -05:00
Andrew Kelley
0860be03b1
Merge branch 'kristate-zig-backport-os_file_read-EISDIR'
2018-11-26 20:07:19 -05:00
Andrew Kelley
67a39a4c99
stage1: better file path handling
...
* better message printed when cache hash fails
* better handling of '/' as root source file
* os_path_split parses '/' and '/a' correctly
closes #1693
closes #1746
2018-11-26 20:04:35 -05:00
Andrew Kelley
d2ed4d3dd3
Merge branch 'zig-backport-os_file_read-EISDIR' of https://github.com/kristate/zig into kristate-zig-backport-os_file_read-EISDIR
2018-11-26 19:59:58 -05:00
kristopher tate
0f7de58b64
std.mem: add new separate method and rework SplitIterator;
2018-11-26 02:02:17 +09:00
daurnimator
f6cd02be65
add std.meta.stringToEnum
2018-11-25 11:48:11 -05:00
Andrew Kelley
a07490a4bc
Merge pull request #1783 from ziglang/rand-range
...
Use better rand range implementations
2018-11-25 11:44:08 -05:00
Josh Wolfe
9ae5200bd2
factor out and expose biased range limiting function
2018-11-24 22:25:21 -05:00
Josh Wolfe
eed7b48fe3
test lots of types
2018-11-24 22:25:21 -05:00
Josh Wolfe
49b49618d2
add biased random range api
2018-11-24 22:25:21 -05:00
Josh Wolfe
1924ffa67d
better debiased random range implementation
2018-11-24 22:25:21 -05:00
Andrew Kelley
4d747d452f
update zen os std lib for latest zig changes
2018-11-24 16:51:52 -05:00
Andrew Kelley
3d2752cc36
refactor type_requires_comptime to have possible error
...
fixes a compiler crash when building
https://github.com/AndreaOrru/zen
2018-11-24 16:15:58 -05:00
Andrew Kelley
56a8f2b018
fix @intCast not catching negative numbers to unsigned
2018-11-24 14:36:16 -05:00
Andrew Kelley
b953e322a8
std.os.path.realC: make overflow more clearly impossible
2018-11-21 13:41:10 -05:00
Andrew Kelley
bb3ac177a8
fix incorrect buf len
2018-11-20 12:37:42 -05:00
kristopher tate
a69695a28c
std/mem: writeIntLE: buf.* to buf;
2018-11-20 11:11:07 -05:00
Wink Saville
a05716bd20
Allow json tests to be easily filtered
2018-11-19 18:08:38 -05:00
Andrew Kelley
4dafdc00d5
zig fmt
2018-11-19 17:28:18 -05:00
Andrew Kelley
9493738e54
Merge branch 'freebsd-up' of https://github.com/myfreeweb/zig into freebsd2
2018-11-19 17:24:41 -05:00
Sahnvour
703c6684d1
Crash fixes and small improvements to inline asm. ( #1756 )
...
* codegen: LLVMConstInlineAsm is deprecated.
* codegen: replace commas in asm constraint strings by pipes as required by LLVM.
* ir: enforce usage of '=' constraint modifier for inline assembly outputs.
Others are not currently supported and this was just asserted alter in `ir_render_asm`.
* asm: forbid comptime_int/floats as inputs in favor of explicitely sized constants.
Fixes a crash due to comptime_int/floats having no type_ref.
* asm: handle inputs with integers of <8 or non power of 2 bitsize.
We widen them to the next highest power of two.
2018-11-19 16:22:21 -05:00
Andrew Kelley
89e82281be
fix incorrect --help text
2018-11-19 13:26:35 -05:00
Andrew Kelley
b1a676b279
docs: fix some incorrect error documentation
2018-11-19 13:20:39 -05:00
Andrew Kelley
2f5d1ec500
improve error message when wrong type returned
...
closes #1650
2018-11-19 11:22:57 -05:00
Wink Saville
81d9403dce
Add SegmentedList.shrink
...
I was exploring std.zig.Tokenizer and wanted to compare performance of
arrays, SegmentedList and ArrayList and needed SegmentedList.shrink
to make the comparison "fair".
2018-11-19 10:53:25 -05:00
Marc Tiehuis
4c0163b69b
std/rand: fix ziggurat next_f64 call
2018-11-19 21:56:45 +13:00
Andrew Kelley
921d9c9bcb
add std.meta.intToEnum
2018-11-18 20:18:24 -05:00
Andrew Kelley
3829e200ec
fix assertion failure related to @intToEnum
2018-11-18 20:04:16 -05:00
Josh Wolfe
3c05ad4012
atomic.Int.set
2018-11-18 19:43:13 -05:00
Andrew Kelley
f8a782fb2e
all numbers with comptime known values implicitly cast
...
to all number types. If the value does not fit,
a compile error is emitted.
closes #422
closes #1712
2018-11-18 19:37:59 -05:00
Wink Saville
8d54cbb834
Fix pushToParent to work for arrays of Objects
...
The reference `*array` is a copy of the value on the stack. Instead use
a reference to top of stack. This is the same technique used above for
`var object` in `Value.String`.
Added two simple tests.
2018-11-18 10:14:37 -08:00
Duncan
e9b47d960b
Fix setsockopt syscall on linux
2018-11-18 10:45:38 -05:00
kristopher tate
947cdafd91
src/os.cpp: os_file_read: return ErrorIsDir on case EISDIR;
2018-11-18 15:30:24 +09:00
Andrew Kelley
085d049a08
aarch64 improvements
...
* support C ABI for all return types
* don't include __aeabi_uldivmod & co on aarch64 since
it's 64 bit
2018-11-17 11:21:00 -05:00
Jimmi HC
2a580278c4
Updated comments in parser.cpp
2018-11-17 14:42:47 +01:00
Jimmi HC
f1fd8d2b1f
Updated docs to newest grammar
2018-11-17 14:36:36 +01:00
Andrew Kelley
c21884e1d6
Merge remote-tracking branch 'origin/master' into llvm8
2018-11-17 02:18:56 -05:00
Andrew Kelley
704374e512
rename section keyword to linksection
...
add zig fmt support for this syntax
closes #1152
2018-11-17 01:38:35 -05:00
Andrew Kelley
3862962881
delete rogue file
2018-11-16 14:26:53 -05:00
Vallentin
398914eb71
Fixed typos
2018-11-16 14:03:39 -05:00
Matthew O'Connor
fbd6a66ae7
camelCase std.rb.set_child to std.rb.setChild
2018-11-16 13:03:13 -05:00
kristopher tate
e198417687
std/fmt/index.zig: support printing hex bytes on slices;
2018-11-16 10:22:33 -05:00
Jimmi Holst Christensen
be9bb0a857
Fixed #1663 and removed IrInstructionArrayLen
2018-11-16 10:15:13 -05:00
Andrew Kelley
332fdf33ee
update readme
2018-11-16 10:05:52 -05:00
Matthew O'Connor
007783753e
Change rb functions to use snakeCase.
2018-11-16 09:21:48 -05:00
Andrew Kelley
ba361f31c6
more fixes related to readStruct API
2018-11-15 16:16:08 -05:00
Jimmi HC
3090f83800
Fixed failure using readStruct and gave async readStruct the same sig
2018-11-15 21:59:17 +01:00
Jimmi HC
f4606842d2
Have readStruct in stream return a value instead of taking a pointer
2018-11-15 21:03:27 +01:00
Jimmi Holst Christensen
2a9843de95
Added NullOutStream and CountingOutStream ( #1722 )
2018-11-15 09:37:39 -08:00
Andrew Kelley
b8b36f3cce
disable windows test until coroutines rewrite lands
...
See #1363
2018-11-15 10:02:12 -05:00
Andrew Kelley
0c3bd0c3d1
zig fmt: add --check flag
...
closes #1558
closes #1555
2018-11-15 00:26:43 -05:00
Josh Wolfe
65cddc5a19
test for readIntBE/LE
2018-11-14 21:40:53 -05:00
Josh Wolfe
8008ae470e
io read/write int be/le optimizations
2018-11-14 20:57:51 -05:00
Josh Wolfe
772876b2f0
implement mem.writeIntLE, mem.writeIntBE
2018-11-14 20:57:46 -05:00
Josh Wolfe
8d8836c2d1
address port getter
2018-11-14 20:28:19 -05:00
Andrew Kelley
3666fbd9f9
** and ++ operators force comptime on operands
...
closes #1707
2018-11-14 12:23:40 -05:00
Jimmi Holst Christensen
14308db923
Manual update to new grammar.
...
TODO: Figure out how we can auto update this, when the grammar changes in
the zig-spec repo
2018-11-14 08:56:26 +01:00
Jimmi Holst Christensen
5b3f7a8e1f
Fixed error where we didn't expect the return type of a function
2018-11-13 14:43:08 +01:00
Jimmi Holst Christensen
8139c5a516
New Zig formal grammar ( #1685 )
...
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-13 05:08:37 -08:00
Andrew Kelley
67fbb0434f
ir: remove redundant casting code
2018-11-11 12:48:55 -05:00
Andrew Kelley
ef5d7ce463
array type syntax implies comptime
2018-11-09 19:26:54 -05:00
emekoi
8e69a18d8c
made colored output more consistent ( #1706 )
...
* made colored output more consistent
* added os.supportsAnsiEscapeCodes
2018-11-08 00:36:36 -05:00
Andrew Kelley
ac8898e681
std.build.Builder: mutable env_map
2018-11-07 21:23:09 -05:00
Andrew Kelley
d9fe38789b
macos: use the same code as linux to determine libc include path
...
this fixes .h file locating on macos 10.14
2018-11-06 17:59:44 -05:00
Andrew Kelley
63f636e7b7
limit integer types to maximum bit width of 65535
...
closes #1541
2018-11-06 11:09:14 -05:00
Andrew Kelley
a08b65720b
README: update CI badges
2018-11-06 09:55:54 -05:00
Andrew Kelley
2928b01afc
fix broken cli test and translate-c: support no-op cast
2018-11-05 20:03:16 -05:00
Andrew Kelley
eba90cdc41
ci: remove accidental .lib files from windows zip
2018-11-05 16:55:16 -05:00
Andrew Kelley
86e3b51565
ci: 7-zip instead of info-zip for windows
...
I'm guessing this is why 0.3.0 is 21.5MiB while
master is 27.6MiB
2018-11-05 13:26:46 -05:00
kristopher tate
3ec58b8e0b
ci/azure: set wget to non-verbose mode to make logs easier to read;
...
Over 5000 lines of wget download process updates are stored to the logs: `2018-11-05T15:12:23.7724039Z 296000K .......... .......... .......... .......... .......... 99% 83.9M 0s`
2018-11-05 12:59:35 -05:00
Andrew Kelley
0a495aa563
update type info behavior test
...
it depends on the OS struct, which is probably not necessary
to accomplish the test's goal.
2018-11-05 11:37:48 -05:00
Andrew Kelley
c19bc7ecb4
update self-hosted compiler for new targets
2018-11-05 11:32:02 -05:00
Andrew Kelley
5b96cc236c
update to build against llvm trunk
2018-11-05 11:17:35 -05:00
Andrew Kelley
197ffe0092
update ci scripts for llvm 8
2018-11-05 10:58:53 -05:00
Andrew Kelley
f8d6f5daff
Merge remote-tracking branch 'origin/master' into llvm8
2018-11-05 10:56:42 -05:00
Andrew Kelley
973e0abe79
ci: full test suite
2018-11-05 10:10:27 -05:00
Andrew Kelley
e64e8d62dd
ci: display environment variables
2018-11-05 09:46:31 -05:00
Andrew Kelley
9b0fb8a912
ci: fix paths
2018-11-05 01:51:28 -05:00
Andrew Kelley
dc2dfef0a2
ci: upload a src tarball too
2018-11-05 01:32:21 -05:00
Andrew Kelley
caf1ec9474
ci: fix shasum commands
2018-11-04 23:26:23 -05:00
Andrew Kelley
eb1c769404
ci: add missing steps field
2018-11-04 22:38:23 -05:00
Andrew Kelley
c2df9236c4
ci: use azure for all CI
...
* appveyor and travis are removed
* add a job to update the download page when all
targets pass. closes #1046
2018-11-04 22:32:59 -05:00
kristopher tate
5d014d4b37
os.crypto: support for HmacBlake2s256 variety;
2018-11-03 15:03:48 -04:00
Andrew Kelley
c7b79284ef
azure: build static macos
2018-11-02 00:54:34 -04:00
Andrew Kelley
1554dd9697
support building static self hosted compiler on macos
...
* add a --system-linker-hack command line parameter to work around
poor LLD macho code. See #1535
* build.zig correctly handles static as well as dynamic dependencies
when building the self hosted compiler.
- no more unnecessary libxml2 dependency
- a static build on macos produces a completely static self-hosted
compiler for macos (except for libSystem as intended).
2018-11-02 00:54:34 -04:00
Andrew Kelley
5c97aff627
readme: MSVC 2017 is the supported one now
...
also add note about pre-built master branch
2018-11-01 15:21:41 -04:00
Andrew Kelley
5b1b072d8d
Merge branch 'winksaville-add-test-for-atomic-Queue-dump'
2018-10-31 10:44:25 -04:00
Andrew Kelley
0f3e7387bf
cleanups
2018-10-31 10:44:05 -04:00
Andrew Kelley
b04c6cee60
Merge branch 'add-test-for-atomic-Queue-dump' of https://github.com/winksaville/zig into winksaville-add-test-for-atomic-Queue-dump
2018-10-31 10:29:49 -04:00
Andrew Kelley
4e12f909df
simplify logic of pass1 ir for while on error unions
2018-10-31 10:00:51 -04:00
Andrew Kelley
7405bc7618
remove implicit cast from number literal to enum
...
I missed this code when removing explicit cast syntax.
2018-10-30 17:28:03 -04:00
Andrew Kelley
ca71373da1
remove another implicit cast to const pointer
...
* remove implicit cast from *T to ?*const T
* remove implicit cast from T to ?*const T when T is a struct/union
2018-10-29 16:41:30 -04:00
Andrew Kelley
0921a93c1c
Merge pull request #1686 from emekoi/comment-fix
...
fixed comments
2018-10-27 14:07:08 -04:00
emekoi
c7799ff2b2
fixed comments
2018-10-27 12:58:40 -05:00
emekoi
395f3d946a
fixed mingw compilation
2018-10-27 11:35:01 -04:00
Andrew Kelley
2b395d4ede
remove @minValue,@maxValue; add std.math.minInt,maxInt
...
closes #1466
closes #1476
2018-10-26 15:01:51 -04:00
Andrew Kelley
40b7652a6d
fix stack pointer register name on i386
2018-10-25 18:25:53 -04:00
Andrew Kelley
eb0b1d38ff
remove 3 more implicit casts to const pointers
...
see #1465
2018-10-25 12:52:12 -04:00
Ryan Saunderson
73ab0afadd
Bug fixes in WinSDK detection ( #1665 )
...
* fixed detecting the latest installed version of the windows sdk & related tests
2018-10-24 16:14:16 -04:00
tgschultz
63f9769e80
fix "std" not found error in meta/trait
2018-10-24 01:47:52 -04:00
tgschultz
65b9fae4f8
fix error where "std" isn't found in meta/trait
2018-10-24 01:47:52 -04:00
Andrew Kelley
b4801186b7
langref: dark style. easier on the eyes
2018-10-23 22:11:31 -04:00
emekoi
d7cec5b37c
fixes #1667
2018-10-23 21:29:04 -04:00
Andrew Kelley
96923edc53
travis: don't use newer cli args of s3cmd
2018-10-23 18:48:34 -04:00
Andrew Kelley
08c5f7d059
travis: add missing http headers for docs
2018-10-23 17:06:37 -04:00
Josh Wolfe
6fe7dd93cb
that's not a keyword
2018-10-22 20:44:59 -04:00
Jimmi Holst Christensen
65b7d85524
Fixed code still using old ptr syntax
2018-10-20 17:59:06 +02:00
tgschultz
58610a4427
Add std.meta to deployment ( #1670 )
2018-10-20 11:40:26 -04:00
Greg V
f3bc1c38bf
Specify 16-byte stack alignment in _start on FreeBSD
2018-10-20 15:21:35 +03:00
Greg V
6a8fb06006
Split at zero byte in SplitIterator
...
To avoid extra zeros in buffers
2018-10-20 15:21:35 +03:00
Greg V
e5627f8e63
Support more of std on FreeBSD
2018-10-20 15:21:35 +03:00
Greg V
831bb66895
Set up libc/rtld paths for FreeBSD
2018-10-20 15:21:35 +03:00
Greg V
a983a0a59b
Add /usr/local/lib path for libxml2 and link libc++ on FreeBSD
2018-10-20 15:21:32 +03:00
Greg V
d6cab0d4b6
Various fcntl flags are also machine-independent on FreeBSD
2018-10-20 15:15:01 +03:00
Greg V
afe26bbcbd
System call numbers on FreeBSD are machine-independent
...
But e.g. sbrk is only removed in new architectures (aarch64, riscv),
so keep it in x86_64
2018-10-20 15:15:01 +03:00
Greg V
7a3f0a55d9
Add freebsd to more things
2018-10-20 15:15:01 +03:00
Greg V
1829c09303
Fix os/freebsd files
2018-10-20 15:15:01 +03:00
Marc Tiehuis
19659c3bd3
freebsd: Fix argc resolution in _start
...
FreeBSD appears to use rdi instead of rsp as in other posix systems.
According to some loose documentation, x86 passes values on the stack,
so amd64 freebsd may be the only exception.
2018-10-20 15:15:01 +03:00
Marc Tiehuis
102cb61e40
Get freebsd std compiling again
2018-10-20 15:15:01 +03:00
Marc Tiehuis
264dd2eb57
Set FreeBSD ELF OS/ABI when targeting
...
Closes #553 .
2018-10-20 15:15:01 +03:00
Marc Tiehuis
e2b9c153bd
Add initial freebsd stdlib functionality
...
Trivial program now compiles with now warnings.
2018-10-20 15:15:01 +03:00
Greg V
9a541c1214
Add FreeBSD support to os.cpp
2018-10-20 15:15:01 +03:00
Greg V
24e54799fd
Fix CMake finding LLVM/clang/lld on FreeBSD
2018-10-20 15:15:01 +03:00
Jimmi Holst Christensen
db3b768eab
Ran fmt on last PR
2018-10-19 23:27:16 +02:00
tgschultz
2a3fdd52ce
Add std.meta ( #1662 )
...
Implement std.meta
2018-10-19 17:19:22 -04:00
Andrew Kelley
b9a53c261a
travis: upload langref on successful test run
2018-10-17 18:10:07 -04:00
Andrew Kelley
eeb4f376a3
std.io: fix compile error when InStream has empty error set
2018-10-16 12:48:38 -04:00
Andrew Kelley
49bc33efe1
fix windows
2018-10-15 21:38:01 -04:00
Andrew Kelley
d5648d2640
remove implicit cast from T to *const T
...
closes #1465
2018-10-15 18:23:47 -04:00
Jimmi Holst Christensen
378d3e4403
Solve the return type ambiguity ( #1628 )
...
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
2018-10-15 09:51:15 -04:00
Andrew Kelley
822d4fa216
fix compiler crash
2018-10-13 16:35:38 -04:00
Andrew Kelley
3e72411db0
C ABI and compiler rt improvements for ARM
...
* add __multi3 compiler rt function. See #1290
* compiler rt includes ARM functions for thumb and aarch64 and
other sub-arches left out. See #1526
* support C ABI for returning structs on ARM. see #1481
2018-10-13 15:18:00 -04:00
Marc Tiehuis
67fb4d1359
Improve time.sleep api
2018-10-11 11:57:59 -04:00
emekoi
a22d9daaec
added math.pow support for integer types. resolves #1637 ( #1642 )
...
added math.powi for integers; pow now handles ints
2018-10-10 10:50:23 -04:00
Andrew Kelley
9e38a81230
Merge pull request #1647 from ziglang/static-libs
...
Support building static libraries
2018-10-09 13:20:27 -04:00
Andrew Kelley
81c6f08724
add workaround for bad LLD macos code
2018-10-09 13:16:51 -04:00
Andrew Kelley
05e608a0c7
stage1 os: workaround for macos not having environ variable
2018-10-09 13:16:51 -04:00
Andrew Kelley
e29a3b1d2a
stage1 link: compiler_rt and builtin libs know ...
...
...whether they will be linked with libc
2018-10-09 13:16:51 -04:00
Andrew Kelley
e0a94db65e
fix error limit linker arg on windows
2018-10-09 13:16:51 -04:00
Andrew Kelley
84690ee05e
std/special/bootstrap: inline some functions to improve stack traces
2018-10-09 13:16:50 -04:00
Andrew Kelley
6b93495792
more efficient builtin library code generation
...
* introduce --disable-pic option which can generally be allowed to be
the default. compiler_rt.a and builtin.a get this option when you
build a static executable.
* compiler_rt and builtin libraries are not built for build-lib
--static
* posix_spawn instead of fork/execv
* disable the error limit on LLD. Fixes the blank lines printed
2018-10-09 13:16:50 -04:00
Andrew Kelley
5a3c02137e
support building static libraries
...
closes #1493
closes #54
2018-10-09 13:15:14 -04:00
Andrew Kelley
d40c4e7c89
Merge pull request #1429 from shawnl/arm64
...
initial arm64 support
2018-10-06 00:11:39 -04:00
Andrew Kelley
5b84192f07
build: try to find llvm-config-7 before llvm-config
2018-10-06 00:10:16 -04:00
Andrew Kelley
b7dda772a8
disable C ABI tests on macos due to LLD deficiency
...
See #1535
we'll have a better macos linker someday
2018-10-06 00:06:36 -04:00
Shawn Landden
2d27341724
arm64: respond to code review
2018-10-06 03:31:52 +00:00
Andrew Kelley
4640853d1b
on linux, link statically if not linking any shared libs
2018-10-05 18:34:37 -04:00
Andrew Kelley
8700f4d2b1
docs: add comment about operator overloading
2018-10-05 18:25:20 -04:00
Andrew Kelley
c81a4b3e3d
docs: fix double escaping html entities
2018-10-05 10:21:08 -04:00
Andrew Kelley
8d6601d7ce
improve pointer documentation
...
closes #1630
2018-10-04 22:51:36 -04:00
Andrew Kelley
d07413f9b7
fix missing .h files
...
closes #1634
2018-10-04 18:14:57 -04:00
Andrew Kelley
23b07ad8d2
refactor ir.cpp
...
Analysis functions no longer return `ZigType *`. Instead they
return `IrInstruction *`.
2018-10-04 14:33:52 -04:00
emekoi
31469daca3
removed unneeded dll extension
2018-10-04 11:43:53 -04:00
Andrew Kelley
3f13a59cbc
better mutex implementation
...
based on Ulrich Drepper's "Futexes are tricky" paper, Mutex, Take 3
also includes tests
2018-10-03 14:55:12 -04:00
Andrew Kelley
66cb75d114
std.Mutex: implement blocking mutexes on linux
...
closes #1463
Thanks to Shawn Landden for the original pull request.
This commit is based on that code.
2018-10-03 13:19:10 -04:00
Andrew Kelley
acefcdbca5
add std.os.linux.vfork and std.os.linux.exit_group
2018-10-02 14:08:32 -04:00
Andrew Kelley
364bc66924
Merge pull request #1619 from bnoordhuis/fix1570
...
fix build-exe for --target-arch wasm32 (#1570 )
2018-10-02 09:02:14 -04:00
Ben Noordhuis
24bbade217
fix build-exe for --target-arch wasm32 ( #1570 )
...
Pass --no-entry instead of --relocatable to lld. Both stop a reference
to the _start() entry point from being emitted but --relocatable also
prevents public symbols from being exported when creating an executable.
2018-10-02 12:31:21 +02:00
Wink Saville
cd211bcc20
Add doc comment for tokenLocationPtr ( #1618 )
...
The algorithm seemed unusual and I had spent some effort understanding
it, so I thought I'd add a comment.
2018-10-02 00:51:53 -04:00
Jimmi Holst Christensen
bc3e99c5e5
Fixed StackTrace not being resolved when panic is invalid ( #1615 )
2018-10-01 20:30:34 +02:00
Andrew Kelley
d4d22df1d9
increase stack size on windows for all executables
...
fixes test failures
See #157
2018-10-01 14:10:18 -04:00
Andrew Kelley
af229c1fdc
std lib (breaking): posixRead can return less than buffer size
...
closes #1414
std.io.InStream.read now can return less than buffer size
introduce std.io.InStream.readFull for previous behavior
add std.os.File.openWriteNoClobberC
rename std.os.deleteFileWindows to std.os.deleteFileW
remove std.os.deleteFilePosix
add std.os.deleteFileC
std.os.copyFile no longer takes an allocator
std.os.copyFileMode no longer takes an allocator
std.os.AtomicFile no longer takes an allocator
add std.os.renameW
add windows support for std.os.renameC
add a test for std.os.AtomicFile
2018-10-01 13:50:55 -04:00
Andrew Kelley
d1ec8377d1
std lib: flesh out the async I/O streaming API a bit
2018-10-01 10:53:39 -04:00
Andrew Kelley
9d4eaf1e07
update std lib API for I/O
...
std.io.FileInStream -> std.os.File.InStream
std.io.FileInStream.init(file) -> file.inStream()
std.io.FileOutStream -> std.os.File.OutStream
std.io.FileOutStream.init(file) -> file.outStream()
remove a lot of error code possibilities from os functions
std.event.net.socketRead -> std.event.net.read
std.event.net.socketWrite -> std.event.net.write
add std.event.net.readv
add std.event.net.writev
add std.event.net.readvPosix
add std.event.net.writevPosix
add std.event.net.OutStream
add std.event.net.InStream
add std.event.io.InStream
add std.event.io.OutStream
2018-09-30 17:28:35 -04:00
Sahnvour
ba78ae0ae7
Fixes --emit asm on windows and makes C header file generation explicit. ( #1612 )
...
* build: only do codegen_link when emitting an actual binary. Fixes #1371
* build: only output C header file when explicitely asked to
2018-09-30 16:59:45 -04:00
Andrew Kelley
418b2e7d47
build: omit finding libxml2, zlib since no direct dependency
2018-09-30 16:56:06 -04:00
Andrew Kelley
57c4d38c55
rename std.event.tcp to std.event.net
2018-09-30 10:37:58 -04:00
Andrew Kelley
a42a213e35
Merge pull request #1594 from emekoi/master
...
added dynamic library loading for windows
2018-09-30 09:31:24 -04:00
emekoi
e6446dfc86
fixed native target detection
2018-09-30 09:27:53 -04:00
emekoi
623f5085f1
merged windows dll apis
2018-09-30 01:05:13 -05:00
emekoi
42ba206c5d
fixed compilation on mingw
2018-09-30 01:05:13 -05:00
emekoi
d3bf267136
added dynamic library loading for windows
2018-09-30 01:05:13 -05:00
Jimmi Holst Christensen
1428ef3b07
Expose failing_allocator as *Allocator instead of const FailingAllocator
2018-09-30 01:23:05 +02:00
Andrew Kelley
40da2c6098
Merge pull request #1599 from ziglang/zig-build-arg0
...
zig build: use os_self_exe_path to determine exe path not arg0
2018-09-28 18:45:50 -04:00
Andrew Kelley
779881b978
zig build: use os_self_exe_path to determine exe path not arg0
2018-09-28 16:41:23 -04:00
Andrew Kelley
e242f6a609
Release 0.3.0
2018-09-28 09:03:40 -04:00
Andrew Kelley
f4a0658585
rely on gcc for static builds on macos
2018-09-27 22:27:52 -04:00
Andrew Kelley
fe524a1fa5
build: add support for ZIG_STATIC on MacOS
2018-09-27 15:09:14 -04:00
Andrew Kelley
cc490f0026
update @typeInfo docs
2018-09-27 12:34:41 -04:00
Andrew Kelley
af3263d7a8
add dll export storage class where appropriate
...
closes #1443
2018-09-27 10:22:16 -04:00
Josh Wolfe
e7d9d00ac8
overhaul api for getting random integers ( #1578 )
...
* rand api overhaul
* no retry limits. instead documented a recommendation
to call int(T) % len directly.
2018-09-27 00:35:38 -04:00
Andrew Kelley
1c26c2f4d5
fix crash when compile error evaluating return...
...
...type of inferred error set. closes #1591
2018-09-26 16:59:08 -04:00
Andrew Kelley
589201b104
fix variables which are pointers to packed struct fields
...
closes #1121
2018-09-26 14:54:53 -04:00
Andrew Kelley
dcfd15a7f0
the last number in a packed ptr is host int bytes
...
See #1121
2018-09-26 14:54:52 -04:00
Wink Saville
631851f8b5
Tweak SYMBOL_CHAR define in tokenizer.cpp
...
Make it a little clearer what a SYMBOL_CHAR is, use ALPHA instead of
ALPHA_EXCEPT_C and case 'c', which is ALPHA's definition.
2018-09-26 11:29:01 -04:00
Andrew Kelley
9485043b3c
fix implicit casting to *c_void
...
closes #1588
also some small std lib changes regarding posix sockets
and one doc typo fix
2018-09-26 11:06:09 -04:00
Jay Weisskopf
7b204649e3
stage1: Added zig help to show usage on stdout
...
This will make it easier to do things like `zig help | grep something`.
Invalid arguments will now display a short notice for `zig help`
instead of showing the full usage information. This will make it easier
to see the actual error.
2018-09-25 22:05:44 -04:00
Andrew Kelley
2e562a5f36
fix crash on runtime index into slice of comptime type
...
closes #1435
2018-09-25 12:03:39 -04:00
Andrew Kelley
839492d0e8
fix not syntax highlighting builtin module
2018-09-25 12:03:09 -04:00
Andrew Kelley
eafb8e8572
fix self reference through fn ptr field crash
...
closes #1208
2018-09-25 10:45:11 -04:00
Wink Saville
0e6c18c820
Remove StrLitKind enum
...
I was looking at the tokenizer specifically fn testTokenize and the
this statement looked odd:
if (@TagType(Token.Id)(token.id) != @TagType(Token.Id)(expected_token_id)) {
I then saw the TODO and thought I'd remove StrLitKind figuring that
would make testTokenize simpler. It did so I thought I'd prepare this PR.
The tests are still working and stage2 zig seems to work, it compiles and
I was able to use the fmt command.
2018-09-24 19:28:46 -04:00
Andrew Kelley
4241cd666d
fix more bigint code paths and add tests
2018-09-24 16:31:22 -04:00
Andrew Kelley
877036e7ef
fix translate-c test expecting incorrect C ABI on windows
2018-09-24 15:14:20 -04:00
Andrew Kelley
32c91ad892
fix comptime bitwise operations with negative values
...
closes #1387
closes #1529
2018-09-24 14:38:51 -04:00
Andrew Kelley
422269ea6e
minor langref improvements
2018-09-24 14:38:51 -04:00
Wink Saville
c5509a07ca
Ignore class-memaccess error for gcc 8 and above
...
On Arch Linux the current default compiler is gcc 8.2.1 and this change
is needed to ignore the following errors:
In file included from /home/wink/local/include/llvm/ADT/STLExtras.h:21,
from /home/wink/local/include/llvm/ADT/StringRef.h:13,
from /home/wink/local/include/llvm/ADT/StringMap.h:17,
from /home/wink/local/include/llvm/Support/Host.h:17,
from /home/wink/local/include/llvm/ADT/Hashing.h:49,
from /home/wink/local/include/llvm/ADT/ArrayRef.h:13,
from /home/wink/local/include/llvm/ADT/APFloat.h:21,
from /home/wink/local/include/clang/AST/APValue.h:18,
from /home/wink/local/include/clang/AST/Decl.h:17,
from /home/wink/local/include/clang/AST/ASTTypeTraits.h:20,
from /home/wink/local/include/clang/AST/ASTContext.h:18,
from /home/wink/local/include/clang/Frontend/ASTUnit.h:18,
from /home/wink/prgs/ziglang/zig/src/translate_c.cpp:18:
/home/wink/local/include/llvm/ADT/SmallVector.h: In instantiation of ‘void llvm::SmallVectorTemplateBase<T, true>::push_back(const T&) [with T = std::pair<void*, long unsigned int>]’:
/home/wink/local/include/llvm/Support/Allocator.h:249:33: required from ‘void* llvm::BumpPtrAllocatorImpl<AllocatorT, SlabSize, SizeThreshold>::Allocate(size_t, size_t) [with AllocatorT = llvm::MallocAllocator; long unsigned int SlabSize = 4096; long unsigned int SizeThreshold = 4096; size_t = long unsigned int]’
/home/wink/local/include/clang/AST/ASTContext.h:659:42: required from here
/home/wink/local/include/llvm/ADT/SmallVector.h:313:11: error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct std::pair<void*, long unsigned int>’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memcpy(this->end(), &Elt, sizeof(T));
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8.2.1/utility:70,
from /home/wink/local/include/llvm/Support/type_traits.h:19,
from /home/wink/local/include/llvm/Support/Casting.h:19,
from /home/wink/local/include/clang/Basic/LLVM.h:22,
from /home/wink/local/include/clang/AST/APValue.h:17,
from /home/wink/local/include/clang/AST/Decl.h:17,
from /home/wink/local/include/clang/AST/ASTTypeTraits.h:20,
from /home/wink/local/include/clang/AST/ASTContext.h:18,
from /home/wink/local/include/clang/Frontend/ASTUnit.h:18,
from /home/wink/prgs/ziglang/zig/src/translate_c.cpp:18:
/usr/include/c++/8.2.1/bits/stl_pair.h:198:12: note: ‘struct std::pair<void*, long unsigned int>’ declared here
struct pair
^~~~
2018-09-24 14:01:59 -04:00
Andrew Kelley
004c383292
fix translate-c incorrectly translating negative enum init values
...
closes #1360
2018-09-24 12:19:16 -04:00
Andrew Kelley
8a7737eef4
fix godbolt cli test on non-linux-x86_64 hosts
2018-09-24 12:01:51 -04:00
Andrew Kelley
6d048aa3bf
add panic function to godbolt CLI API test
2018-09-24 11:14:39 -04:00
Andrew Kelley
a155f2973b
add test to cover the CLI API that godbolt is using
...
closes #1399
2018-09-24 11:12:21 -04:00
Wink Saville
a170a64776
Fix typo in argsAlloc comment
...
Changed freeArgs to argsFree.
2018-09-23 13:12:57 -04:00
Andrew Kelley
af01c6e2bf
include LICENSE in windows static builds
2018-09-23 12:29:38 -04:00
Jeff Fowler
f955844435
rm extraneous macro
2018-09-22 10:50:35 -04:00
Andrew Kelley
c84548e71d
fix @compileLog having unintended side effects
...
closes #1459
2018-09-22 10:46:22 -04:00
Andrew Kelley
3c1f9baff1
doc: add note about reproducible builds
2018-09-22 10:22:01 -04:00
Andrew Kelley
5c15c5fc48
add compile error for slice of undefined slice
...
closes #1293
2018-09-22 10:04:47 -04:00
Andrew Kelley
2e27407161
stage1: unify 2 implementations of pointer deref
...
I found out there were accidentally two code paths
in zig ir for pointer dereference. So this should
fix a few bugs.
closes #1486
2018-09-21 18:47:12 -04:00
Andrew Kelley
9e5cd43e6d
fix comptime string concatenation ignoring slice bounds
...
closes #1362
2018-09-21 15:45:13 -04:00
Andrew Kelley
0ca12ded2f
Merge branch 'raulgrell-BitByteOffsetOfs'
2018-09-21 14:16:14 -04:00
Andrew Kelley
7c5e3e1f8e
fixups
2018-09-21 14:15:58 -04:00
Andrew Kelley
5a21d3dce0
Merge branch 'BitByteOffsetOfs' of https://github.com/raulgrell/zig into raulgrell-BitByteOffsetOfs
2018-09-21 13:10:21 -04:00
Andrew Kelley
44f2ee101f
fix comptime slice of pointer to array
...
closes #1565
2018-09-21 10:31:11 -04:00
Andrew Kelley
073f7ebb0e
fix formatInt to handle upcasting to base int size
2018-09-20 13:46:20 -04:00
Andrew Kelley
9c8dfadbb1
add compile error for casting const array to mutable slice
...
See #1565
2018-09-20 12:24:51 -04:00
Andrew Kelley
f8fe517d12
better string literal caching implementation
...
We were caching the ConstExprValue of string literals,
which works if you can never modify ConstExprValues.
This premise is broken with `comptime var ...`.
So I implemented an optimization in ConstExprValue
arrays, where it stores a `Buf *` directly rather
than an array of ConstExprValues for the elements,
and then similar to array of undefined, it is
expanded into the canonical form when necessary.
However many operations can happen directly on the
`Buf *`, which is faster.
Furthermore, before a ConstExprValue array is expanded
into canonical form, it removes itself from the string
literal cache. This fixes the issue, because before an
array element is modified it would have to be expanded.
closes #1076
2018-09-20 11:04:31 -04:00
Andrew Kelley
492821781d
add workaround for llvm-config --system-libs
...
not handling static libs correctly
2018-09-19 18:28:50 -04:00
Andrew Kelley
ce912e2964
add HermitCore target
2018-09-19 17:52:37 -04:00
Andrew Kelley
a4d61b5d72
update to llvm 8
2018-09-19 17:34:52 -04:00
Andrew Kelley
f9bf04c38b
travis: build zig with gcc to match what llvm was built with
...
from #llvm IRC:
<andrewrk> does llvm 7 as a .so have some kind of new initialization
requirement? I'm getting a segfault in llvm::DIBuilder::createFile
(with valid non-null parameters), when linking my frontend against
llvm-7.so but not when linking against llvm .a libraries
<d0k> we have an ABI bug in LLVM 7 when the .so is built with gcc
but your program is build with clang. I'm sorry for that.
2018-09-19 17:15:33 -04:00
Andrew Kelley
287f5cce50
build: fix finding llvm and clang 7
2018-09-19 15:38:36 -04:00
Andrew Kelley
e3d8cae35a
travis: fix llvm apt package names
2018-09-19 14:54:32 -04:00
Andrew Kelley
6d23619cce
fix typo from previous commit
2018-09-19 13:53:47 -04:00
Andrew Kelley
f418a943cc
travis: fix package names
2018-09-19 13:46:20 -04:00
Andrew Kelley
d4cb373024
travis: update apt repo url
2018-09-19 13:25:11 -04:00
Andrew Kelley
69c876cc87
appveyor: remove old cache file
2018-09-19 12:58:58 -04:00
Andrew Kelley
15301504e2
Merge remote-tracking branch 'origin/llvm7'
2018-09-19 12:57:58 -04:00
Christian Wesselhoeft
5eeef1f5ed
std/index.zig: Fix import
...
BufferOutStream is defined in io.zig
2018-09-18 19:01:35 -04:00
Andrew Kelley
6dd93ee5d9
fix regression from previous commit
2018-09-18 18:56:29 -04:00
Andrew Kelley
21328e0036
zig fmt: handle shebang lines
...
closes #1546
2018-09-18 18:36:39 -04:00
Andrew Kelley
345f8db1c4
fix optional pointer to empty struct incorrectly being non-null
...
closes #1178
2018-09-18 17:51:50 -04:00
Andrew Kelley
0ab7cfa023
appveyor: use MSVC 2017
2018-09-18 16:36:31 -04:00
Andrew Kelley
c1af360532
add compile error for slice.*.len
...
closes #1372
2018-09-18 16:32:40 -04:00
Andrew Kelley
84b963cb1b
Merge remote-tracking branch 'origin/master' into llvm7
2018-09-18 15:39:05 -04:00
Andrew Kelley
148fe2e999
stage1 caching: don't write manifest until cache release
...
this prevents the situation where we determine the cache
manifest and write it, but then crash or otherwise error out
before putting the artifacts in the proper place.
now the artifacts will be in place because cache_release
happens after that step is done.
2018-09-18 15:35:03 -04:00
Andrew Kelley
275b4100c0
remove unnecessary setFloatMode calls
...
Now that Strict is the default, these calls only add noise.
2018-09-18 15:15:03 -04:00
Andrew Kelley
4b2719b51d
Merge remote-tracking branch 'origin/master' into llvm7
2018-09-18 15:05:47 -04:00
Andrew Kelley
8c77c5705f
implementation for bitcasting extern enum type to c_int
...
closes #1036
2018-09-18 15:00:14 -04:00
Andrew Kelley
5fd3af9dc6
fix implicit cast of packed struct field to const ptr
...
closes #966
2018-09-18 14:34:30 -04:00
Andrew Kelley
1fc2019031
fix @embedFile reading garbage memory
...
closes #1547
2018-09-18 10:25:57 -04:00
Andrew Kelley
93ff5024a4
minor cleanups from 68c1d05917
2018-09-18 10:17:48 -04:00
Andrew Kelley
d353d5aef8
fix @bytesToSlice on a packed struct
...
closes #1551
2018-09-18 09:49:57 -04:00
emekoi
68c1d05917
compiling on mingw is now supported ( #1542 )
...
* compiles on mingw-w64
* fixed error in os_file_overwrite on windows
* fixed windows hello_world example
2018-09-18 00:13:17 -04:00
Josh Wolfe
13645585fe
link to #1544
2018-09-17 21:25:37 -04:00
Josh Wolfe
8f0618a5b1
Merge pull request #1543 from ziglang/bit_shifting
...
somewhat realistic usecase test for shifting strange integer sizes
2018-09-17 21:07:01 -04:00
Josh Wolfe
d7492b2c22
somewhat realistic usecase test for shifting strange integer sizes
2018-09-17 20:49:23 -04:00
Andrew Kelley
bfcfaaf5bd
fix codegen for @intCast to u0
2018-09-17 20:33:42 -04:00
Andrew Kelley
15e59eb142
remove deprecated, unused windows functions
...
* `CryptAcquireContextA`
* `CryptReleaseContext`
* `CryptGenRandom`
See https://github.com/ziglang/zig/issues/534#issuecomment-422208368
2018-09-17 20:07:48 -04:00
Andrew Kelley
b16229da1d
add compile error for @ptrCast 0 bit type to non-0 bit type
2018-09-17 19:41:11 -04:00
Andrew Kelley
78a9a465a3
add compile error for non-optional types compared against null
...
closes #1539
2018-09-17 18:58:50 -04:00
Andrew Kelley
6c71e9a54d
fix crash when bit shifting a u1
2018-09-17 18:44:45 -04:00
Andrew Kelley
cf9200b815
dereferencing a *u0 is comptime-known to be 0
2018-09-17 18:13:38 -04:00
Andrew Kelley
4c6f1e614a
remove zig build --init. add zig init-lib and zig init-exe
...
init-lib creates a working static library with tests, and
init-exe creates a working hello world with a `run` target.
both now have test coverage with the new "cli tests" file.
closes #1035
2018-09-17 17:11:18 -04:00
Andrew Kelley
9c9eefc841
allow extern structs to have stdcallcc function pointers
...
closes #1536
2018-09-17 11:22:30 -04:00
Andrew Kelley
dd5b2d1b04
fix crash when pointer casting a runtime extern function
2018-09-16 11:23:38 -04:00
Andrew Kelley
a2abdb185f
Merge remote-tracking branch 'origin/master' into llvm7
2018-09-16 10:51:58 -04:00
Andrew Kelley
780e567446
add docs for @This()
2018-09-15 10:14:50 -04:00
Andrew Kelley
3f776af3fa
fix alignment of structs
...
closes #1248
closes #1052
closes #1154
2018-09-14 19:08:59 -04:00
Wink Saville
d9ed3d186d
Add test for Queue.dump
...
To make dump testable added dumpToSteam which takes a stream as input
and added the stream as a paraemter to dumpRecursive.
Added test "std.atomic.Queue dump"
And to make the test more robust SliceOutStream.pos is now public. This
allows the user of SliceOutStream to know the length of the data captured.
2018-09-14 14:14:58 -07:00
Andrew Kelley
639c381128
fix coroutine alignment
...
zig returned the wrong alignment for coroutine promises
in some cases
2018-09-14 13:55:45 -04:00
Wink Saville
82af31ce36
Fix additional regressions calling FileOutStream/FileInStream init()
...
This is caused by change 686663239a and not
fixed in 832caefc2a .
2018-09-14 12:07:21 -04:00
Andrew Kelley
5e39328542
docs: more syntax highlighting
2018-09-14 10:35:03 -04:00
Andrew Kelley
3d38feded9
fix tagged union with all void payloads but meaningful tag
...
closes #1322
2018-09-14 00:38:22 -04:00
Andrew Kelley
1e03cf1739
fix assertion failure on compile-time @intToPtr of function
2018-09-13 19:12:25 -04:00
Andrew Kelley
c06a61e9bf
remove this. add @This().
...
closes #1283
2018-09-13 16:34:33 -04:00
Andrew Kelley
7c3636aaa3
remove the scope parameter of setFloatMode
...
also document that scopes inherit this value. See #367
See #1283
2018-09-13 15:46:34 -04:00
Andrew Kelley
9ac9633b10
stage1: put test output artifact back in zig-cache folder
...
close #1508
2018-09-13 14:30:15 -04:00
Andrew Kelley
ac0cda8df8
add compile error for merging non- error sets
...
closes #1509
2018-09-13 13:48:41 -04:00
Andrew Kelley
22e39e1e5a
fix tagged union with only 1 field tripping assertion
...
closes #1495
now the tag type of an enum with only 1 item is comptime_int.
2018-09-13 13:33:11 -04:00
Andrew Kelley
77fd147b26
appveyor: skip all release tests to save time
...
appveyor is taking longer than 1 hour to run the tests
2018-09-13 11:26:13 -04:00
Andrew Kelley
d332311e53
Merge branch 'kristate-cache-invalidformat-issue1510'
2018-09-13 11:25:31 -04:00
Andrew Kelley
e3f0ba4984
alternate fix using the rest() function
2018-09-13 11:24:57 -04:00
kristopher tate
6d0a122816
src/cache_hash.cpp: support file paths that contain spaces;
...
ref: #1510
2018-09-13 23:34:01 +09:00
Marc Tiehuis
e70c543bc4
math/complex: cexp test correction and ldexp usage fix
2018-09-13 20:33:05 +12:00
Andrew Kelley
afe6316d32
appveyor: skip release-safe to save time
...
appveyor is taking longer than 1 hour to run the tests
2018-09-12 17:36:24 -04:00
Andrew Kelley
0dbbc91bc9
docs: langref is now javascript-free
2018-09-12 17:27:10 -04:00
Andrew Kelley
869475c110
ci: skip release-small tests to save time
...
we keep hitting the limit on how long CI tests take to run.
2018-09-12 14:50:26 -04:00
Andrew Kelley
a757533386
fix zig fmt on windows
...
closes #1069
2018-09-12 14:26:21 -04:00
Andrew Kelley
178d69191b
windows: std.fs functions support concurrent ops
...
when reading and writing the same file descriptors
2018-09-12 13:55:35 -04:00
Andrew Kelley
0cfd019377
Merge pull request #1494 from ziglang/stage1-caching
...
stage1 caching
2018-09-12 12:40:16 -04:00
Andrew Kelley
3a49d115cf
fix zig build cache dir path
2018-09-12 11:49:46 -04:00
Andrew Kelley
1caa48c2df
windows os.cpp implementations
2018-09-12 11:33:26 -04:00
Andrew Kelley
7bd8a2695b
Merge pull request #1506 from emekoi/master
...
fixed WriteFile segfault
2018-09-12 09:03:14 -04:00
emekoi
54f7d58722
fixed WriteFile segfault
2018-09-12 07:01:48 -05:00
Andrew Kelley
ff0b7fe29a
error messages for attempted cache when zig cannot perfectly do it
2018-09-11 22:59:40 -04:00
Andrew Kelley
014cc60a72
rename --enable-timing-info to -ftime-report to match clang
...
and have it print llvm's internal timing info
2018-09-11 22:46:22 -04:00
Andrew Kelley
ee263a15cc
bring back zig-cache
...
we need somewhere to put .o files and leave them while the user
executes their program, so that stack traces on MacOS can find
the .o files and get at the DWARF info.
if we try to clean up old global tmp dir files, first of all that's
a hard and complicated problem, and secondly it's not clear how
that is better than dumping the .o file inside zig-cache locally.
2018-09-11 22:25:52 -04:00
Andrew Kelley
25466ffb71
Merge remote-tracking branch 'origin/master' into stage1-caching
2018-09-11 20:54:55 -04:00
Andrew Kelley
7e9f25dd18
stage1: clean up timing report in test mode
2018-09-11 20:54:39 -04:00
Andrew Kelley
6b7f3d01ae
ci: build zig in release mode
...
It makes sense to test release mode, plus we're up against the
time limits of CI, so this should make room.
2018-09-11 20:53:28 -04:00
Andrew Kelley
04dc5cdaca
zig build: make the cache root dir before building
2018-09-11 18:15:08 -04:00
Andrew Kelley
1a4dcf10fe
darwin fixups
2018-09-11 17:42:03 -04:00
Andrew Kelley
a1132ffe0f
stage1: build blake code with -std=c99
2018-09-11 17:29:18 -04:00
Andrew Kelley
9227315bf2
zig build: better placement of test exe artifact
2018-09-11 17:23:36 -04:00
Andrew Kelley
15c67d2d50
fix docgen tests
2018-09-11 16:52:50 -04:00
Andrew Kelley
4af844732a
Merge remote-tracking branch 'origin/master' into stage1-caching
2018-09-11 15:56:04 -04:00
Andrew Kelley
7dd3c3814d
fix incorrect error union const value generation
...
closes #1442
zig needed to insert explicit padding into this structure before
it got bitcasted.
2018-09-11 15:16:50 -04:00
Andrew Kelley
dd1338b0e6
fix incorrect union const value generation
...
closes #1381
The union was generated as a 3 byte struct when it needed to be
4 bytes so that the packed struct bitcast could work correctly.
Now it recognizes this situation and adds padding bytes to become
the correct size so that it can fit into an array.
2018-09-11 12:59:39 -04:00
Andrew Kelley
c4f96ea745
disable stage2 tests on all targets
...
See #1364
2018-09-11 11:52:16 -04:00
Andrew Kelley
67735c6f15
ability to disable cache. off by default except for...
...
...zig run, zig build, compiler_rt.a, and builtin.a
2018-09-11 00:32:40 -04:00
Andrew Kelley
a6bf37f8ca
Merge remote-tracking branch 'origin/master' into llvm7
2018-09-10 22:45:20 -04:00
Andrew Kelley
52f4e934a9
fix llvm assertion and missing compile error
2018-09-10 22:44:27 -04:00
Andrew Kelley
5ee5933ade
stage1 caching: zig no longer uses zig-cache
2018-09-10 17:30:45 -04:00
Andrew Kelley
c7f7089392
drop patches on top of clang's C headers
...
We now match clang 7.0.0rc3 exactly.
See https://reviews.llvm.org/D51265 for more details.
2018-09-10 15:55:39 -04:00
Andrew Kelley
e077d765fe
LLD patch: workaround for buggy MACH-O code
...
This reapplies 1a1414fc42
to the embedded LLD.
2018-09-10 15:54:51 -04:00
Andrew Kelley
54e470f936
update embedded LLD to 7.0.0rc3
2018-09-10 15:54:16 -04:00
Andrew Kelley
32be6e9b2a
caching is working
...
* add almost all the input parameter state to the hash
- missing items are the detected MSVC installation on Windows
and detected libc installation on POSIX
- also missing are C files and .h files that libclang finds
* artifacts are created in global cache directory instead of
zig-cache.
- exception: builtin.zig is still in zig-cache
* zig run uses the new cache correctly
* zig run uses execv on posix systems
2018-09-10 13:46:23 -04:00
Andrew Kelley
c9474faa4e
Merge remote-tracking branch 'origin/master' into llvm7
2018-09-10 12:30:57 -04:00
Andrew Kelley
fbe5737c84
stage1: always optimize blake and softfloat even in debug mode
2018-09-10 09:46:15 -04:00
Andrew Kelley
c0bdcc7417
zig id command
2018-09-09 23:58:52 -04:00
Andrew Kelley
173fc842c4
basic compiler id hash working
2018-09-09 18:38:41 -04:00
Bas van den Berg
7c9f7b72c5
Add capacity and appendAssumeCapacity to ArrayList
2018-09-09 10:28:07 -04:00
Andrew Kelley
859b0aee1e
Merge pull request #1488 from Sahnvour/windows-resolve-path
...
Fixes a path corruption when compiling on windows.
2018-09-08 16:26:46 -04:00
Sahnvour
d80a5c9a79
Fixes a path corruption when compiling on windows.
2018-09-08 18:43:18 +02:00
Shawn Landden
17cb69cebc
fix elf auxv handling
...
Auxillery vectors are not guaranteed to be in any order, this
just happens to work on x86_64.
2018-09-08 14:47:21 +00:00
Shawn Landden
7d6d1d1f60
NaNs do not have signedness.
...
From IEEE-754 standard:
Conversion of a quiet NaN in a supported format to an external character sequence
shall produce a language-defined one of “nan” or a sequence that is equivalent except
for case (e.g., “NaN”), with an optional preceding sign. (This standard does not interpret
the sign of a NaN.)
2018-09-08 03:52:28 +00:00
Shawn Landden
fdeb8765f0
use vfork in stage1 compiler to avoid OOM
2018-09-08 03:52:28 +00:00
Shawn Landden
cba0d76fbc
clone() on arm64
2018-09-08 03:52:28 +00:00
Shawn Landden
f8808edff4
simplify f64_min to equivilent value
...
arm64 complains about the old value (I added a test)
2018-09-08 03:52:28 +00:00
Shawn Landden
342cff28f5
initial arm64 support
2018-09-08 03:52:28 +00:00
Shawn Landden
4a8c992ef1
os: use less syscalls
...
these don't exist on new platforms (such as arm64)
also switch from the deprecated dirent to dirent64
2018-09-08 03:52:28 +00:00
Shawn Landden
d956d30167
this is not arch-specific
2018-09-08 03:52:28 +00:00
Andrew Kelley
2005898689
improve panic message from previous commit
2018-09-07 20:19:55 -04:00
Andrew Kelley
9c169f3cf7
C ABI: support returning large structs on x86_64
...
also panic instead of emitting bad code for returning small structs
See #1481
2018-09-07 20:09:33 -04:00
Andrew Kelley
9017efee22
C ABI: support medium size structs & unions for x86_64 params
...
See #1481
2018-09-07 18:51:34 -04:00
Andrew Kelley
85534a26c6
stage1: function to classify x86_64 abi types
2018-09-07 18:51:34 -04:00
Raul Leal
f2186e5fa7
Update langref.html.in
2018-09-07 22:58:31 +01:00
raulgrell
09a1162af5
builtin functions: @byteOffsetOf and @bitOffsetOf
2018-09-07 22:49:19 +01:00
Andrew Kelley
b18af37c57
fix crash when var init has compile error
...
and then the var is referenced
closes #1483
2018-09-07 15:17:24 -04:00
Andrew Kelley
7505529e44
Merge branch 'c-abi'
...
closes #1411
closes #1264
2018-09-07 13:56:54 -04:00
Andrew Kelley
743b2e4afc
add C ABI test for big unions
2018-09-07 13:51:11 -04:00
Andrew Kelley
421ca1523f
stage1: refactor variable inits to use c abi fn walk
2018-09-07 13:24:41 -04:00
Andrew Kelley
c528c00900
stage1: refactor param vars for C ABI
2018-09-07 12:59:59 -04:00
Andrew Kelley
04d7b565f7
stage1: refactor fn type analysis to use C ABI walk fn
2018-09-07 12:23:50 -04:00
Andrew Kelley
be6cccb3a5
stage1: c abi for big struct works
2018-09-07 11:52:57 -04:00
Andrew Kelley
a9a925e500
add C ABI tests
2018-09-06 16:29:35 -04:00
Andrew Kelley
a375bd0d9f
stage1: compile error instead of incorrect code
...
for unimplemented C ABI
See #1411
See #1481
2018-09-06 11:58:58 -04:00
Marc Tiehuis
29923efb95
Merge pull request #1480 from kristate/x25519-pubkey-fix
...
X25519: Fix createPublicKey signature and add test
2018-09-06 17:23:38 +12:00
Andrew Kelley
b4d5d4d174
assume evenly divided base64
2018-09-05 23:39:14 -04:00
kristopher tate
15d30b967a
std/crypto/x25519.zig: add test for createPublicKey;
2018-09-06 12:24:53 +09:00
Andrew Kelley
97c9f61db4
start creating a hash of input parameters
...
See #1416
2018-09-05 23:24:40 -04:00
kristopher tate
d1855a0e93
std/crypto/x25519.zig: fix signature for createPublicKey;
2018-09-06 12:24:12 +09:00
Andrew Kelley
2d4b95900e
stage1: import blake2b implementation
...
from master branch of blake2 reference implementation
320c325437539ae91091ce62efec1913cd8093c2
2018-09-05 23:23:11 -04:00
Andrew Kelley
6632d85e5f
stage1: improve handling of generic fn proto type expr
...
closes #902
2018-09-05 21:21:59 -04:00
Andrew Kelley
1d8b8ad687
add compile error for using outer scoped runtime variables
...
from a fn defined inside it. closes #876
2018-09-05 20:32:06 -04:00
Andrew Kelley
8400163e02
stage1: rename more TypeTableEntry types to ZigType
2018-09-05 18:42:56 -04:00
Andrew Kelley
1f5c7ff4d7
stage1: rename VariableTableEntry to ZigVar
2018-09-05 18:35:57 -04:00
Andrew Kelley
3500d32db5
stage1: rename FnTableEntry to ZigFn
2018-09-05 18:34:33 -04:00
Andrew Kelley
db882e5d63
stage1: rename TypeTableEntry to ZigType
2018-09-05 18:33:07 -04:00
Andrew Kelley
a3d384e593
add test case for #726
2018-09-05 18:20:04 -04:00
Andrew Kelley
cc17b662e4
Merge branch 'hcff-floatToIntError'
2018-09-05 18:02:13 -04:00
Andrew Kelley
b517bea734
allow comptime_int to @floatToInt
2018-09-05 18:01:48 -04:00
hfcc
768d1fc539
Added compilation error when a non-float is given to @floatToInt()
2018-09-05 23:31:25 +02:00
Andrew Kelley
ffb3b1576b
stage1: fix tagged union with no payloads
...
closes #1478
2018-09-05 16:19:58 -04:00
Andrew Kelley
c87a576cb5
stage1 compile error instead of crashing for unsupported comptime ptr cast
...
See #955
2018-09-05 15:53:36 -04:00
Andrew Kelley
ba7836ea48
stage1: fix build on macos
2018-09-05 12:10:53 -04:00
Andrew Kelley
a76a72469b
stage1: fix crash when invalid type used in array type
...
closes #1186
2018-09-05 10:43:35 -04:00
Andrew Kelley
3e94650ef7
stage1: fix emit asm with explicit output file
...
closes #1473
2018-09-05 10:28:08 -04:00
Andrew Kelley
9a123697e3
fix compile error on gcc 7.3.0
...
Only set -Werror for debug builds, and only for zig itself, not for
embedded LLD.
See #1474
2018-09-05 10:18:12 -04:00
Andrew Kelley
ac3cf0775f
Merge pull request #1474 from ziglang/issue-1357
...
Downgrade new g++-8.0 error to warning
2018-09-05 09:05:01 -04:00
Marc Tiehuis
ef2b8d4574
Downgrade new g++-8.0 error to warning
...
Allows building in Debug mode. Closes #1357 .
2018-09-05 20:43:14 +12:00
Andrew Kelley
b35c74ea4c
stage1: use os_path_resolve instead of os_path_real
...
to canonicalize imports.
This means that softlinks can represent different files,
but referencing the same absolute path different ways
still references the same import.
2018-09-04 23:17:38 -04:00
Andrew Kelley
2bf1b6840d
port std.os.path.resolve to stage1
2018-09-04 22:45:20 -04:00
Andrew Kelley
869167fc6d
compile error for @noInlineCall on an inline fn
...
closes #1133
2018-09-04 17:38:48 -04:00
Andrew Kelley
cbb3f1d76c
ir: consistent error checking for br and cond_br instructions
2018-09-04 16:58:19 -04:00
Andrew Kelley
b00007056d
update throughput test to new File API
...
closes #1468
2018-09-04 15:33:44 -04:00
Andrew Kelley
68db9d5074
add compile error for comptime control flow inside runtime block
...
closes #834
2018-09-04 15:28:35 -04:00
Andrew Kelley
f27d82fe90
Merge remote-tracking branch 'origin/master' into llvm7
2018-09-04 12:51:50 -04:00
Andrew Kelley
36828a2e6a
fix incorrect variable ref count
...
regression introduced by e82cd53df4
2018-09-04 12:50:02 -04:00
Andrew Kelley
ff4591f0e6
fix llvm assertion when adding callsite sret attr
2018-09-04 12:15:15 -04:00
Andrew Kelley
dbde8254d0
Merge remote-tracking branch 'origin/master' into llvm7
2018-09-04 11:58:31 -04:00
Andrew Kelley
2bd2a8ea34
Merge pull request #1441 from ziglang/poly1305-x25519
...
Add poly1305 and x25519 crypto primitives
2018-09-04 10:34:46 -04:00
Marc Tiehuis
8b50d10a84
std/crypto: Clean up poly1305/x25519
2018-09-04 20:16:12 +12:00
Andrew Kelley
bc88ef2dc3
compile errors for unimplemented minValue/maxValue builtins
2018-09-03 22:47:23 -04:00
Andrew Kelley
e82cd53df4
fix incorrect value for inline loop
...
09cc1dc660 failed to handle mem_slot_index correctly
closes #1436
2018-09-03 21:24:20 -04:00
Andrew Kelley
a11e73bee2
compile error instead of segfault for unimplemented feature
...
closes #1103
2018-09-03 12:38:24 -04:00
Andrew Kelley
3f273479f8
clarify const variables in docs
...
closes #1200
2018-09-03 12:18:12 -04:00
Andrew Kelley
2a9329c998
better anonymous struct naming
...
this makes anonymous structs inherit the name of the function they are in
only when they are the return expression.
also document the behavior and provide examples.
closes #1243
2018-09-03 11:32:39 -04:00
Andrew Kelley
95636c7e5f
ability to @ptrCast to *void
...
fixes #960
2018-09-03 00:04:12 -04:00
Andrew Kelley
92f7474359
switch most windows calls to use W versions instead of A
...
See #534
2018-09-02 23:25:04 -04:00
Andrew Kelley
d5968086fe
use the sret attribute at the callsite when appropriate
...
Thanks to Shawn Landden for the original pull request.
closes #1450
2018-09-02 21:08:59 -04:00
Andrew Kelley
8558caecb5
Merge branch 'kristate-std-fmt-hexToBytes'
2018-09-02 19:25:07 -04:00
Andrew Kelley
3eb89ee4db
fixups
...
* zig fmt
* use canonical parameter order. memcpy has dest first and
the base64 code follows the pattern.
* pass correct radix to charToDigit
2018-09-02 19:23:30 -04:00
Andrew Kelley
0d8412d9f0
Merge branch 'std-fmt-hexToBytes' of https://github.com/kristate/zig into kristate-std-fmt-hexToBytes
2018-09-02 19:08:54 -04:00
Andrew Kelley
ab387bb4c7
Merge pull request #1460 from ziglang/Sahnvour-windows-coff-issue721
...
Stack traces for Windows
2018-09-02 18:47:48 -04:00
Andrew Kelley
832caefc2a
fix regressions
2018-09-02 18:35:32 -04:00
Andrew Kelley
4cd50865bf
fix source file lookup
2018-09-02 17:58:50 -04:00
Andrew Kelley
98dc943c07
rework code to avoid duplicate operations
2018-09-02 15:58:08 -04:00
kristopher tate
fbd9bac5e7
std/fmt/index.zig: add hexToBytes function under std.fmt;
...
Depends on #1454 being implemented;
2018-09-03 01:12:52 +09:00
Andrew Kelley
86e55567b4
Merge pull request #1454 from kristate/str-hexbytes-issue1453
...
std.fmt: print zeroed high-order bytes correctly in hex
2018-09-02 11:31:05 -04:00
Andrew Kelley
78a110cda5
Merge pull request #1452 from shawnl/patch-1
...
std/rb.zig: fix comment
2018-09-02 11:17:54 -04:00
Andrew Kelley
67cb299f7d
Merge pull request #1456 from shawnl/inaccurate-comments
...
these all use futex() (inaccurate comments)
2018-09-02 11:14:17 -04:00
Shawn Landden
528e3b43a6
these all use futex() (inaccurate comments)
2018-09-01 23:52:52 -07:00
kristopher tate
d1752fbdc0
std/fmt/index.zig: test for printing double width hex bytes with zeros;
...
Co-Authored-By: Shawn Landden <shawn@git.icu >
2018-09-02 15:04:57 +09:00
kristopher tate
48d3fbef5c
std/fmt/index.zig: set width from 0 to 2;
...
\x00 was printed as 0 and \x0E was printed as E;
\x00 now correctly prints 00 and \x0E correctly prints 0E;
2018-09-02 15:04:20 +09:00
Shawn Landden
4bf54f3010
std/rb.zig: fix comment
2018-09-01 22:23:34 -07:00
Andrew Kelley
1a5c3e4501
Merge pull request #1451 from kristate/fmt-hexbytes-issue1358
...
allow bytes to be printed-out as hex (#1358 )
2018-09-01 10:44:54 -04:00
Andrew Kelley
19004cd5db
Merge pull request #1444 from kristate/winsdk-vercheck-issue1438
...
correct version comparison for detecting msvc (fixes #1438 )
2018-09-01 10:39:19 -04:00
kristopher tate
7a633f472d
std/fmt/index.zig: #1358 : test bytes printed-out as hex;
2018-09-01 19:53:11 +09:00
kristopher tate
454b2362ee
std/fmt/index.zig: #1358 allow bytes to be printed-out as hex;
...
Supports {x} for lowercase and {X} for uppercase;
2018-09-01 19:40:05 +09:00
kristopher tate
9e6f53dd58
i#1438: src/windows_sdk.cpp: fix version guard in find_81_version;
2018-09-01 12:02:21 +09:00
kristopher tate
d4474e195e
i#1438: src/windows_sdk.cpp: fix version guard in find_10_version;
2018-09-01 12:02:04 +09:00
Andrew Kelley
6ddbd345aa
figuring out where /names stream is
2018-08-31 19:50:03 -04:00
Jimmi Holst Christensen
e036f65ac0
Translate-c: Check for error before working on while loop body ( #1445 )
2018-08-31 23:17:17 +02:00
Andrew Kelley
b36b93fb3e
awareness of debug subsections
2018-08-31 15:02:41 -04:00
Marc Tiehuis
763845f95c
std/crypto: zig fmt
2018-08-31 18:45:45 +12:00
Marc Tiehuis
38399941d4
std/crypto: Update throughput_test.zig to include all hash functions
...
This avoids the need to recompile to test specific hash functions. This
also adds mac/key exchange performance tests as well.
2018-08-31 18:45:07 +12:00
Marc Tiehuis
a7527389cc
Make poly1305 and x25519 more idiomatic zig
...
This also adjusts the current hash/hmac functions to have a consistent
interface allowing easier switching/testing.
2018-08-31 18:40:09 +12:00
Andrew Kelley
99170aa13d
finding source file, line, and column info
2018-08-31 01:01:37 -04:00
Andrew Kelley
72185e7dd3
finding the function that an address is in
2018-08-30 16:57:55 -04:00
Andrew Kelley
44f908d2e6
figuring out which module an address belongs in
2018-08-30 15:33:50 -04:00
Andrew Kelley
96117e20cc
reading the module information substream
2018-08-30 03:44:34 -04:00
Marc Tiehuis
65b89f598c
Add poly1305 and x25519 crypto primitives
...
These are translated from [monocypher](https://monocypher.org/ ) which
has fairly competitive performance while remaining quite simple.
Initial performance comparision:
Zig:
Poly1305: 1423 MiB/s
X25519: 8671 exchanges per second
Monocypher:
Poly1305: 1567 MiB/s
X25519: 10539 exchanges per second
There is room for improvement and no real effort has been made at all in
optimization beyond a direct translation.
2018-08-30 18:02:19 +12:00
Andrew Kelley
686663239a
printing info from the ModuleInfo substream of DebugInfo
2018-08-29 19:00:24 -04:00
Andrew Kelley
f1b71053de
use RtlCaptureStackBackTrace on windows
2018-08-29 16:35:51 -04:00
Andrew Kelley
833477abf5
fix unresolved path preventing PDB loading
2018-08-28 18:55:51 -04:00
Andrew Kelley
41723f842c
Merge branch 'windows-coff-issue721' of https://github.com/Sahnvour/zig into Sahnvour-windows-coff-issue721
2018-08-28 17:32:32 -04:00
Andrew Kelley
9de0f900e1
Merge pull request #1369 from shawnl/crypto
...
std/crypto: add chacha20
2018-08-28 16:07:58 -04:00
Andrew Kelley
b65cca37ce
add test coverage for invalid switch expression parameter
...
closes #604
2018-08-28 15:48:39 -04:00
Andrew Kelley
901b5c1566
add compile error for function prototype with no body
...
closes #1231
2018-08-28 15:39:32 -04:00
Andrew Kelley
09cc1dc660
fix crash when var in inline loop has different types
...
closes #917
closes #845
closes #741
closes #740
2018-08-28 15:24:28 -04:00
Marc Tiehuis
87eb95f816
speed up chacha20
...
The main changes are:
Unrolling the inner rounds of salsa20_wordtobyte which doubles the speed.
Passing the slice explicitly instead of returning the array saves a copy (can optimize out in future with copy elision) and gives ~10% improvement.
Inlining the outer loop gives ~15-20% improvement but it costs an extra 4Kb of code space. I think the tradeoff is worthwhile here.
The other inline loops are small and can be done by the compiler if it is worthwhile.
The rotate function replacement doesn't alter the performance from the former.
The modified throughput test I've used to benchmark is as follows. Interestingly we need to allocate memory instead of using a fixed buffer else Zig optimizes the whole thing out.
https://github.com/ziglang/zig/pull/1369#issuecomment-416456628
2018-08-27 22:55:53 -07:00
Shawn Landden
444edd9aed
std.crypto: add chaCha20
...
v3
2018-08-27 19:44:11 -07:00
Andrew Kelley
048f506aa6
langref: document labeled blocks, labeled for, labeled while
...
closes #1327
2018-08-27 20:59:28 -04:00
Andrew Kelley
fb6d3859e8
zig fmt
2018-08-27 19:25:40 -04:00
Andrew Kelley
4f2d49fd13
std.zig.parse: fix parsing of doc comments after fields
...
closes #1404
2018-08-27 19:21:38 -04:00
Andrew Kelley
b92fac329e
Merge branch 'raulgrell-CastToCVoid'
2018-08-27 18:31:41 -04:00
Andrew Kelley
45d9d9f953
minor fixups
2018-08-27 18:31:28 -04:00
raulgrell
e2a9f2ef98
Allow implicit cast from *T and [*]T to ?*c_void
2018-08-27 23:13:57 +01:00
Andrew Kelley
c48be3a742
langref: document exporting a library
...
closes #1431
2018-08-27 17:44:58 -04:00
tgschultz
ecc5464024
Handle unions differently in std.fmt ( #1432 )
...
* Handle unions differently in std.fmt
Print the active tag's value in tagged unions. Untagged unions considered unsafe to print and treated like a pointer or an array.
2018-08-27 17:25:33 -04:00
Andrew Kelley
009e90f446
fix @typeInfo unable to distinguish compile error vs no-payload
...
closes #1421
closes #1426
2018-08-27 17:13:34 -04:00
Andrew Kelley
2f2215c9f4
this was intended to be included in the previous commit
2018-08-27 16:26:36 -04:00
Andrew Kelley
526d8425ab
fix false negative determining if function is generic
...
This solves the smaller test case of #1421 but the
other test case is still an assertion failure.
2018-08-27 16:14:48 -04:00
Andrew Kelley
68e2794e15
ir: const_ptr_pointee asserts that its return value is non-null
2018-08-26 13:13:26 -04:00
Andrew Kelley
6a3fad1d59
Revert "src/ir.cpp: check return value of const_ptr_pointee to protect against dereferencing null pointers;"
...
This reverts commit 0839ed1f94 .
I realized too late there is a better fix. See PR #1419
2018-08-26 13:04:58 -04:00
kristopher tate
0839ed1f94
src/ir.cpp: check return value of const_ptr_pointee to protect against dereferencing null pointers;
2018-08-26 13:02:09 -04:00
Andrew Kelley
f7f11e237c
Merge remote-tracking branch 'origin/master' into llvm7
2018-08-26 02:39:26 -04:00
Andrew Kelley
8047f0eae2
fix llvm assertion failure when building std lib tests for macos
...
closes #1417
2018-08-26 02:36:18 -04:00
Andrew Kelley
cce14f92fc
update clang headers to 7.0.0rc2
2018-08-25 22:14:41 -04:00
Andrew Kelley
20810e0a79
LLD patch: workaround for buggy MACH-O code
...
This reapplies 1a1414fc42
to the embedded LLD.
2018-08-25 22:11:32 -04:00
Andrew Kelley
95dbba046d
update LLD fork to 7.0.0rc2
2018-08-25 22:10:32 -04:00
Andrew Kelley
7109035b78
Merge remote-tracking branch 'origin/master' into llvm7
2018-08-25 21:57:28 -04:00
Andrew Kelley
526338b00f
document fixed-width integer types
...
closes #1280
2018-08-25 17:39:43 -04:00
Andrew Kelley
56a53021a1
Merge branch 'tgschultz-patch-3'
2018-08-25 17:28:40 -04:00
Andrew Kelley
2cce171448
add test for previous commit
2018-08-25 17:28:30 -04:00
tgschultz
61c0c6d502
Fixed compile error when passing enum to fmt
...
Caused by struct printing behavior. Enums are different enough from structs and unions that the field iteration behavior doesn't do what we want even if @memberName didn't error on enums.
2018-08-25 10:51:49 -05:00
Andrew Kelley
4003cd4747
Merge pull request #1406 from ziglang/macos-stack-traces
...
MacOS stack traces
closes #1365
2018-08-25 04:50:51 -04:00
Andrew Kelley
815950996d
Merge remote-tracking branch 'origin/master' into macos-stack-traces
2018-08-25 04:48:58 -04:00
Andrew Kelley
8aacfc8465
add workaround on macos for shared libraries
2018-08-25 04:37:55 -04:00
Andrew Kelley
02f5a9fa62
fix handling multiple extern vars with the same name
2018-08-25 03:55:59 -04:00
Andrew Kelley
b95ff12f2f
fix regressions
2018-08-25 03:40:47 -04:00
Andrew Kelley
ac36f98e72
fix stack traces on linux
2018-08-25 03:07:37 -04:00
Andrew Kelley
32901926f0
compilation unit cwd dir appears to be unnecessary on macos
2018-08-24 15:43:48 -04:00
Andrew Kelley
4e7c255e4d
macos stack traces have address-to-line translation
2018-08-24 14:55:55 -04:00
Andrew Kelley
bf1f91595d
std.debug: remove workaround for fixed bug
2018-08-24 13:00:28 -04:00
Andrew Kelley
6b31b178a6
fix regression from 2f7f7d815d
2018-08-24 12:59:31 -04:00
Andrew Kelley
95e197667e
macos stack traces have the compilation unit in them
2018-08-24 11:30:36 -04:00
Andrew Kelley
0a918aaa14
Merge pull request #1407 from ziglang/builtin-alignment-fix
...
Fix builtin alignment type
2018-08-24 10:42:43 -04:00
Marc Tiehuis
05f9b14fc2
Fix builtin alignment type
...
Closes #1235 .
2018-08-24 17:57:17 +12:00
Andrew Kelley
3a02ba9b82
fix error message for incorrect panic handler fn signature
...
closes #1353
2018-08-23 23:22:48 -04:00
Andrew Kelley
3173c90f14
macos stack traces: read debug info sections from .o files
2018-08-23 23:08:34 -04:00
Andrew Kelley
6c064cfd88
Merge pull request #1405 from shawnl/path-max
...
missing PATH_MAX change
2018-08-23 20:16:13 -04:00
Shawn Landden
2f7f7d815d
missing PATH_MAX change
2018-08-23 17:00:50 -07:00
Andrew Kelley
5c1ec20c9a
MacOS stack traces use the already mmapped executable
...
...rather than trying to find the executable on the file system.
Also use a more robust PIE offset calculation based on the
available metadata.
And for the last function, use the data that tells the end
rather than assuming 4K.
Also they print in a consistent way with Linux stack traces.
2018-08-23 16:23:33 -04:00
Andrew Kelley
327482c3a4
Merge pull request #1402 from ziglang/default-fp-ieee-strict
...
Default to strict IEEE floating point
2018-08-23 08:26:09 -04:00
Andrew Kelley
68dcdf1c86
Merge pull request #1401 from kristate/mem-testWriteIntImpl-u64
...
std/mem.zig: test writing u64 integers;
2018-08-23 08:25:26 -04:00
Marc Tiehuis
353419f82d
Default to strict IEEE floating point
...
Closes #1227 .
2018-08-23 22:54:46 +12:00
Andrew Kelley
8f96553be8
rename std.debug.ElfStackTrace to std.debug.DebugInfo
2018-08-22 21:35:49 -04:00
kristopher tate
e95345b3dc
std/mem.zig: test writing u64 integers;
2018-08-23 09:03:02 +09:00
Andrew Kelley
4b68ef45af
fix incorrectly generating an unused const fn global
...
closes #1277
2018-08-22 14:31:30 -04:00
Andrew Kelley
5aeb3217ee
fixup for previous commit
2018-08-22 14:24:48 -04:00
Raul Leal
87b10400c2
allow implicit cast from *[N]T to ?[*]T ( #1398 )
...
* allow implicit cast from *[N]T to ?[*]T
2018-08-22 13:12:08 -04:00
Andrew Kelley
3d780cf2ef
Merge branch 'shawnl-path_max'
...
This does a proof of concept of changing most file system APIs to not
require an allocator and remove the possibility of failure via
OutOfMemory.
This also does most of the work of #534 .
2018-08-21 21:02:01 -04:00
Andrew Kelley
3dd1026c8b
fix docs on windows
2018-08-21 21:01:37 -04:00
Andrew Kelley
02ba4b1678
Merge branch 'master' into shawnl-path_max
2018-08-21 20:56:28 -04:00
Andrew Kelley
478db39866
fix selfExePath on macosx
2018-08-21 20:52:21 -04:00
Andrew Kelley
b2917e6be0
Revert "Merge branch 'mtn-translate-c-enum-vals'"
...
This reverts commit 937b822fa9 , reversing
changes made to dd4b13ac03 .
Tests failing on Windows.
Re-opens #1360
2018-08-21 20:50:03 -04:00
Andrew Kelley
ea1b21dbdb
fix linux
...
* error.BadFd is not a valid error code. it would always be a bug to
get this error code.
* merge error.Io with existing error.InputOutput
* merge error.PathNotFound with existing error.FileNotFound.
Not all OS's support both.
* add os.File.openReadC
* add error.BadPathName for windows file operations with invalid
characters
* add os.toPosixPath to help stack allocate a null terminating byte
* add some TODOs for other functions to investigate removing the
allocator requirement
* optimize some implementations to use the alternate functions when
a null byte is already available
* add a missing error.SkipZigTest
* os.selfExePath uses a non-allocating API
* os.selfExeDirPath uses a non-allocating API
* os.path.real uses a non-allocating API
* add os.path.realAlloc and os.path.realC
* convert many windows syscalls to use the W versions (See #534 )
2018-08-21 20:31:50 -04:00
Andrew Kelley
51852d2587
fix windows
2018-08-21 16:07:28 -04:00
Andrew Kelley
bda5539e9d
*WIP* std.os assumes comptime-known max path size
...
this allows us to remove the requirement of allocators for a lot
of functions
See #1392
2018-08-21 00:46:42 -04:00
Andrew Kelley
937b822fa9
Merge branch 'mtn-translate-c-enum-vals'
...
This reintroduces b8ce8f219c .
(reverting dd4b13ac03 )
Now with correct author information. Apologies to kristopher tate
and Michael Noronha.
2018-08-20 22:46:50 -04:00
kristopher tate
b023db2e82
src/translate_c.cpp: correctly bridge llvm::APSInt with Zig BigInt;
...
ACHTUNG: llvm::APSInt stores an int's sign inside of its getRawData; Internally to Zig we store an integer's sign outside of getRawData! (~aps_int) calls .flip() internally on the raw data to match Zig.
test/translate_c.zig: enum: add wider range of values (u64) to try;
2018-08-20 22:46:11 -04:00
Michael Noronha
7e7e59d881
translate-c: Correctly translate enum init values, addressing #1360
2018-08-20 22:45:19 -04:00
Andrew Kelley
dd4b13ac03
Revert "translate-c: Correctly translate enum init values, addressing #1360 ( #1377 )"
...
This reverts commit b8ce8f219c .
Squashing the commits from the pull request resulted in kristopher tate
from being omitted from the authors. A future commit will merge
the code correctly.
2018-08-20 22:39:39 -04:00
Andrew Kelley
302936309a
Merge branch 'path_max' of https://github.com/shawnl/zig into shawnl-path_max
2018-08-20 17:57:49 -04:00
Andrew Kelley
9e9dce76ff
refactor std.os.makePath to use a switch instead of if
2018-08-20 17:57:03 -04:00
Andrew Kelley
820bf054ea
std.fmt.format: handle non-pointer struct/union/enum
...
Also adds support for printing structs via reflection.
The case when structs have pointers to themselves is not
handled yet.
closes #1380
2018-08-20 16:04:03 -04:00
Michael Noronha
b8ce8f219c
translate-c: Correctly translate enum init values, addressing #1360 ( #1377 )
...
* translate-c: Correctly translate enum init values
* translate-c: Test enum initialization
* translate-c: Flip to positive using APSInt builtins
* src/translate_c.cpp: correctly bridge llvm::APSInt with Zig BigInt;
ACHTUNG: llvm::APSInt stores an int's sign inside of its getRawData; Internally to Zig we store an integer's sign outside of getRawData! (~aps_int) calls .flip() internally on the raw data to match Zig.
* test/translate_c.zig: enum: add wider range of values (u64) to try;
closes #1360
2018-08-20 14:29:26 -04:00
Andrew Kelley
3ee1b60edf
langref: add docs for peer type resolution
...
closes #1367
2018-08-20 14:22:16 -04:00
Shawn Landden
bb93886791
do not use an allocator when we don't need to because of the existance of PATH_MAX
2018-08-19 21:42:48 -07:00
Marc Tiehuis
53b18b0791
Add secureZero function
...
This is identical to `mem.set(u8, slice, 0)` except that it will never
be optimized out by the compiler. Intended usage is for clearing
secret data.
The resulting assembly has been manually verified in --release-* modes.
It would be valuable to test the 'never be optimized out' claim in tests
but this is harder than initially expected due to how much Zig appears
to know locally. May be doable with @intToPtr, @ptrToInt to get around
known data dependencies but I could not work it out right now.
2018-08-18 12:15:39 +12:00
Marc Tiehuis
1da93caced
docs: correct @memcpy, @memset function signatures
2018-08-18 12:06:25 +12:00
Andrew Kelley
4c95b2f9d1
Merge pull request #1379 from tgschultz/patch-1
...
fixed handling of [*]u8 when no format specifier is set
2018-08-14 14:38:20 -04:00
tgschultz
fa955f0024
fixed handling of [*]u8 when no format specifier is set
...
If fmt was called on with a [*]u8 or [*]const u8 argument, but the fmt string did not specify 's' to treat it as a string, it produced a compile error due to accessing index 1 of a 0 length slice.
2018-08-14 12:56:41 -05:00
Andrew Kelley
52471f6221
Merge pull request #1378 from prazzb/cmake-fix
...
Find local llvm-config first
2018-08-14 12:53:54 -04:00
prazzb
6e55f61581
Find local llvm-config first
...
Distro's llvm usually have a 6.0 suffix.Any custom llvm build
names the binary as llvm-config.Keeping 6.0 variant first causes
the distro's llvm to be compiled in place of a custom one even if
given using CMAKE_PREFIX_PATH.
2018-08-13 22:55:19 +05:30
Andrew Kelley
65497121f4
Merge pull request #1370 from shawnl/master
...
rb: some style fixes
2018-08-12 12:58:11 -04:00
Shawn Landden
64a71be5c3
rb: some style fixes
...
avoid @import("std") as is the custom
compare function name
2018-08-10 21:46:30 -07:00
Andrew Kelley
c4b9466da7
Merge pull request #1294 from ziglang/async-fs
...
introduce std.event.fs for async file system functions
2018-08-10 15:51:17 -04:00
Andrew Kelley
598e80957e
windows: call CancelIo when canceling an fs watch
2018-08-10 13:19:07 -04:00
Andrew Kelley
0df485d4dc
self-hosted: reorganize creation and destruction of Compilation
2018-08-10 12:28:20 -04:00
Andrew Kelley
d40f3fac74
docgen: fix usage of std.HashMap
2018-08-10 00:03:16 -04:00
Andrew Kelley
23af36c54f
windows fs watching: fix not initializing table value
2018-08-09 21:48:25 -04:00
Andrew Kelley
26a842c264
windows: only create io completion port once
2018-08-09 20:12:46 -04:00
Andrew Kelley
b219feb3f1
initial windows implementation of std.event.fs.Watch
2018-08-09 16:48:44 -04:00
Andrew Kelley
c63ec9886a
std.event.fs.preadv windows implementation
2018-08-08 16:55:19 -04:00
Andrew Kelley
8b456927be
std.event.fs.pwritev windows implementation
...
also fix 2 bugs where the function didn't call allocator.shrink:
* std.mem.join
* std.os.path.resolve
2018-08-08 15:06:32 -04:00
Wink Saville
d927f347de
Fix ir_analyze_instruction_atomic_rmw ( #1351 )
...
There were two tests of type_is_valid(casted_ptr->value.type) change the
second one to type_is_valie(casted_operand->value.type).
2018-08-07 23:18:26 -04:00
Andrew Kelley
ac12f0df71
fix linux regressions
2018-08-07 22:23:26 -04:00
Andrew Kelley
60955feab8
std.event.fs.Watch distinguishes between Delete and CloseWrite on darwin
...
TODO: after 1 event emitted for a deleted file, the file is no longer
watched
2018-08-07 22:14:30 -04:00
Andrew Kelley
5cbfe392be
implement std.event.fs.Watch for macos
2018-08-07 21:06:21 -04:00
Shawn Landden
a583beb76c
mem: use pub on Compare ( #1352 )
...
fixes rb
/home/shawn/git/zig/std/rb.zig:133:37: error: 'Compare' is private
compare_fn: fn(*Node, *Node) mem.Compare,
2018-08-07 19:15:11 -04:00
Andrew Kelley
034363a86c
Merge pull request #1338 from shawnl/master
...
std: add red-black tree implementation
2018-08-07 12:47:28 -04:00
Shawn Landden
bbbb26f4d3
mem: add mem.compare(), and use it for mem.lessThan()
2018-08-07 05:30:54 -07:00
Shawn Landden
86b512c5cd
mem: move enum Compare from rb to mem
2018-08-07 04:57:41 -07:00
Andrew Kelley
dcf3869acd
Merge pull request #1346 from shawnl/doc
...
doc: @addWithOverflow also returns if overflow occured
2018-08-07 01:28:55 -04:00
Shawn Landden
5d2abf4402
std: add red-black tree implementation
...
This is to be used with @fieldParentPtr();
Example:
const rb = @import("std").rb;
const Number = struct {
node: rb.Node,
value: i32,
};
fn number(node: *rb.Node) *Number {
@fieldParentPtr(Number, "node", node);
}
fn compare(l: *rb.Node, r: *rb.Node) rb.Compare {
var left = number(l);
var right = number(r);
if (left.value < right.value) {
return rb.Compare.LessThan;
} else if (left.value == right.value) {
return rb.Compare.Equal;
} else if (left.value > right.value) {
return rb.Compare.GreaterThan;
}
unreachable;
}
--
A version that caches rb.Tree.first() could be added in the future.
2018-08-06 22:18:44 -07:00
Shawn Landden
cb0ef3ad4c
doc: @addWithOverflow also returns if overflow occured
2018-08-06 22:12:14 -07:00
Andrew Kelley
1a28f09684
fix hash map test
2018-08-07 00:54:19 -04:00
Andrew Kelley
fd50a6896b
std.event.fs support for macos
...
The file I/O stuff is working, but the fs watching
stuff is not yet.
2018-08-07 00:49:09 -04:00
Andrew Kelley
2c9ed664dd
merge @kristate's std lib changes to darwin
2018-08-06 19:36:31 -04:00
Andrew Kelley
97be8debab
std.HashMap.autoHash: use xor instead of wrapping mult
2018-08-06 19:09:22 -04:00
Andrew Kelley
c02ed80512
Merge branch 'mdsteele-threadid'
2018-08-06 17:32:55 -04:00
Andrew Kelley
24d74cbf44
fix Thread impl on Linux and add docs
2018-08-06 17:31:52 -04:00
Andrew Kelley
d2dd29e80c
separate os.Thread.Id and os.Thread.Handle because of windows
2018-08-06 17:25:24 -04:00
Andrew Kelley
0a3ae9dc6e
fix std.os.Thread.getCurrentId for linux
2018-08-06 16:48:49 -04:00
Andrew Kelley
647fd0f4f1
Merge branch 'threadid' of https://github.com/mdsteele/zig into mdsteele-threadid
2018-08-06 16:12:37 -04:00
Andrea Orru
72bac72338
Merge pull request #1339 from ziglang/zen_stdlib
...
Updates and fixes for the Zen stdlib
2018-08-06 03:05:22 -04:00
Andrea Orru
79d77faebf
More type cast fixes
2018-08-06 02:42:12 -04:00
Andrea Orru
641066d82e
Fix casts
2018-08-06 02:29:11 -04:00
Andrea Orru
d2f5e57b68
Merge branch 'master' into zen_stdlib
2018-08-06 01:43:19 -04:00
Andrew Kelley
63a23e848a
translate-c: fix for loops with var init and empty body
2018-08-05 18:40:14 -04:00
Andrew Kelley
387fab60a6
translate-c: fix do while with empty body
2018-08-05 18:32:38 -04:00
Andrew Kelley
c420b234cc
translate-c: handle for loop with empty body
2018-08-05 18:18:24 -04:00
Andrew Kelley
aa232089f2
translate-c: fix while loop with no body
2018-08-05 18:06:39 -04:00
Andrew Kelley
6cf248ec08
update c_headers/* to LLVM 7.0.0rc1
2018-08-05 02:20:05 -04:00
Matthew D. Steele
7a2401ef1e
Don't compare ?Thread.Id == Thread.Id in the test
...
It doesn't work, because of issue #1332 .
2018-08-04 21:47:13 -04:00
Andrew Kelley
ee68f28bba
LLD patch: workaround for buggy MACH-O code
...
This reapplies 1a1414fc42
to the embedded LLD.
2018-08-04 18:19:26 -04:00
Andrew Kelley
c4d31c8323
build: update embedded LLD build files
2018-08-04 18:09:19 -04:00
Andrew Kelley
cfb29f18e4
update embedded LLD to 7.0.0rc1
2018-08-04 17:47:16 -04:00
Andrew Kelley
b48948d6e8
Merge branch 'master' into llvm7
2018-08-04 15:19:03 -04:00
kristopher tate
a25824e033
zig/std/os/index.zig: clean-up thread id; ( #1 )
...
Ref #1316 #1330
2018-08-04 14:38:51 -04:00
Matthew D. Steele
86d1cc8e2f
Add thread ID support to std.os.Thread ( fixes #1316 )
2018-08-03 21:36:04 -04:00
Andrew Kelley
2680f9ab48
Merge remote-tracking branch 'origin/master' into async-fs
2018-08-03 18:47:30 -04:00
Andrew Kelley
c5f1925bc8
when decls don't change, don't regenerate them
2018-08-03 17:59:11 -04:00
Andrew Kelley
5dfcd09e49
self-hosted: watch files and trigger a rebuild
2018-08-03 17:22:17 -04:00
Andrew Kelley
9bd8b01650
fix tagged union initialization with a runtime void
...
closes #1328
2018-08-03 15:21:08 -04:00
Andrew Kelley
c66c6304f9
add a friendly note in .gitignore
2018-08-03 15:20:19 -04:00
Matthew D. Steele
dcaaa241df
Fix a type error in std.os.linux.getpid() ( #1326 )
...
syscall0() returns usize, but we were trying to @bitCast to i32.
2018-08-03 11:45:23 -04:00
Matthew D. Steele
c2a08d7c51
Fix the start-less-than-end assertion in std.rand.Random.range ( #1325 )
...
The function returns a value in [start, end), but was asserting
start <= end instead of start < end. With this fix, range(1, 1)
will now assertion error instead of dividing by zero.
2018-08-03 11:44:39 -04:00
kristopher tate
298abbcff8
better support for _ identifier
...
* disallow variable declaration of `_`
* prevent `_` from shadowing itself
* prevent read access of `_`
closes #1204
closes #1320
2018-08-03 02:57:17 -04:00
Andrew Kelley
7f6e97cb26
fixups from the merge
2018-08-02 17:36:08 -04:00
Andrew Kelley
65140b2fba
Merge remote-tracking branch 'origin/master' into async-fs
2018-08-02 17:29:31 -04:00
Andrew Kelley
951124e177
evented I/O zig fmt
2018-08-02 17:24:15 -04:00
Andrew Kelley
821805aa92
WIP: Channel.getOrNull
2018-08-02 17:04:17 -04:00
Andrew Kelley
fb05b96492
Merge branch 'kristate-handle-builtin-issue1296'
2018-08-02 14:16:46 -04:00
Andrew Kelley
895f262a55
pull request fixups
...
* clean up parser code
* fix stage2 parse and render code
* remove redundant test
* make stage1 compile tests leaner
2018-08-02 14:15:31 -04:00
Andrew Kelley
44fd3045ce
Merge branch 'handle-builtin-issue1296' of https://github.com/kristate/zig into kristate-handle-builtin-issue1296
2018-08-02 13:37:24 -04:00
Andrew Kelley
9ecbabfc4c
Merge branch 'pr-1319'
2018-08-02 13:35:06 -04:00
Andrew Kelley
729f2aceb0
fix API of RtlGenRandom
2018-08-02 13:34:31 -04:00
Andrew Kelley
cbca434cf0
Merge branch 'windows-RtlGenRandom-issue1318' of https://github.com/kristate/zig into pr-1319
2018-08-02 13:26:02 -04:00
kristopher tate
782043e2e6
std/os/windows/util.zig: SKIP instead of PASS on non-windows systems;
...
Tracking Issue #1318 ;
2018-08-03 02:16:49 +09:00
kristopher tate
dde7eb45c5
std/os/index.zig: call getRandomBytes() twice and compare;
...
Tracking Issue #1318 ;
2018-08-03 02:16:19 +09:00
kristopher tate
c44653f40f
std/os/index.zig: swap CryptGetRandom() with RtlGenRandom();
...
Tracking Issue #1318 ;
2018-08-03 02:14:52 +09:00
kristopher tate
22fd359e2c
std/os/windows/advapi32.zig: add SystemFunction036;
...
Tracking Issue #1318 ;
2018-08-03 02:14:06 +09:00
kristopher tate
432b7685bf
std/os/index.zig: use "hw.logicalcpu" instead of "hw.ncpu" in macOS; ( #1317 )
...
Tracking Issue #1252 ;
hw.ncpu was deprecated in macOS. Among 4 new options available (hw.{physicalcpu, physicalcpu_max, logicalcpu, logicalcpu_max}), hw.logicalcpu was chosen because it actually reflects the number of logical cores the OS sees.
2018-08-02 12:59:59 -04:00
kristopher tate
96a94e7da9
std/event: directly return @handle();
...
Tracking Issue #1296 ;
2018-08-02 17:52:40 +09:00
kristopher tate
ac0a87d58d
doc/langref.html.in: add builtin @handle() to docs;
...
Tracking Issue #1296 ;
2018-08-02 17:47:39 +09:00
kristopher tate
9b890d7067
test/cases/cancel.zig: update suspend to use @handle();
...
Tracking Issue #1296 ;
2018-08-02 17:47:03 +09:00
kristopher tate
9bed23f8b7
test/cases/coroutines.zig: update suspend to use @handle();
...
Tracking Issue #1296 ;
2018-08-02 17:46:41 +09:00
kristopher tate
915e321a23
doc/langref.html.in: update suspend example with @handle();
...
Tracking Issue #1296 ;
2018-08-02 17:45:35 +09:00
kristopher tate
5de92425d5
src/parser.cpp: fix typo from rebase;
2018-08-02 17:11:37 +09:00
kristopher tate
ff4a03f351
doc/langref.html.in: update docs to reflect that the promise symbol is no in scope with suspend;
...
Tracking Issue #1296 ;
2018-08-02 17:03:39 +09:00
kristopher tate
51955a5ca2
test/compile_errors.zig: update test to reflect that the promise symbol is no in scope with suspend;
...
Tracking Issue #1296 ;
2018-08-02 17:02:14 +09:00
kristopher tate
9b3cebcdb9
test/cases/coroutines.zig: test for immediate resume inside of suspend with @handle();
...
Tracking Issue #1296 ;
2018-08-02 17:02:14 +09:00
kristopher tate
3241ada468
test/cases/coroutines.zig: update test to reflect that the promise symbol is no in scope with suspend;
...
Tracking Issue #1296 ;
2018-08-02 17:02:14 +09:00
kristopher tate
79792a32e1
test/cases/coroutine_await_struct.zig: update test to reflect that the promise symbol is no in scope with suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
bc032a89cc
std/zig/parser_test.zig: update test to reflect that the promise symbol is no in scope with suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
9fe140abad
std/event/tcp.zig: remove promise_symbol from suspend and use @handle();
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
a3705b4251
std/event/loop.zig: remove promise_symbol from suspend and use @handle();
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
efec3a0e34
std/event/lock.zig: remove promise_symbol from suspend and use @handle();
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
b4ff464d39
std/event/group.zig: remove promise_symbol from suspend and use @handle();
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
244a7fdafb
std/event/future.zig: remove promise_symbol from suspend and use @handle();
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
29057e5511
std/event/channel.zig: remove promise_symbol from suspend and use @handle();
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
d3f628907a
src/parser.cpp: remove promise_symbol from suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
b3cd65d56e
src/ir.cpp: remove promise_symbol from suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
5e5685c117
src/ast_render.cpp: remove promise_symbol from suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
ca1b356337
src/all_types.hpp: remove promise_symbol from suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
92cb330e16
src/codegen.cpp: @handle(): replace hacky ref chain with llvm intrinsic;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
13ec5db234
test/compile_errors.zig: @handle() in non-async function
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
c546f750f1
test/compile_errors.zig: @handle() called outside of function definition;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
104bdb03d6
src/codegen.cpp: return promise instead of null promise;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
a8ea236095
src/ir.cpp: don't allow @handle() outside of a function;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
fcf53b31fc
src/ir.cpp: return promise->T instead of promise;
...
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
1f0040dd92
test/cases/coroutines.zig: remove dummy assert used for testing;
2018-08-02 16:50:08 +09:00
kristopher tate
c1a3b0cb0a
src/ir.cpp: add/throw error for @handle() in a non async context;
...
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
db362bec18
src/codegen.cpp: reassert that there are no generated errors in codegen;
...
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
0ee6502562
src/codegen.cpp: remove add_node_error from ir_render_handle;
...
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
81f463626a
src/codegen.cpp: add/throw error for @handle() in a non async context;
...
Tracking Issue #1296 ;
I removed/commented-out the assert checking for no errors since we now have some errors rendered.
2018-08-02 16:50:08 +09:00
kristopher tate
a2e5691228
src/codegen.cpp: return null if calling convention is not async;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
9366a58bdd
test/cases/couroutines.zig: test @handle();
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
da5f3d5c4c
src/ir_print.cpp: support @handle();
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
cd18186715
src/codegen.cpp: base handle builtin on @frameAddress();
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
a9ea22d4f9
src/ir.cpp: wire-up IR for handle builtin;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
e79c913cbc
src/all_types.hpp: add enums for Handle Builtin;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
Andrew Kelley
e3ae2cfb52
add std.event.RwLock and a few more std changes
...
* add std.event.RwLock and std.event.RwLocked
* std.debug.warn does its printing locked
* add std.Mutex, however it's currently implemented as a spinlock
* rename std.event.Group.cancelAll to std.event.Group.deinit and change
the docs and assumptions.
* add std.HashMap.clone
2018-08-01 16:26:37 -04:00
Marc Tiehuis
e66f538972
Add integer binary output format ( #1313 )
2018-08-01 11:38:04 -04:00
Andrew Kelley
de949b72c7
simpler std.event.Lock implementation
2018-07-31 19:57:46 -04:00
Andrew Kelley
f804310d9f
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-31 14:36:27 -04:00
Andrew Kelley
058bfb254c
std.fmt.format: add '*' for formatting things as pointers
...
closes #1285
2018-07-31 11:36:57 -04:00
Matthew D. Steele
0db33e9c86
Add "Comments" section to language reference ( #1309 )
...
The contents of this section come from the discussion on issue #1305 .
2018-07-30 22:27:07 -04:00
Andrew Kelley
3c8d4e04ea
std: file system watching for linux
2018-07-30 13:46:09 -04:00
Andrew Kelley
a870228ab4
self-hosted: use std.event.fs.readFile
2018-07-30 13:44:36 -04:00
Andrew Kelley
cc45527333
introduce std.event.fs for async file system functions
...
only works on linux so far
2018-07-30 13:44:36 -04:00
Andrew Kelley
5d4a02c350
Merge pull request #1307 from ziglang/cancel-semantics
...
improved coroutine cancel semantics
2018-07-30 13:42:26 -04:00
Andrew Kelley
cfe03c764d
fix docs for break from suspend
2018-07-30 13:07:04 -04:00
Andrew Kelley
c91c781952
add behavior tests for cancel semantics
2018-07-30 12:49:53 -04:00
Andrew Kelley
6fd6bc94f5
await sets suspend bit; return clears suspend bit
2018-07-30 12:22:54 -04:00
Andrew Kelley
09304aab77
fix cancel and await semantics
2018-07-29 23:25:40 -04:00
dbandstra
608ff52dc3
add SliceOutStream, rename SliceStream to SliceInStream ( #1301 )
2018-07-29 14:52:10 -04:00
Andrew Kelley
f884381c60
Merge pull request #1300 from dbandstra/more-stream-functions
...
A few new functions in InStream/OutStream
2018-07-29 14:51:25 -04:00
dbandstra
f36faa32c4
add skipBytes function to InStream
...
this reads N bytes, discarding their values
2018-07-28 17:34:28 -07:00
dbandstra
3ce0ea884f
add int writing functions to OutStream
...
added: writeInt, writeIntLe, and writeIntBe
2018-07-28 17:30:05 -07:00
Andrew Kelley
0d79e03816
canceling an await also cancels things awaiting it
2018-07-28 13:52:48 -04:00
Andrew Kelley
05456eb275
make some functions in std.event.Loop public
2018-07-28 12:53:33 -04:00
Andrew Kelley
dd272d1316
await cancels the await target when it is canceled
2018-07-28 12:36:02 -04:00
Andrew Kelley
0ba2bc38d7
await checks the cancel bit
2018-07-28 12:23:47 -04:00
Andrew Kelley
60cda3713f
suspend cancels awaiter when it gets canceled
2018-07-28 12:11:39 -04:00
Andrew Kelley
c6f9a4c044
cancel detects suspend bit
2018-07-28 01:26:11 -04:00
Andrew Kelley
6fed777637
cancel detects if the target handle has already returned
2018-07-28 01:22:51 -04:00
Andrew Kelley
f0c049d02b
detect double await
2018-07-27 18:37:30 -04:00
Andrew Kelley
e5beca886d
suspend checks the cancel bit
2018-07-27 18:07:30 -04:00
Andrew Kelley
e491c38189
resume detects resuming when not suspended
2018-07-27 18:01:39 -04:00
Andrew Kelley
341bd0dfa4
await sets the await bit
2018-07-27 17:47:27 -04:00
Andrew Kelley
0b7a9c0722
cancel sets the cancel bit
2018-07-27 17:42:09 -04:00
Andrew Kelley
02c5bda704
remove ability to break from suspend blocks
...
closes #803
2018-07-27 17:27:03 -04:00
Andrew Kelley
442e244b4d
suspend sets suspend bit
2018-07-27 17:16:00 -04:00
Andrew Kelley
10764ee0e6
resume clears suspend bit
2018-07-27 17:00:41 -04:00
Andrew Kelley
7113f109a4
update coroutine return codegen with new status bits
2018-07-27 15:50:26 -04:00
Andrew Kelley
b3f4182ca1
coroutines have 3 more bits of atomic state
2018-07-26 22:26:00 -04:00
Andrew Kelley
2cbad364c1
add compile error for ignoring return value of while loop bodies
...
closes #1049
2018-07-26 18:29:07 -04:00
Andrew Kelley
fd575fe1f3
add compile error for missing parameter name of generic function
2018-07-25 18:15:55 -04:00
Andrew Kelley
84195467ad
add compile error for non-inline for loop on comptime type
2018-07-25 17:08:55 -04:00
Andrew Kelley
2257660916
fix assertion failure when some compile errors happen
...
I don't actually know of a test case to trigger this
self-hosted won't have this problem because get_pointer_to_type
will return error.SemanticAnalysisFailed
2018-07-25 13:12:03 -04:00
Andrew Kelley
95f45cfc34
patch LLD to fix COFF crashing when linking twice in same process
...
closes #1289
2018-07-25 02:36:29 -04:00
Andrew Kelley
02713e8d8a
fix race conditions in self-hosted compiler; add test
...
* fix race condition in std.event.Channel deinit
* add support to zig build for --no-rosegment
* add passing self-hosted compare-output test for calling a function
* put a global lock on LLD linking because it's not thread safe
2018-07-24 21:28:54 -04:00
Andrew Kelley
adefd1a52b
self-hosted: function calling another function
2018-07-24 20:24:05 -04:00
Andrew Kelley
2ea08561cf
self-hosted: function types use table lookup
2018-07-24 14:20:49 -04:00
Andrew Kelley
1d4a94b635
remove old section from readme
...
we still want all these people but I think there are better ways
to communicate this than the readme file
2018-07-24 11:04:01 -04:00
Andrew Kelley
29e19ace36
fix logic for determining whether param requires comptime
...
closes #778
closes #1213
2018-07-24 10:21:33 -04:00
Andrew Kelley
74c80d2c7f
Merge pull request #1282 from nwsharp/master
...
std.io: PeekStream and SliceStream
2018-07-24 09:26:08 -04:00
Nathan Sharp
0046551852
std.io: PeekStream and SliceStream
...
SliceStream is a read-only stream wrapper around a slice of bytes. It
allows adapting algorithms which work on InStreams to in-memory data.
PeekStream is a stream wrapper which allows "putting back" bytes into
the stream so that they can be read again. This will help make
look-ahead parsers easier to write.
2018-07-23 23:30:40 -07:00
Andrew Kelley
dd9728c5a0
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-24 00:43:12 -04:00
Andrew Kelley
10bdf73a02
Merge pull request #1266 from ziglang/self-hosted-libc-hello-world
...
Self hosted libc hello world
2018-07-24 00:31:33 -04:00
Andrew Kelley
72599d420b
self-hosted: find all libc paths; windows linker code
2018-07-24 00:06:34 -04:00
Andrew Kelley
2614ef056a
self-hosted: basic linker code for macos
2018-07-23 17:38:03 -04:00
Andrew Kelley
7dbbddf2a6
macho backtraces - use std.sort.sort instead of insertion sort
...
it's way faster
2018-07-23 15:36:45 -04:00
Andrew Kelley
5a919dd82d
Merge remote-tracking branch 'origin/master' into self-hosted-libc-hello-world
2018-07-23 14:32:13 -04:00
Andrew Kelley
10d2f08d37
self-hosted: fix error messages not cleaning up correctly
2018-07-23 14:28:14 -04:00
Andrew Kelley
d767fae47e
self-hosted: add first compare-output test
2018-07-23 00:35:53 -04:00
Andrew Kelley
93e78ee722
self-hosted can compile libc hello world
2018-07-22 23:28:53 -04:00
Andrew Kelley
99153ac0aa
add std.math.big.Int.fitsInTwosComp
...
so that we can pass runtime-known values
2018-07-22 10:58:45 -04:00
Marc Tiehuis
d53fae3551
Add big int fits function ( #1279 )
...
Returns whether the current value in an Int fits in the requested type.
2018-07-22 10:11:27 -04:00
Marc Tiehuis
07b6a3d335
Tighten Int.to bounds and add twos-complement bitcount
2018-07-22 17:47:57 +12:00
Andrew Kelley
bbd293355b
Merge branch 'kristate-posix-darwin-issue1271'
2018-07-22 00:08:30 -04:00
Andrew Kelley
20f286f22a
re-organize std lib darwin files
2018-07-22 00:04:24 -04:00
Andrew Kelley
f72f46e912
Merge branch 'posix-darwin-issue1271' of https://github.com/kristate/zig into kristate-posix-darwin-issue1271
2018-07-21 23:59:35 -04:00
Andrew Kelley
0a32f80d9a
Merge branch 'kristate-skippable-tests-issue1274'
2018-07-21 23:44:17 -04:00
Andrew Kelley
4d9964a457
rename error.skip to error.SkipZigTest
...
also print stats at the end of test runner
2018-07-21 23:43:43 -04:00
Andrew Kelley
44292721bf
Merge branch 'skippable-tests-issue1274' of https://github.com/kristate/zig into kristate-skippable-tests-issue1274
2018-07-21 23:32:12 -04:00
kristopher tate
bb1b796711
README: include link to channel logs ( #1278 )
2018-07-21 23:26:52 -04:00
Sahnvour
2ec9a11646
Very much WIP base implementation for #721 .
...
Currently does:
- read COFF executable file
- locate and load corresponding .pdb file
- expose .pdb content as streams (PDB format)
2018-07-21 20:30:11 +02:00
kristopher tate
c5c053b6fd
std.event.tcp: add switch statement in preparation for building-out abstractions;
...
depends on issue #1274 ;
2018-07-22 03:11:55 +09:00
kristopher tate
bc411af4ff
std.event.tcp: SKIP test instead of OKing test;
...
tracking issue #1274 ;
2018-07-22 02:21:52 +09:00
kristopher tate
df574ccf86
std.special.test_runner.zig: make tests skippable;
...
tracking issue #1274 ;
tests can be skipped by returnning `error.skip` :
2018-07-22 02:20:03 +09:00
kristopher tate
501dd5f284
CMakeLists.txt: add darwin_socket.zig;
...
Tracking issue #1271 ;
thanks @Hejsil;
2018-07-22 01:47:53 +09:00
kristopher tate
460c266216
std.os.posix: Add SOCK_* for darwin;
...
Tracking issue #1271 ;
2018-07-21 19:15:03 +09:00
kristopher tate
8062afcb31
std.os.posix: Add SYSPROTO_* for darwin;
...
Tracking issue #1271 ;
2018-07-21 19:14:40 +09:00
kristopher tate
7ef110b484
std.os.posix: Add AF_* for darwin;
...
Tracking issue #1271 ;
2018-07-21 19:14:14 +09:00
Andrew Kelley
58c5f94a99
self-hosted: share C++ code for finding libc on windows
2018-07-20 23:38:13 -04:00
Jimmi HC
1f4c7d5ebf
Fixed windows getPos
2018-07-20 23:05:53 +02:00
Andrew Kelley
f5a67dba08
self-hosted: implicit cast comptime ints to other ints
...
we now have successful exit codes from main linking
against libc
2018-07-20 01:46:49 -04:00
Andrew Kelley
33fbd8c1d3
self-hosted: convert some stuff to async/await
2018-07-20 00:13:48 -04:00
Andrew Kelley
d9fc149752
relative path to cwd in compile errors
2018-07-19 23:52:44 -04:00
Andrew Kelley
0a880d5e60
fix generation of error defers for fns inside fns
...
closes #878
2018-07-19 18:06:41 -04:00
Andrew Kelley
3908b4fdee
self-hosted: refactor ParsedFile out of existence
...
also we are successfully analyzing the return type of main
2018-07-19 15:11:39 -04:00
Andrew Kelley
0736e6aa34
std.os.File: add missing pub modifiers
2018-07-19 13:06:13 -04:00
Andrew Kelley
a9f0681f85
prevent non-export symbols from clobbering builtins
...
closes #1263
2018-07-19 10:47:17 -04:00
Andrew Kelley
1d85b588ea
self-hosted: progress on IR for supporting libc hello world
...
* add c int types
* some more ir stubs
2018-07-19 00:08:47 -04:00
Andrew Kelley
7f1a550760
std.zig.parse: fix treating integer literals as string literals
2018-07-18 17:56:34 -04:00
Andrew Kelley
bd1c55d2c2
self-hosted: compile errors for return in wrong place
...
* outside fn definition
* inside defer expression
2018-07-18 17:43:36 -04:00
Andrew Kelley
aa3b41247f
self-hosted: linking against libc
...
also introduce `zig libc` command to display paths
`zig libc file.txt` will parse equivalent text and use that for libc
paths.
2018-07-18 17:43:36 -04:00
Andrew Kelley
3e4a3fa5b7
self-hosted: find libc on linux
2018-07-18 17:43:36 -04:00
Jimmi Holst Christensen
fd3a41dadc
Allow pointers to anything in extern/exported declarations ( #1258 )
...
* type_allowed_in_extern accepts all ptr not size 0
* Generate correct headers for none extern structs/unions/enums
2018-07-18 11:00:42 -04:00
Andrew Kelley
c393a399fb
fix invalid character test on windows
2018-07-18 10:51:42 -04:00
Andrew Kelley
cd488c9da5
fix std.os.getAppDataDir test on linux
2018-07-18 10:45:17 -04:00
Andrew Kelley
a8a1b5af07
fix build on windows
...
* move getAppDataDir and utf16leToUtf8 from self-hosted to std lib
* fix std.event.Loop on windows
2018-07-18 10:07:22 -04:00
Jimmi HC
b7be082bd9
-Dskip-release now also skips build example tests
2018-07-18 10:28:14 +02:00
Josh Wolfe
843529d234
implement proper utf16leToUtf8
2018-07-18 03:01:01 -04:00
Andrew Kelley
cbfe9a4077
fix @setEvalBranchQuota not respected in generic fn calls
...
closes #1257
2018-07-17 23:37:17 -04:00
Jay Weisskopf
6394f7e9a3
Fixed minor documentation errors ( #1256 )
...
Changed:
- "retuns" to "returns"
- "null-terminated pointers" to "pointers to null-terminated arrays"
2018-07-17 21:18:41 -04:00
Andrew Kelley
a9ab528e34
std.event.Loop.onNextTick dispatches work to waiting threads
2018-07-17 15:17:44 -04:00
Andrew Kelley
ecf8da00c5
self-hosted: linking
2018-07-17 13:18:13 -04:00
Andrew Kelley
1a7cf4cbce
port 69e3b4e to self-hosted compiler
...
See #1249
2018-07-17 10:42:44 -04:00
Wink Saville
3cbf59b4c1
Add swapRemoveOrError ( #1254 )
...
* Add swapRemoveOrError, this mirrors setOrError.
2018-07-17 10:29:42 -04:00
Wink Saville
d1a60243c9
Give ArrayList tests consistent names ( #1253 )
...
The recent change that added swapRemove used std.ArrayList as the test
name prefix. Change the other tests to use the same prefix for consistency
and making it easier to use --test-filter.
2018-07-17 10:28:08 -04:00
kristopher tate
69e3b4e7dc
revert commit 860d3da915 ; please see #1249 for more information; ( #1255 )
2018-07-17 10:27:18 -04:00
Andrew Kelley
3bb00eac37
self-hosted: implement getAppDataDir for windows
2018-07-17 00:01:36 -04:00
Andrew Kelley
97bfeac13f
self-hosted: create tmp dir for .o files and emit .o file for fn
2018-07-16 20:52:50 -04:00
Andrew Kelley
0fa24b6b75
allow implicit cast of undefined to optional
2018-07-16 19:26:15 -04:00
Andrew Kelley
9b56efc957
remove std.ArrayList.removeOrError function
2018-07-16 17:45:18 -04:00
Andrew Kelley
558b0b8791
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-16 13:37:16 -04:00
Andrew Kelley
d3ce9d0643
codegen: remove unused variable
2018-07-16 11:59:37 -04:00
Andrew Kelley
e9a03cccf3
all integer sizes are available as primitives
...
* fix wrong implicit cast for `@IntType` bit_count parameter.
* fix incorrect docs for `@IntType` bit_count parameter.
closes #1242
closes #745
closes #1240
2018-07-16 10:53:15 -04:00
Andrew Kelley
363f4facea
self-hosted: generate LLVM IR for simple function
2018-07-15 00:07:33 -04:00
Andrew Kelley
2255f275a0
update for latest clang API
2018-07-15 00:03:33 -04:00
Andrew Kelley
4d920cee6e
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-14 18:27:51 -04:00
Andrew Kelley
28c3d4809b
rename Module to Compilation
...
and CompilationUnit to ObjectFile
2018-07-14 16:31:17 -04:00
Bas van den Berg
69e50ad2f5
Improve realloc on fixed buffer allocator ( #1238 )
...
* Add test to check re-use of memory
* Check if realloc has to reallocate the last allocated memory block.
If so extend that block instead of allocating a new one.
* Also check if the realloc actually preserves the data.
2018-07-14 16:31:11 -04:00
Andrew Kelley
278829fc2c
self-hosted: adding a fn to an llvm module
2018-07-14 16:03:22 -04:00
Andrew Kelley
91636f1e8c
Merge pull request #1237 from BarabasGitHub/fix-reallocating-from-0
...
Fix aligned reallocation
2018-07-14 12:09:54 -04:00
Bas van den Berg
c021a44567
Fix aligned reallocation from zero size.
2018-07-14 18:05:05 +02:00
Bas van den Berg
8be6c98ca6
Create unit test that tests aligned reallocation.
2018-07-14 18:04:23 +02:00
Andrew Kelley
29c756abba
docs: correct some misinformation
2018-07-14 11:53:51 -04:00
Marc Tiehuis
bf441ed244
Add --stdin option to zig fmt
2018-07-14 11:43:35 -04:00
Andrew Kelley
ed3181f029
Merge branch 'eduardosm-extern-return-small-struct'
2018-07-14 11:33:13 -04:00
Andrew Kelley
f78d4ed30c
add an assertion to the test
2018-07-14 11:33:01 -04:00
Eduardo Sánchez Muñoz
722b9b9e59
codegen: Store returned value if type is 'handle_is_ptr' and function is not 'first_arg_ret'.
...
Seems to fix #1230 , includes test.
2018-07-14 11:33:01 -04:00
Andrew Kelley
2a719ee6c5
Merge branch 'tgschultz-arraylist-remove'
2018-07-14 10:02:13 -04:00
Andrew Kelley
b44332f5a6
std.ArrayList - rename remove to swapRemove
2018-07-14 10:01:45 -04:00
tgschultz
a0c1498e65
Added remove to ArrayList
2018-07-14 09:55:47 -04:00
Andrew Kelley
317ed57cb1
docs: clarify mem.Allocator.reallocFn
2018-07-14 09:55:10 -04:00
Andrew Kelley
5f1aa3505d
Merge pull request #1232 from BarabasGitHub/fix-array-list-insert
...
Fix array list insert
2018-07-14 09:35:50 -04:00
Andrew Kelley
e78b1b810f
self-hosted: basic IR pass2
2018-07-13 21:56:38 -04:00
Bas van den Berg
fe98a2da70
Add a copyBackwards to fix the broken insert methods for ArrayList.
2018-07-13 23:01:21 +02:00
Bas van den Berg
a1cafa650d
Improve ArrayList insert unit tests.
2018-07-13 22:35:34 +02:00
Andrew Kelley
c87102c304
ir_get_ref: delete unnecessary and probably buggy code
2018-07-13 14:53:54 -04:00
Andrew Kelley
171f33b961
ir: remove unnecessary and probably buggy code
2018-07-13 14:18:37 -04:00
Andrew Kelley
860d3da915
ir: remove dead code
2018-07-13 13:37:01 -04:00
Andrew Kelley
5354d1f5fc
allow == for comparing optional pointers
...
closes #658
2018-07-13 12:34:42 -04:00
Andrew Kelley
ac096c2949
zig fmt
2018-07-12 19:24:32 -04:00
Andrew Kelley
69e60e351b
self-hosted: better IR for empty fn
...
avoids a void
2018-07-12 15:22:23 -04:00
Andrew Kelley
687bd92f9c
self-hosted: generate zig IR for simple function
...
no tests for this yet. I think the quickest path to testing will be
creating the .o files and linking with libc, executing, and then
comparing output.
2018-07-12 15:12:44 -04:00
Andrew Kelley
ce11d6d16c
ir: refactor lvalues
2018-07-11 21:37:47 -04:00
Andrew Kelley
30c4add85a
std.event.Future: workaround in tests for llvm coro memory
...
See #1194
2018-07-11 20:17:47 -04:00
Andrew Kelley
9751a0ae04
std.atomic: use spinlocks
...
the lock-free data structures all had ABA problems and
std.atomic.Stack had a possibility to load an unmapped memory address.
2018-07-11 19:38:01 -04:00
Andrew Kelley
9bdcd2a495
add std.event.Future
...
This is like a promise, but it's for multiple getters, and
uses an event loop.
2018-07-11 16:00:06 -04:00
Andrew Kelley
5954c94d20
build system: add -Dskip-release option to test faster
2018-07-11 14:09:05 -04:00
Andrew Kelley
3f30897fdc
add compile error for disallowed types in extern structs
...
closes #1218
2018-07-11 14:08:56 -04:00
Andrew Kelley
3aaf814b9d
Merge pull request #1216 from ziglang/sort-improvements
...
Add generic comparator generator functions for sorting
2018-07-11 11:56:14 -04:00
Marc Tiehuis
9b054e73f6
Add generic comparator generator functions for sorting
...
- Copy-by-value instead of pointer where appropriate
- Clean up old zig fmt issues
2018-07-11 18:44:30 +12:00
Andrew Kelley
c6c49389eb
self-hosted: add compile error test for missing fn name
2018-07-11 01:26:46 -04:00
Andrew Kelley
c620a1fe3d
Merge pull request #1215 from ziglang/self-hosted-first-test
...
self-hosted: first passing test
2018-07-11 00:50:17 -04:00
Andrew Kelley
da3acacc14
update vendor list for newest llvm version
2018-07-11 00:46:48 -04:00
Andrew Kelley
8197a14ceb
self-hosted test: use C allocator since we depend on libc
2018-07-10 20:27:15 -04:00
Andrew Kelley
574e31f0a0
self-hosted: first passing test
...
* introduce std.atomic.Int
* add src-self-hosted/test.zig which is tested by the main test suite
- it fully utilizes the multithreaded async/await event loop so the
tests should Go Fast
* `stage2/bin/zig build-obj test.zig` is able to spit out an error if 2 exported
functions collide
* ability for `zig test` to accept `--object` and `--assembly`
arguments
* std.build: TestStep supports addLibPath and addObjectFile
2018-07-10 20:18:43 -04:00
Andrew Kelley
8fba0a6ae8
introduce std.event.Group for making parallel async calls
2018-07-10 15:17:01 -04:00
Andrew Kelley
cfaebb20d8
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-10 14:03:03 -04:00
Andrew Kelley
0ce6934e26
allow var args calls to async functions
2018-07-10 11:44:47 -04:00
Andrew Kelley
696ef0bc03
langref: docs for union safety
2018-07-10 10:37:58 -04:00
Andrew Kelley
28f9230b40
fix crash when calling comptime-known undefined function ptr
...
closes #880
closes #1212
2018-07-10 10:12:08 -04:00
Andrew Kelley
b5cfbfd84e
fix regression from b6eb4048
2018-07-09 23:41:28 -04:00
Andrew Kelley
1b82a9defc
enable basic event loop test
2018-07-09 22:41:16 -04:00
Andrew Kelley
b6eb404831
organize std.event into directories
2018-07-09 22:22:44 -04:00
Andrew Kelley
ccef60a640
Merge pull request #1198 from ziglang/m-n-threading
...
M:N threading
2018-07-09 22:06:47 -04:00
Andrew Kelley
10cc49db1c
define c macros before importing llvm h files
...
Seems to matter on Ubuntu 16.04.
closes #1196
2018-07-09 22:05:22 -04:00
Andrew Kelley
c89aac85c4
better workaround for guaranteeing memory in coroutine frame
...
See #1194
2018-07-09 21:21:59 -04:00
wilsonk
a2834d48b9
Update throughput_test.zig. ( #1211 )
2018-07-09 17:21:20 -04:00
Andrew Kelley
1a1534ecb5
fix regression on macos
2018-07-09 17:16:06 -04:00
Andrew Kelley
3f4d0ecd7e
Merge remote-tracking branch 'origin/master' into m-n-threading
2018-07-09 17:14:42 -04:00
Andrew Kelley
0ac1b83885
fix non-portable format specifier
2018-07-09 17:13:31 -04:00
Andrew Kelley
9462852433
std.event.Loop multithreading for windows using IOCP
2018-07-09 16:49:46 -04:00
Andrew Kelley
caa0085057
implement std.os.cpuCount for windows
2018-07-09 13:19:11 -04:00
Andrew Kelley
05f1ea33d2
ZIG_DEBUG_COLOR=1 overrides tty detection for runtime stack traces
2018-07-09 12:12:37 -04:00
Andrew Kelley
2ee67b7642
langref: docs for invalid error set cast and incorrect pointer alignment
...
also add detection of incorrect pointer alignment at compile-time
of pointers that were constructed with `@intToPtr`.
2018-07-09 11:13:29 -04:00
Andrew Kelley
9eb51e20ed
fix crash on @ptrToInt of a *void
...
closes #1192
2018-07-09 10:44:06 -04:00
Andrew Kelley
42ba06133a
std.Hashmap - don't use catch unreachable in tests
2018-07-09 10:44:06 -04:00
Andrew Kelley
a0c564d762
zig fmt
2018-07-09 01:23:47 -04:00
Andrew Kelley
3ba451778f
fix regressions on linux
2018-07-09 01:22:36 -04:00
Marc Tiehuis
82e9190d09
Update zig.parser benchmark program
2018-07-09 17:14:04 +12:00
Andrew Kelley
04d3da4bd1
std.os.cpuCount implementation for macos
2018-07-09 01:08:33 -04:00
Andrew Kelley
50d70d5f49
tests passing with kqueue on macos
2018-07-08 02:46:10 -04:00
Josh Wolfe
410b4d9bdf
builder.addBuildOption
2018-07-08 00:00:05 -04:00
Andrew Kelley
ced3aae3b2
cleaner output from zig build when there are compile errors
2018-07-07 20:31:50 -04:00
Andrew Kelley
c15a6fa9d0
add std.os.cpuCount and have std.event.Loop use it for thread pool size
2018-07-07 01:23:18 -04:00
Andrew Kelley
57f36c4201
std.event.Loop: use EPOLLONESHOT to save 1 syscall
...
when a thread pool worker accepts a coroutine to resume
2018-07-07 00:32:19 -04:00
Andrew Kelley
eb326e1553
M:N threading
...
* add std.atomic.QueueMpsc.isEmpty
* make std.debug.global_allocator thread-safe
* std.event.Loop: now you have to choose between
- initSingleThreaded
- initMultiThreaded
* std.event.Loop multiplexes coroutines onto kernel threads
* Remove std.event.Loop.stop. Instead the event loop run() function
returns once there are no pending coroutines.
* fix crash in ir.cpp for calling methods under some conditions
* small progress self-hosted compiler, analyzing top level declarations
* Introduce std.event.Lock for synchronizing coroutines
* introduce std.event.Locked(T) for data that only 1 coroutine should
modify at once.
* make the self hosted compiler use multi threaded event loop
* make std.heap.DirectAllocator thread-safe
See #174
TODO:
* call sched_getaffinity instead of hard coding thread pool size 4
* support for Windows and MacOS
* #1194
* #1197
2018-07-07 00:32:19 -04:00
Andrew Kelley
d8295c1889
add @popCount intrinsic
2018-07-07 00:25:32 -04:00
Andrew Kelley
e19f0b5d9c
remove outdated semantic analysis documentation
2018-07-06 18:24:09 -04:00
Andrew Kelley
4ad4cd2654
fix iterating over a void slice
...
closes #1203
2018-07-06 17:27:44 -04:00
Andrew Kelley
1cf7511dc9
add compile error notes for where struct definitions are
...
closes #1202
2018-07-06 16:20:46 -04:00
Andrew Kelley
6d793c0ea3
langref: add more internal links
2018-07-06 16:20:31 -04:00
Andrew Kelley
0e9fef78dd
Merge branch 'isaachier-switch-enum-fix'
2018-07-06 12:07:57 -04:00
Andrew Kelley
1a5bd88881
alternate implementation of previous commit
...
This strategy adds another field to the SwitchBr instruction,
which is the result of the CheckSwitchProngs instruction. The
type of the result is void, and is unused, except that the SwitchBr
instruction will not perform analysis if the CheckSwitchProngs
instruction did not pass analysis. This allows the CheckSwitchProngs
instruction to do implicit casting for its type checking, while
preventing duplicate compile error messages.
2018-07-06 12:03:07 -04:00
Andrew Kelley
b5d07297de
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-04 20:43:49 -04:00
Isaac Hier
9cff23dbf9
Fix assertion crash on enum switch values
2018-07-04 13:27:10 -04:00
Isaac Hier
9395162a7c
Debug enum issue
2018-07-04 12:47:35 -04:00
Andrew Kelley
8c39cdc89f
fix await on early return when return type is struct
...
previously, await on an early return would try to access the
destroyed coroutine frame; now it copies the result into a
temporary variable before destroying the coroutine frame
2018-07-04 11:51:02 -04:00
Marc Tiehuis
1d18688628
Do not normalize langref.html.in line endings
...
See #1191 .
2018-07-04 23:47:15 +12:00
Jimmi HC
28821b5f31
Fixed last commit compiler error
2018-07-04 11:35:29 +02:00
Jimmi HC
4f32b86142
Allow allocation of any 0 sized type (not just void)
2018-07-04 11:29:02 +02:00
Andrew Kelley
291afcf75a
fix runtime libc detection depending on locale
...
closes #1165
2018-07-03 14:20:26 -04:00
Andrew Kelley
27fc49f72c
langref: improve docs for while and undefined
...
closes #1190
2018-07-03 14:03:27 -04:00
Andrew Kelley
9665cfe027
update for latest llvm
2018-07-03 03:48:47 -04:00
Marc Tiehuis
1eda86e1ad
Clean up outstanding compiler_rt todos
2018-07-03 13:22:12 +12:00
Andrew Kelley
6e1425e312
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-02 20:00:13 -04:00
Andrew Kelley
06e8c2e519
fix stage2 macos build
...
See #1173
2018-07-02 17:55:59 -04:00
Andrew Kelley
bd282d6cca
Merge pull request #1176 from bnoordhuis/f16-std
...
improve std.math f16 support
2018-07-02 16:03:25 -04:00
Andrew Kelley
22b7312460
Merge pull request #1173 from ziglang/event-loop-channel
...
add event loop Channel abstraction
2018-07-02 16:01:38 -04:00
Andrew Kelley
35463526cc
add runtime safety for @intToEnum; add docs for runtime safety
...
See #367
2018-07-02 15:50:28 -04:00
Andrew Kelley
2da999372a
add another BuildError code
2018-07-02 15:25:23 -04:00
Andrew Kelley
96a6bc57d2
modify std.event.Loop to work for windows and macos
2018-07-02 14:38:11 -04:00
Andrew Kelley
a3f55aaf34
add event loop Channel abstraction
...
This is akin to channels in Go, except:
* implemented in userland
* they are lock-free and thread-safe
* they integrate with the userland event loop
The self hosted compiler is changed to use a channel for events,
and made to stay alive, watching files and performing builds when
things change, however the main.zig file exits after 1 build.
Note that nothing is actually built yet, it just parses the input
and then declares that the build succeeded.
Next items to do:
* add windows and macos support for std.event.Loop
* improve the event loop stop() operation
* make the event loop multiplex coroutines onto kernel threads
* watch source file for updates, and provide AST diffs
(at least list the top level declaration changes)
* top level declaration analysis
2018-07-02 14:38:11 -04:00
Andrew Kelley
2759c7951d
always link against compiler_rt.o even when linking libc
...
sometimes libgcc is missing things we need, so we always link
compiler_rt and rely on weak linkage to allow libgcc to override.
2018-07-02 14:10:27 -04:00
Josh Wolfe
0206b76351
syntax in build.zig example doc
2018-07-01 22:03:51 -04:00
Josh Wolfe
e833a5a24c
gitignore docgen test artifacts
2018-07-01 13:47:29 -04:00
Andrew Kelley
4c0e280d6d
Merge pull request #1185 from ziglang/undefined-at-comptime-improvements
...
Operators now throw a compiler error when operating on undefined values
2018-07-01 01:33:23 -04:00
Jimmi Holst Christensen
b182151de5
Fixed line numbers for tests
2018-06-30 21:59:14 +02:00
Jimmi Holst Christensen
055e0fef4e
Avoid resolve_const in cmp when instr are not comptime
2018-06-30 21:22:26 +02:00
Jimmi Holst Christensen
ecd5e60be9
Expanded the list of operators that catch undefined values at comptime
2018-06-30 20:50:09 +02:00
Jimmi Holst Christensen
42033ea3ca
Merge pull request #1167 from ziglang/comptime-array-by-value
...
Implement const_values_equal for arrays
2018-06-30 18:58:31 +02:00
Andrew Kelley
3f4b77f561
Merge pull request #1177 from jayschwa/fix-out-of-src-builds
...
Fix version detection for out-of-source builds
2018-06-30 12:01:47 -04:00
Jimmi Holst Christensen
01bd5c46e1
Revert "ir_resolve_const now checks recursivly for undef values"
...
This reverts commit 4c3f27ce1e .
2018-06-30 17:35:06 +02:00
Jimmi Holst Christensen
616fe798c8
Revert "contains_comptime_undefined_value should not follow pointers"
...
This reverts commit 58b1692182 .
2018-06-30 17:35:05 +02:00
Marc Tiehuis
887c97742f
Alignment fix and allow rudimentary f128 float printing
2018-06-30 21:58:59 +12:00
Marc Tiehuis
951512f5ae
compiler_rt: Add CMake entries
2018-06-30 21:58:59 +12:00
Marc Tiehuis
9f48b2ab48
compiler_rt: Remove wrapping add/sub operators where unneeded
...
Closes #495 .
2018-06-30 21:58:59 +12:00
Marc Tiehuis
814a34f263
compiler_rt: Add floattitf/floattidf/floattisf
2018-06-30 21:58:59 +12:00
Marc Tiehuis
53fef94b9f
compiler_rt: Add missing install targets
2018-06-30 21:58:59 +12:00
Marc Tiehuis
e19fc4a0a3
compiler_rt: Add missing exports
2018-06-30 21:58:59 +12:00
Marc Tiehuis
cb7bdc2da1
compiler_rt: Add floatuntitf
2018-06-30 21:58:59 +12:00
Marc Tiehuis
61ebfe6603
compiler_rt: Add floatunditf and floatunsitf
2018-06-30 21:58:59 +12:00
Marc Tiehuis
c32b2e45ef
compiler_rt: Add floatuntisf
2018-06-30 21:58:59 +12:00
Marc Tiehuis
379950f81d
compiler_rt: Add trunc f128 narrowing functions
2018-06-30 21:58:59 +12:00
Jay Weisskopf
25bbb1a8ff
Fix version detection for out-of-source builds
...
Git was called in the build directory and not the source directory.
This works fine when the build directory resides within the source
repository, but doesn't work for out-of-source builds. Example:
```
~/zigbuild$ cmake ../zig
fatal: not a git repository (or any of the parent directories): .git
Configuring zig version 0.2.0+
```
Use Git's `-C <path>` flag to always point to the source directory so
that it doesn't matter where the build directory lives.
2018-06-29 22:22:04 -04:00
Ben Noordhuis
30cfc0ab2c
test std.math f16 sqrt support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
be36179064
add std.math f16 signbit support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
ca444e6191
add std.math f16 copysign support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
d293f1a0ed
add std.math f16 floor support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
1abc925292
add std.math f16 fabs support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
f36b095b5f
add std.math f16 isnormal support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
30b75ae353
add std.math f16 isfinite support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
a36d7b6131
add std.math f16 inf support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
27b02413dc
add std.math f16 nan support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
61df5bc142
add std.math f16 constants
...
refs #1122
2018-06-30 01:58:17 +02:00
Andrew Kelley
a3ab4325fd
Merge pull request #1175 from bnoordhuis/zig-test-emit-switch
...
support --emit in 'test' command
2018-06-29 18:39:19 -04:00
Ben Noordhuis
03f66825d6
support --emit in 'test' command
...
Support the `--emit` switch in `zig --emit asm test file.zig`.
The command fails because no tests run (no executable is created) but
it emits the requested file. That seems like a good tradeoff.
2018-06-29 23:32:10 +02:00
isaachier
f1c56f7f22
Clarify reason implicit cast does not work for large RHS ( #1168 )
...
* Clarify reason implicit cast does not work for large RHS
2018-06-29 14:52:25 -04:00
Andrew Kelley
0874a5ba77
std.atomic.queue - document limitation and add MPSC queue
2018-06-29 14:45:42 -04:00
Jimmi HC
58b1692182
contains_comptime_undefined_value should not follow pointers
2018-06-29 11:34:38 +02:00
Jimmi HC
4c3f27ce1e
ir_resolve_const now checks recursivly for undef values
2018-06-29 10:21:43 +02:00
Jimmi HC
b1128b18d5
Assert that array is not ConstArraySpecialUndef in const_values_equal
2018-06-29 08:41:16 +02:00
Jimmi HC
3ec38b2494
Implement const_values_equal for array type
...
* This allows arrays to be passed by value at comptime
2018-06-28 10:34:37 +02:00
Marc Tiehuis
4a35d7eeeb
Correct hex-float parsing
...
Unblocks #495 .
2018-06-28 20:12:03 +12:00
Andrew Kelley
2fa588e81d
fix coroutine accessing freed memory
...
closes #1164
2018-06-27 18:45:21 -04:00
Andrew Kelley
19961c50e4
fix comptime @tagName crashing sometimes
...
closes #1118
2018-06-27 13:15:55 -04:00
Andrew Kelley
6f88ecc9b6
add f16 to langref
2018-06-27 12:59:12 -04:00
tgschultz
3e94347e61
Fix up some std.rand syntax #1161 ( #1162 )
...
* Fix old syntax in rand
Ziggurat somehow did not get updated to latest syntax
* Fix broken float casts
f32 float casts somehow not updated to latest syntax
2018-06-27 12:30:15 -04:00
Andrew Kelley
1b4bae6d69
Merge pull request #1159 from bnoordhuis/f16
...
add f16 type
2018-06-27 12:29:05 -04:00
Ben Noordhuis
440c1d52b4
simplify comptime floating-point @divTrunc
...
Replace a conditional ceil/floor call with an unconditional trunc call.
2018-06-27 16:20:04 +02:00
Ben Noordhuis
fd75e73ee9
add f16 type
...
Add support for half-precision floating point operations.
Introduce `__extendhfsf2` and `__truncsfhf2` in std/special/compiler_rt.
Add `__gnu_h2f_ieee` and `__gnu_f2h_ieee` as aliases that are used in
Windows builds.
The logic in std/special/compiler_rt/extendXfYf2.zig has been reworked
and can now operate on 16 bits floating point types.
`extendXfYf2()` and `truncXfYf2()` are marked `inline` to work around
a not entirely understood stack alignment issue on Windows when calling
the f16 versions of the builtins.
closes #1122
2018-06-27 16:20:04 +02:00
Ben Noordhuis
1f45075a0e
dry floating-point type definitions
2018-06-27 16:20:04 +02:00
Ben Noordhuis
0ebc7b66e6
scope variables in floating point cast tests
...
Fixes a bug where the result of a @floatCast wasn't actually checked; it
was checking the result from the previous @floatCast.
2018-06-27 16:20:04 +02:00
Andrew Kelley
4de60dde6e
langref: explicit cast section
2018-06-26 15:48:42 -04:00
Andrew Kelley
11ca38a4e9
fix crash for optional pointer to empty struct
...
closes #1153
2018-06-26 15:27:41 -04:00
Andrew Kelley
af95e15572
rename get_maybe_type to get_optional_type
2018-06-26 15:11:05 -04:00
Isaac Hier
8e714289ca
Fix os_path_join for case where dirname is empty
2018-06-26 13:31:32 -04:00
Andrew Kelley
3290e72833
std.zig.ast: fix incorrect impl of FnProto.firstToken
...
closes #1151
2018-06-25 11:54:10 -04:00
Andrew Kelley
8866bef92c
clean up self hosted main. delete unsupported commands
2018-06-22 01:54:38 -04:00
Andrew Kelley
be2a4c42bd
Merge pull request #1149 from ziglang/issue346
...
fix compiler crash for invalid enum
2018-06-21 21:21:05 -04:00
Andrew Kelley
459d72f873
fix compiler crash for invalid enum
...
closes #1079
closes #1147
2018-06-21 17:41:49 -04:00
Andrew Kelley
5f38d6e2e9
add casting docs, __extenddftf2, and __extendsftf2
2018-06-21 14:44:35 -04:00
Andrew Kelley
47dd1049c8
Merge pull request #1145 from isaachier/bigint-neg-one-incr-fix
...
Fix bigint -1 increment operation
2018-06-21 13:40:37 -04:00
Isaac Hier
f1207a8e74
Add test case
2018-06-21 08:32:05 -04:00
Isaac Hier
eeda1a1396
Fix logic
2018-06-21 08:17:08 -04:00
Isaac Hier
0ab4afbf42
Fix increment operation for bigint -1
2018-06-21 08:14:26 -04:00
Marc Tiehuis
f50c0c664f
Add float repr bit extraction functions
2018-06-21 01:45:12 -04:00
Ben Noordhuis
eb6a8e6a3b
fix f128 remainder division bug
...
The modulo operation computed rem(b+rem(a,b), b) which produces -1
for a=1 and b=2.
Switch to a - b * trunc(a/b) which produces the expected result, 1.
closes #1137
2018-06-20 17:37:38 -04:00
Andrew Kelley
4eca75c53b
Merge branch 'kristate-stdmem-replace-create-with-construct'
2018-06-20 17:33:49 -04:00
Andrew Kelley
85f928f8bf
remove std.mem.Allocator.construct and other fixups
2018-06-20 17:33:29 -04:00
Andrew Kelley
e891f9cd9d
zig fmt
2018-06-20 17:16:27 -04:00
kristopher tate
6bd8610063
std.mem.Allocator.construct: improve formatting;
2018-06-21 01:40:25 +09:00
kristopher tate
4b46af4810
std.mem.Allocator.construct: remove deprecation warning;
2018-06-21 01:39:48 +09:00
kristopher tate
71db8df548
std: update stdlib to match updated allocator create signature; ref #733
2018-06-21 00:40:21 +09:00
kristopher tate
457c0f0a7e
std.mem: remove allocator create in favor of construct; ref #733
2018-06-21 00:39:19 +09:00
Andrew Kelley
55193cb13b
fix runtime fn ptr equality codegen
...
closes #1140
2018-06-20 06:46:53 -04:00
Andrew Kelley
7c99c30bf4
fix calling method with comptime pass-by-non-copyign-value self arg
...
closes #1124
2018-06-19 19:35:59 -04:00
Andrew Kelley
42db807f37
remove redundant implicit casting code
...
and introduce better type mismatch errors
closes #1061
2018-06-19 18:51:46 -04:00
Andrew Kelley
ee525c92a4
langref: organize docs for inline loops and add note about when to use it
2018-06-19 17:21:08 -04:00
Andrew Kelley
c7804277bf
@floatToInt now has safety-checked undefined behavior
...
when the integer part does not fit in the destination integer type
* Also fix incorrect safety triggered for integer casting an
`i32` to a `u7`. closes #1138
* adds compiler-rt function: `__floatuntidf`
2018-06-19 16:06:10 -04:00
Andrew Kelley
0b92d689d0
update langref
2018-06-19 12:16:59 -04:00
Andrew Kelley
85422d7aea
Merge pull request #1136 from alexnask/typeinfo_improvements
...
@typeInfo now uses optional types instead of @typeOf(undefined)
2018-06-19 11:46:32 -04:00
Andrew Kelley
9f2324389d
Merge pull request #1134 from ziglang/no-explicit-casting
...
remove "cast harder" casting syntax; add new casting builtins
2018-06-19 11:40:21 -04:00
Alexandros Naskos
811539f8ee
Added missing ?type in docs.
2018-06-19 17:49:48 +03:00
Alexandros Naskos
1392313236
@typeInfo now uses optional types instead of @typeOf(undefined)
2018-06-19 17:45:19 +03:00
Andrew Kelley
a3ddd0826b
remove enum to/from int casting syntax; add @enumToInt/@intToEnum
...
see #1061
2018-06-19 03:50:38 -04:00
Andrew Kelley
dd62737266
translate-c: add new libclang c types
2018-06-19 03:43:40 -04:00
Andrew Kelley
626b73e8be
remove error to/from int casting syntax; add @errorToInt/@intToError
...
See #1061
2018-06-18 18:48:29 -04:00
Andrew Kelley
a430853a48
standard library fixes
2018-06-18 17:43:01 -04:00
Andrew Kelley
1aafbae5be
remove []u8 casting syntax. add @bytesToSlice and @sliceToBytes
...
See #1061
2018-06-18 17:25:29 -04:00
Andrew Kelley
5d705fc6e3
remove error set casting syntax. add @errSetCast
...
See #1061
2018-06-18 15:01:42 -04:00
Andrew Kelley
c757984879
Merge remote-tracking branch 'origin/master' into llvm7
2018-06-18 14:51:23 -04:00
Andrew Kelley
1ca90b5856
zig fmt: support directories
...
zig fmt accepts any number of file paths. For each one, if it
is a file, then it formats the file. If it is a directory, then
zig recursively scans the directory, formatting all files that
end in `.zig`.
it maintains a map of paths that have been seen already, to avoid
softlink loops.
closes #1068
2018-06-18 13:58:08 -04:00
Andrew Kelley
cd4676a233
stage1: update darwin code to workaround old libc bug
...
See #1128
2018-06-18 12:54:31 -04:00
Andrew Kelley
1aa93808b1
Merge branch 'binary132-fix-1117-macos-realpath'
2018-06-18 12:19:16 -04:00
Andrew Kelley
4ce36a6475
adjust logic for finding the path to zig executable on darwin
2018-06-18 12:18:39 -04:00
Andrew Kelley
c09c3902c4
Merge branch 'fix-1117-macos-realpath' of https://github.com/binary132/zig into binary132-fix-1117-macos-realpath
2018-06-18 12:16:47 -04:00
Andrew Kelley
48985a7e68
langref: add docs for void
...
see #367
2018-06-18 12:02:30 -04:00
Andrew Kelley
8fd7cc11e1
disallow opaque as a return type of fn type syntax
...
closes #1115
2018-06-18 11:12:15 -04:00
Andrew Kelley
d49d6f0cde
fix compiler crash when using @intToFloat with float literal
...
closes #1132
2018-06-18 11:04:18 -04:00
Andrew Kelley
7151d72532
Merge pull request #1130 from ziglang/remove-bool-casting-syntax
...
remove bool to int syntax. add @boolToInt
2018-06-18 10:52:31 -04:00
Bodie Solomon
c7057bd25b
Fix 1117: Revise realpath scratch logic
2018-06-18 07:40:31 -04:00
Bodie Solomon
0456822892
Fix 1117: Tweak realpath logic to use out_path as scratch space
2018-06-18 07:40:31 -04:00
Bodie Solomon
e6b69151c0
Fix 1117: Use realpath in stage1 Darwin os_self_exe_path
...
Issue: https://github.com/ziglang/zig/issues/1117
The macOS stage1 Zig compiler should look in Zig's real absolute path
for the Zig stdlib, but os_self_exe_path looks in its path as returned
by _NSGetExecutablePath, which may be a symlink. This means that a
symlinked Zig cannot find the Zig stdlib.
This patch fixes the issue by resolving the _NSGetExecutablePath result
to the real path using realpath() before copying the result to the
output path.
2018-06-18 07:40:31 -04:00
Andrew Kelley
4210f1f6a0
remove bool to int syntax. add @boolToInt
...
add missing docs
See #1061
2018-06-18 03:07:16 -04:00
Andrew Kelley
d52ef95f77
disable failing macos test. see #1126
...
I'm unable to reproduce the failure on my mac laptop
more investigation required
2018-06-18 01:09:51 -04:00
Andrew Kelley
92a36040b1
msp430 target: c_long is always 32 bits
...
closes #1125
2018-06-18 01:03:45 -04:00
Andrew Kelley
906ed059ce
update std.DynLib to use @intCast
2018-06-18 00:52:55 -04:00
Andrew Kelley
431fda4141
Merge pull request #1123 from ziglang/remove-number-casting-syntax
...
Remove number casting syntax
2018-06-17 14:40:07 -04:00
Andrew Kelley
e5956f23ca
add target C int type information for msp430 target
...
closes #1125
2018-06-17 12:47:27 -04:00
Andrew Kelley
74ccf56a4b
update more tests
2018-06-17 12:33:24 -04:00
Andrew Kelley
3c12ba7180
update test cases
2018-06-17 04:32:57 -04:00
Andrew Kelley
7912061226
remove integer and float casting syntax
...
* add `@intCast`
* add `@floatCast`
* add `@floatToInt`
* add `@intToFloat`
See #1061
2018-06-17 02:57:07 -04:00
Andrew Kelley
06a26f0965
std.Complex: use better arg passing convention and fix a TODO
2018-06-16 21:32:53 -04:00
Andrew Kelley
751518787a
Merge pull request #1109 from ziglang/pass-by-non-copying-value
...
allow passing by non-copying value
2018-06-16 21:13:10 -04:00
Andrew Kelley
3ee4d23ebd
posix read can return error.IsDir
2018-06-16 19:54:16 -04:00
Andrew Kelley
eae9634ac9
langref: be clear that float types are always IEEE 754
2018-06-16 19:53:52 -04:00
Andrew Kelley
472b7ef7e6
disable byval
2018-06-16 19:37:00 -04:00
Andrew Kelley
e311cd562b
don't automatically take pointer when passing by non-copying value
...
this commit does not have all tests passing
2018-06-16 19:37:00 -04:00
Andrew Kelley
59b3dc8907
allow passing by non-copying value
...
closes #733
2018-06-16 19:36:33 -04:00
Andrew Kelley
a7d59086b4
disable load dynamic library test
...
it's failing on CI. I will troubleshoot it and then re-enable
2018-06-16 19:36:06 -04:00
Andrew Kelley
c529b814ee
load_dynamic_library test: no need to link libc
2018-06-16 18:54:41 -04:00
Sahnvour
f47655eb6d
pointer reform: missed change in windows specific code.
2018-06-16 23:47:51 +02:00
Andrew Kelley
65d04cbeb4
std.DynLib: open the fd with CLOEXEC
2018-06-16 17:27:45 -04:00
Andrew Kelley
48de57d824
add basic std lib code for loading dynamic libraries
...
this is going to only work for very basic libraries;
I plan to slowly add more features over time to support more
complicated libraries
2018-06-16 17:01:23 -04:00
Jay Weisskopf
b3a3e2094e
Make zig version compliant with SemVer ( #1113 )
...
The git revision is build metadata and should be appended with a plus sign.
https://semver.org/#spec-item-10
2018-06-15 14:06:56 -04:00
Andrew Kelley
84a700f972
llvm7: find external liblldWasm and update for newest lld macho API
2018-06-14 18:28:42 -04:00
Andrew Kelley
32dd98b19f
Merge remote-tracking branch 'origin/master' into llvm7
2018-06-14 18:27:59 -04:00
Andrew Kelley
f0697c28f8
langref: docs for error return traces
...
See #367
2018-06-14 18:12:31 -04:00
Andrew Kelley
cdf1e366f9
fix build on windows, broken by previous commit
2018-06-14 16:36:07 -04:00
Andrew Kelley
6943cefebf
std.os.path.dirname: return null instead of empty slice
...
for when there is no directory component. Makes it harder
to write bugs.
closes #1017
2018-06-14 16:15:32 -04:00
Andrew Kelley
2219cc0612
Merge pull request #1105 from ziglang/i128-compiler-rt
...
Add i128 compiler-rt div/mul support
2018-06-14 10:59:38 -04:00
Alexandros Naskos
4ec09ac243
Enabled optional types of zero bit types with no LLVM DI type. ( #1110 )
...
* Zero bit optional types do not need a LLVM DI type
2018-06-14 10:57:28 -04:00
Marc Tiehuis
a369d69c51
Add windows x86_64 i128 abi workaround
2018-06-14 21:18:36 +12:00
Andrew Kelley
fc87f6e417
fix race condition bug in test harness of std.atomic
2018-06-13 11:57:57 -04:00
Andrew Kelley
e1f56c9af6
std.zig.ast: add test for iterate
...
closes #1101
2018-06-13 11:48:06 -04:00
Andrew Kelley
41e6c664d8
langref: add merge error sets operator to operator table
2018-06-13 11:09:41 -04:00
Andrew Kelley
8dd24796c4
disallow implicit casts that break rules for optionals
...
closes #1102
2018-06-13 11:04:09 -04:00
Marc Tiehuis
9110140514
Add i128 compiler-rt div/mul support
2018-06-13 22:25:04 +12:00
Andrew Kelley
86adc1ef39
add docs and missing test case for merging error sets
...
See #367
2018-06-12 19:38:59 -04:00
Andrew Kelley
13d3255e2a
docgen: don't leave garbage .h files lying around
...
closes #1100
2018-06-12 15:21:14 -04:00
Andrew Kelley
fdd9cf0928
better debugging for CI failures of std.atomic
2018-06-12 15:14:32 -04:00
Andrew Kelley
259413251d
fix ability to call mutating methods on zero size structs
...
closes #838
2018-06-12 15:06:02 -04:00
Andrew Kelley
7580e39b38
zig fmt
2018-06-12 02:18:11 -04:00
Andrew Kelley
3dd9af9948
implement std.os.Dir for windows
...
improve std.os.File.access so that it does not depend on shlwapi.dll
closes #1084
2018-06-12 01:57:09 -04:00
Andrew Kelley
0a18d53c3d
langref: add orelse keyword to syntax highlighting
2018-06-11 17:38:24 -04:00
Andrew Kelley
5252566137
langref: add coroutines documentation
...
See #367
2018-06-11 17:34:45 -04:00
Andrew Kelley
03c16c6c54
implement @tagName as a switch instead of table lookup
...
closes #976
closes #1080
2018-06-11 14:58:42 -04:00
tgschultz
854f90aa30
Added C string support to fmt by using "{s}". The format string requirement is for saftey. ( #1092 )
2018-06-10 12:57:21 -04:00
Marc Tiehuis
dc8bda7e02
Add arbitrary-precision integer to std
...
A few notes on the implementation:
- Any unsigned power of two integer type less than 64 bits in size is supported
as a Limb type.
- The algorithms used are kept simple for the moment. More complicated
algorithms are generally only more useful as integer sizes increase a
lot and I don't expect our current usage to be used for this purpose
just yet.
- All branches (practically) have been covered by tests.
See 986a2b3243/bench
for rough performance comparison numbers.
Closes #364 .
2018-06-10 18:24:34 +12:00
Andrew Kelley
0a95b0f1ff
std.zig: update syntax for orelse keyword
2018-06-10 01:18:31 -04:00
Andrew Kelley
77678b2cbc
breaking syntax change: orelse keyword instead of ?? ( #1096 )
...
use the `zig-fmt-optional-default` branch to have zig fmt
automatically do the changes.
closes #1023
2018-06-10 01:13:51 -04:00
Andrew Kelley
ec1b6f6673
breaking syntax change: ??x to x.? ( #1095 )
...
See #1023
This also renames Nullable/Maybe to Optional
2018-06-09 23:42:14 -04:00
Ben Noordhuis
d464b25322
support --target-arch wasm32 ( #1094 )
...
Add wasm32 support to the build-obj, build-exe and build-lib commands
of the stage 1 compiler. Wasm64 should work transparently once it's
supported in upstream LLVM.
To export a function:
// lib.zig - for exposition, not necessary for this example
pub use @import("add.zig");
// add.zig
export fn add(a: i32, b: i32) i32 {
return a + b;
}
To import a function:
// cube.zig
extern fn square(x: i32) i32;
export fn cube(x: i32) i32 {
return x * square(x);
}
2018-06-09 22:39:22 -04:00
marleck55
7a9635555b
std/fmt: Use lowercase k for kilo in base 1000 ( #1090 )
2018-06-09 12:05:58 -04:00
Andrew Kelley
670a0a3eed
Merge branch 'clownpriest-arraylist_set'
2018-06-09 12:04:48 -04:00
Andrew Kelley
fc6446702e
clean up std.ArrayList
...
* add `std.debug.assertError`
* `std.ArrayList` update everything to follow `self` convention
* rename `std.ArrayList.set` to `std.ArrayList.setOrError`
* add `std.ArrayList.set` which asserts
Before 1.0.0 we might remove some of this API, because you can use
`toSlice()` for everything, but it's ok to add these functions as
an experiment before then.
2018-06-09 12:03:11 -04:00
Arthur Elliott
e0092ee4a5
add set function to arraylist
...
so you can set a value without growing the underlying buffer,
with range safety checks
2018-06-09 11:42:41 -04:00
Andrew Kelley
9046b5eac0
fix assertion failure when debug printing comptime values
2018-06-09 11:41:59 -04:00
Andrew Kelley
6edd81109d
nullable pointers follow const-casting rules
...
any *T -> ?*T cast is allowed implicitly, even
when it occurs deep inside the type, and the cast
is a no-op at runtime.
in order to add this I had to make the comptime value
representation of nullable pointers the same as the
comptime value representation of normal pointers,
so that we don't have to do any recursive transformation
of values when doing this kind of cast.
2018-06-09 00:26:26 -04:00
isaachier
1a9d2f3aae
Fix error handling in Buffer::fromOwnedSlice ( #1082 )
2018-06-08 19:24:48 -04:00
Andrew Kelley
39fa313ad8
disable some implicit casts for unknown length pointers
...
closes #770
2018-06-08 14:57:16 -04:00
Jimmi HC
bf3d1c1aab
Allow access of array.len through a pointer
2018-06-08 09:21:31 +02:00
Marc Tiehuis
ffb089a9f5
Fix json parser comma after empty object case
2018-06-08 17:43:13 +12:00
Andrew Kelley
f0b6dac1f2
add implicit casts from *[N]T
...
* to `[]T`
* to `[*]T`
See #770
2018-06-07 22:41:58 -04:00
Andrew Kelley
b65203f573
remove @canImplicitCast builtin
...
nobody will miss it
2018-06-07 19:50:25 -04:00
Andrew Kelley
688ff2830d
langref: automatic update of builtin.zig
...
now the docs can't get out of date for this
See #367
2018-06-07 19:10:45 -04:00
Andrew Kelley
31aefa6a21
fix structs that contain types which require comptime
...
Now, if a struct has any fields which require comptime,
such as `type`, then the struct is marked as requiring
comptime as well. Same goes for unions.
This means that a function will implicitly be called
at comptime if the return type is a struct which contains
a field of type `type`.
closes #586
2018-06-07 18:07:30 -04:00
Andrew Kelley
b11c5d8f82
fix std.os.windows.PathFileExists specified in the wrong DLL ( #1066 )
...
closes #1054
2018-06-06 15:36:47 -04:00
isaachier
4fc601895b
Fix const-ness of buffer in replaceContents method ( #1065 )
2018-06-06 14:09:47 -04:00
Marc Tiehuis
e7f141b376
Add json.TokenStream ( #1062 )
...
This hides some of the low-level parsing details from the
StreamingParser. These don't need to be known when parsing a complete
slice at once (which is we can usually do).
Also, remove `Json` from Parser names. The namespace `json` is sufficient.
2018-06-06 11:24:36 -04:00
Braedon
f389e53735
Add newline to zig fmt error ( #1064 )
2018-06-06 10:45:19 -04:00
Marc Tiehuis
212449bc23
Fix Log2Int type construction
...
The following case for example, would previously fail:
const a = u24(1) << Log2Int(u24)(22);
2018-06-06 22:41:55 +12:00
Andrew Kelley
d3693dca73
Pointer Reform: update @typeInfo
...
* add assertion for trying to do @typeInfo on global error set
* remove TypeInfo.Slice
* add TypeInfo.Pointer.Size with possible values
- One
- Many
- Slice
See #770
2018-06-06 00:39:39 -04:00
Andrew Kelley
76c8efd56c
add test for not allowing implicit cast from T to [*]const T
...
See #770
2018-06-05 23:54:14 -04:00
Andrew Kelley
bd13e757e7
disable deref syntax for unknown length pointers
...
See #770
2018-06-05 23:26:43 -04:00
Andrew Kelley
0ccc186869
disable field access for unknown length pointers
...
See #770
2018-06-05 23:26:43 -04:00
Andrew Kelley
bbb565a21e
README: update support table
...
macosx does not run on some of these architectures
2018-06-05 21:56:19 -04:00
Andrew Kelley
652f4bdf62
disallow unknown-length pointer to opaque
...
This also means that translate-c has to detect when a pointer to
opaque is happening, and use `*` instead of `[*]`.
See #1059
2018-06-05 18:03:21 -04:00
Andrew Kelley
ef7f69d14a
update to latest libclang
2018-06-05 15:02:48 -04:00
Andrew Kelley
ba5eeea1e5
Merge remote-tracking branch 'origin/master' into llvm7
2018-06-05 11:28:30 -04:00
Andrew Kelley
7a09482536
fix crash when evaluating return type has compile error
...
closes #1058
2018-06-05 10:48:53 -04:00
Andrew Kelley
7dd18294b7
Merge remote-tracking branch 'origin/master' into llvm7
2018-06-05 10:29:54 -04:00
Andrew Kelley
677eaf29b1
Merge pull request #1057 from ziglang/comptime-int
...
Rename integer literal type and float literal type
2018-06-05 10:16:51 -04:00
Jimmi HC
a8146ade2a
Renamed UndefinedLiteral to Undefined
2018-06-05 11:54:11 +02:00
Jimmi HC
236c680f6b
Removed NullLiteral to Null
2018-06-05 11:30:01 +02:00
Jimmi HC
02cb220faf
Renamed "(int/float literal)" to "comptime_int/float"
2018-06-05 11:14:43 +02:00
Andrew Kelley
e53b683bd3
Pointer Reform: proper slicing and indexing ( #1053 )
...
* enable slicing for single-item ptr to arrays
* disable slicing for other single-item pointers
* enable indexing for single-item ptr to arrays
* disable indexing for other single-item pointers
see #770
closes #386
2018-06-04 22:11:14 -04:00
Andrew Kelley
32e0dfd4f0
never call malloc with size 0
...
instead we return nullptr. this makes the behavior consistent
across all platforms.
closes #1044
closes #1045
2018-06-04 14:09:31 -04:00
Andrew Kelley
d21a1922eb
support zig fmt: off and zig fmt: on between top level decls
...
closes #1030
closes #1033
2018-06-04 12:15:02 -04:00
Andrew Kelley
8dfa66fee3
Merge branch 'tgschultz-zig-custom-format'
2018-06-04 11:07:47 -04:00
Andrew Kelley
11e7e03139
Merge branch 'zig-custom-format' of https://github.com/tgschultz/zig into tgschultz-zig-custom-format
...
I removed the code that checks for type signature and type.
A function named `format` is enough for zig to give it a try.
2018-06-04 11:06:55 -04:00
Andrew Kelley
58ce79f935
Merge remote-tracking branch 'origin/master' into llvm7
2018-06-04 02:58:55 -04:00
Andrew Kelley
96164ce613
disallow single-item pointer indexing
...
add pointer arithmetic for unknown length pointer
2018-06-04 01:39:57 -04:00
Marc Tiehuis
4c273126df
Add context to zig_unreachable calls ( #1039 )
...
This greatly aids debugging on platforms with no stack-traces.
2018-06-03 02:30:43 -04:00
Andrew Kelley
b85b68a7fd
better compile error for error sets behind nullable
2018-06-02 15:20:51 -04:00
Marc Tiehuis
e514454c0e
Make zig fmt exit with error on any parse errors
...
This is required for proper detection in editor plugins. Other files may
have been formatted correctly, this only indicates that some failed.
2018-06-02 20:49:35 +12:00
Andrew Kelley
f06bce5dda
introduce [*] for unknown length pointers
...
See #770
Currently it does not have any different behavior than `*`
but it is now recommended to use `[*]` for unknown length
pointers to be future-proof.
Instead of [ * ] being separate tokens as the proposal
suggested, this commit implements `[*]` as a single token.
2018-06-02 04:04:23 -04:00
Andrew Kelley
7b386ea242
fix build file template
...
See #1035
2018-06-01 21:51:54 -04:00
Andrew Kelley
a3d7a807b7
appveyor: remove llvm 5.0.1 from cache
2018-06-01 12:22:53 -04:00
Andrew Kelley
081072d3b6
docs: add missing builtin to langref syntax coloring
2018-06-01 12:22:53 -04:00
Arthur Elliott
08693411d2
fix typo ( #1034 )
2018-06-01 12:23:07 -04:00
Andrew Kelley
3918e7699d
Merge pull request #1032 from ziglang/pointer-reform
...
use * for pointer type instead of &
2018-06-01 11:49:25 -04:00
Andrew Kelley
e29d12d821
fix incorrect address-of syntax on windows
2018-06-01 01:29:34 -04:00
Andrew Kelley
5f38a01ede
run zig fmt
2018-06-01 01:22:35 -04:00
Andrew Kelley
4d13ab07de
std.zig: update to new pointer syntax
2018-06-01 01:19:26 -04:00
Andrew Kelley
2a7c8c5b10
add test case for pointer to type and slice of type
...
closes #588
2018-06-01 00:18:10 -04:00
Andrew Kelley
019217d7a2
fix regressions
2018-06-01 00:17:31 -04:00
Andrew Kelley
2f614c42fe
ir: rip out special logic for using addr-of instruction for types
...
See #588
2018-05-31 18:23:39 -04:00
Andrew Kelley
fcbb7426fa
use * for pointer type instead of &
...
See #770
To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.
This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
2018-05-31 17:28:07 -04:00
Andrew Kelley
717ac85a5a
zig fmt: add --color option to CLI help text
2018-05-30 18:37:12 -04:00
Andrew Kelley
a05acaf9fd
Add --color CLI option to zig fmt
...
It doesn't actually do terminal color yet because we need to add
cross platform terminal color abstractions. But it toggles between
the single line error reporting and the multiline error reporting.
See #1026
2018-05-30 18:26:09 -04:00
Andrew Kelley
d8699ae57e
zig fmt: don't compute a sha-256 for no reason
...
I forgot to delete this code before pushing 2c96f19fd3
2018-05-30 16:45:32 -04:00
Andrew Kelley
ea58f4a5a9
run zig fmt on the codebase
2018-05-30 16:09:11 -04:00
Andrew Kelley
b082cd4580
zig fmt: field access does not cause spaces for slicing
...
See #1003
2018-05-30 16:08:40 -04:00
Andrew Kelley
84b1842026
zig fmt: space after fn in fn prototypes
...
See #1003
2018-05-30 15:50:01 -04:00
Andrew Kelley
93b51b0e40
spaces around slice operator if operands are infix
...
See #1003
2018-05-30 15:33:58 -04:00
Andrew Kelley
2c96f19fd3
std.zig.render returns bool of whether anything changed
...
zig fmt only renames files and prints to stdout for files which changed
2018-05-30 14:58:27 -04:00
tgschultz
940a854448
Fix MacOS CI Timer test failing...?
2018-05-30 13:38:41 -05:00
tgschultz
fb001f5e90
Fixed character handling
2018-05-30 12:18:24 -05:00
tgschultz
8938c16f38
Formatting
2018-05-30 10:41:48 -05:00
tgschultz
4e1d0a59fa
Minor typo
2018-05-30 10:24:27 -05:00
tgschultz
8fc52a94f4
Added custom formatter support, refactored fmt.format
2018-05-30 10:18:11 -05:00
tgschultz
8174f972a7
Merge pull request #2 from ziglang/master
...
sync with ziglang
2018-05-30 08:26:13 -05:00
Jimmi HC
15302e84a4
Adding workaround for when the user tries to unwrap 'type'
...
closes #1011
2018-05-30 11:51:46 +02:00
Jimmi HC
1b3aaacba2
Removed copy-pasted resolve_inferred_error_set
...
both ir.cpp and analyze.cpp have a function resolve_inferred_error_set,
which is a nearly exact copy-paste. This commit removes the one in ir.cpp
and exposes then one in analyze.cpp. This also allows us to make
analyze_fn_body local to analyze.cpp, as it is not used anywhere in
ir.cpp after this change
2018-05-30 10:34:20 +02:00
Jimmi HC
2b3af4ef6b
fixed #1009
...
ir_make_type_info_defs already calls resolve_top_level_decl on all Tld
when building the def array. This means, that there is no reason that
analyze_fn_body is nessesary, as the fn type should have already been
resolved completly. The only thing analyze_fn_body does here, is cause
problems with generic functions.
2018-05-30 10:30:09 +02:00
Andrew Kelley
b0eebfa560
fix syntax of std/json_test.zig
...
See #663
2018-05-29 18:10:36 -04:00
Andrew Kelley
d172e3f3bb
fix AtomicFile for relative paths
...
closes #1017
2018-05-29 17:38:50 -04:00
Andrew Kelley
0c16cd2d0e
run zig fmt on the codebase
...
See #1003
2018-05-29 04:23:38 -04:00
Andrew Kelley
cdf30c31ea
zig fmt: fix implementation of firstToken() for fn call
2018-05-29 03:47:27 -04:00
Andrew Kelley
cd325e408e
zig fmt: fix extra space after comma before multi line string
2018-05-29 03:33:03 -04:00
Andrew Kelley
cb042c8343
Merge remote-tracking branch 'origin/master' into llvm7
2018-05-29 03:22:52 -04:00
Andrew Kelley
eda6898c5b
zig fmt: handle if and while indentation better
2018-05-29 03:15:12 -04:00
Andrew Kelley
530d175422
zig fmt: fix spacing when moving doc comment on var decls
2018-05-28 23:41:09 -04:00
Andrew Kelley
0d1b47362c
zig fmt: if-else with comment before else
2018-05-28 22:41:05 -04:00
Andrew Kelley
77ec81b035
zig fmt: respect line breaks in if-else
2018-05-28 22:22:01 -04:00
Andrew Kelley
71badebd08
zig fmt: respect line breaks after infix operators
2018-05-28 21:28:32 -04:00
Andrew Kelley
354ab1c5c8
zig fmt: render fn decl with trailing comma 1 line per param
2018-05-28 21:18:41 -04:00
Andrew Kelley
530da36352
zig fmt: fix enum decl with no trailing comma
...
See #1003
2018-05-28 17:43:17 -04:00
Andrew Kelley
6c1fda3f99
zig fmt: fix switch body indent
2018-05-28 17:09:55 -04:00
Andrew Kelley
fd13a75785
zig fmt: allow same line struct literal with no trailing comma
...
See #1003
2018-05-28 17:00:04 -04:00
Andrew Kelley
122a74724c
zig fmt: use simple newlines rather than empty comments to hint
...
now the first row of an array literal is the hint to zig fmt
for how long each row should be.
See #1003
2018-05-28 16:23:33 -04:00
Andrew Kelley
3fed10883b
zig fmt: array literals with no trailing comma all on one line
2018-05-26 23:25:04 -04:00
Andrew Kelley
afdfbc0367
zig fmt: delete empty comments that do nothing
2018-05-26 23:25:04 -04:00
Andrew Kelley
b184ae5ca5
run zig fmt on some of the codebase
...
See #1003
2018-05-26 23:00:29 -04:00
Andrew Kelley
118d41ef83
zig fmt: support array literal row size hint
...
See #1003
2018-05-26 22:59:46 -04:00
Andrew Kelley
349365d9a4
zig fmt: better multiline string formatting
2018-05-26 19:32:28 -04:00
Andrew Kelley
cabf7fa93b
zig fmt: fn calls with trailing comma with params on new lines
2018-05-26 18:44:10 -04:00
Andrew Kelley
b8d4e05361
zig fmt: handle empty block with comment inside
2018-05-26 18:29:14 -04:00
Andrew Kelley
7e900d28be
zig fmt: no space on switch range operator
2018-05-26 18:10:06 -04:00
Andrew Kelley
0bef1f9824
zig fmt: fix rendering of struct with no trailing comma on last field
2018-05-26 16:43:33 -04:00
Andrew Kelley
0ab888c639
zig fmt: parse extra comma in asm expressions
2018-05-26 16:37:55 -04:00
Andrew Kelley
85ca611af1
zig fmt: put nested struct inits on newlines
...
See #1003
2018-05-26 15:37:47 -04:00
Andrew Kelley
7fa97b752e
add strict float mode to some math functions
...
fixes a test failure for acosh32
2018-05-26 14:57:53 -04:00
Andrew Kelley
8efb3f5e19
update to latest LLVM API
2018-05-26 12:18:13 -04:00
Andrew Kelley
1f96a86676
Merge remote-tracking branch 'origin/master' into llvm7
2018-05-26 12:06:08 -04:00
Andrew Kelley
c029f4bfc4
trailing comma after var args is not supported
2018-05-25 20:41:14 -04:00
Andrew Kelley
4405897cbd
zig fmt: support trailing comma on switch case items
2018-05-25 20:34:53 -04:00
Andrew Kelley
a630d3e851
zig fmt: fix rendering of align keyword of slice type
2018-05-25 02:19:53 -04:00
Andrew Kelley
56cb7f1740
update json_test to be compliant with zig source encoding
...
See #663
2018-05-25 02:08:43 -04:00
Andrew Kelley
3f302f8411
handle more cases of inserting trailing commas
2018-05-25 01:52:59 -04:00
Andrew Kelley
000c01a36a
zig fmt: handle missing trailing comma in array literals
2018-05-25 01:45:14 -04:00
Andrew Kelley
08f95d0c2f
enum fields with a type are not supported
...
the c++ codebase lets it slide
the self hosted parser correctly reports a parse error
2018-05-25 01:10:54 -04:00
Andrew Kelley
dfc3e11748
zig fmt: fix handling of comments at top of file
2018-05-25 01:03:15 -04:00
Andrew Kelley
ca49b6f6b4
struct fields with no explicit type are not supported
...
the c++ codebase lets it slide
the self hosted parser correctly reports a parse error
2018-05-25 00:39:18 -04:00
Andrew Kelley
e6afea99a9
zig fmt: support aligned ptr with bit fields
2018-05-25 00:38:07 -04:00
Andrew Kelley
b74dda34b6
std.zig.tokenizer: support hex escape in char literals
2018-05-24 21:51:58 -04:00
Andrew Kelley
43085417be
update github.com/zig-lang to github.com/ziglang
2018-05-24 21:27:44 -04:00
Andrew Kelley
af7073b779
Merge branch 'BraedonWooding-patch-3'
2018-05-24 20:59:39 -04:00
Andrew Kelley
fa5b0ef54f
doc fixups
2018-05-24 20:59:19 -04:00
braedonww@gmail.com
938d791b23
Added argtype and error inferring info
2018-05-24 20:20:07 -04:00
Andrew Kelley
54e887ed9e
std.zig.tokenizer: fix tokenization of hex floats
2018-05-24 01:16:07 -04:00
Andrew Kelley
b132a17a74
std.zig.parse ignores comments
...
std.zig.render handles comments by looking at nearby tokens
2018-05-24 00:35:53 -04:00
Marc Tiehuis
4f4afe186d
Make JsonParser public
2018-05-22 15:34:17 +12:00
Marc Tiehuis
698c52e796
Make StreamingJsonParser public
2018-05-22 15:32:17 +12:00
Andrew Kelley
bfbe26734d
zig fmt: add pointer deref syntax
2018-05-20 14:50:27 -04:00
Andrew Kelley
83a7809478
Merge pull request #1019 from zig-lang/pointer-reform
...
Pointer Reform - change prefix deref syntax to postfix deref syntax
2018-05-18 13:30:25 -04:00
Andrew Kelley
c38b165db4
all tests passing with postfix deref syntax
2018-05-17 23:21:44 -04:00
Andrew Kelley
99fc2bd4dd
Merge remote-tracking branch 'origin/master' into pointer-reform
2018-05-17 00:56:35 -04:00
Andrew Kelley
b73307befb
more std lib to postfix deref with zig fmt
2018-05-17 00:56:14 -04:00
Andrew Kelley
942d384831
fix std.SegmentedList.Iterator.set
2018-05-17 00:52:36 -04:00
Andrew Kelley
b48d354600
zig fmt: fix comment after if before another if
2018-05-17 00:44:55 -04:00
Andrew Kelley
37c6afa5b4
zig fmt: line comment between if block and else keyword
2018-05-17 00:31:47 -04:00
Andrew Kelley
9ea0e4ca68
zig fmt: same line comments after tokens in expression
2018-05-17 00:16:32 -04:00
Andrew Kelley
967bad43a0
OpenBSD has the same C integer sizes as Linux
...
Thanks Jan S <jan.schreib@gmail.com > for this information
closes #1016
2018-05-16 20:18:38 -04:00
Andrew Kelley
4a3d689550
std.fmt: use SI prefixes for printing bytes
...
closes #1015
2018-05-16 18:22:39 -04:00
Andrew Kelley
288fc3a8d3
convert more std lib files to postfix pointer deref
2018-05-16 00:43:28 -04:00
Andrew Kelley
ee5f9ffad0
zig fmt: add comma on last switch prong
2018-05-16 00:27:18 -04:00
Andrew Kelley
5cfabdd493
Merge remote-tracking branch 'origin/master' into pointer-reform
2018-05-16 00:02:26 -04:00
Andrew Kelley
492a214d4c
std.fmt.format: support {B} for human readable bytes
2018-05-15 22:11:03 -04:00
Andrew Kelley
3625df25d6
build: add flag to LLD to fix gcc 8 build ( #1013 )
...
* build: add flag to LLD to fix gcc 8 build
* build: add -Wno-unknown-warning-option to work around older gcc
2018-05-15 16:21:47 -04:00
Andrew Kelley
74b10c08d1
fix @typeInfo not setting a field to comptime
2018-05-15 14:11:41 -04:00
Andrew Kelley
04bca58a3a
zig fmt: preserve same line doc comments on var decls
2018-05-15 00:33:34 -04:00
Andrew Kelley
abcd418451
std.zig.parse cleanup
2018-05-13 14:20:01 -04:00
Andrew Kelley
86a352c45b
Merge branch 'master' into pointer-reform
2018-05-13 13:38:03 -04:00
Andrew Kelley
05ecb49bac
README: https links
2018-05-13 01:07:55 -04:00
Andrew Kelley
4c3aa09f2a
self hosted compiler: remove unused flag
2018-05-13 01:06:52 -04:00
Andrew Kelley
548ddd1f0c
fix AST dumping code in self hosted compiler
2018-05-12 23:57:15 -04:00
Andrew Kelley
7cdc9d98c7
refactor std.zig.render to be recursive
...
See #1006
2018-05-12 23:06:54 -04:00
Andrew Kelley
911cbf57cd
recursive render top level decl
2018-05-12 19:03:39 -04:00
Andrew Kelley
a6ae45145f
add @newStackCall builtin function
...
See #1006
2018-05-12 17:35:15 -04:00
Andrew Kelley
4277762b74
fix windows build system
...
broken by 6e821078f6
2018-05-11 23:04:41 -04:00
Andrew Kelley
277b9cf878
fix comptime code modification of global const
...
closes #1008
2018-05-11 22:41:44 -04:00
tgschultz
8c1872543c
Merge pull request #1 from zig-lang/master
...
Sync with zig-lang/zig master
2018-05-11 21:36:02 -05:00
Andrew Kelley
6e821078f6
update std.Buffer API
...
* remove Buffer.appendFormat
* remove Buffer.appendByte
* remove Buffer.appendByteNTimes
Added test to demo what to use instead of the above functions
2018-05-11 14:08:16 -04:00
Andrew Kelley
284ab109c4
Merge remote-tracking branch 'origin/master' into llvm7
2018-05-10 11:37:25 -04:00
Marc Tiehuis
efa39c5343
Fix bigint shift-right partial shift
2018-05-10 22:26:26 +12:00
Andrew Kelley
c3ddf5069e
zig fmt: fix not writing results
2018-05-10 00:40:07 -04:00
Andrew Kelley
4787127cf6
partial conversion to post-fix pointer deref using zig fmt
2018-05-10 00:29:49 -04:00
Andrew Kelley
6928badd85
Merge branch 'master' into pointer-reform
2018-05-09 23:43:07 -04:00
Andrew Kelley
4438c5e09b
Merge branch 'rework-parser'
2018-05-09 22:17:47 -04:00
Andrew Kelley
bbae6267fe
fix self hosted compiler
2018-05-09 21:45:29 -04:00
Andrew Kelley
774b6ffe1e
fix parser performance regression
2018-05-09 21:17:05 -04:00
Andrew Kelley
403e5239e3
all tests passing again
2018-05-09 21:15:34 -04:00
Andrew Kelley
bf21747a42
translate-c: fix typedef duplicate definition of variable
...
closes #998
2018-05-09 20:23:36 -04:00
Andrew Kelley
116914ab3e
Merge pull request #1000 from zig-lang/slice-type-info
...
Added Slice as its own type info in userland
2018-05-09 09:27:14 -04:00
Jimmi HC
2a74aa2067
Freeing ptr_field_name after use
2018-05-09 09:40:57 +02:00
Jimmi HC
9b29c872ce
Added Slice as it's own type info in userland
2018-05-09 09:34:04 +02:00
Andrew Kelley
670c9f9b74
add benchmark for measuring parser performance
2018-05-08 16:23:08 -04:00
Andrew Kelley
ca27ce3bee
std.zig.parser supports same-line comments on any token
2018-05-07 23:54:35 -04:00
Andrew Kelley
0cb65b266a
separate std.zig.parse and std.zig.render
2018-05-07 22:07:50 -04:00
Andrew Kelley
69ef6ae0f9
rework std.zig.parser
2018-05-07 21:57:44 -04:00
Andrew Kelley
dc23350847
add std.SegmentedList.Iterator.prev
2018-05-07 16:50:33 -04:00
Andrew Kelley
3b7aa80892
add std.SegmentedList.Iterator
2018-05-07 16:50:33 -04:00
Andrew Kelley
77a1a216d2
tagged union field access prioritizes members over enum tags
...
closes #959
2018-05-07 16:43:20 -04:00
Andrew Kelley
2f633452bb
std.SegmentedList: cleaner separation of capacity functions
2018-05-07 10:34:38 -04:00
Andrew Kelley
78ba3b8485
Merge pull request #992 from zig-lang/segmented-list
...
Segmented list implementation
2018-05-07 09:54:30 -04:00
Andrew Kelley
81007d0a4b
SegmentedList: fixups from review comments
2018-05-07 09:53:52 -04:00
Andrew Kelley
7fdbaeca72
zig fmt: same-line comment after non-block if expression
2018-05-07 01:05:06 -04:00
Andrew Kelley
41e1cd185b
std.SegmentedList implementation
2018-05-07 01:04:43 -04:00
Marc Tiehuis
d7b029995c
Fix bigint multi-limb shift and masks
2018-05-05 22:40:29 +12:00
Andrew Kelley
4d6d2f1cd2
zig fmt: same-line comment after non-block if expression
2018-05-04 18:35:43 -04:00
Jimmi Holst Christensen
87c0060e81
Made container methods that can be const, const
2018-05-04 23:48:14 +02:00
Andrew Kelley
0fc8885a8d
zig fmt: switch with empty body
2018-05-04 16:49:51 -04:00
Andrew Kelley
eef21df94f
zig fmt: same-line comment on comptime expression
2018-05-04 16:46:35 -04:00
Andrew Kelley
8721eb68fc
zig fmt: fix tokenization of float literal with exponent
2018-05-04 14:34:32 -04:00
Andrew Kelley
7e37d268c8
Merge remote-tracking branch 'origin/master' into llvm7
2018-05-04 13:39:27 -04:00
Marc Tiehuis
ef3111be23
Use allocator backed array for json value decoder
2018-05-04 17:56:20 +12:00
Marc Tiehuis
f17472635e
Fix review comments for json decoder
2018-05-04 17:56:20 +12:00
Marc Tiehuis
0afc6a9886
Add json decoder
...
- streaming json decoder
- dynamic tree/value decoder
2018-05-04 17:56:20 +12:00
Andrew Kelley
33fa87a9d8
Merge pull request #981 from BraedonWooding/ArrayIteratorUnifiedSyntax
...
ArrayList iterator, unifying API of HashMap and its derivatives
2018-05-03 23:15:17 -04:00
Andrew Kelley
b9e320dd52
Merge pull request #951 from alexnask/reflect_reify
...
Metaprogramming - @typeInfo [DONE]
2018-05-03 23:02:33 -04:00
Jimmi Holst Christensen
aa2586de18
Fixed extern enums having the wrong size ( #970 )
...
Fixed extern enums having the wrong size
See #977
2018-05-03 22:27:04 -04:00
Andrew Kelley
7337029ce1
Merge pull request #979 from zig-lang/test-release-small
...
add ReleaseSmall mode in zig tests
2018-05-03 11:47:22 -04:00
Braedon
e907c5cab9
Unified API
2018-05-03 23:54:33 +10:00
Andrew Kelley
adbb691f46
fix behavior tests for ReleaseSmall
2018-05-02 22:48:04 -04:00
Andrew Kelley
6fd14f23b5
add ReleaseSmall mode in zig tests
...
closes #969
2018-05-02 22:41:02 -04:00
Alexandros Naskos
131c133bb7
Fixed inlining determination test ( #972 )
...
When deciding wether we should inline a scope, look up the parents until we get to a function definition scope
2018-05-02 21:43:07 -04:00
Andrew Kelley
02c1b9df3b
fix compiler-rt tests accidentally running std tests
...
also reduce the aggressiveness of std.atomic.stack
and std.atomic.queue fuzz testing. appveyor has 1 core
and 10,000 iterations is too much for 6 threads to
thrash over
2018-05-02 21:34:34 -04:00
Andrew Kelley
c186cd187e
std.atomic - use AtomicOrder.SeqCst for everything
...
also use less memory for the tests
2018-05-02 20:19:26 -04:00
Andrew Kelley
6f002e724b
Merge pull request #975 from zig-lang/none-pure-enums
...
Added better support for none pure enums in translate-c
2018-05-02 16:56:47 -04:00
Jimmi Holst Christensen
1a9403f38a
Added better support for none pure enums in tranlate C
2018-05-02 21:50:41 +02:00
Andrew Kelley
86a428a4a5
windows threading: add missing call to CloseHandle
2018-05-02 10:03:58 -04:00
Andrew Kelley
6309121f70
translate-c: update to llvm7
2018-05-02 09:46:29 -04:00
Andrew Kelley
1090b289ec
Merge remote-tracking branch 'origin/master' into llvm7
2018-05-01 14:29:50 -04:00
Alexandros Naskos
849ea61fa1
Small fix.
2018-05-01 17:10:50 +03:00
Alexandros Naskos
57940837e7
Added typeInfo to langref built_ins
2018-05-01 13:44:19 +03:00
Alexandros Naskos
7d239414f7
Fixed type info test, added documentation.
2018-05-01 13:42:20 +03:00
Alexandros Naskos
1b6e97355d
Added type info tests to behavior test listing
2018-05-01 13:31:14 +03:00
Alexandros Naskos
255c0ef406
Resolved merge conflict.
2018-05-01 13:09:34 +03:00
Alexandros Naskos
e1535ee0a9
Added typeInfo tests
2018-05-01 13:01:54 +03:00
Alexandros Naskos
ff1c4e1f13
Added tests.
2018-05-01 13:00:39 +03:00
Andrew Kelley
ac4d55dec1
behavior tests passing with new pointer deref syntax
2018-05-01 01:53:04 -04:00
Andrew Kelley
3a8dc4e90d
zig fmt: line comments in struct initializer
2018-05-01 01:30:53 -04:00
Andrew Kelley
a35b366eb6
[breaking] delete ptr deref prefix op
...
start using zig-fmt-pointer-reform branch build of zig fmt
to fix code to use the new syntax
all of test/cases/* are processed, but there are more left
to be done - all the std lib used by the behavior tests
2018-04-30 20:35:54 -04:00
Andrew Kelley
7c822869fe
zig fmt: only some docs have doc comments
2018-04-30 20:25:54 -04:00
Andrew Kelley
61a726c290
zig fmt: comments in field decls
2018-04-30 19:27:14 -04:00
Andrew Kelley
4cc1008c2d
zig fmt: error set decls
2018-04-30 19:16:46 -04:00
Andrew Kelley
3e61c45f89
zig fmt: consistent spacing for container inits
2018-04-30 18:49:05 -04:00
Andrew Kelley
eed49a2104
zig fmt: aggregate type init with only 1 field
2018-04-30 18:30:47 -04:00
Andrew Kelley
1d06915f27
zig fmt: support union(enum(tag)) and enum init values
2018-04-30 18:20:27 -04:00
Andrew Kelley
7dc8d433ab
zig fmt: support labeled suspend
2018-04-30 17:30:57 -04:00
Andrew Kelley
37d3ef2835
zig fmt: support promise->T
2018-04-30 16:16:58 -04:00
Andrew Kelley
47680cc0d8
zig fmt: better multiline string handling
2018-04-30 15:10:55 -04:00
Andrew Kelley
76ab1d2b6c
support foo.* for ptr deref
...
See #770
2018-04-30 14:20:56 -04:00
Andrew Kelley
e14db23661
run zig fmt on std/os/index.zig
2018-04-30 01:03:38 -04:00
Andrew Kelley
54987c3d8f
std.zig.tokenizer: 3 slashes is doc comment, 4 is line comment
2018-04-30 00:56:59 -04:00
Andrew Kelley
0bf7ebcfea
std.zig.tokenizer: fix handling of line comment / doc comment
2018-04-30 00:52:09 -04:00
Andrew Kelley
fd2cd38bdb
zig fmt: support line comments and doc comments
...
line comments can go anywhere a list of something is allowed
2018-04-30 00:19:55 -04:00
Andrew Kelley
39befc35a8
update comment in std/os/index.zig
2018-04-29 22:31:42 -04:00
Andrew Kelley
4e23fb7f06
zig fmt: comments before error set decl
2018-04-29 22:12:17 -04:00
Andrew Kelley
f04015c080
zig fmt: comments before switch prong
2018-04-29 21:47:54 -04:00
Andrew Kelley
a912c7d75f
zig fmt: same-line comment after switch prong
2018-04-29 21:27:44 -04:00
Andrew Kelley
c53209a8a8
zig fmt: comments before var decl in struct
2018-04-29 19:55:57 -04:00
Andrew Kelley
3235eb03f9
zig fmt: preserve same line comment after struct field
2018-04-29 19:23:19 -04:00
Andrew Kelley
3fa0bed985
zig fmt: array literal with 1 item on 1 line
2018-04-29 18:22:39 -04:00
Josh Wolfe
9543c0a7cc
use explicit error sets for utf8Decode functions
...
and run unicode tests at comptime also
2018-04-29 18:07:18 -04:00
Andrew Kelley
c03b9010db
zig fmt: preserve same-line comment after statement
2018-04-29 17:37:15 -04:00
Josh Wolfe
2387292f20
move some checks around in utf8Encode logic to be more zig idiomatic
2018-04-29 17:28:11 -04:00
Josh Wolfe
8c567d84f1
Merge pull request #954 from BraedonWooding/patch-2
...
Utf8 Encoding from Codepoint to Bytes
2018-04-29 16:57:29 -04:00
Andrew Kelley
ad4ee47d9f
zig fmt: preserve comments before global variables
2018-04-29 16:24:12 -04:00
Andrew Kelley
a0e9f1e0c3
fix bootstrap_lib for windows, take 2
2018-04-29 15:51:23 -04:00
Andrew Kelley
5e5eceb0de
fix bootstrap_lib for windows
2018-04-29 15:50:56 -04:00
Andrew Kelley
b7095912c7
zig fmt: respect comments before statements
2018-04-29 15:48:53 -04:00
Andrew Kelley
f37e79e720
Merge pull request #963 from zig-lang/atomic-stack-and-queue
...
Atomic stack and queue
2018-04-29 12:29:40 -04:00
Alexandros Naskos
013f548202
Finished FnDef TypeInfo generation (warning: may be buggy).
2018-04-29 15:40:26 +03:00
Alexandros Naskos
66aa760f83
More FnDef TypeInfo generation.
2018-04-29 14:03:55 +03:00
Andrew Kelley
c76b0a845f
fix std threads for linux
2018-04-29 02:56:59 -04:00
Andrew Kelley
b21bcbd775
fix std threads for macos
2018-04-29 02:52:04 -04:00
Andrew Kelley
6376d96824
support kernel threads for windows
...
* remove std.os.spawnThreadAllocator - windows does not support
an explicit stack, so using an allocator for a thread stack
space does not work.
* std.os.spawnThread - instead of accepting a stack argument, the
implementation will directly allocate using OS-specific APIs.
2018-04-29 02:40:22 -04:00
Andrew Kelley
bf8e419d2b
linux uses pthreads when linking against libc
2018-04-29 00:40:04 -04:00
Andrew Kelley
abf90eaa67
enable atomic queue and stack tests for macos
2018-04-29 00:09:32 -04:00
Andrew Kelley
a425420993
make pthreads threads work on darwin
...
darwin pthreads adds a restriction that the stack start and end
must be page aligned
2018-04-29 00:07:32 -04:00
Andrew Kelley
998e25a01e
pthread support working
2018-04-28 23:47:39 -04:00
Andrew Kelley
a344cb03bc
*WIP* use pthreads when linking libc
2018-04-28 23:30:13 -04:00
Andrew Kelley
0bb054e5e7
Merge pull request #930 from zig-lang/float-printing
...
Finish and fix float printing
2018-04-28 22:43:52 -04:00
Andrew Kelley
ec2a81a081
fix compiler-rt ABI for x86_64 windows
2018-04-28 22:03:07 -04:00
Andrew Kelley
a10351b439
disable atomic stack and queue tests for non-linux
2018-04-28 18:19:00 -04:00
Andrew Kelley
5d6e44b3f2
add tests for std.atomic Queue and Stack
2018-04-28 18:00:51 -04:00
Andrew Kelley
96ecb40259
add fuzz tests for std.atomic.Stack
2018-04-28 17:53:06 -04:00
Andrew Kelley
4ac36d094c
add std.atomic.Stack and std.atomic.Queue
2018-04-28 16:11:32 -04:00
Jimmi Holst Christensen
73bf897b5c
Using allocate instead of allocate_nonzero so we don't have to memset
2018-04-28 19:21:23 +02:00
Jimmi Holst Christensen
d6f033b42d
Fixed build error
2018-04-28 19:09:25 +02:00
Jimmi Holst Christensen
837166319d
Trying to fix osx build failing by setting param_info.type to nullptr
2018-04-28 19:02:46 +02:00
Alexandros Naskos
af73462da4
Started work on function definition TypeInfo generation.
2018-04-28 19:57:59 +03:00
Jimmi Holst Christensen
341f8c1e86
Fixed wrong formatting for arg_index when reporting @ArgType error
2018-04-28 17:57:47 +02:00
Alexandros Naskos
9ba400673d
Generating TypeInfo's now forces definitions to be resolved.
2018-04-28 18:38:38 +03:00
Jimmi Holst Christensen
fba0347ec4
.ReturnType and @ArgType now emits errors on unresolved types
...
related: #846
2018-04-28 17:17:48 +02:00
Jimmi Holst Christensen
2fc34eaa58
Functions with infered error set can now return literals
...
fixes #852
2018-04-28 16:27:31 +02:00
Alexandros Naskos
61b0180596
Added definition TypeInfo generation, except for function definitions.
2018-04-28 17:01:19 +03:00
Jimmi Holst Christensen
3178528335
Removed zero sized error set optimization
...
fixes #762
fixes #818
2018-04-28 14:05:08 +02:00
Alexandros Naskos
ea2596280f
Added BoundFn TypeInfo generation.
2018-04-27 05:10:20 +03:00
Alexandros Naskos
8f703f919f
Added Fn TypeInfo generation.
2018-04-27 04:29:50 +03:00
Alexandros Naskos
a2dadbc206
Added struct TypeInfo generation.
2018-04-27 02:52:09 +03:00
Alexandros Naskos
9041d0d37e
Fixed enum tag type detection in TypeInfo generation.
2018-04-27 02:05:24 +03:00
Alexandros Naskos
884e32d5c3
Added ErrorUnion, Union TypeInfo generation
2018-04-26 19:56:34 +03:00
Andrew Kelley
4d0b660f4b
translate-c: add missing decl type from LLVM 7
2018-04-26 11:43:18 -04:00
Alexandros Naskos
fbbbee6b72
Switched to shallow TypeInfo.
2018-04-26 18:18:47 +03:00
Andrew Kelley
bbfff46146
Merge remote-tracking branch 'origin/master' into llvm7
2018-04-26 10:55:29 -04:00
Alexandros Naskos
4aa5d87ada
Added ErrorSet TypeInfo generation.
2018-04-26 17:14:38 +03:00
Alexandros Naskos
f5977f68eb
Added Enum TypeInfo except for methods
2018-04-26 16:41:59 +03:00
Alexandros Naskos
7a91e4736a
Reset parent on cached TypeInfo values if we need to.
2018-04-26 14:29:27 +03:00
Alexandros Naskos
bb56360bfa
Added TypeInfo cache
2018-04-26 14:03:19 +03:00
Alexandros Naskos
dd88d7deda
Cleanup
2018-04-26 13:27:16 +03:00
Alexandros Naskos
bc160821d3
Changed TypeInfo layout.
2018-04-25 17:50:11 +03:00
Alexandros Naskos
2606993cb4
Fixed ir_type_info_struct_set_parent for struct parents.
2018-04-25 11:59:35 +03:00
Alexandros Naskos
d68aea4f35
Added checks for field name/index mapping in TypeInfo generation. Abstracted the parent setting out.
2018-04-25 11:35:46 +03:00
Braedon
07af6559d8
Changed to use shifting and masking
2018-04-25 16:26:57 +10:00
Braedon
f6cbe9a9cc
Utf8 Encode
2018-04-25 14:59:03 +10:00
Andrew Kelley
7270f35c93
Merge remote-tracking branch 'origin/master' into float-printing
2018-04-24 23:47:37 -04:00
Andrew Kelley
27cbb44993
Merge pull request #949 from zig-lang/complex-math
...
Add initial complex-number support
2018-04-24 21:24:08 -04:00
Andrew Kelley
84391af7b8
convert NOTE to TODO so we catch it later
...
See #363
For Complex as a builtin type, see discussion in #949
2018-04-24 21:23:03 -04:00
Andrew Kelley
1d998d5dce
clean up complex math tests
2018-04-24 21:14:12 -04:00
Andrew Kelley
13076d5f22
std.mem: add more slice manipulation functions
...
* add std.mem.trimLeft
* add std.mem.trimRight
* add std.mem.trimRight
* add std.mem.lastIndexOfScalar
* add std.mem.lastIndexOfAny
* add std.mem.lastIndexOf
* add std.mem.endsWith
closes #944
Thanks Braedon Wooding for the original PR
2018-04-24 20:53:36 -04:00
Alexandros Naskos
778b931bf3
Fixed comptime union void field access
2018-04-25 02:50:18 +03:00
Alexandros Naskos
182a9fad2d
Added ArrayInfo, NullableInfo, PromiseInfo generation
2018-04-24 17:38:30 +03:00
Alexandros Naskos
09d7033d1d
PointerInfo child is known at comptime
2018-04-24 17:08:45 +03:00
Alexandros Naskos
2d8553c853
Fixed PointerInfo generation
2018-04-24 17:01:20 +03:00
Alexandros Naskos
189e8e97bd
PointerInfo child is a pointer to a TypeInfo union, still not working correctly
2018-04-24 16:50:36 +03:00
Alexandros Naskos
0e5fb035e3
Added (broken) pointer info, float info
2018-04-24 16:23:22 +03:00
Alexandros Naskos
e9309d3b13
Fixed IntInfo generation.
2018-04-24 15:17:34 +03:00
Alexandros Naskos
ec2a3ed500
Attempt at adding comptime union field access
2018-04-24 15:03:46 +03:00
Marc Tiehuis
0501e066b5
crypto throughput test now uses os.time module
2018-04-24 23:54:27 +12:00
Alexandros Naskos
fb88f5a0d2
@typeInfo with void payloads now works!
2018-04-24 11:20:33 +03:00
Marc Tiehuis
d5e99cc05e
Add initial complex-number support
...
- Library type instead of builtin
- All C complex functions implemented
Partial WIP: Needs more tests for edge cases.
2018-04-24 19:18:31 +12:00
Alexandros Naskos
7eab62325b
One step towards @typeInfo
2018-04-24 01:49:22 +03:00
Andrew Kelley
15bf0c1541
fix interaction between defer and labeled break
...
closes #830
2018-04-23 18:06:33 -04:00
Andrew Kelley
89a4c373d3
fix bigint twos complement implementation
...
closes #948
2018-04-23 12:06:18 -04:00
Marc Tiehuis
e5175d432e
Fix release float printing errors
...
Fixes #564 .
Fixes #669 .
Fixes #928 .
2018-04-23 17:22:51 +12:00
Marc Tiehuis
d8ba1bc120
Improve fmt float-printing
...
- Fix errors printing very small numbers
- Add explicit scientific output mode
- Add rounding based on a specific precision for both decimal/exp
modes.
- Test and confirm exp/decimal against libc for all f32 values. Various
changes to better match libc.
2018-04-23 17:22:51 +12:00
Andrew Kelley
8503eff8c1
add compile error for invalid deref on switch target
...
closes #945
2018-04-22 23:46:55 -04:00
Andrew Kelley
75328e3204
exit(1) instead of abort() for file not found
2018-04-22 21:47:25 -04:00
Andrew Kelley
25dff91fa0
fix windows build broken by previous commit
...
fixes build failure from 1c41f1ca62
2018-04-22 21:08:52 -04:00
Andrew Kelley
1c41f1ca62
better error reporting for missing libc on windows
...
closes #931
2018-04-22 20:54:52 -04:00
Andrew Kelley
371a3ad4bd
Merge branch 'tgschultz-std.os.time'
2018-04-22 18:13:57 -04:00
Andrew Kelley
7af6ed3f20
add alignment docs
2018-04-22 18:13:53 -04:00
Andrew Kelley
21767144fc
linux: support VDSO for clock_gettime
...
also fix a compiler crash when using cmpxchg with nullable pointer
2018-04-22 18:11:50 -04:00
Andrew Kelley
da2af9c613
fixups
2018-04-22 13:36:26 -04:00
Andrew Kelley
0dcadc61b4
Merge branch 'std.os.time' of https://github.com/tgschultz/zig into tgschultz-std.os.time
2018-04-22 13:24:25 -04:00
Andrew Kelley
98b88bb52f
add alignment docs
2018-04-22 12:52:28 -04:00
Andrew Kelley
3010668390
Merge pull request #939 from tgschultz/large-alignment-directalloc
...
DirectAllocator alignments > os.page_size on posix
2018-04-22 12:49:13 -04:00
Andrew Kelley
a3e9ae8f74
travis: use encrypted env vars for s3 credentials
2018-04-22 12:33:02 -04:00
tgschultz
a1083b019c
Added DirectAllocator support for alignments > os.page_size on posix systems
2018-04-21 20:41:49 -05:00
Andrew Kelley
c4840d78fb
add test case for #936
2018-04-21 02:10:22 -04:00
Andrew Kelley
1098545e47
std.zig.parser: remove unused field
2018-04-21 02:10:22 -04:00
Harry Eakins
eef4bbb65f
Changed all MB to MiB
2018-04-21 11:06:10 +12:00
Harry Eakins
b229aff34a
Readability improvements and bug-fix to std/crypto/throughput_test.zig
2018-04-21 11:06:10 +12:00
Andrew Kelley
6e57243a79
zig fmt: preserve comments in front of test blocks
...
* refactor std.zig.parser
* fix compiler crashing for some compile errors
* take advantage of @field in std.zig.ast
* move ast.NodeFoo to ast.Node.Foo
* comment preservation is more explicit
See #911
2018-04-20 02:15:09 -04:00
Jimmi Holst Christensen
cc35f085ca
Merge pull request #934 from zig-lang/adding-builtin-field
...
Added @field builtin function
2018-04-19 22:43:41 +02:00
tgschultz
ca4053ba49
Use std.os.errorUnexpectedPosix if timer initialization encounters unexpected error
2018-04-19 14:53:58 -05:00
Jimmi Holst Christensen
72bf9d90cc
Added builtin field to docs
2018-04-19 21:48:09 +02:00
Jimmi Holst Christensen
1b91478bff
Optimized field ptr ir for hot path and fix assignment bug
2018-04-19 21:34:18 +02:00
Jimmi Holst Christensen
6b4f6ebd89
Added field builtin function
2018-04-19 20:11:16 +02:00
tgschultz
89eade0548
Style cleanups, u64 casts, Timer.start returns error instead of unreachable on unexpected errno.
2018-04-19 10:01:41 -05:00
Andrew Kelley
06909ceaab
support break in suspend blocks
...
* you can label suspend blocks
* labeled break supports suspend blocks
See #803
2018-04-18 22:21:54 -04:00
tgschultz
3c9b6f8cd5
Fixed another incorrect comment
2018-04-18 19:57:47 -05:00
tgschultz
fdebe38fa3
Added notes regarding CLOCK_MONOTONIC_RAW and made it easy to change our mind in the future.
...
Updated std.os imported tests' block with lazy declaration workaround and added time.zig.
Corrected some incorrect comments.
2018-04-18 19:48:19 -05:00
tgschultz
5c83d271a3
Fixed incorrect sign on epoch.clr
2018-04-18 18:50:28 -05:00
tgschultz
7cfe328a16
fixed typos.
2018-04-18 17:43:35 -05:00
Andrew Kelley
ca4341f7ba
add --no-rosegment cli option
...
this provides a workaround for #896
until valgrind adds support for clang/LLD
(equivalent to gcc/gold -rosegment)
2018-04-18 17:14:09 -04:00
tgschultz
bf9cf28322
Fixed compiler errors around darwin code.
2018-04-18 15:46:50 -05:00
tgschultz
8b66dd8c7d
Added unstaged changes.
2018-04-18 13:55:42 -05:00
tgschultz
c90f936eef
Added timestamp, high-perf. timer functions.
2018-04-18 13:52:25 -05:00
Andrew Kelley
f1f998e071
improve cmpxchg
...
* remove @cmpxchg, add @cmpxchgWeak and @cmpxchgStrong
- See explanations in the langref.
* add operand type as first parameter
* return type is ?T where T is the operand type
closes #461
2018-04-18 12:16:42 -04:00
Andrew Kelley
96ebd8b23b
fix windows not respecting --msvc-lib-dir, --kernel32-lib-dir
...
I believe this was a regression caused by
51a6ff18d4
closes #927
2018-04-16 22:33:34 -04:00
Marc Tiehuis
c7cb5c31e5
Add exp/norm distributed random float generation
2018-04-16 20:06:50 +12:00
Andrew Kelley
caefaf781e
std.debug: dumpStackTrace & friends use DirectAllocator
...
this has the downside of failing to print a stack trace
when the system is out of memory (maybe we could add a
FallbackAllocator which tries DirectAllocator and falls
back on the 200KB preallocated buffer).
but for the more common use case when the system is not
out of memory, but the debug info cannot fit in
std.debug.global_allocator, now stack traces will work.
this is the case for the self hosted compiler.
2018-04-16 03:17:15 -04:00
Andrew Kelley
88724217dd
Merge pull request #925 from alexnask/release_small
...
Added ReleaseSmall mode.
2018-04-15 21:57:26 -04:00
Alexandros Naskos
1bc140964f
Added ReleaseSmall mode to docgen
2018-04-16 04:18:52 +03:00
Alexandros Naskos
6492763bef
Fixed test build code
2018-04-16 04:06:00 +03:00
Alexandros Naskos
1c85050dad
Set SizeLevel to 2 in ReleaseSmall mode
2018-04-16 03:54:40 +03:00
Alexandros Naskos
253ecd5c11
Added ReleaseSmall mode
2018-04-16 03:26:10 +03:00
Andrew Kelley
b9360640ce
add @atomicLoad builtin
...
See #174
2018-04-15 18:12:00 -04:00
Andrew Kelley
859b10d8bf
std.math.ln and std.math.exp use float strict mode
...
closes #920
2018-04-15 15:22:27 -04:00
Andrew Kelley
a8d794215e
exit with error code instead of panic for file not found
2018-04-15 15:22:07 -04:00
Andrew Kelley
b5459eb987
add @sqrt built-in function
...
See #767
2018-04-15 13:26:58 -04:00
Andrew Kelley
4a2bfec150
fix linux implementation of self exe path
...
closes #894
2018-04-15 12:57:45 -04:00
Andrew Kelley
b7af9edb8a
add std.os.createThread
...
this adds kernel thread support to the standard library for
linux.
See #174
2018-04-14 02:24:05 -04:00
Andrea Orru
06614b3fa0
Merge branch 'master' into zen_stdlib
2018-04-13 11:11:21 -07:00
Andrea Orru
d2c672ab0c
FIXME note
2018-04-13 11:10:36 -07:00
Andrew Kelley
fa05cab01a
travis: put cache-control header for ziglang.org/download
2018-04-13 12:17:07 -04:00
Andrew Kelley
0509414dfe
fix regression with zig install dir
...
introduced in 1999f0daad
2018-04-13 11:31:38 -04:00
Andrew Kelley
4662fd4d92
Merge pull request #919 from zig-lang/self-hosted-parser-refactor
...
Self-hosted parser refactor
2018-04-13 11:17:09 -04:00
Andrew Kelley
30c5f3c441
Merge pull request #915 from zig-lang/self-hosted-cli
...
Revise self-hosted command line interface
2018-04-13 11:16:06 -04:00
Andrew Kelley
1999f0daad
fix undefined behavior triggered by fn inline test
...
LLVM destroys the string that we use to test if LLVM deleted the
inlined function.
Also fixed forgetting to initialize a buffer in std lib path detection.
2018-04-13 11:10:17 -04:00
Marc Tiehuis
fe9489ad63
Fix windows access check
2018-04-13 22:50:57 +12:00
Marc Tiehuis
03bec631bd
Replace File.exists with File.access
2018-04-13 21:27:09 +12:00
Jimmi Holst Christensen
a498993fd1
Merged with master
2018-04-13 10:40:37 +02:00
Jimmi Holst Christensen
44c53c9979
std.zig.parser: Refactor round 2
...
* More work on ensuring that each state only eat one token
* VarDecl parsing now constructs its node
* Handling all fn parsing in the same case
* Using eatToken instead of getNextToken where possible
* All tokenIdTo* now takes @TagType(Token.Id)
* Added a createToCtxLiteral function
2018-04-13 10:15:12 +02:00
Marc Tiehuis
b946982e90
Use builtin Arch/Os/Environ
2018-04-13 20:12:30 +12:00
Marc Tiehuis
7fe1c7c04f
Remove cc command
2018-04-13 19:43:18 +12:00
Andrea Orru
c5f088e52c
Pass up to 5 arguments in Zen IPC
2018-04-12 22:24:57 -07:00
Andrew Kelley
0f652b4d80
zig fmt: switch cases on new lines
...
See #911
2018-04-12 21:56:12 -04:00
Andrew Kelley
9e701e951b
zig fmt includes trailing commas
...
See #911
2018-04-12 21:40:15 -04:00
Andrew Kelley
d4572d1140
zig fmt: container init fields each on own line
...
See #911
2018-04-12 21:23:18 -04:00
Andrew Kelley
373b3586a1
inline functions must be stored in const or comptime var
...
closes #913
2018-04-12 16:26:23 -04:00
Jimmi Holst Christensen
fad54e62bb
std.zig.ast: Fixed build failures
2018-04-12 18:56:58 +02:00
Jimmi Holst Christensen
d35a6655e0
std.zig.parser: Refactored commaOrEnd to expectCommaOrEnd
...
* Now it returns end when found, or null if comma was found.
* State should now be appended outside the function
2018-04-12 18:13:09 +02:00
Andrew Kelley
29e0e4088e
Merge remote-tracking branch 'origin/master' into self-hosted-cli
2018-04-12 11:20:38 -04:00
Andrew Kelley
7b2cb7e679
remove --zig-install-prefix arg now that we find std at runtime
2018-04-12 11:00:11 -04:00
Andrew Kelley
c43f77f109
fix invalid implicit cast on macos
2018-04-12 10:38:32 -04:00
Jimmi Holst Christensen
206c0b8bdb
std.zig.parser: Refactor, round 1:
...
* Removed the Optional state
* We now have an OptionalCtx instead of DestPtr
* OptionalCtx simulated return, instead of reverting states
* OptionalCtx is a lot less hacky, but is still a small footgun
* Trying to avoid consuming more than one token per state
* This is required, because of comments
* The C++ compiler allows comments between all tokens
* We therefor have to consume comment tokens between each state
* Reordered states so they are grouped in some logical fasion
2018-04-12 16:08:23 +02:00
Marc Tiehuis
803f0a295b
Revise self-hosted command line interface
...
Commands are now separated more precisely from one another. Arguments
are parsed mostly using a custom argument parser instead of manually.
This should be on parity feature-wise with the previous main.zig but
adds a few extra code-paths as well that were not yet implemented.
Subcommands are much more prominent and consistent. The first argument
is always a sub-command and then all following arguments refer to that
command. Different commands display there own usage messages and options
based on what they can do instead of a one-for-all usage message that
was only applicable for the build commands previously.
The `cc` command is added and is intended for driving a c compiler. See #490 .
This is currently a wrapper over the system cc and assumes that it
exists, but it should suffice as a starting point.
2018-04-12 22:28:47 +12:00
Jimmi Holst Christensen
0d8646d262
std.zig.parser now parses alignment of functions
...
Related #909
This allows it to parse `std/special/compiler_rt/index.zig`
2018-04-12 08:46:26 +02:00
Andrea Orru
70f2bb03fd
outb syscall
2018-04-11 23:11:26 -07:00
Andrew Kelley
ce68dda4b6
Merge remote-tracking branch 'origin/master' into llvm7
2018-04-11 18:27:06 -04:00
Andrew Kelley
2b86ffe34a
LLD patch: Do not keep shared symbols to garbage...
...
-collected eliminated DSOs.
This applies https://reviews.llvm.org/D45536 to the embedded
LLD.
Closes #883
2018-04-11 18:15:33 -04:00
Jimmi Holst Christensen
ed1b028276
Merge branch 'master' of github.com:zig-lang/zig
2018-04-11 20:56:22 +02:00
Jimmi Holst Christensen
5b584e06e3
std.zig.parser special cased error in return.
...
Related #909
This allows parsing of `std/special/build_runner.zig`
2018-04-11 20:56:05 +02:00
Andrew Kelley
e48e707c32
allow integer and float literals to be passed to var params
...
closes #623
2018-04-11 14:47:37 -04:00
Jimmi Holst Christensen
a7f77d7c6a
std.zig.parser: requireSemiColon now matches the C++ behavior
...
Related #909
Allowes parsing of `std/os/child_process.zig`
2018-04-11 15:26:00 +02:00
Jimmi Holst Christensen
df4c575525
std.zig.parser now parses inline fn proto
...
Related #909
Allows parsing of `std/os/zen.zig`.
2018-04-11 15:17:51 +02:00
Jimmi Holst Christensen
fe7146277d
std.zig.parser now accept both string and multiline string for strings
...
Related #909
Allows it to parse `std/special/compiler_rt/aullrem.zig`,
`std/special/compiler_rt/aulldiv.zig` and `std/math/x86_64/sqrt.zig`
2018-04-11 14:43:53 +02:00
Jimmi Holst Christensen
28ea364e5e
std.zig.parser now handle try's precedence correctly
...
This allows parsing of `std/zig/parser.zig`. Related: #909
2018-04-11 13:56:39 +02:00
Jimmi Holst Christensen
841ac0f4e1
std.zig.parser now allows assignment expr in switch cases.
...
This makes `std/os/index.zig` parse
related: #909
2018-04-11 13:46:35 +02:00
Jimmi Holst Christensen
4b0556ebd4
std.zig.parser can now parse std/heap.zig:
...
related: #909
* Struct fields can now be pub
* Parsing of double deref now works
* Block expressions now have the right precedence
2018-04-11 13:38:06 +02:00
Jimmi Holst Christensen
6fb5ab1b52
std.zig.parser: Redid parsing of error set delc
...
related: #909
2018-04-11 13:05:42 +02:00
Jimmi Holst Christensen
5f3ec023cd
std.zig.parser: Fixed parsing of field access rhs
...
related: #909
2018-04-11 12:53:01 +02:00
Jimmi Holst Christensen
281c17f6ae
std.zig.parser:
...
* Renamed eatToken to expectToken
* A new eatToken fn, which only eats the token, if the id match
* Inlined initNode, as it is not suppose to be used outside createNode
2018-04-11 12:05:10 +02:00
Jimmi Holst Christensen
dae287524d
std.zig: Major refactor
...
* There now exists a few function to allocate all nodes in parser.zig
* ast.zig now have a table of Ids and their corrisponding type
2018-04-11 10:37:04 +02:00
Andrea Orru
135a335ce1
Merge branch 'master' into zen_stdlib
2018-04-11 00:33:19 -07:00
Andrea Orru
b01c5a95c4
Update zen library
2018-04-11 00:31:32 -07:00
Andrew Kelley
f43711e5fb
Merge branch 'bnoordhuis-fix879'
2018-04-11 00:33:14 -04:00
Andrew Kelley
58c6424d4f
simplify and fix BufMap logic
2018-04-11 00:32:42 -04:00
Andrew Kelley
19e0ed5d3e
Merge branch 'fix879' of https://github.com/bnoordhuis/zig into bnoordhuis-fix879
2018-04-10 23:37:08 -04:00
Andrew Kelley
2ec1cec92d
add more linux syscalls and constants
...
Based on #904 by tgshultz
2018-04-10 23:29:24 -04:00
Andrew Kelley
64d96ad703
Merge pull request #873 from zig-lang/self-hosted-parser
...
Self hosted parser completion
2018-04-10 22:47:18 -04:00
Josh Wolfe
405a2390f0
zig fmt while-else with no blocks
2018-04-10 22:44:55 -04:00
Andrew Kelley
f6c77746d6
add memmove to builtin.o
...
related: #514
2018-04-10 22:24:01 -04:00
Andrew Kelley
27e881c2d7
fix another undefined deref
...
see 0ba85ea6ff
2018-04-10 21:58:04 -04:00
Josh Wolfe
b553b7ab83
Merge branch 'master' into self-hosted-parser
2018-04-10 21:46:13 -04:00
Andrew Kelley
ee3e2790aa
cmake defaults stage1 to install in build directory
2018-04-10 20:57:37 -04:00
Jimmi Holst Christensen
0ba85ea6ff
std.zig.parser fixed segfault when parsing cc for fn decl
2018-04-10 17:46:17 +02:00
Andrew Kelley
477ded9042
add missing call in zig fmt to commit results to disk
2018-04-10 11:00:57 -04:00
Jimmi Holst Christensen
c6aa637146
std.zig.parser: removed dublicate "zig fmt: coroutines" test
2018-04-10 16:33:43 +02:00
Jimmi Holst Christensen
b9cccce26d
std.zig.ast: fixed none compiling code
2018-04-10 15:56:37 +02:00
Jimmi Holst Christensen
db9a9f3a6c
std.zig.parser now parses the var type
...
* I parse it as a type in all contexts. This is not how the
C++ compiler does it, but I think typechecking should catch this
2018-04-10 15:16:31 +02:00
Jimmi Holst Christensen
aa09e7b639
std.zig.tokinizer now treats string identifiers as identifiers
2018-04-10 15:01:21 +02:00
Jimmi Holst Christensen
3b80e66507
std.zig.parser now parses toplevel use
2018-04-10 14:52:47 +02:00
Jimmi Holst Christensen
db0812d4b7
std.zig.parser: changed block exprs from primary expr to expr
2018-04-10 14:22:01 +02:00
Jimmi Holst Christensen
706e0d739e
std.zig.parser readded all tests
...
* Ops!
2018-04-10 13:49:52 +02:00
Jimmi Holst Christensen
1b81e406f0
std.zig: fixed compiler errors
2018-04-10 13:43:20 +02:00
Jimmi Holst Christensen
34af38e09b
std.zig.tokinizer: fixed failing tests
2018-04-10 11:35:41 +02:00
Jimmi Holst Christensen
f85b9f2bf3
std.zig.parser now parses coroutine code
2018-04-10 11:25:58 +02:00
Jimmi Holst Christensen
5cd69ee6a4
std.zig.parser changed assign expr to only be allowed in some contexts
...
* Only allowed in while continue expr and statement expr
2018-04-10 09:37:29 +02:00
Jimmi Holst Christensen
2c7996f400
std.zig.parser can now render asm expressions
2018-04-10 09:27:11 +02:00
Andrew Kelley
4545be360a
fix std.io.readline to work on windows
...
closes #882
2018-04-09 21:14:55 -04:00
Jimmi Holst Christensen
a09bb408a2
std.zig.parser now parses asm expressions
...
* We cannot render asm expressions yet
2018-04-09 15:40:16 +02:00
Jimmi Holst Christensen
aa552633cc
std.zig.parser now parses fn types
2018-04-09 14:02:03 +02:00
Jimmi Holst Christensen
7d32c9521f
std.zig.parser now parses comptime
2018-04-09 13:24:47 +02:00
Jimmi Holst Christensen
d04346d2ac
ast.zig.parser now parses defer statements
2018-04-09 13:07:46 +02:00
Jimmi Holst Christensen
c19f5a2356
std.zig.parser now parses if statements
2018-04-09 12:51:18 +02:00
Jimmi Holst Christensen
7dd55a8007
std.zig.parser now parses for loops
2018-04-09 11:48:25 +02:00
Jimmi Holst Christensen
e24409ebe0
std.zig.parser unified code for rendering and parsing semicolon in statements
2018-04-09 11:17:57 +02:00
Jimmi Holst Christensen
e260c8ca63
std.zig.parser now parses while loops and labeled break and continue
2018-04-09 11:11:18 +02:00
Andrew Kelley
9ef1ba9d54
Merge branch 'async-tcp-server'
2018-04-09 00:53:16 -04:00
Andrew Kelley
e85a10e9f5
async tcp server proof of concept
2018-04-09 00:52:45 -04:00
Andrew Kelley
cbda0fa78c
basic tcp server working when used with netcat
2018-04-08 20:08:40 -04:00
Andrew Kelley
acd8f6ef18
fixups from rebase
2018-04-08 18:49:20 -04:00
Andrew Kelley
8f4ad95777
update what std tests to run
2018-04-08 18:30:54 -04:00
Andrew Kelley
b85ef656ca
running into the llvm corosplit error again
2018-04-08 18:30:54 -04:00
Andrew Kelley
0d22a00f6f
*WIP* async/await TCP server
2018-04-08 18:26:24 -04:00
Andrew Kelley
292d0cbdad
add docs for union methods
2018-04-08 18:03:09 -04:00
Andrew Kelley
eae355d771
add docs for packed enum
2018-04-08 18:03:09 -04:00
Andrew Kelley
fef06f2142
Merge branch 'async-err-ret-traces'
...
closes #821
2018-04-08 17:57:29 -04:00
Andrew Kelley
ee1a4f4c1d
error return traces work with async return case
2018-04-08 17:44:29 -04:00
Andrew Kelley
9e98ea552d
fix calling convention at callsite of zig-generated fns
2018-04-08 16:40:59 -04:00
Andrew Kelley
ada441157f
put the error return addresses in the coro frame
2018-04-08 16:04:48 -04:00
Andrew Kelley
e4083b7391
codegen: fix not putting llvm allocas together
2018-04-08 16:04:48 -04:00
Andrew Kelley
d26905c102
error return traces for the early return case
...
it would work but LLVM is not correctly spilling the addresses.
See #821
2018-04-08 16:04:48 -04:00
Jimmi Holst Christensen
e4d0b46c0c
std.zig.parser WIP generalizing parsing of payloads
...
* Note, it doesn't work :)
2018-04-08 17:05:08 +02:00
Jimmi Holst Christensen
bdff5bfa3e
std.zig.parser now parses switch
2018-04-07 01:38:38 +02:00
Andrew Kelley
7186e92c86
Merge pull request #900 from zig-lang/hash-and-checksums
...
Add common hash/checksum functions
2018-04-06 09:44:25 -04:00
Jimmi Holst Christensen
820de1716b
std.zig.parser now parses labeled blocks.
...
* There is also some code for switch range parsing
2018-04-06 15:37:49 +02:00
Marc Tiehuis
c34ce2cbc6
Add common hash/checksum functions
...
- SipHash64, SipHash128
- Crc32 (fast + small variants)
- Adler32
- Fnv1a (32, 64 and 128 bit variants)
2018-04-06 23:10:54 +12:00
Jimmi Holst Christensen
f667744d44
std.zig.parser Fixed:
...
* Parsing of the optional expression in contrl flow expr
* Rendering of catch expressions
2018-04-06 09:36:11 +02:00
Jimmi Holst Christensen
e45de607d6
std.zig.parser: Initializers are now parsed and fmt correctly
2018-04-06 08:56:28 +02:00
Andrew Kelley
873641c123
Merge pull request #899 from bnoordhuis/fix898
...
fix llvm assert on version string with git sha
2018-04-05 18:55:09 -04:00
Ben Noordhuis
8980281184
fix llvm assert on version string with git sha
...
LLVM's CodeViewDebug pass misparses the version string when it contains
a git revision so stop doing that. This only affected Windows builds.
closes #898
2018-04-06 00:31:55 +02:00
Ben Noordhuis
9e8519b7a2
fix use-after-free in BufMap.set()
...
closes #879
2018-04-05 23:32:49 +02:00
Andrew Kelley
588116cacc
travis: update docker image tag for llvm7
2018-04-04 18:29:31 -04:00
Andrew Kelley
5800faa318
update to latest llvm API
2018-04-04 18:27:52 -04:00
Jimmi Holst Christensen
779247ba11
std.zig Major Refactor
...
* parser now parses expression like the C++ compiler does
* This makes initializers work
* Added control flow expression (only return is parsed)
* Added catch parsing (It doesn't quite work)
* The parse can now specify states as optional.
* The parse will roll back on error if states are optional
* This can be overriden by State.Required
2018-04-04 23:36:55 +02:00
Andrew Kelley
cca93908e6
Merge remote-tracking branch 'origin/master' into llvm7
2018-04-04 17:22:26 -04:00
Marc Tiehuis
8938429ea1
Add Hmac function ( #890 )
2018-04-04 10:31:10 -04:00
Jimmi Holst Christensen
744416ce0c
std.zig.parser should now parse operators with precedence.
...
* This haven't been tested yet
2018-04-04 14:58:51 +02:00
Marc Tiehuis
f68c2e0a14
Fix off-by-one error in all crypto functions
2018-04-04 21:32:23 +12:00
Jimmi Holst Christensen
ca0085c46d
std.zig.parser now parses error set declarations
2018-04-04 10:54:48 +02:00
Jimmi Holst Christensen
020724cfa0
std.zig.tokenizer Tokens now don't contain a line and column field.
...
* Instead, this information is optained by asking the tokenizer.
* getTokenLocation takes a start_index, so relative loc can be optained
2018-04-04 10:27:38 +02:00
Jimmi Holst Christensen
09cf823619
std.zig.parser now parses container decls
2018-04-04 09:57:37 +02:00
Andrew Kelley
3d8541121b
Merge branch 'hellerve-wip-macos-dirent'
2018-04-04 00:08:48 -04:00
Andrew Kelley
abd389209b
fix up logic for macos std.os.deleteTree
2018-04-04 00:08:10 -04:00
Andrew Kelley
e1e536e03d
Merge branch 'wip-macos-dirent' of https://github.com/hellerve/zig into hellerve-wip-macos-dirent
2018-04-03 23:33:18 -04:00
Andrew Kelley
6050b9d835
travis: don't skip tests
...
fix broken previous commit
2018-04-03 21:40:36 -04:00
Andrew Kelley
2676da61a6
travis: better s3 artifacts
2018-04-03 21:39:03 -04:00
Andrew Kelley
9dfd1a7c8a
remove more signal handling stuff from std.os.ChildProcess
...
439621e44a failed to remove
everything. this finishes the job
2018-04-03 18:26:49 -04:00
Andrew Kelley
d1f8e722b5
travis: don't upload other files as artifacts
2018-04-03 14:23:56 -04:00
Jimmi Holst Christensen
ec611bf8b4
std.zig.parser now parses regular enums, unions and struct
...
* Still missing packed, and extern
2018-04-03 20:00:02 +02:00
Andrew Kelley
21b47b34d8
travis: don't upload build/ folder as artifacts
2018-04-03 12:59:28 -04:00
Andrew Kelley
65e4bb149e
travis artifacts: don't upload extra stuff
2018-04-03 12:04:06 -04:00
Andrew Kelley
aadc14fd78
upload static linux artifacts on successful travis build
2018-04-03 11:22:18 -04:00
Jimmi Holst Christensen
d602f12df8
std.zig.ast Added ContainerDecl
2018-04-03 15:59:14 +02:00
Jimmi Holst Christensen
4fae452684
std.zig.parser Refactored top level decl parsing
...
* Now, the arraylist from the root node is passed through the states.
* This allows us to reuse the code for enums, unions and structs
2018-04-03 15:33:22 +02:00
Jimmi Holst Christensen
40f35e997a
std.zig.parser moved container initializer tests down
2018-04-03 15:17:26 +02:00
Jimmi Holst Christensen
9d69e94bba
std.zig.parser now parses grouped expressions
...
* I also moved some tests down, as they fail in ways I can't fix yet
2018-04-03 15:16:32 +02:00
Jimmi Holst Christensen
5c82ed2ea9
std.zig.parser now parses initializers... Or, it would, if it worked
2018-04-03 14:53:27 +02:00
Jimmi Holst Christensen
0b9247fb63
std.zig.parser Refactor:
...
* Slice/Array access is now not parsed in the expr contruction loop
* State.ExprListItemOrEnd now takes a token id for the end token
2018-04-03 14:20:34 +02:00
Jimmi Holst Christensen
b424cd75ab
std.zig.parser refactored call, slice and array access to be suffix op
2018-04-03 12:33:06 +02:00
Jimmi Holst Christensen
22e38ffb54
std.zig.tokenizer fixed tokens having wrong column and line
2018-04-03 11:18:18 +02:00
Jimmi Holst Christensen
a2330d0ea3
std.zig.parser now parses slice and array types
2018-04-03 10:54:19 +02:00
Andrew Kelley
4eb68987d8
std.io.readLine function
...
this provides a better input for guess number example.
see #882
2018-04-02 11:34:31 -04:00
Jimmi Holst Christensen
b9093185f7
std.zig.parser now parses slicing and array access
2018-04-01 22:02:51 +02:00
Marc Tiehuis
2e5115b068
Add run compiler command
...
'zig run file.zig' builds a file and stores the artifacts in the global
cache. On successful compilation the binary is executed.
'zig run file.zig -- a b c' does the same, but passes the arguments a,
b and c as runtime arguments to the program. Everything after an '--' are
treated as runtime arguments.
On a posix system, a shebang can be used to run a zig file directly. An
example shebang would be '#!/usr/bin/zig run'. You may not be able pass
extra compile arguments currently as part of the shebang. Linux for example
treats all arguments after the first as a single argument which will result
in an 'invalid command'.
Currently there is no customisability for the cache path as a compile
argument. For a posix system you can use `TMPDIR=. zig run file.zig` to
override, in this case using the current directory for the run cache.
The input file is always recompiled, even if it has changed. This is
intended to be cached but further discussion/thought needs to go into
this.
Closes #466 .
2018-04-01 17:03:06 +12:00
Jimmi Holst Christensen
df09c01f7f
std.zig.parser now parses error, this and unreachable
2018-03-31 22:48:12 +02:00
Andrew Kelley
67f11190d1
musl-friendly dynamic linking
2018-03-31 16:34:55 -04:00
Jimmi Holst Christensen
aabf7cf57e
std.zig.parser now parses null and bool literals
2018-03-31 22:10:49 +02:00
Jimmi Holst Christensen
975dc5a390
std.zig.parser now parses char literals
2018-03-31 21:28:40 +02:00
Jimmi Holst Christensen
4d8f9e2295
std.zig.parser now parses multi line strings
2018-03-31 21:04:54 +02:00
Raul Leal
eb6ff796c1
Fix undeclared identifier error in readUntilDelimiterBuffer and incorrect number of parameters in readUntilDelimiterAlloc ( #877 )
2018-03-31 12:21:19 -04:00
Andrew Kelley
51a6ff18d4
Merge pull request #872 from zig-lang/runtime-libc
...
find libc and zig std lib at runtime
2018-03-31 12:13:30 -04:00
Jimmi Holst Christensen
4793c3397e
std.zig.parser now handles lib name for extern var and fn
2018-03-31 17:46:29 +02:00
Andrew Kelley
8f962a957a
fix regressions on windows
2018-03-31 11:26:02 -04:00
Jimmi Holst Christensen
cda3509353
Added test cases to cover all of zigs syntax
2018-03-31 15:39:51 +02:00
Jimmi Holst Christensen
26e56f2fab
Each test now have it's own test name
2018-03-31 14:18:09 +02:00
Jimmi Holst Christensen
596f4b6002
Fixed review commented code
2018-03-31 14:00:49 +02:00
Marc Tiehuis
7d66908f29
docs: fix unclosed code tag
2018-03-31 23:17:02 +13:00
Andrew Kelley
c3724ec506
implement os_self_exe_path in the c++ compiler for darwin
...
ported from the zig std lib
this fixes looking for zig std lib at runtime on darwin
2018-03-31 02:12:44 -04:00
Jimmi Holst Christensen
5118caf5ab
Added a lot of test cases
2018-03-31 00:53:00 +02:00
Andrew Kelley
5d5feb11de
appveyor and travis ci: stop passing unused configure args
2018-03-30 17:26:01 -04:00
Andrew Kelley
b01c50d6fa
find libc and zig std lib at runtime
...
this removes the following configure options:
* ZIG_LIBC_LIB_DIR
* ZIG_LIBC_STATIC_LIB_DIR
* ZIG_LIBC_INCLUDE_DIR
* ZIG_DYNAMIC_LINKER
* ZIG_EACH_LIB_RPATH
* zig's reliance on CMAKE_INSTALL_PREFIX
these options are still available as command line options, however,
the default will attempt to execute the system's C compiler to
collect system defaults for these values.
closes #870
2018-03-30 17:10:54 -04:00
Jimmi Holst Christensen
24071c6803
std.zig.parser parses all prefix operators
2018-03-30 21:45:42 +02:00
Jimmi Holst Christensen
1dfa927a67
std.zig.parser now treats call expr as a suffix operator
2018-03-30 20:47:09 +02:00
Andrew Kelley
f586acabdc
add ZIG_STATIC cmake option
...
it's not compatible with glibc but it works with musl
2018-03-30 13:20:13 -04:00
Jimmi Holst Christensen
edca173997
std.zig.parser now parses call expr
2018-03-29 23:40:46 +02:00
Jimmi Holst Christensen
8ada030971
Fixed self hosted compiler compiler error from prev commit
2018-03-29 22:37:54 +02:00
Jimmi Holst Christensen
530f795769
std.zig.parser now supports all infix operators
2018-03-29 22:31:17 +02:00
Andrew Kelley
b80398b355
Merge pull request #867 from zig-lang/rand-overhaul
...
Rewrite Rand functions
2018-03-29 14:14:35 -04:00
Andrew Kelley
ccadcbc715
fix examples and rename std.rand.Rand to std.rand.Random
2018-03-29 12:33:29 -04:00
Marc Tiehuis
0fd0f6fd1f
Rewrite Rand functions
...
We now use a generic Rand structure which abstracts the core functions
from the backing engine.
The old Mersenne Twister engine is removed and replaced instead with
three alternatives:
- Pcg32
- Xoroshiro128+
- Isaac64
These should provide sufficient coverage for most purposes, including a
CSPRNG using Isaac64. Consumers of the library that do not care about
the actual engine implementation should use DefaultPrng and DefaultCsprng.
2018-03-30 01:50:58 +13:00
Jimmi Holst Christensen
9df2a6a502
std.zig.parser can now parse top level test declarations
2018-03-29 13:43:17 +02:00
hellerve
7e951e5043
st/os: address @andrewrk concerns
2018-03-29 10:23:44 +02:00
Andrew Kelley
032fccf615
fix compile time array concatenation for slices
...
closes #866
2018-03-28 23:25:12 -04:00
Andrew Kelley
5627347bab
Merge pull request #865 from bnoordhuis/zig-build-stage2
...
skeleton stage 2 support for 'zig build'
2018-03-28 21:02:09 -04:00
Jimmi Holst Christensen
72ce146293
Fixed looking for windows sdk when targeting linux
2018-03-29 00:53:06 +02:00
Ben Noordhuis
b60b01ce97
skeleton stage 2 support for 'zig build'
...
Initial port of the 'zig build' logic from the stage 1 compiler to the
stage 2 compiler sans code generation and BUILD_INFO support.
2018-03-28 18:30:41 +02:00
Ben Noordhuis
db70b909a0
non-zero exit when build.zig cannot be created
...
Make the stage 1 compiler exit with a non-zero status code
when `zig build --init` cannot create a new build.zig file.
2018-03-28 18:30:41 +02:00
Andrew Kelley
f5b43ada46
std/os: getting dir entries works on OS X
2018-03-28 12:06:48 +02:00
Andrew Kelley
5b00dee0c2
std.math.cast handles signed integers
2018-03-27 15:20:07 -04:00
Andrew Kelley
6cb99fdac3
fix crash when compile error in analyzing @panic call
2018-03-27 15:07:45 -04:00
Andrew Kelley
0b7b3190fd
fix bitrotted code in unexpected error tracing
2018-03-27 10:44:13 -04:00
Andrew Kelley
c0a69a5075
Merge pull request #860 from jayschwa/patch-1
...
doc: fix typo and tighten wording in error sections
2018-03-25 23:31:12 -04:00
Jay Weisskopf
3e836f5516
doc: fix typo and tighten wording in error sections
...
Changes:
- Removed superfluous "when possible"
- Fixed typo in "documentationt"
- Added missing comma
- Moved definition of error union type up to first sentence
2018-03-25 18:48:07 -04:00
Andrew Kelley
aa2995ee39
fix invalid codegen for error return traces across suspend points
...
See #821
Now the code works correctly, but error return traces are missing
the frames from coroutines.
2018-03-24 22:07:12 -04:00
Andrew Kelley
a43c7af3d1
add comptime test for the type of suspend promise
2018-03-24 19:31:00 -04:00
Andrew Kelley
897e783763
add promise->T syntax parsing
...
closes #857
2018-03-24 19:25:53 -04:00
Andrew Kelley
18af2f9a27
fix async fns with inferred error sets
...
closes #856
2018-03-24 18:28:32 -04:00
Andrew Kelley
b1c07c0ea9
move error ret tracing codegen to zig ir
...
progress towards #821
2018-03-24 18:28:32 -04:00
Andrew Kelley
2cff31937f
std.os.linux exposes syscall functions and syscall numbers
2018-03-24 15:57:36 -04:00
Marc Tiehuis
7350181a4a
Fix os.File.mode function
2018-03-23 22:41:08 +13:00
Marc Tiehuis
3d1732ef6c
Fix OpqaueType usage in exported c functions
...
We prefer `struct typename`. If a typedef is required, this must be done
manually after generation.
2018-03-23 20:27:11 +13:00
Andrew Kelley
c541ac240c
use the llvm API for creating memcpy and memset instructions
2018-03-22 20:59:26 -04:00
Andrew Kelley
fe38d8142f
create multiple llvm.memcpy and llvm.memset with different align params
2018-03-22 20:22:15 -04:00
Andrew Kelley
7a99d63c76
ability to use async function pointers
...
closes #817
2018-03-22 16:56:03 -04:00
Andrew Kelley
62668e3e6b
update to llvm 7.0.0
2018-03-22 15:39:50 -04:00
Marc Tiehuis
53588f4f12
Add missing pub specifier to atan2
2018-03-22 19:18:51 +13:00
Andrew Kelley
f885a1ab61
change async function call syntax
...
* instead of `async(allocator) call()`, now it is
`async<allocator> call()`.
* Fixes syntax ambiguity when leaving off the allocator
* Fixes parse failure when call is a field access
This sets a precedent for using `<` to pass arguments
to a keyword. This will affect `enum`, `union`, and
`fn` (see #661 )
2018-03-21 19:56:41 -04:00
Andrew Kelley
66fec3a3d7
Merge pull request #851 from zig-lang/zen_stdlib
...
Zen specific hacks
2018-03-20 16:16:08 -04:00
Andrea Orru
43cdfa275a
Zen specific hacks
2018-03-20 16:09:30 -04:00
Andrew Kelley
1369fecccf
Merge pull request #847 from walac/master
...
Include libxml2 and zlib as required libraries
2018-03-20 16:05:15 -04:00
Wander Lairson Costa
543952eb87
Include libxml2 and zlib as required libraries
...
libxml2 is a required library, but we only find out that when the build
fails to link against it, if it is not present. The same for zlib.
We use find_library to find these two libraries and print nice fail
messages if they are not found.
2018-03-20 18:15:02 +00:00
Andrew Kelley
cb744f3a28
self-hosted build: print helpful message when libstdc++.a not found
...
closes #843
2018-03-20 13:48:25 -04:00
Andrew Kelley
71b4ee931e
Merge pull request #849 from zig-lang/zen_stdlib
...
Updates to the Zen standard library
2018-03-20 11:47:19 -04:00
Andrea Orru
0082ed0ef1
Public SplitIterator
2018-03-20 11:40:33 -04:00
Andrew Kelley
e966d375fb
Merge pull request #844 from ice1000/patch-1
...
Remove unnecessary rule and re-fix an old bug
2018-03-19 15:12:44 -04:00
Tesla Ice Zhang
c4544df011
Remove unnecessary rule and re-fix an old bug
...
The "old bug" is cause my last pr. I'm fixing it now.
2018-03-20 03:00:11 +08:00
Andrea Orru
935f10502f
Message type, Undefined mailbox, read syscall, more constructors
2018-03-18 14:45:23 -04:00
Andrew Kelley
d959faa4c7
add test for addIncludeDir for test step
2018-03-17 18:19:23 -04:00
Marc Tiehuis
bea9e9c7f8
Add addIncludeDir to TestStep + fix build template
...
Closes #794 .
2018-03-17 18:15:35 -04:00
Andrew Kelley
bbad0fa411
Merge pull request #839 from ice1000/patch-1
...
Fix typos in grammar section of langref
2018-03-17 14:44:17 -04:00
Andrew Kelley
453439a964
Merge pull request #840 from bnoordhuis/libdirs
...
add CLANG_LIBDIRS cmake build variable
2018-03-17 14:43:26 -04:00
Ben Noordhuis
c2c34c09b9
add LLVM_LIBDIRS to link directories
...
This seems to be the only way to get the zig build to link against llvm
libraries in a non-standard location.
2018-03-17 18:41:54 +01:00
Ben Noordhuis
4a921b2eba
add CLANG_LIBDIRS cmake build variable
...
Mirrors LLVM_LIBDIRS, tells cmake where to look for libclang libraries.
2018-03-17 18:41:47 +01:00
Tesla Ice Zhang
cc6ac77913
Fix some explicit errors
2018-03-17 23:17:07 +08:00
Andrea Orru
df3d2115b5
Service -> Server
2018-03-16 20:27:13 -07:00
Andrea Orru
81941f9161
Add Thread option for Mailboxes
2018-03-16 01:41:45 -07:00
Andrea Orru
ce88034716
Merge branch 'master' into zen_stdlib
2018-03-15 21:17:40 -07:00
Andrea Orru
4c16deed3e
Some POSIX stuff, including a primitive write
2018-03-15 17:57:56 -07:00
Andrew Kelley
f073923ea0
Release 0.2.0
2018-03-15 09:15:05 -04:00
Andrea Orru
681c62941e
subscribeIRQ support
2018-03-15 04:28:45 -07:00
Andrea Orru
9b7e4b535c
More precise naming
2018-03-15 02:22:03 -07:00
Andrea Orru
52ef1aadcb
Merge branch 'master' into zen_stdlib
2018-03-14 22:15:33 -07:00
Andrea Orru
4fcf01adc5
IPC structure updates
2018-03-14 22:07:17 -07:00
Andrew Kelley
50e25f6cec
add missing docs for setAlignStack builtin
2018-03-14 21:51:06 -04:00
Andrew Kelley
efebb6d341
fix tests broken by previous commit
2018-03-14 03:37:54 -04:00
Andrea Orru
c828c23f71
Tests for zero-bit field compiler error
2018-03-13 22:07:40 -07:00
Andrea Orru
7ac44037db
Compiler error when taking @offsetOf of void struct member
...
closes #739
2018-03-13 21:20:06 -07:00
Andrea Orru
2a6ad23b52
Merge branch 'master' of https://github.com/zig-lang/zig
2018-03-13 16:16:22 -07:00
Andrew Kelley
7f7823e23c
fix casting a function to a pointer causing compiler crash
...
closes #777
2018-03-13 19:15:20 -04:00
Andrea Orru
2cdd50c9b2
Panic instead of segfault when returning generic type from functions
...
closes #829
2018-03-13 16:14:21 -07:00
Marc Tiehuis
d6e84e325b
Add WebAssembly output workaround for LLVM 6
2018-03-13 21:53:42 +13:00
Andrew Kelley
bcce77700f
some return types disqualify comptime fn call caching
...
closes #828
2018-03-12 12:56:25 -04:00
Andrew Kelley
5834ff0cc5
don't memoize comptime fn calls that access comptime mutable state
...
closes #827
2018-03-12 08:35:41 -04:00
Andrew Kelley
1bf2810f33
fix comptime slicing not preserving comptime mutability
...
* fix comptime slice of slice not preserving mutatibility
of the comptime data
* fix comptime slice of pointer not preserving mutability
of the comptime data
closes #826
2018-03-12 01:21:10 -04:00
Andrew Kelley
49c3922037
fix incorrect setEvalBranchQuota compile error
...
closes #688
2018-03-12 00:08:52 -04:00
Andrea Orru
c18059a3dd
Merge branch 'master' of https://github.com/zig-lang/zig
2018-03-10 16:59:53 -08:00
Andrea Orru
d0621391bc
zen-specific: main -> _start
2018-03-10 16:59:28 -08:00
Andrew Kelley
5bc4f1e3f1
xml2 workaround is relevant for linux too
2018-03-10 18:23:08 -05:00
Andrea Orru
10fb1f2730
Merge branch 'test-ci'
2018-03-10 13:13:48 -08:00
Andrea Orru
152b408934
Simplify intrusive linked list test
2018-03-10 12:20:29 -08:00
Andrew Kelley
e4fd3fd52b
workaround for llvm-config missing xml2
2018-03-10 14:48:41 -05:00
Andrew Kelley
6288ad865c
change 5 to 6 in travis osx scripts
2018-03-10 14:36:59 -05:00
Andrew Kelley
84e952c230
fix await multithreaded data race
...
coro return was reading from a value that coro await was
writing to. that wasn't how it was designed to work, it
was an implementation mistake.
this commit also has some work-in-progress code for fixing
error return traces across suspend points.
2018-03-10 01:38:40 -05:00
Andrew Kelley
3b3649b86f
refactor stack trace code to remove global state
2018-03-10 01:38:40 -05:00
Andrew Kelley
60b2031831
improvements to stack traces
...
* @panic generates an error return trace
* printing an error return trace no longer interferes with
normal stack traces.
* instead of ignore_frame_count, we look at the return address
when you call panic, and that's the first stack trace function
makes stack traces much cleaner - the error return trace
flows gracefully into the stack trace
2018-03-10 01:38:40 -05:00
Andrew Kelley
20011a7a1c
add behavior test for coroutine frame allocation failure
2018-03-10 01:38:40 -05:00
Andrew Kelley
61a02d9d1e
omit pad zeroes in debug stack traces
2018-03-10 01:38:40 -05:00
Andrea Orru
f25c1c6858
Fixed syntax errors in linux-i386 syscalls
2018-03-09 22:25:21 -08:00
Andrea Orru
70c3008a00
Added 6 parameters syscalls for zen
2018-03-09 22:24:52 -08:00
Marc Tiehuis
7a893691c0
Unroll Sha3 inner loop
...
Issue #699 since fixed. Nearly a x3 perf improvement.
Using --release-fast.
Sha3_256 (before): 96 Mb/s
Sha3_256 (after): 267 Mb/s
Sha3_512 (before): 53 Mb/s
Sha3_512 (after): 142 Mb/s
No real gains from unrolling other initialization loops in crypto
functions so have been left as is.
2018-03-10 10:00:07 +13:00
Andrew Kelley
5a7a0e8518
update to SoftFloat-3e
...
closes #823
2018-03-09 15:06:06 -05:00
Andrew Kelley
6db9be8900
don't memoize comptime functions if they can mutate state via parameters
...
closes #639
2018-03-09 14:20:44 -05:00
Andrew Kelley
aaf2230ae8
fix partial inlining of binary math operator using old value
...
the code was abusing the internal IR API. fixed now.
closes #699
2018-03-08 17:15:55 -05:00
Andrew Kelley
028ec0f2c3
enums with 1 field and explicit tag type still get the tag type
...
closes #820
2018-03-08 15:22:42 -05:00
Andrew Kelley
aa9902b586
translate-c: add missing case labels
2018-03-08 11:47:07 -05:00
Andrew Kelley
2db28ea849
travis ci: update ubuntu llvm repo and CC,CXX env vars to 6
2018-03-08 11:46:47 -05:00
Andrew Kelley
3200ebc2ea
Merge branch 'llvm6'
...
Zig now depends on LLVM 6.0.0.
The latest commit that depends on LLVM 5.0.1 is
2e010c60ae .
2018-03-08 10:59:54 -05:00
Andrew Kelley
b57cb04afc
Merge remote-tracking branch 'origin/master' into llvm6
2018-03-08 10:59:24 -05:00
Jimmi Holst Christensen
2e010c60ae
Translate C now correctly converts ints, floats, ptrs and enums to bools
...
* Boolean "and" and "or" should also work with these types.
* This new method also simplifies to output code.
2018-03-08 15:34:00 +01:00
Jimmi Holst Christensen
b2887620f3
Translate C will now handle ignored return values
2018-03-08 13:15:30 +01:00
Jimmi Holst Christensen
689e241ff8
Merge branch 'master' of github.com:zig-lang/zig
2018-03-08 10:29:43 +01:00
Jimmi Holst Christensen
51b2f1b80b
Translate C can now translate switch statements again
2018-03-08 10:29:29 +01:00
Andrew Kelley
790aaeacae
add compile error for using @tagName on extern union
...
closes #742
2018-03-07 14:35:48 -05:00
Jimmi Holst Christensen
bb80daf509
Ast Render no longer outputs erroneous semicolon
...
closes #813
2018-03-07 10:39:32 +01:00
Andrew Kelley
d96dd5bc32
fix missing compile error for returning error from void async function
...
closes #799
2018-03-06 21:44:27 -05:00
Andrew Kelley
6b5cfd9d99
turn assertion into compile error for using var as return type
...
closes #758
2018-03-06 20:41:49 -05:00
Andrew Kelley
eff3530dfa
var is no longer a pseudo-type, it is syntax
...
closes #779
2018-03-06 18:31:31 -05:00
Andrew Kelley
44ae891bd7
fix assertion when taking slice of zero-length array
...
closes #788
2018-03-06 17:19:45 -05:00
Andrew Kelley
cc0f660ad2
unless hf is specified in target environ, assume soft floating point
...
closes #804
2018-03-06 16:57:41 -05:00
Andrew Kelley
5d5820029d
fix broken tests from previous commit
2018-03-06 16:46:45 -05:00
Andrew Kelley
07e47c058c
ptrCast builtin now gives an error for removing const qualifier
...
closes #384
2018-03-06 16:37:03 -05:00
Andrew Kelley
46e258c9f7
Merge pull request #815 from Hejsil/more-translate-c
...
Translate C now handles bools better
2018-03-06 10:43:52 -05:00
Andrew Kelley
c3807dfb34
remove value judgement from std lib API docs
...
documentation should be purely technical, and not contain opinions about
how easy or hard something is.
2018-03-06 10:41:07 -05:00
Jimmi Holst Christensen
1d378d8f26
Removed fixed todo
2018-03-06 12:33:09 +01:00
Jimmi Holst Christensen
5ab25798e3
We now also use trans_to_bool_expr on bool not
2018-03-06 12:04:14 +01:00
Jimmi Holst Christensen
bf47cf418a
expr to bool is now it's own function.
...
* Now while and for loops work on ints and floats, like if statements
* This fixes the loop problem in #813
2018-03-06 11:57:51 +01:00
Jimmi Holst Christensen
61ecc48671
Added appropriate TODO comment to UO_LNot
2018-03-06 11:15:13 +01:00
Jimmi Holst Christensen
ed1386eeff
Simple translation of UO_LNot
2018-03-06 11:13:10 +01:00
Andrew Kelley
d34d36619e
Merge pull request #814 from jacobdufault/utf8-view
...
Make Utf8View public, add comments, and make iterator lowercase.
2018-03-06 01:42:04 -05:00
Jacob Dufault
8fd7e9115c
Make Utf8View public, add comments, and make iterator lowercase.
2018-03-05 21:42:01 -08:00
Joshua Olson
c787837ce5
Clarify what is meant by 'libraries' ( #808 )
2018-03-04 19:26:16 -05:00
Joshua Olson
db18d38a43
Fix Linux gcc requirement ( #807 )
...
g++ may be a separate package. I had this problem on Fedora.
2018-03-04 17:46:17 -05:00
Andrew Kelley
73a306e2fa
fix conflict artifact accidentally in appveyor script
2018-03-03 17:44:41 -05:00
Andrew Kelley
7ee1b88042
add llvm 6.0.0 binaries to appveyor cache
2018-03-03 16:43:57 -05:00
Andrew Kelley
1c244d34b3
Merge branch 'master' into llvm6
2018-03-03 16:30:59 -05:00
Andrew Kelley
56645c1701
std.debug.dwarf supports line number version 4
...
fixes stack traces for llvm6 generated zig programs
2018-03-02 16:26:22 -05:00
Andrew Kelley
101b7745c4
add optnone noinline to async functions
...
this works around LLVM optimization assertion failures.
https://bugs.llvm.org/show_bug.cgi?id=36578
closes #800
2018-03-02 13:40:03 -05:00
Andrew Kelley
a217c764db
Merge remote-tracking branch 'origin/master' into llvm6
2018-03-01 22:25:15 -05:00
Andrew Kelley
7d494b3e7b
Merge branch 'async'
...
closes #727
2018-03-01 21:55:15 -05:00
Andrew Kelley
de5c0c9f40
Merge remote-tracking branch 'origin/master' into async
2018-03-01 20:47:35 -05:00
Andrew Kelley
6bade0b825
coroutines: add await early test case
2018-03-01 16:17:38 -05:00
Andrew Kelley
8a0e1d4c02
await keyword works
2018-03-01 15:46:35 -05:00
Andrew Kelley
a7c87ae1e4
fix not casting result of llvm.coro.promise
2018-03-01 10:23:47 -05:00
Andrew Kelley
253d988e7c
implementation of await
...
but it has bugs
2018-03-01 03:28:13 -05:00
Andrew Kelley
834e992a7c
add test for coroutine suspend with block
2018-02-28 22:26:26 -05:00
Andrew Kelley
8429d4ceac
implement coroutine resume
2018-02-28 22:18:48 -05:00
Andrew Kelley
c622766156
async function fulfills promise atomically
2018-02-28 21:48:20 -05:00
Andrew Kelley
807a5e94e9
add atomicrmw builtin function
2018-02-28 21:19:51 -05:00
Andrew Kelley
36eadb569a
run coroutine tests only in Debug mode
...
LLVM 5.0.1, 6.0.0, and trunk crash when attempting to optimize coroutine code.
So, Zig does not support ReleaseFast or ReleaseSafe for coroutines yet.
Luckily, Clang users are running into the same crashes, so folks from the LLVM
community are working on fixes. If we're really lucky they'll be fixed in 6.0.1.
Otherwise we can hope for 7.0.0.
2018-02-28 18:56:26 -05:00
Andrew Kelley
58dc2b719c
better coroutine codegen, now passing first coro test
...
we have to use the Suspend block with llvm.coro.end to
return from the coro
2018-02-28 18:22:43 -05:00
Andrew Kelley
ad2a29ccf2
break the data dependencies that llvm coro transforms cant handle
...
my simple coro test program builds now
see #727
2018-02-28 16:47:13 -05:00
Andrew Kelley
026aebf2ea
another workaround for llvm coroutines
...
this one doesn't work either
2018-02-28 04:01:22 -05:00
Andrew Kelley
6568be575c
Merge branch 'bnoordhuis-fix795'
2018-02-28 00:29:20 -05:00
Andrew Kelley
556f22a751
different way of fixing previous commit
...
get_fn_type doesn't need the complete parameter type, it
can just ensure zero bits known.
2018-02-28 00:28:26 -05:00
Andrew Kelley
1b8a241f6f
Merge branch 'fix795' of https://github.com/bnoordhuis/zig into bnoordhuis-fix795
2018-02-28 00:22:53 -05:00
Andrew Kelley
0f449a3ec1
Merge pull request #796 from bnoordhuis/fix731-more
...
allow implicit cast from &const to ?&const &const
2018-02-27 23:55:03 -05:00
Ben Noordhuis
90598b4631
fix assert on self-referencing function ptr field
...
The construct `struct S { f: fn(S) void }` is not legal because structs
are not copyable but it should not result in an ICE.
Fixes #795 .
2018-02-28 00:56:00 +01:00
Andrew Kelley
d243453862
Revert "llvm coroutine workaround: sret functions return sret pointer"
...
This reverts commit 132e604aa3 .
this workaround didn't work either
2018-02-27 17:47:18 -05:00
Andrew Kelley
138d6f9093
revert workaround for alloc and free as coro params
...
reverts 4ac6c4d6bf
the workaround didn't work
2018-02-27 17:46:13 -05:00
Andrew Kelley
132e604aa3
llvm coroutine workaround: sret functions return sret pointer
2018-02-27 17:12:53 -05:00
Andrew Kelley
6e2a67724c
Revert "another llvm workaround for getelementptr"
...
This reverts commit c2f5634fb3 .
It doesn't work. With this, LLVM moves the allocate fn call
to after llvm.coro.begin
2018-02-27 14:58:02 -05:00
Andrew Kelley
c2f5634fb3
another llvm workaround for getelementptr
2018-02-27 14:57:49 -05:00
Andrew Kelley
439621e44a
remove signal hanlding stuff from std.os.ChildProcess
2018-02-27 11:14:14 -05:00
Andrew Kelley
4e43bde924
workaround for llvm: delete coroutine allocation elision
...
maybe this can be reverted, but it seems to be related
to llvm's coro transformations crashing.
See #727
2018-02-26 21:31:00 -05:00
Andrew Kelley
4ac6c4d6bf
workaround llvm coro transformations
...
by making alloc and free functions be parameters to async
functions instead of using getelementptr in the DynAlloc block
See #727
2018-02-26 21:14:15 -05:00
Ben Noordhuis
9aa65c0e8e
allow implicit cast from &const to ?&const &const
...
Allow implicit casts from n-th degree const pointers to nullable const
pointers of degree n+1. That is:
fn f() void {
const s = S {};
const p = &s;
g(p); // Works.
g(&p); // So does this.
}
fn g(_: ?&const &const S) void { // Nullable 2nd degree const ptr.
}
Fixes #731 some more.
2018-02-26 19:56:26 +01:00
Andrew Kelley
1eecfdaa9b
Merge pull request #785 from bnoordhuis/fix731
...
allow implicit cast from `S` to `?&const S`
2018-02-26 03:20:46 -05:00
Andrew Kelley
3e86fb500d
implement coroutine suspend
...
see #727
2018-02-26 02:46:21 -05:00
Andrew Kelley
c60496a297
parse await and suspend syntax
...
See #727
2018-02-26 00:04:11 -05:00
Andrew Kelley
6fef7406c8
move coroutine init code to after coro.begin
2018-02-25 20:29:14 -05:00
Andrew Kelley
6b436146a8
fix invalid memory write in coroutines implementation
2018-02-25 20:28:44 -05:00
Andrew Kelley
6cbea99ed6
async functions are allowed to accept zig types
2018-02-25 20:27:53 -05:00
Andrew Kelley
b018c64ca2
add coroutine LLVM passes
2018-02-25 18:09:39 -05:00
Andrew Kelley
fe354ebb5c
coroutines: fix llvm error of instruction not dominating uses
...
See #727
2018-02-25 17:57:05 -05:00
Andrew Kelley
704a8acb59
fix handle_is_ptr for promise type
2018-02-25 17:34:18 -05:00
Andrew Kelley
83f8906449
codegen for coro_resume instruction
...
See #727
2018-02-25 17:34:05 -05:00
Andrew Kelley
4eac75914b
codegen for coro_free instruction
...
See #727
2018-02-25 16:46:01 -05:00
Andrew Kelley
d2d2ba10e9
codegen for coro_end instruction
...
See #727
2018-02-25 16:40:00 -05:00
Andrew Kelley
0cf327eb17
codegen for coro_suspend instruction
...
See #727
2018-02-25 16:29:07 -05:00
Andrew Kelley
d0f2eca106
codegen for coro_begin instruction
...
See #727
2018-02-25 16:22:19 -05:00
Andrew Kelley
79f1ff574b
codegen for coro_alloc_fail instruction
...
See #727
2018-02-25 16:15:14 -05:00
Andrew Kelley
bced3fb64c
codegen for get_implicit_allocator instruction
...
See #727
2018-02-25 16:05:10 -05:00
Andrew Kelley
93cbd4eeb9
codegen for coro_alloc and coro_size instructions
...
See #727
2018-02-25 15:20:31 -05:00
Andrew Kelley
9f6c5a20de
codegen for coro_id instruction
...
See #727
2018-02-25 15:10:29 -05:00
Andrew Kelley
7567448b91
codegen for cancel
...
See #727
2018-02-25 14:47:58 -05:00
Andrew Kelley
05bf666eb6
codegen for calling an async function
...
See #727
2018-02-25 02:47:31 -05:00
Marc Tiehuis
08d595b472
Add utf8 string view
2018-02-24 11:32:01 -07:00
Andrew Kelley
8db7a1420f
update errors section of docs
...
closes #768
2018-02-23 20:43:47 -05:00
Andrew Kelley
4955c4b8f9
update C headers to clang 6.0.0rc3
2018-02-23 13:15:16 -05:00
Andrew Kelley
1ba6e1641a
LLD patch: workaround for buggy MACH-O code
...
This reapplies 1a1414fc42
to the embedded LLD.
2018-02-23 13:05:17 -05:00
Andrew Kelley
a33b689f2c
update embedded LLD to 6.0.0rc3
2018-02-23 13:04:47 -05:00
Andrew Kelley
9cfd7dea19
Merge remote-tracking branch 'origin/master' into llvm6
2018-02-23 12:56:41 -05:00
Andrew Kelley
78bc62fd34
Revert "workaround on windows for llvm6 missing advapi32.lib in llvm-config"
...
This reverts commit eaac218d59 .
This is fixed now in llvm6 rc3
2018-02-23 12:55:58 -05:00
Andrew Kelley
40dbcd09da
fix type_is_codegen_pointer being used incorrectly
...
The names of these functions should probably change, but at least
the semantics are correct now:
* type_is_codegen_pointer - the type is either a fn, ptr, or promise
* get_codegen_ptr_type -
- ?&T and &T returns &T
- ?promise and promise returns promise
- ?fn()void and fn()void returns fn()void
- otherwise returns nullptr
2018-02-23 12:49:21 -05:00
Ben Noordhuis
f11b948019
allow implicit cast from S to ?&const S
...
Allow implicit casts from container types to nullable const pointers to
said container type. That is:
fn f() void {
const s = S {};
g(s); // Works.
g(&s); // So does this.
}
fn g(_: ?&const S) void { // Nullable const pointer.
}
Fixes #731 .
2018-02-23 15:55:57 +01:00
Andrew Kelley
99985ad6fc
implement Zig IR for async functions
...
See #727
2018-02-23 03:03:06 -05:00
Andrew Kelley
b66547e98c
Merge pull request #783 from bnoordhuis/fix675
...
name types inside functions after variable
2018-02-22 14:26:45 -05:00
Ben Noordhuis
0845cbe277
name types inside functions after variable
...
Before this commit:
fn f() []const u8 {
const S = struct {};
return @typeName(S); // "f()", unexpected.
}
And now:
fn f() []const u8 {
const S = struct {};
return @typeName(S); // "S", expected.
}
Fixes #675 .
2018-02-22 19:54:02 +01:00
Andrew Kelley
ca1b77b2d5
IR analysis for coro.begin
...
See #727
2018-02-22 11:54:27 -05:00
Andrew Kelley
88e7b9bf80
ir analysis for coro_id and coro_alloc
...
See #727
2018-02-22 09:36:58 -05:00
Andrew Kelley
37c07d4f3f
coroutines: analyze get_implicit_allocator instruction
...
see #727
2018-02-22 09:30:55 -05:00
Andrew Kelley
b261da0672
add coroutine startup IR to async functions
...
See #727
2018-02-21 23:28:35 -05:00
Andrew Kelley
884b5fb4cf
Merge branch 'bnoordhuis-macho'
2018-02-21 02:00:52 -05:00
Andrew Kelley
623466762e
clean up mach-o stack trace code
2018-02-21 02:00:33 -05:00
Andrew Kelley
236bbe1183
implement IR analysis for async function calls
...
See #727
2018-02-21 00:52:20 -05:00
Andrew Kelley
65a51b401c
add promise type
...
See #727
2018-02-20 16:42:14 -05:00
Andrew Kelley
a06f3c74fd
parse async fn definitions
...
See #727
2018-02-20 00:31:52 -05:00
Andrew Kelley
3d58d7232a
parse async fn calls and cancel expressions
2018-02-20 00:05:38 -05:00
Andrew Kelley
af10b0fec2
add async, await, suspend, resume, cancel keywords
...
See #727
2018-02-19 23:19:59 -05:00
Ben Noordhuis
2b35615ffb
fix memory leak in std.debug.openSelfDebugInfo()
2018-02-19 23:11:11 +01:00
Ben Noordhuis
ab48934e9c
add support for stack traces on macosx
...
Add basic address->symbol resolution support. Uses symtab data from the
MachO image, not external dSYM data; that's left as a future exercise.
The net effect is that we can now map addresses to function names but
not much more. File names and line number data will have to wait until
a future pull request.
Partially fixes #434 .
2018-02-19 23:11:11 +01:00
Andrew Kelley
bde15cf080
improve std lib linux epoll API
2018-02-17 17:53:07 -05:00
Andrew Kelley
72ca2b214d
ability to slice an undefined pointer at compile time if the len is 0
2018-02-16 15:22:29 -05:00
Andrew Kelley
cbbd6cfa1e
add an assert to catch #777
...
asserting is better than segfaulting
2018-02-15 23:39:35 -05:00
Andrew Kelley
5f5880979e
zig fmt supports simple line comments
2018-02-15 12:30:29 -05:00
Andrew Kelley
cc26148ba7
fix compiler crash when struct contains...
...
ptr to another struct which contains original struct
2018-02-15 12:14:20 -05:00
Andrew Kelley
1c1c0691cc
fix crash when doing comptime float rem comptime int
...
closes #776
2018-02-14 23:12:51 -05:00
Andrew Kelley
ca597e2bfb
std.zig.parser understands try. zig fmt respects a double line break.
2018-02-14 23:00:53 -05:00
Andrew Kelley
9fa35adbd4
fix sometimes not type checking function parameters
...
closes #774
regression introduced in cfb2c67692
2018-02-14 16:24:43 -05:00
Andrew Kelley
629f134d38
std.zig.parser understands inferred return type and error inference
2018-02-14 15:50:40 -05:00
Andrew Kelley
e8d81c5acf
fix build broken by previous commit
2018-02-14 13:55:06 -05:00
Andrew Kelley
d790670f4c
self hosted parser: support string literals
2018-02-14 13:43:05 -05:00
Andrew Kelley
1a53c648ed
self hosted parser supports builtin fn call with no args
2018-02-14 09:45:10 -05:00
Andrew Kelley
e7ab2bc553
Merge remote-tracking branch 'origin/master' into llvm6
2018-02-13 11:53:20 -05:00
Andrew Kelley
c721354b73
correct doc comment in self hosted parser
2018-02-13 11:17:26 -05:00
Andrew Kelley
02f70cda8a
zig_llvm.cpp uses new(std::nothrow)
...
This fixes a mismatched malloc/delete because
we were allocating with malloc and then llvm was
freeing with delete.
2018-02-13 10:54:46 -05:00
Andrew Kelley
2dcff95bd2
self hosted: add tokenizer test fix eof handling
2018-02-13 10:28:55 -05:00
Andrew Kelley
dfbb8254ca
fix self hosted tokenizer handling of EOF
2018-02-12 21:26:15 -05:00
Andrew Kelley
7903a758a4
Merge remote-tracking branch 'origin/master' into llvm6
2018-02-12 17:00:02 -05:00
Andrew Kelley
b4e44c4e80
self hosted parser tests every combination of memory allocation failure
2018-02-12 13:31:50 -05:00
Andrew Kelley
eaac218d59
workaround on windows for llvm6 missing advapi32.lib in llvm-config
2018-02-12 11:05:28 -05:00
Andrew Kelley
491d818f17
Merge remote-tracking branch 'origin/master' into llvm6
2018-02-12 10:48:02 -05:00
Andrew Kelley
ec0846a00f
std.heap.ArenaAllocator: fix incorrectly activating safety check
2018-02-12 03:21:18 -05:00
Andrew Kelley
227ead54be
back to malloc instead of aligned_alloc for c_allocator
...
it seems that a 7 years old standard is still too new for the
libc variants that are ubiquitous
(tests failing on macos for not providing C11 ABI)
2018-02-12 03:15:12 -05:00
Andrew Kelley
4a4ea92cf3
remove std.heap.IncrementingAllocator
...
Use std.heap.FixedBufferAllocator combined with
std.heap.DirectAllocator instead.
std.mem.FixedBufferAllocator is moved to std.heap.FixedBufferAllocator
2018-02-12 02:44:31 -05:00
Andrew Kelley
445b03384a
introduce std.heap.ArenaAllocator and std.heap.DirectAllocator
...
* DirectAllocator does the underlying syscall for every allocation.
* ArenaAllocator takes another allocator as an argument and
allocates bytes up front, falling back to DirectAllocator with
increasingly large allocation sizes, to avoid calling it too often.
Then the entire arena can be freed at once.
The self hosted parser is updated to take advantage of ArenaAllocator
for the AST that it returns. This significantly reduces the complexity
of cleanup code.
docgen and build runner are updated to use the combination of
ArenaAllocator and DirectAllocator instead of IncrementingAllocator,
which is now deprecated in favor of FixedBufferAllocator combined
with DirectAllocator.
The C allocator calls aligned_alloc instead of malloc, in order to
respect the alignment parameter.
Added asserts in Allocator to ensure that implementors of the
interface return slices of the correct size.
Fixed a bug in Allocator when you call realloc to grow the allocation.
2018-02-12 02:14:44 -05:00
Andrew Kelley
ef6260b3a7
Merge remote-tracking branch 'origin/master' into llvm6
2018-02-11 23:49:20 -05:00
Andrew Kelley
f2d601661d
fix exported variable not named in the object file
...
closes #771
2018-02-11 16:46:02 -05:00
Andrew Kelley
e743b30bbf
std: refactor posixOpen to be friendlier to error return traces
2018-02-11 05:26:51 -05:00
Andrew Kelley
46aa416c48
std.os and std.io API update
...
* move std.io.File to std.os.File
* add `zig fmt` to self hosted compiler
* introduce std.io.BufferedAtomicFile API
* introduce std.os.AtomicFile API
* add `std.os.default_file_mode`
* change FileMode on posix from being a usize to a u32
* add std.os.File.mode to return mode of an open file
* std.os.copyFile copies the mode from the source file instead of
using the default file mode for the dest file
* move `std.os.line_sep` to `std.cstr.line_sep`
2018-02-10 21:02:24 -05:00
Andrew Kelley
8c31eaf2a8
std zig tokenizer: don't require 3 newlines at the end of the source
2018-02-10 14:52:39 -05:00
Andrew Kelley
a2bd9f8912
std lib: modify allocator idiom
...
Before we accepted a nullable allocator for some stuff like
opening files. Now we require an allocator.
Use the mem.FixedBufferAllocator pattern if a bound on the amount
to allocate is known.
This also establishes the pattern that usually an allocator is the
first argument to a function (possibly after "self").
fix docs for std.cstr.addNullByte
self hosted compiler:
* only build docs when explicitly asked to
* clean up main
* stub out zig fmt
2018-02-09 18:27:50 -05:00
Andrew Kelley
e7bf8f3f04
fix compiler crash switching on global error with no else
2018-02-09 13:49:58 -05:00
Andrew Kelley
1fb308ceee
self hosted compiler: move tokenization and parsing to std lib
2018-02-09 13:08:02 -05:00
Andrew Kelley
3919afcad2
fix crash with error peer type resolution
...
closes #765
2018-02-09 11:16:04 -05:00
Andrew Kelley
2c697e50db
appveyor: don't try to build for mingw
...
pacman is giving me:
:: msys2-runtime and catgets are in conflict.
Remove catgets? [y/N] error: unresolvable package conflicts detected
error: failed to prepare transaction (conflicting dependencies)
2018-02-09 01:15:17 -05:00
Andrew Kelley
5911962842
Merge pull request #759 from zig-lang/error-sets
...
Error Sets
2018-02-09 00:47:57 -05:00
Andrew Kelley
8e554561df
appveyor: answer Yes to all pacman questions
2018-02-09 00:47:13 -05:00
Andrew Kelley
32c988a2d7
fix build runner on windows
2018-02-09 00:24:23 -05:00
Andrew Kelley
916d24cd21
add compile error tests for error sets
2018-02-08 23:44:21 -05:00
Andrew Kelley
4b16874f04
add test for comptime err to int with only 1 member of set
2018-02-08 22:44:15 -05:00
Andrew Kelley
ee982ae162
syntax: parse ?error!i32 as ?(error!i32)
2018-02-08 22:30:08 -05:00
Andrew Kelley
0efe441dfd
if statements support comptime known test error, runtime payload
2018-02-08 22:18:13 -05:00
Andrew Kelley
54c06bf715
error sets: runtime safety for int-to-err and err set cast
2018-02-08 21:54:44 -05:00
Andrew Kelley
8fc6e31567
std: fix return type of std.c.write
2018-02-08 20:46:12 -05:00
Andrew Kelley
f9be970375
Merge remote-tracking branch 'origin/master' into error-sets
2018-02-08 20:45:26 -05:00
Andrew Kelley
57edd4dcb3
error sets - fix bad value for constant error literal
2018-02-08 18:13:07 -05:00
Marc Tiehuis
1c236b0766
Add ArrayList functions ( #755 )
...
at - Get the item at the n-th index.
insert - Insert and item into the middle of the list, resizing and copying
existing elements if needed.
insertSlice - Insert a slice into the middle of the list, resizing and
copying existing elements if needed.
2018-02-08 11:22:31 -05:00
Andrew Kelley
fee875770c
error set casting building
2018-02-08 11:09:18 -05:00
Andrew Kelley
76239f2089
error sets - update langref. all tests passing
2018-02-08 03:02:41 -05:00
Andrew Kelley
0d5ff6f462
error sets - most tests passing
2018-02-08 02:08:45 -05:00
Andrew Kelley
68238d5678
fix comptime fn execution not returning error unions properly
2018-02-07 22:33:05 -05:00
Ben Noordhuis
dd20f558f0
implement openSelfExe() on darwin ( #753 )
2018-02-07 18:14:32 -05:00
Jeff Fowler
c88e6e8aee
improve behavior of zig build ( #754 )
...
See #748
2018-02-07 17:45:20 -05:00
Andrew Kelley
5d9e3cb77f
LLD patch: workaround for buggy MACH-O code
...
This reapplies 1a1414fc42
to the embedded LLD.
2018-02-07 17:38:33 -05:00
Andrew Kelley
38aed5af8b
update embedded LLD to 6.0.0rc2
2018-02-07 17:38:02 -05:00
Andrew Kelley
aa043a6339
Merge remote-tracking branch 'origin/master' into llvm6
2018-02-07 17:27:30 -05:00
Ben Noordhuis
79ad1d9610
format struct pointers as "<typename>@<address>" ( #752 )
2018-02-07 16:18:48 -05:00
Ben Noordhuis
0090c2d70b
DRY 'is slice?' conditionals in parser ( #750 )
2018-02-07 14:38:49 -05:00
Andrew Kelley
f99b8b006f
error sets - fix most std lib compile errors
2018-02-05 18:09:13 -05:00
Andrew Kelley
6940212ecb
error sets: fix peer resolution of error unions
2018-02-05 17:42:13 -05:00
Andrew Kelley
917e6fe370
handle linux returning EINVAL for large writes
...
See #743
2018-02-05 13:21:08 -05:00
Andrew Kelley
40e4e42a66
handle linux returning EINVAL for large reads
...
see #743
2018-02-05 12:48:29 -05:00
Andrew Kelley
44d8d654a0
fix test failure, organize code, add new compile error
2018-02-05 09:26:39 -05:00
Andrew Kelley
ec59f76526
Merge pull request #743 from bnoordhuis/linux-random
...
Use /dev/urandom and sysctl(RANDOM_UUID) on Linux.
2018-02-05 08:09:10 -05:00
Andrew Kelley
b7bc259093
make OutStream and InStream take an error set param
2018-02-05 07:38:24 -05:00
Andrew Kelley
893f1088df
error sets - peer resolution for error unions
2018-02-05 01:49:14 -05:00
Andrew Kelley
15075d2c3d
error sets - compile error for equality with no common errors
2018-02-05 00:05:04 -05:00
Andrew Kelley
31abef172a
fix accidentally linking against kernel32 on non windows
2018-02-04 22:13:21 -05:00
Andrew Kelley
21ce559c9c
add --forbid-library
...
to help track down accidentally linking against a library
2018-02-04 22:06:03 -05:00
Ben Noordhuis
73ee434c8c
Use /dev/urandom and sysctl(RANDOM_UUID) on Linux.
...
Add fallback paths for when the getrandom(2) system call is not
available. Try /dev/urandom first and sysctl(RANDOM_UUID) second.
The sysctl issues a warning in the system logs with some kernels but
that seems like an acceptable tradeoff for the fallback of a fallback.
2018-02-04 18:58:36 +01:00
Andrew Kelley
61718742f7
*WIP* error sets - std lib test compile but try to link against windows
2018-02-03 14:42:20 -05:00
Andrew Kelley
ef5e7bb469
*WIP* error sets - an inferred error set can end up being the global one
2018-02-03 14:06:37 -05:00
Andrew Kelley
abf5ae6897
*WIP* error sets - support fns called at comptime
2018-02-03 11:51:29 -05:00
Andrew Kelley
b8f59e14cd
*WIP* error sets - correctly resolve inferred error sets
2018-02-02 18:13:32 -05:00
Andrew Kelley
39d5f44863
*WI* error sets - basic support working
2018-02-02 14:26:14 -05:00
Andrew Kelley
cfb2c67692
*WIP* error sets - rewrite "const cast only" function
2018-02-02 11:50:19 -05:00
Andrew Kelley
15eb28efaf
Merge pull request #738 from corngood/cygwin-fixes
...
make lld include paths private
2018-02-02 10:53:54 -05:00
David McFarland
4ec856b0f0
make lld include paths private
...
This fixes a build failure on cygwin caused by <string.h> -> <strings.h> taking
the latter from one of the lld paths.
2018-02-02 10:49:31 -04:00
Andrew Kelley
406496ca33
*WIP* error sets - allow peer type resolution to create new error set
2018-02-01 23:32:09 -05:00
Andrew Kelley
13b36d458f
*WIP* error sets - fix implicit cast
2018-02-01 10:23:25 -05:00
Andrew Kelley
5f518dbeb9
*WIP* error sets converting std lib
2018-01-31 22:48:40 -05:00
Andrew Kelley
02b61224b2
add docs for memberType, memberCount, memberName
2018-01-31 20:56:53 -05:00
Andrew Kelley
e6d4028a84
docs: move source encoding section
2018-01-31 20:42:27 -05:00
Andrew Kelley
3a11757d57
add docs recommending to only have 1 cImport
2018-01-31 20:18:47 -05:00
Andrew Kelley
a795e4ce32
add some docs for reflection
2018-01-31 11:47:56 -05:00
Andrew Kelley
44f38b04b0
fix assertion fail when using global var number literal
...
closes #697
2018-01-31 11:13:39 -05:00
Andrew Kelley
5161d70620
*WIP* error sets
2018-01-31 01:51:31 -05:00
Andrew Kelley
40ca39d3d5
fix error message mentioning unreachable instead of noreturn
2018-01-31 01:44:52 -05:00
Andrew Kelley
3ef6a00bb8
add compile error for duplicate struct, enum, union fields
...
closes #730
2018-01-30 11:52:03 -05:00
Andrew Kelley
0995a81b8b
langref: remove page title header
2018-01-30 10:31:01 -05:00
Andrew Kelley
d6b7d9090e
Merge pull request #729 from zig-lang/www-changes
...
Improve documentation styling for mobile devices
2018-01-30 01:06:20 -05:00
Andrea Orru
7eea20bc50
Add IntrusiveLinkedList to index.zig
2018-01-29 21:02:57 -08:00
Marc Tiehuis
5e9f87c3bd
Improve documentation styling for mobile devices
...
- No overscrolling on small screens
- Font-size is reduced for more content per screen
- Tables + Code blocks scroll within a block to avoid page-widenening
2018-01-30 17:33:38 +13:00
Andrew Kelley
1c60f31450
add compile error for calling naked function
2018-01-29 14:01:12 -05:00
Andrew Kelley
96c9a9bdb3
Merge remote-tracking branch 'origin/master' into llvm6
2018-01-29 13:26:09 -05:00
Andrew Kelley
2b5e0b66a2
std: fix fn return syntax for zen os
2018-01-29 10:57:27 -05:00
Andrew Kelley
abe6c2d585
allow packed containers in extern functions
2018-01-29 10:57:09 -05:00
Andrew Kelley
f66ac9a5e7
fix crash when align 1 field before self referential...
...
...align 8 field as slice return type
closes #723
2018-01-27 18:30:36 -05:00
Andrew Kelley
ad3e2a5da0
fix compiler crash on function with invalid return type
...
closes #722
2018-01-26 10:37:18 -05:00
Andrew Kelley
47be64af5a
Merge remote-tracking branch 'origin/master' into llvm6
2018-01-25 11:51:41 -05:00
Andrew Kelley
f7670882af
Merge pull request #720 from zig-lang/require-return-type
...
syntax: functions require return type. remove `->`
2018-01-25 10:03:26 -05:00
Andrew Kelley
3671582c15
syntax: functions require return type. remove ->
...
The purpose of this is:
* Only one way to do things
* Changing a function with void return type to return a possible
error becomes a 1 character change, subtly encouraging
people to use errors.
See #632
Here are some imperfect sed commands for performing this update:
remove arrow:
```
sed -i 's/\(\bfn\b.*\)-> /\1/g' $(find . -name "*.zig")
```
add void:
```
sed -i 's/\(\bfn\b.*\))\s*{/\1) void {/g' $(find ../ -name "*.zig")
```
Some cleanup may be necessary, but this should do the bulk of the work.
2018-01-25 04:10:11 -05:00
Andrew Kelley
e5bc5873d7
rename "debug safety" to "runtime safety"
...
closes #437
2018-01-25 01:46:12 -05:00
Andrew Kelley
b71a56c9df
cleanups that I meant to put in the previous commit
2018-01-23 23:12:38 -05:00
Andrew Kelley
b3a6faf13e
replace %defer with errdefer
...
See #632
now we have 1 less sigil
2018-01-23 23:08:09 -05:00
Andrew Kelley
ad2527d47a
clean up readme
2018-01-23 22:56:03 -05:00
Andrew Kelley
c2838f2442
fix printf format specifier
2018-01-23 11:40:22 -05:00
Andrew Kelley
b8dcdc75c1
Merge pull request #716 from zig-lang/export-c-additions
...
Add array type handling for gen_h
2018-01-23 09:20:57 -05:00
Marc Tiehuis
470ec91164
Add array type handling for gen_h
2018-01-23 23:38:20 +13:00
Andrew Kelley
fa7072f3f2
docgen: verify internal links
2018-01-22 23:06:07 -05:00
Andrew Kelley
cf39819478
add new kind of test: generating .h files. and more
...
* docgen supports obj_err code kind for demonstrating
errors without explicit test cases
* add documentation for `extern enum`. See #367
* remove coldcc keyword and add @setIsCold. See #661
* add compile errors for non-extern struct, enum, unions
in function signatures
* add .h file generation for extern struct, enum, unions
2018-01-22 22:24:07 -05:00
Andrew Kelley
cacba6f435
fix crash on union-enums with only 1 field
...
closes #713
2018-01-22 17:23:23 -05:00
Andrew Kelley
b52bffcf8d
appveyor: add language reference to build artifacts
2018-01-22 16:14:06 -05:00
Andrew Kelley
5b7ae86af4
fix crash when switching on enum with 1 field and no switch prongs
...
closes #712
2018-01-21 14:44:24 -05:00
Andrew Kelley
517e8ea426
remove unused function, fixes mingw build
2018-01-20 02:49:53 -05:00
Andrew Kelley
ddd04a7b46
fix docgen on windows
2018-01-19 22:17:31 -05:00
Andrew Kelley
ec27d3b4ba
Merge pull request #711 from zig-lang/fix-build-template
...
Fix build template to match build runner changes
2018-01-19 20:47:20 -05:00
Marc Tiehuis
a7e10565fc
Fix build template to match build runner changes
...
Api changed in 7b57454cc1 .
2018-01-20 13:32:49 +13:00
Andrew Kelley
890bf001db
os_rename uses MoveFileEx on windows
2018-01-19 16:53:08 -05:00
Andrew Kelley
9f5c0b6e60
windows-compatible os_rename function
...
windows libc rename() requires destination file path to not exist
2018-01-19 16:31:21 -05:00
Andrew Kelley
2eede35577
Merge pull request #710 from Hejsil/seekto-getpos-windows
...
Implemented windows versions of seekTo and getPos
2018-01-19 16:17:04 -05:00
Jimmi Holst Christensen
d8469e3c7c
usize might be same size as LARGE_INTEGER. If that's the case, then we don't want to compare pos to @maxValue(usize).
2018-01-19 22:08:44 +01:00
Jimmi Holst Christensen
a1a69f24c8
We now make a more correct conversion from windows LARGE_INTEGER type to usize
2018-01-19 22:05:56 +01:00
Jimmi Holst Christensen
61497893d3
Removed bitcast from usize to isize in seekTo
2018-01-19 21:57:13 +01:00
Andrew Kelley
613c4dbf58
temporary workaround for os.deleteTree not implemented for windows/mac
...
See #709
2018-01-19 15:51:37 -05:00
Jimmi Holst Christensen
8be606ec80
Now using the right unexpectedError in seekForward
2018-01-19 21:51:10 +01:00
Jimmi Holst Christensen
a76023bcd8
Removed PLARGE_INTEGER
2018-01-19 21:49:16 +01:00
Jimmi Holst Christensen
90714a3831
Implemented windows versions of seekTo and getPos
2018-01-19 21:30:57 +01:00
Andrew Kelley
21e8ecbafa
readme: specify that we need exactly llvm 5.0.1
...
closes #708
2018-01-19 04:01:03 -05:00
Andrew Kelley
2c25c8aeed
docs: remove references to %% prefix operator
...
also cleanup the table of contents
2018-01-19 03:47:27 -05:00
Andrew Kelley
ea623f2d39
all doc code examples are now tested
...
improve color scheme of docs
make docs depend on no external files
fix broken example code in docs
closes #465
2018-01-19 03:21:47 -05:00
Andrew Kelley
4b64c777ee
add compile error for shifting by negative comptime integer
...
closes #698
2018-01-18 17:47:21 -05:00
Andrew Kelley
0fc645ab70
emit a compile error for @panic called at compile time
...
closes #706
2018-01-18 17:15:36 -05:00
Andrew Kelley
0b8f19fcba
fix null debug info for 0-length array type
...
closes #702
2018-01-18 15:08:20 -05:00
Andrew Kelley
0aae96b5f0
test: fix brace expansion test not checking invalid inputs
2018-01-18 11:41:20 -05:00
Andrew Kelley
4556f44806
LLD patch: workaround for buggy MACH-O code
...
This reapplies 1a1414fc42
to the embedded LLD.
2018-01-17 17:30:38 -05:00
Andrew Kelley
4aed7ea6f8
update embedded LLD to 6.0.0rc1
2018-01-17 17:29:21 -05:00
Andrew Kelley
48cd808185
Merge remote-tracking branch 'origin/master' into llvm6
2018-01-17 13:11:21 -05:00
Andrew Kelley
a4e8e55908
Merge pull request #701 from Hejsil/fix-xor-with-zero
...
Fixed bigint_xor for none negative numbers
2018-01-17 10:24:27 -05:00
Jimmi Holst Christensen
1d6f54cc7d
A few more none negative cases, just to be sure we've covered everything
2018-01-17 14:35:13 +01:00
Jimmi Holst Christensen
fa2c3be341
More tests, and fixed none negative bigint xor
2018-01-17 14:31:47 +01:00
Jimmi Holst Christensen
db0fc32ab2
fixed xor with zero
2018-01-17 14:00:27 +01:00
Andrew Kelley
2e6125bc66
ziglang.org home page no longer in this repo
...
update docs examples which use build-exe to be tested
See #465
2018-01-17 03:24:49 -05:00
Marc Tiehuis
7a3fd89d25
Add Sha3 hashing functions
...
These are on the slower side and could be improved. No performance optimizations
yet have been done.
```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
```
-- Sha3-256
```
Zig --release-fast
93 Mb/s
Zig --release-safe
99 Mb/s
Zig
4 Mb/s
```
-- Sha3-512
```
Zig --release-fast
49 Mb/s
Zig --release-safe
54 Mb/s
Zig
2 Mb/s
```
Interestingly, release-safe is producing slightly better code than
release-fast.
2018-01-17 21:19:45 +13:00
Marc Tiehuis
dfd5363494
Add throughput test program
...
Blake performance numbers for reference:
```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
```
-- Blake2s
```
Zig --release-fast
485 Mb/s
Zig --release-safe
377 Mb/s
Zig
11 Mb/s
```
-- Blake2b
```
Zig --release-fast
616 Mb/s
Zig --release-safe
573 Mb/s
Zig
18 Mb/s
```
2018-01-17 21:19:45 +13:00
Marc Tiehuis
7af53d0826
Fix crypto exports
2018-01-17 21:19:45 +13:00
Andrew Kelley
1eda7e0fde
docgen: support executing exe code examples
...
See #465
2018-01-17 01:50:35 -05:00
Andrew Kelley
5aefabe045
docgen: validate See Also sections
...
See #465
2018-01-17 00:22:53 -05:00
Andrew Kelley
2774fe8a1b
docgen auto generates table of contents
...
See #465
2018-01-17 00:22:53 -05:00
Andrew Kelley
4bdfc8a10a
fix error return traces pointing to off-by-one source line
...
See #651
2018-01-17 00:22:53 -05:00
Josh Wolfe
24c2ff5cae
Revert "Buffer.toSliceCopy"
...
This reverts commit c58f5a4742 .
2018-01-16 13:45:34 -07:00
Josh Wolfe
c58f5a4742
Buffer.toSliceCopy
2018-01-16 13:28:53 -07:00
Andrew Kelley
b897e98d30
Merge remote-tracking branch 'origin/master' into llvm6
2018-01-16 12:26:04 -05:00
Andrew Kelley
ee9ab15679
Merge pull request #695 from Hejsil/tranlate-c-fixes
...
Tranlate c fixes - undefined variable initialization and non-bool if statements
2018-01-16 10:32:37 -05:00
Jimmi Holst Christensen
3974b7d31d
translate_c can now translate if statements on integers and floats
2018-01-16 15:48:28 +01:00
Jimmi Holst Christensen
f59dcc5546
Fixed tests for undefined variables
2018-01-16 15:21:48 +01:00
Andrew Kelley
8b280d5b31
Merge pull request #689 from zig-lang/blake2
...
Add Blake2X hash functions
2018-01-16 09:13:09 -05:00
Jimmi Holst Christensen
821cbd7a1b
Output "undefined" on uninitialized variables
2018-01-16 15:01:02 +01:00
Marc Tiehuis
73b4f09845
Add crypto internal test functions
2018-01-17 00:20:20 +13:00
Marc Tiehuis
66a24c9c00
Merge branch 'master' into blake2
2018-01-17 00:20:06 +13:00
Marc Tiehuis
fa7b33549e
Change crypto functions to fill a buffer
...
- Rename blake2x -> blake2
- Fix blake2s truncated tests
2018-01-17 00:17:48 +13:00
Andrew Kelley
6a95b88d1b
fix bigint remainder division
...
See #405
2018-01-16 03:09:44 -05:00
Andrew Kelley
84d8584c5b
implement bigint div and rem
...
See #405
2018-01-16 02:22:19 -05:00
Andrew Kelley
92fc5947fc
fix compiler crash related to @alignOf
2018-01-15 20:44:21 -05:00
Andrew Kelley
5a4968484b
Merge branch 'wip-err-ret-trace'
2018-01-15 16:28:30 -05:00
Andrew Kelley
6ec9933fd8
fix getting debug info twice in default panic handler
2018-01-15 16:26:13 -05:00
Marc Tiehuis
4cf86b4a94
Add Blake2X hash functions
...
The truncated output variants currently are dependent on a more complete
bigint implementation in the compiler.
2018-01-15 23:14:13 +13:00
Andrew Kelley
c9ac607bd3
add builtin.have_error_return_tracing
2018-01-15 00:14:14 -05:00
Andrew Kelley
7b57454cc1
clean up error return tracing
...
* error return tracing is disabled in release-fast mode
* add @errorReturnTrace
* zig build API changes build return type from `void` to `%void`
* allow `void`, `noreturn`, and `u8` from main. closes #535
2018-01-15 00:01:02 -05:00
Andrew Kelley
d973b40884
stack traces are a variable number of frames
2018-01-14 19:40:02 -05:00
Andrew Kelley
f0df2cdde9
error return traces use a zig-provided function to save binary size
2018-01-14 16:26:06 -05:00
Andrew Kelley
793f031c4c
remove 32-bit windows from supported targets list
...
we still want to support it, but there are too many bugs
to claim that we support it right now.
See #537
2018-01-14 15:17:07 -05:00
Andrew Kelley
fa024f8092
error return trace pointer prefixes other params
...
instead of being last. This increases the chances that it can
remain in the same register between calls.
2018-01-14 14:35:43 -05:00
Andrew Kelley
971a6fc531
fix duplicate stack trace code
2018-01-14 10:19:21 -05:00
Andrew Kelley
e7e7625633
Merge pull request #687 from zig-lang/sha2
...
Add Sha2 functions
2018-01-13 21:38:29 -05:00
Marc Tiehuis
9be9f1ad20
Disable win32 tests for Sha2 + correct lengths
2018-01-14 09:58:30 +13:00
Marc Tiehuis
1f3ed5cf27
Change indexing variable types for crypto functions
2018-01-13 22:44:58 +13:00
Marc Tiehuis
2659ac01be
Add Sha2 functions
...
We take the fastest time measurement taken across multiple runs. Tested
across multiple compiler flags and the best chosen.
```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```
See https://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly .
```
Gcc -O2
219 Mb/s
Clang -O2
213 Mb/s
Zig --release-fast
284 Mb/s
Zig --release-safe
211 Mb/s
Zig
6 Mb/s
```
```
Gcc -O2
350 Mb/s
Clang -O2
354 Mb/s
Zig --release-fast
426 Mb/s
Zig --release-safe
300 Mb/s
Zig
11 Mb/s
```
2018-01-13 22:37:47 +13:00
Andrew Kelley
4551489b92
typecheck the panic function
2018-01-13 01:00:50 -05:00
Andrew Kelley
a2315cfbfc
Merge pull request #686 from zig-lang/md5-sha1
...
Add Md5 and Sha1 functions
2018-01-13 00:00:33 -05:00
Marc Tiehuis
51fdbf7f8c
Add Md5 and Sha1 hash functions
...
Some performance comparisons to C.
We take the fastest time measurement taken across multiple runs.
The block hashing functions use the same md5/sha1 methods.
```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```
See https://www.nayuki.io/page/fast-md5-hash-implementation-in-x86-assembly :
```
gcc -O2
661 Mb/s
clang -O2
490 Mb/s
zig --release-fast and zig --release-safe
570 Mb/s
zig
50 Mb/s
```
See https://www.nayuki.io/page/fast-sha1-hash-implementation-in-x86-assembly :
```
gcc -O2
588 Mb/s
clang -O2
563 Mb/s
zig --release-fast and zig --release-safe
610 Mb/s
zig
21 Mb/s
```
In short, zig provides pretty useful tools for writing this sort of
code. We are in the lead against clang (which uses the same LLVM
backend) with us being slower only against md5 with GCC.
2018-01-13 14:40:21 +13:00
Marc Tiehuis
304f6f1d01
Add integer rotation functions
2018-01-13 13:23:12 +13:00
Andrew Kelley
32ea6f54e5
*WIP* proof of concept error return traces
2018-01-12 02:12:11 -05:00
Andrew Kelley
7ec783876a
functions which can return errors have secret stack trace param
...
See #651
2018-01-11 23:04:08 -05:00
Andrew Kelley
eb3726c502
Merge branch 'master' into llvm6
2018-01-11 22:26:55 -05:00
Andrew Kelley
3268276b58
the same string literal codegens to the same constant
...
this makes it so that you can send the same string literal
as a comptime slice and get the same type
2018-01-11 21:02:30 -05:00
Andrew Kelley
465e75bc5a
Merge pull request #682 from zig-lang/fix-endian
...
Fix endian swap parameters
2018-01-11 02:51:17 -05:00
Marc Tiehuis
899e36489d
Fix endian swap parameters
2018-01-11 19:50:08 +13:00
Andrew Kelley
891c93c118
Merge pull request #681 from zig-lang/hw-math
...
Add hw sqrt for x86_64
2018-01-10 10:22:40 -05:00
Andrew Kelley
d4f791cf6c
Merge pull request #680 from zig-lang/intrusiveLinkedList
...
Intrusive linked lists
2018-01-10 10:13:15 -05:00
Marc Tiehuis
24cd99160c
Add hw sqrt for x86_64
2018-01-10 19:53:36 +13:00
Andrea Orru
19343db593
Intrusive linked lists
2018-01-10 00:33:07 -05:00
Andrew Kelley
d1d3dbc7b5
Merge branch 'master' into llvm6
2018-01-09 09:56:24 -05:00
Andrew Kelley
3c094116aa
remove %% prefix operator
...
See #632
closes #545
closes #510
this makes #651 higher priority
2018-01-09 00:51:51 -05:00
Andrea Orru
98a95cc698
exit, createThread for zen
2018-01-08 12:16:23 -05:00
Andrew Kelley
5a8d87f504
Merge branch 'master' into llvm6
2018-01-08 10:34:45 -05:00
Andrew Kelley
598170756c
a catch unreachable generates unwrap-error code
...
See #545
See #510
See #632
2018-01-07 18:13:54 -05:00
Andrew Kelley
632d143bff
replace a %% b with a catch b
...
See #632
better fits the convention of using keywords for control flow
2018-01-07 17:28:20 -05:00
Andrew Kelley
66717db735
replace %return with try
...
See #632
better fits the convention of using keywords for control flow
2018-01-07 16:53:13 -05:00
Andrea Orru
de1f57926f
Merge branch 'master' of github.com:zig-lang/zig
2018-01-07 04:43:15 -05:00
Andrea Orru
3182857224
Adding zen support
2018-01-07 04:43:08 -05:00
Andrew Kelley
32ba0dcea9
update hello world docs
2018-01-07 01:59:23 -05:00
Andrew Kelley
e7c04b6df2
add a test for returning a type that closes over a local const
...
closes #552
2018-01-07 00:50:43 -05:00
Andrew Kelley
bb39e503c0
fix struct inside function referencing local const
...
closes #672
the crash and compile errors are fixed but structs
inside functions still get named after the functions
they're in. this will be fixed later.
2018-01-07 00:28:37 -05:00
Andrea Orru
ad438cfd40
Merge branch 'master' of github.com:zig-lang/zig
2018-01-06 23:13:51 -05:00
Andrea Orru
e932919e68
Darwin -> MacOSX, added Zen. See #438
2018-01-06 23:10:53 -05:00
Andrew Kelley
a9d2a7f002
Merge pull request #674 from Hejsil/readInt-calling-fix
...
Fixed calls to mem.readInt
2018-01-06 19:45:08 -05:00
Jimmi Holst Christensen
e91136d61f
Fixed the call to mem.readInt in endian.swap
2018-01-07 00:24:35 +01:00
Jimmi Holst Christensen
6f85c860c6
Fixed the call to mem.readInt in Rand.scalar
2018-01-07 00:24:17 +01:00
Andrew Kelley
38658a597b
Merge branch 'master' into llvm6
2018-01-06 02:59:17 -05:00
Andrew Kelley
dde7cc52d2
fix exp1m implementation
...
in the llvm6 branch with assertions on, it failed the test
this fixes it
2018-01-06 02:58:45 -05:00
Andrew Kelley
17e68c4a11
disable NewGVN
...
closes #673
2018-01-06 00:15:37 -05:00
Andrew Kelley
2200c2de6f
translate-c: update to clang 6.0.0 which has more binary operators
2018-01-05 13:53:04 -05:00
Andrew Kelley
5d9a8cbe1a
Merge remote-tracking branch 'origin/master' into llvm6
2018-01-05 13:46:21 -05:00
Andrew Kelley
e08a4ea62d
Merge branch 'appveyor'
2018-01-05 12:16:16 -05:00
Andrew Kelley
2c35e24bd9
workaround for microsoft releasing windows SDK with wrong version
2018-01-05 11:35:46 -05:00
Andrew Kelley
79d50d9933
appveyor: enable verbose link for self hosted compiler
2018-01-04 23:43:46 -05:00
Andrew Kelley
f377b1e886
Revert "appveyor ci: look for newer windows sdk version"
...
This reverts commit 31d632b72e .
according to
https://developer.microsoft.com/en-us/windows/downloads/sdk-archive
10240 is actually 26624 and there was some kind of versioning issue.
2018-01-04 23:37:21 -05:00
Andrew Kelley
7f0b12a481
appveyor: skip building self hosted compiler for now
2018-01-04 23:30:03 -05:00
Andrew Kelley
25ad0b47e2
appveyor: try using vcvarsall
2018-01-04 23:11:27 -05:00
Andrew Kelley
d1ef17e3cd
appveyor: set VCINSTALLDIR
2018-01-04 22:59:39 -05:00
Andrew Kelley
1b120d1e49
update windows build to llvm 5.0.1
...
llvm-config.exe does not handle diaguids.lib for us so we have to
duplicate the work.
2018-01-04 22:46:26 -05:00
Andrew Kelley
21a552682e
Revert "try using appveyor's llvm copy"
...
This reverts commit 35dc987dc8 .
2018-01-04 19:06:48 -05:00
Andrew Kelley
35dc987dc8
try using appveyor's llvm copy
2018-01-04 18:54:46 -05:00
Andrew Kelley
31d632b72e
appveyor ci: look for newer windows sdk version
2018-01-04 18:34:42 -05:00
Andrew Kelley
7e65fe7ac3
fix test regressions on windows from previous commit
2018-01-04 16:36:59 -05:00
Andrew Kelley
d008e209e7
self-hosted compiler works on macos
2018-01-04 15:30:22 -05:00
Andrew Kelley
e1c03d9e8e
self-hosted compiler works on windows
...
* better error message for realpath failing
* fix bug in std.io.readFileAllocExtra incorrectly returning
error.EndOfStream
* implement std.os.selfExePath and std.os.selfExeDirPath for windows
2018-01-04 13:48:45 -05:00
Andrew Kelley
0cd63b28f3
fix self-hosted build on windows
2018-01-03 22:38:13 -05:00
Andrew Kelley
477e3f64fc
self-hosted build: use llvm-config from stage1
2018-01-03 21:32:50 -05:00
Andrew Kelley
5c8600d790
add december in review to reading material; fix docs
2018-01-03 21:11:58 -05:00
Andrew Kelley
8eae4a0967
Merge branch 'master' into llvm6
2018-01-03 20:53:53 -05:00
Andrew Kelley
5a800db48c
build: std files and c header files are only specified once
...
In the CMakeLists.txt file. And then we communicate the list
to the zig build.
2018-01-03 19:39:04 -05:00
Andrew Kelley
a45db7e853
add building the self hosted compiler to the main test suite
2018-01-03 18:25:17 -05:00
Andrew Kelley
5b156031e9
enum tag values are expressions so no parentheses needed
2018-01-03 16:05:37 -05:00
Andrew Kelley
5c988cc722
readme: update macos installation instructions
2018-01-03 14:16:20 -05:00
Andrew Kelley
36ff26609b
fix self hosted compiler on windows
2018-01-03 04:55:49 -05:00
Andrew Kelley
6281a511e1
add noInlineCall to docs
2018-01-03 03:27:48 -05:00
Andrew Kelley
c741d3f4b2
add test for while respecting implicit comptime
2018-01-03 03:15:06 -05:00
Andrew Kelley
d9d61ed563
doc fixes
2018-01-03 02:51:45 -05:00
Andrew Kelley
1d77f8db28
Merge branch 'master' into llvm6
2018-01-03 00:42:00 -05:00
Andrew Kelley
0ea50b3157
ir: new pass iteration strategy
...
Before:
* IR basic blocks are in arbitrary order
* when doing an IR pass, when a block is encountered, code
must look at all the instructions in the old basic block,
determine what blocks are referenced, and queue up those
old basic blocks first.
* This had a bug (See #667 )
Now:
* IR basic blocks are required to be in an order that guarantees
they will be referenced by a branch, before any instructions
within are referenced.
ir pass1 is updated to meet this constraint.
* When doing an IR pass, we iterate over old basic blocks
in the order they appear. Blocks which have not been
referenced are discarded.
* After the pass is complete, we must iterate again to look
for old basic blocks which now point to incomplete new
basic blocks, due to comptime code generation.
* This last part can probably be optimized - most of the time
we don't need to iterate over the basic block again.
closes #667
2018-01-02 21:08:12 -05:00
Andrew Kelley
aafb832288
Merge pull request #668 from sparrisable/master
...
Added format for floating point numbers. {.x} where x is the number of decimals.
2017-12-30 23:21:02 -05:00
Peter Rönnquist
d15b02a6b6
Added format for floating point numbers. {.x} where x is the number of decimals.
2017-12-31 00:27:58 +01:00
Josh Wolfe
4e3d7fc4bc
fix self-hosted parser test
2017-12-26 23:29:15 -07:00
Josh Wolfe
192a039173
move utf8 parsing to std
...
source files no longer need to end with a newline
2017-12-26 23:17:33 -07:00
Andrew Kelley
6bfaf262d5
Merge branch 'master' into llvm6
2017-12-26 21:44:08 -05:00
Josh Wolfe
08dd1b553b
set compile flags for zip_cpp
2017-12-26 18:05:43 -07:00
Andrew Kelley
6fece14cfb
self-hosted: build against zig_llvm and embedded LLD
...
Now the self-hosted compiler re-uses the same C++ code for interfacing
with LLVM as the C++ code.
It also links against the same LLD library files.
2017-12-26 19:44:08 -05:00
Andrew Kelley
2a25398c86
fix segfault when passing union enum with sub byte...
...
...field to const slice parameter
we use a packed struct internally to represent a const array
of disparate union values, and needed to update the internal
getelementptr instruction to recognize that.
closes #664
2017-12-24 04:11:58 -05:00
Andrew Kelley
86397a532e
docs: fix typo
2017-12-24 02:52:30 -05:00
Josh Wolfe
f0a1753607
add source encoding rules to the docs. see #663
2017-12-23 22:23:06 -07:00
Josh Wolfe
d6a74ed463
[self-hosted] source must be valid utf8. see #663
2017-12-23 21:47:13 -07:00
Josh Wolfe
fb96c3e73e
debug needs to export FailingAllocator
2017-12-23 21:47:13 -07:00
Andrew Kelley
4183c6f1a5
move std/debug.zig to a subdirectory
...
self hosted compiler parser tests do some fuzz testing
2017-12-23 22:15:48 -05:00
Andrew Kelley
9dae796fe3
translate-c: set up debug scope for translated functions
2017-12-23 22:14:35 -05:00
Andrew Kelley
79c2ceb2d5
build: findLLVM correctly handles system libraries
2017-12-23 22:14:35 -05:00
Andrew Kelley
e0a1466bd8
build: add --search-prefix option
2017-12-23 22:14:35 -05:00
Andrew Kelley
2031989d98
std.os.path.resolve handles an absolute path that is missing the drive
2017-12-23 22:14:35 -05:00
Andrew Kelley
8b716f941d
Merge branch 'master' into llvm6
2017-12-23 21:21:32 -05:00
Andrew Kelley
87ba004d46
translate-c: set up debug scope for translated functions
2017-12-23 21:20:38 -05:00
Andrew Kelley
c8302a5a0e
build: findLLVM correctly handles system libraries
2017-12-23 21:19:48 -05:00
Josh Wolfe
0082989f22
[self-hosted] tokenizer error for ascii control codes
2017-12-23 18:35:45 -07:00
Andrew Kelley
3cbc244e98
build: add --search-prefix option
2017-12-23 20:21:57 -05:00
Andrew Kelley
74a12d818d
std.os.path.resolve handles an absolute path that is missing the drive
2017-12-23 19:50:01 -05:00
Josh Wolfe
45ab752f9a
source files must end with newline
2017-12-23 17:47:48 -07:00
Andrew Kelley
fe66046283
Merge remote-tracking branch 'origin/master' into llvm6
2017-12-23 12:00:25 -05:00
Andrew Kelley
39c7bd24e4
port most of main.cpp to self hosted compiler
2017-12-23 00:57:56 -05:00
Andrew Kelley
760b307e8a
fix endianness of sub-byte integer fields in packed structs
...
closes #307
2017-12-22 18:27:33 -05:00
Andrew Kelley
e44a11341d
std.math: remove unnecessary inline calls and
...
workaround windows 32 bit test failure
See #537
2017-12-22 13:14:07 -05:00
Josh Wolfe
0e7fb69bea
bufPrint returns an error
2017-12-22 00:52:01 -07:00
Andrew Kelley
ea805c5fe7
fix darwin and windows from previous commit
2017-12-22 02:33:39 -05:00
Andrew Kelley
d917815d81
explicitly return from blocks
...
instead of last statement being expression value
closes #629
2017-12-22 00:50:30 -05:00
Andrew Kelley
8bc523219c
add labeled loops, labeled break, labeled continue. remove goto
...
closes #346
closes #630
regression: translate-c can no longer translate switch statements.
after #629 we can ressurect and modify the code to utilize arbitrarily
returning from blocks.
2017-12-20 23:00:19 -05:00
Andrew Kelley
d686113bd2
fix crash when implicitly casting array of len 0 to slice
...
closes #660
2017-12-19 22:38:02 -05:00
Andrew Kelley
1cc450e6e7
fix assert when wrapping zero bit type in nullable
...
closes #659
2017-12-19 18:21:42 -05:00
Andrew Kelley
1435604b84
add sort.min and sort.max functions to stdlib
2017-12-19 17:35:38 -05:00
Andrew Kelley
2a8160e80f
Merge branch 'export-rewrite'
...
introduces the `@export` builtin function which can be used
in a comptime block to conditionally export a function.
it also allows creation of aliases.
previous export syntax is still allowed.
closes #462
closes #420
2017-12-19 02:44:14 -05:00
Andrew Kelley
9d9201c3b4
bring back code that uses export and fix tests
...
partial revert of 1fdebc1dc4
2017-12-19 02:39:43 -05:00
Andrew Kelley
27ba4f0baf
export keyword works again
2017-12-19 01:49:42 -05:00
Andrew Kelley
c627f9ea18
wip bring back export keyword
2017-12-19 01:19:49 -05:00
Andrew Kelley
1fdebc1dc4
wip export rewrite
2017-12-18 09:59:57 -05:00
Andrew Kelley
3f65887974
fix std.mem missing error.OutOfMemory decl
...
this will be fixed in a better way later by #632
2017-12-17 20:52:29 -05:00
Josh Wolfe
ab44939941
roughly parsing infix operators
2017-12-17 11:16:55 -07:00
Andrew Kelley
39e96d933e
change mem.cmp to mem.lessThan and add test
2017-12-15 17:26:22 -05:00
Andrew Kelley
68f6332343
fix missing import from previous commit
2017-12-14 21:24:00 -05:00
Andrew Kelley
6bc0561d13
disable sort tests for 32-bit windows because of issue #537
2017-12-14 19:55:34 -05:00
Andrew Kelley
75ecfdf66d
replace quicksort with blocksort
...
closes #657
2017-12-14 19:41:35 -05:00
Andrew Kelley
c9e01412a4
fix compiler crash in a nullable if after an if in...
...
...a switch prong of a switch with 2 prongs in an else
closes #656
2017-12-14 01:07:23 -05:00
Andrew Kelley
f55fdc00fc
fix const and volatile qualifiers being dropped sometimes
...
in the expression `&const a.b`, the const (and/or volatile)
qualifiers would be incorrectly dropped.
closes #655
2017-12-13 21:53:52 -05:00
Andrew Kelley
84619abe9f
add test for allowing slice[slice.len..slice.len]
2017-12-12 21:56:13 -05:00
Josh Wolfe
d295279b16
self-hosted: implement var decl align
2017-12-12 19:50:43 -07:00
Josh Wolfe
0003cc8105
self-hosted: implement addr of align parsing
2017-12-12 19:26:33 -07:00
Andrew Kelley
24c2703dfa
self-hosted: look for llvm-config in homebrew
2017-12-12 17:25:57 -05:00
Andrew Kelley
cdaa735b2b
self-hosted: build tries to find llvm-config.exe
2017-12-12 16:40:04 -05:00
Andrew Kelley
2b9302107f
self-hosted: cleanup build looking for llvm-config
2017-12-12 16:03:20 -05:00
Andrew Kelley
cd5fd653d7
self-hosted: move code to std.os.ChildProcess.exec
2017-12-12 14:35:53 -05:00
Andrew Kelley
caa6433b56
stack traces: support DW_AT_ranges
...
This makes some cases print stack traces where it previously failed.
2017-12-12 12:05:28 -05:00
Andrew Kelley
23058d8b43
self-hosted: link with LLVM
2017-12-11 23:34:59 -05:00
Andrew Kelley
ed4d94a5d5
self-hosted: test all out of memory conditions
2017-12-11 21:12:47 -05:00
Andrew Kelley
c4e7d05ce3
refactor debug.global_allocator into mem.FixedBufferAllocator
2017-12-11 17:27:31 -05:00
Andrew Kelley
d8d379faf1
self-hosted: refactor into multiple files
...
add return expression
add number literal
2017-12-11 16:18:06 -05:00
Andrew Kelley
a3a590a32a
self-hosted: workaround for issue #537
2017-12-11 14:47:20 -05:00
Andrew Kelley
fd6a36a235
self-hosted: parsing and rendering blocks
2017-12-11 09:21:06 -05:00
Andrew Kelley
9a51091a5c
self-hosted: clean up parser
2017-12-10 23:19:01 -05:00
Andrew Kelley
f951bcf01b
self-hosted: parse variable declarations with types
2017-12-10 23:02:45 -05:00
Andrew Kelley
53d58684a6
self-hosted: parse var decls
2017-12-10 22:44:04 -05:00
Andrew Kelley
f210f17d30
add self-hosted parsing and rendering to main tests
2017-12-10 21:26:52 -05:00
Andrew Kelley
4b1d120f58
Merge remote-tracking branch 'origin/master' into self-hosted
2017-12-10 19:41:01 -05:00
Andrew Kelley
dc2e3465c7
rendering source code without recursion
2017-12-10 19:40:46 -05:00
Andrew Kelley
22dc713a2f
mem.Allocator initializes bytes to undefined
2017-12-10 15:38:05 -05:00
Andrew Kelley
990db3c35a
rename @EnumTagType to @TagType in type names
2017-12-10 15:03:57 -05:00
Andrew Kelley
62ead3a2ee
parsing an extern fn declaration
2017-12-09 20:50:31 -05:00
Andrew Kelley
e9efa74333
partial parameter decl parsing
2017-12-09 20:01:13 -05:00
Andrew Kelley
f466e539ef
tokenizing libc hello world
2017-12-08 23:56:07 -05:00
Andrew Kelley
d431b0fb99
parse a simple variable declaration
2017-12-08 23:15:43 -05:00
Andrew Kelley
5ead3244a2
Merge remote-tracking branch 'origin/master' into self-hosted
2017-12-08 23:15:07 -05:00
Andrew Kelley
756a218e27
add implicit cast from enum tag type of union to const ptr to the union
...
closes #654
2017-12-08 17:49:14 -05:00
Andrew Kelley
18cf256817
Merge branch 'master' into self-hosted
2017-12-08 16:39:00 -05:00
Andrew Kelley
3577a80bb6
translate-c: more complex logic for translating a C cast in a macro
2017-12-08 12:28:21 -05:00
Andrew Kelley
0dd3bbf6e8
Merge branch 'master' into self-hosted
2017-12-07 14:22:41 -05:00
Andrew Kelley
182cf5b8de
translate-c: support macros with pointer casting
2017-12-07 12:27:29 -05:00
Andrew Kelley
dc502042d5
translate-c: refactor prefix and suffix op C macro parsing
2017-12-07 11:52:52 -05:00
Andrew Kelley
37fbf01755
awkward void union field syntax no longer needed
2017-12-06 21:41:38 -05:00
Andrew Kelley
18b8a625f5
upgrade to new args api
2017-12-06 18:22:52 -05:00
Andrew Kelley
7c91a055c1
Merge branch 'master' into self-hosted
2017-12-06 18:20:02 -05:00
Andrew Kelley
62c25af802
add higher level arg-parsing API + misc. changes
...
* add @noInlineCall - see #640
This fixes a crash in --release-safe and --release-fast modes
where the optimizer inlines everything into _start and
clobbers the command line argument data.
If we were able to verify that the user's code never reads
command line args, we could leave off this "no inline"
attribute.
* add i29 and u29 primitive types. u29 is the type of alignment,
so it makes sense to be a primitive.
probably in the future we'll make any `i` or `u` followed by
digits into a primitive.
* add `aligned` functions to Allocator interface
* add `os.argsAlloc` and `os.argsFree` so that you can get
a `[]const []u8`, do whatever arg parsing you want, and then free
it. For now this uses the other API under the hood, but it could
be reimplemented to do a single allocation.
* add tests to make sure command line argument parsing works.
2017-12-06 18:12:05 -05:00
Andrew Kelley
04612d25d7
Merge branch 'master' into self-hosted
2017-12-06 14:58:24 -05:00
Andrew Kelley
249cb2aa30
fix regressions from previous commit
...
c49ee9f632 broke the tests
and this fixes them
2017-12-05 22:39:36 -05:00
Andrew Kelley
f464fe14f4
switch on enum which only has 1 field is comptime known
...
closes #593
2017-12-05 22:26:17 -05:00
Andrew Kelley
bb6b4f8db2
fix enum with 1 member causing segfault
...
closes #647
2017-12-05 22:15:33 -05:00
Andrew Kelley
c49ee9f632
allow union and its tag type to peer resolve to the tag type
2017-12-05 21:33:24 -05:00
Andrew Kelley
2715f6fdb8
allow implicit cast from union to its enum tag type
...
closes #642
2017-12-05 21:10:47 -05:00
Andrew Kelley
b66fb7ceae
revert to master branch ir.cpp, fixes issue better than this branch
2017-12-05 20:51:49 -05:00
Andrew Kelley
6018dbd339
Merge branch 'master' into self-hosted
2017-12-05 20:49:03 -05:00
Andrew Kelley
960914a073
add implicit cast from enum to union
...
when the enum is the tag type of the union and is comptime known
to be of a void field of the union
See #642
2017-12-05 20:46:58 -05:00
Andrew Kelley
63a2f9a8b2
fix casting integer literal to enum
2017-12-05 18:09:22 -05:00
Andrew Kelley
74cea89fce
translate-c: fix not printing clang errors
2017-12-05 12:28:59 -05:00
Andrew Kelley
08d531143f
parser skeleton
2017-12-05 00:20:23 -05:00
Andrew Kelley
3976981ab3
tokenizing hello world
2017-12-04 23:40:33 -05:00
Andrew Kelley
7297baa9c6
tokenizing basic operators
2017-12-04 23:29:39 -05:00
Andrew Kelley
07898cc0df
tokenizing string literals
2017-12-04 23:25:59 -05:00
Andrew Kelley
798dbe487b
simple tokenization
2017-12-04 23:09:03 -05:00
Andrew Kelley
31d9dc3539
read a file
2017-12-04 22:05:27 -05:00
Andrew Kelley
fe39ca01bc
Merge remote-tracking branch 'origin/master' into llvm6
2017-12-04 17:45:21 -05:00
Andrew Kelley
5ebed1c9ee
fix incorrect LLVM IR for union constant when active field is void
...
found in the llvm6 branch with llvm assertions on
2017-12-04 17:10:46 -05:00
Andrew Kelley
42004f9013
Merge branch 'master' into llvm6
2017-12-04 15:28:17 -05:00
Andrew Kelley
a966275e50
rename builtin.is_big_endian to builtin.endian
...
See #307
2017-12-04 10:36:31 -05:00
Andrew Kelley
67e6d9bc30
Merge pull request #644 from Dubhead/Dubhead-fix-message-color
...
Fix the color of compiler messages for light-themed terminal.
2017-12-04 09:15:17 -05:00
MIURA Masahiro
fea016afc0
Fix the color of compiler messages for light-themed terminal.
2017-12-04 19:22:34 +09:00
Andrew Kelley
76f3bdfff8
add test for casting union to tag type of union
2017-12-04 02:12:13 -05:00
Andrew Kelley
dd3437d5ba
fix build on windows
2017-12-04 02:08:26 -05:00
Andrew Kelley
54138d9e82
add test for union with 1 void field being 0 bits
2017-12-04 02:05:33 -05:00
Andrew Kelley
084911d9b3
add test for @sizeOf on extern and packed unions
2017-12-04 02:04:08 -05:00
Andrew Kelley
942b250895
update docs regarding enums and unions
2017-12-04 01:43:06 -05:00
Andrew Kelley
05d9f07541
more tests for unions
...
See #618
2017-12-04 00:56:27 -05:00
Andrew Kelley
fce435db26
fix abi alignment of union-enums not counting tag type
...
add more tests for unions
See #618
2017-12-04 00:32:12 -05:00
Andrew Kelley
5a8367e892
rename @EnumTagType to @TagType. add tests for union-enums
...
See #618
2017-12-03 22:36:01 -05:00
Andrew Kelley
0ad1239522
rework enums and unions and their relationship to each other
...
* @enumTagName renamed to @tagName and it works on enums and
union-enums
* Remove the EnumTag type. Now there is only enum and union,
and the tag type of a union is always an enum.
* unions support specifying the tag enum type, and they support
inferring an enum tag type.
* Enums no longer support field types but they do support
setting the tag values. Likewise union-enums when inferring
an enum tag type support setting the tag values.
* It is now an error for enums and unions to have 0 fields.
* switch statements support union-enums
closes #618
2017-12-03 20:43:56 -05:00
Andrew Kelley
137c8f5e8a
ability to set tag values of enums
...
also remove support for enums with 0 values
closes #305
2017-12-02 22:32:39 -05:00
Andrew Kelley
98237f7c0b
casting between integer and enum only works via tag type
...
See #305
2017-12-02 17:12:37 -05:00
Josh Wolfe
54a0db0daf
todo: fix #639
2017-12-01 19:54:01 -07:00
Josh Wolfe
67b8b00c44
implement insertion sort. something's broken
2017-12-01 16:11:39 -07:00
Andrew Kelley
921825b4c0
Merge branch 'llvm5.0.1'
2017-12-01 13:51:53 -05:00
Andrew Kelley
cf96b6f87b
update to LLVM 5.0.1rc2
2017-12-01 13:44:28 -05:00
Andrew Kelley
bdd5241615
update c_headers to llvm 5.0.1rc2
2017-12-01 12:15:19 -05:00
Andrew Kelley
a206ef34bb
LLD patch: Fix the ASM code generated for __stub_helpers section
...
This applies 93ca847862af07632197dcf2d8a68b9b27a26d7a
from the llvm-project git monorepo to the embedded LLD.
2017-12-01 12:11:55 -05:00
Andrew Kelley
ddca67a2b9
LLD patch: workaround for buggy MACH-O code
...
This reapplies 1a1414fc42
to the embedded LLD.
2017-12-01 12:09:55 -05:00
Andrew Kelley
fa45407e78
LLD patch: Fix for LLD on linker scripts with empty sections
...
This reapplies 569cf286ff
to the embedded LLD.
2017-12-01 12:08:16 -05:00
Andrew Kelley
9ea23272fa
LLD patch: COFF: better behavior when using as a library
...
This applies de776439b61fb71c1256ad86238799c758c66048
from the LLVM git monorepo to the embedded LLD.
2017-12-01 12:06:33 -05:00
Andrew Kelley
77b530b50a
updated embedded LLD to 5.0.1rc2
2017-12-01 11:59:14 -05:00
Andrew Kelley
b4120423a5
translate-c: only emit enum tag type if not c_int or c_uint
2017-12-01 00:37:15 -05:00
Andrew Kelley
264c86853b
packed structs can have enums with explicit tag types
...
See #305
2017-12-01 00:34:29 -05:00
Andrew Kelley
b62e2fd870
ability to specify tag type of enums
...
see #305
2017-11-30 22:08:11 -05:00
Josh Wolfe
5786df933d
add mem.readIntLE and readIntBE
2017-11-30 11:20:50 -07:00
Andrew Kelley
210d0017c4
fix build broken by previous commit
...
now we report a compile error for unusual failures from translate-c
2017-11-29 23:09:35 -05:00
Andrew Kelley
7729f6cf4e
translate-c: support static incomplete array inside function
2017-11-29 21:50:38 -05:00
Andrew Kelley
716b0b8655
fix capturing value of switch with all unreachable prongs
...
closes #635
2017-11-29 21:34:17 -05:00
Andrew Kelley
ccea8dcbf6
better error code for File.getEndPos failure
2017-11-29 21:34:17 -05:00
Josh Wolfe
88a7f203f9
add Buffer.appendFormat()
2017-11-29 19:31:09 -07:00
Josh Wolfe
418b0967fc
fix os.Dir compile errors
2017-11-29 17:52:58 -07:00
Andrew Kelley
afe3aae582
Merge remote-tracking branch 'origin/llvm6' into llvm6
2017-11-29 19:12:55 -05:00
Andrew Kelley
d4cd4a35d5
update fast math llvm API to latest
2017-11-29 19:11:34 -05:00
Andrew Kelley
91ef68f9b1
Merge remote-tracking branch 'origin/master' into llvm6
2017-11-29 16:34:50 -05:00
Andrew Kelley
7066283004
translate-c: support const ptr initializer
2017-11-28 23:44:45 -05:00
Andrew Kelley
26096e79d1
translate-c: fix clobbering primitive types
2017-11-28 03:17:28 -05:00
Andrew Kelley
8d5c4a67a7
Merge branch 'dimenus-c-field-expr'
2017-11-28 03:00:13 -05:00
Andrew Kelley
e745544dac
translate-c: detect macros referencing field lookup
...
as fn calls which assert the fn ptr is non-null
2017-11-28 02:58:51 -05:00
Andrew Kelley
f537c51f25
Merge branch 'c-field-expr' of https://github.com/dimenus/zig into dimenus-c-field-expr
2017-11-28 00:44:16 -05:00
Andrew Kelley
1ab84a27d3
translate-c: fix sometimes getting (no file) warnings
...
Thanks to Mason Remaley for testing the fix.
2017-11-28 00:32:32 -05:00
Mason Remaley
3e8fd24547
Implements translation for the prefix not operator ( #628 )
2017-11-27 21:00:05 -05:00
Ryan Saunderson
57049b95b3
Resolving merge w/ upstream master
2017-11-27 11:42:48 -06:00
dimenus
04472f57be
Added support for exporting of C field expressions
2017-11-27 11:23:14 -06:00
Andrew Kelley
671183fa9a
translate-c: support pointer casting
...
also avoid some unnecessary casts
2017-11-26 20:05:55 -05:00
Andrew Kelley
93fac5f257
translate-c: support variable name shadowing
2017-11-26 17:30:43 -05:00
Andrew Kelley
9a8545d590
translate-c: fix translation when no default switch case
2017-11-26 16:03:56 -05:00
Andrew Kelley
aa2ca3f02c
translate-c: better way to translate switch
...
previously `continue` would be handled incorrectly
2017-11-26 15:58:49 -05:00
Andrew Kelley
1b0e90f70b
translate-c supports switch statements
2017-11-26 00:58:11 -05:00
Andrew Kelley
687e359291
translate-c: avoid global state and introduce var decl scopes
...
in preparation to implement switch and solve variable name collisions
2017-11-25 22:17:24 -05:00
Andrew Kelley
df0e875856
translate-c: introduce the concept of scopes
...
in preparation to implement switch and solve variable name collisions
2017-11-25 20:34:05 -05:00
Andrew Kelley
a2afcae9ff
fix crash when constant inside comptime function has compile error
...
closes #625
2017-11-25 18:16:33 -05:00
Andrew Kelley
48ebb65cc7
add an assert to catch corrupted memory
2017-11-25 16:34:08 -05:00
Andrew Kelley
b390929826
translate-c supports break and continue
2017-11-25 11:56:17 -05:00
Andrew Kelley
bf20b260ce
translate-c supports for loops
2017-11-25 00:57:48 -05:00
Andrew Kelley
18eb3c5f90
translate-c supports returning void
2017-11-25 00:25:47 -05:00
Andrew Kelley
cd36baf530
fix assertion failed when invalid type encountered
2017-11-24 22:04:24 -05:00
Andrew Kelley
40480c7cdc
translate-c supports string literals
2017-11-24 19:26:05 -05:00
Andrew Kelley
68312afcdf
translate-c: support pre increment and decrement operators
2017-11-24 16:36:39 -05:00
Andrew Kelley
741504862c
update homepage docs
2017-11-24 15:06:12 -05:00
Andrew Kelley
5a25505668
rename "parsec" to "translate-c"
2017-11-24 14:56:05 -05:00
Josh Wolfe
afbbdb2c67
move base64 functions into structs
2017-11-20 23:26:45 -07:00
Josh Wolfe
a44283b0b2
rework std.base64 api
...
* rename decode to decodeExactUnsafe.
* add decodeExact, which checks for invalid chars and padding.
* add decodeWithIgnore, which also allows ignoring chars.
* alphabets are supplied to the decoders with their
char-to-index mapping already built, which enables it to be
done at comptime.
* all decode/encode apis except decodeWithIgnore require dest
to be the exactly correct length. This is calculated by a
calc function corresponding to each api. These apis no longer
return the dest parameter.
* for decodeWithIgnore, an exact size cannot be known a priori.
Instead, a calc function gives an upperbound, and a runtime
error is returned in case of overflow. decodeWithIgnore
returns the number of bytes written to dest.
closes #611
2017-11-20 23:26:45 -07:00
Andrew Kelley
339d48ac15
parse-c: support address of operator
2017-11-17 12:11:03 -05:00
Andrew Kelley
3e835973db
Merge pull request #617 from dimenus/dll-load
...
Added DLL loading capability in windows to the std lib.
2017-11-17 10:24:34 -05:00
Andrew Kelley
b50c676f76
add parse-c support for unions
2017-11-16 23:54:33 -05:00
dimenus
a7d07d412c
Added DLL loading capability in windows to the std lib.
2017-11-16 21:49:05 -06:00
Andrew Kelley
d108689382
Merge branch 'unions'
...
closes #144
2017-11-16 22:14:50 -05:00
Andrew Kelley
1473eb9ae0
add documentation placeholders for unions
2017-11-16 22:13:20 -05:00
Andrew Kelley
5d2ba056c8
fix codegen for union init with runtime value
...
see #144
2017-11-16 22:06:08 -05:00
Andrew Kelley
e26ccd5166
debug safety for unions
2017-11-16 21:15:15 -05:00
Andrew Kelley
f12d36641f
union secret field is the tag index instead of distinct type index
...
See #144
2017-11-16 10:06:58 -05:00
Andrew Kelley
018cbff438
unions have a secret field for the type
...
See #144
2017-11-15 22:52:47 -05:00
Andrew Kelley
3740bfa3bf
update fast math flags for latest llvm
2017-11-15 22:32:57 -05:00
Andrew Kelley
a984040fae
Merge remote-tracking branch 'origin/master' into llvm6
2017-11-15 22:32:23 -05:00
Andrew Kelley
9a4da6c8d8
Merge branch 'master' into llvm6
2017-11-15 22:24:42 -05:00
Andrew Kelley
f276fd0f37
basic union support
...
See #144
2017-11-15 13:04:18 -05:00
Andrew Kelley
7a74dbadd7
add docs for std.base64
2017-11-14 17:58:58 -05:00
Ryan Saunderson
371e578151
Merge remote-tracking branch 'upstream/master' into llvm6
2017-11-14 07:00:27 -06:00
Andrew Kelley
5029322aa1
c-to-zig: handle UO_Deref
2017-11-14 02:10:13 -05:00
Josh Wolfe
6ffaf4c2e2
parsec supports do loop
2017-11-13 22:56:20 -07:00
Josh Wolfe
012ce1481e
parsec supports post increment/decrement with used result
2017-11-13 22:19:51 -07:00
Josh Wolfe
4c2cdf6f4d
parsec supports more compound assign operators
2017-11-13 21:37:30 -07:00
Josh Wolfe
c1fde0e8c4
parsec supports bitshift operators
2017-11-13 20:49:53 -07:00
Andrew Kelley
6356724057
Merge branch 'dimenus-parsec'
2017-11-13 22:33:58 -05:00
Andrew Kelley
03732860be
add test case for previous commit
2017-11-13 22:33:41 -05:00
Andrew Kelley
df07361642
Merge branch 'parsec' of https://github.com/dimenus/zig into dimenus-parsec
2017-11-13 22:26:31 -05:00
Josh Wolfe
57cd074959
parsec supports C comma operator
2017-11-13 19:59:32 -07:00
Josh Wolfe
1f28fcdec5
parsec supports C NULL to pointer implicit cast
2017-11-13 19:39:46 -07:00
dimenus
b3b4786c24
Fixed duplicate decl detection for typedefs/enums
2017-11-13 20:10:36 -06:00
dimenus
98e3c7911c
Fixed duplicate decl detection for typedefs/enums
2017-11-13 16:37:46 -06:00
Andrew Kelley
a890380b6a
fix windows trying to run linux-only tests
2017-11-10 18:29:49 -05:00
Andrew Kelley
ca87f55a7b
Merge branch 'bscheinman-linux_timer'
2017-11-10 18:25:32 -05:00
Andrew Kelley
5ae53dacfb
rename test
2017-11-10 18:24:52 -05:00
Andrew Kelley
5895204c99
Merge branch 'linux_timer' of https://github.com/bscheinman/zig into bscheinman-linux_timer
2017-11-10 18:18:03 -05:00
Brendon Scheinman
87407b54b6
add epoll and timerfd support on linux
2017-11-10 15:12:46 -08:00
Andrew Kelley
1403748fd8
disable broken 32 bit windows test
...
See #537
2017-11-10 17:08:11 -05:00
Andrew Kelley
df89291d1c
Merge remote-tracking branch 'origin/master' into llvm6
2017-11-10 16:45:01 -05:00
Andrew Kelley
019f18058b
fix test failures
...
put all the codegen for fn prototypes to the same place
2017-11-10 16:32:37 -05:00
Andrew Kelley
403a46abcc
fix test failure on 32 bit windows
2017-11-10 16:03:14 -05:00
Andrew Kelley
6bf1547148
Merge branch 'darwin-stat'
...
closes #606
2017-11-10 15:01:09 -05:00
Andrew Kelley
029d37d6a7
fix bug when multiple function definitions exist
...
This might be related to #529
2017-11-10 14:58:50 -05:00
Andrew Kelley
20c2dbdbd3
add windows implementation of io.File.getEndPos
2017-11-10 14:36:03 -05:00
Andrew Kelley
1ac46fac15
add a std lib test for reading and writing files
...
* fix fstat wrong on darwin
* move std.debug.global_allocator to std.debug.global_allocator_state and make it private
* add std.debug.global_allocator as a pointer (to upgrade your zig code remove
the '&')
2017-11-10 14:17:23 -05:00
dimenus
e9d7623e1f
Merge remote-tracking branch 'origin/master' into llvm6
2017-11-10 09:49:45 -06:00
Jeff Fowler
336d81894d
Fix Stat include in darwin land ( #605 )
2017-11-09 13:46:53 -05:00
Jeff Fowler
52521d5f67
fix typo on darwin lseek ( #602 )
2017-11-09 11:35:35 -05:00
Andrew Kelley
7ea669e04c
fix parameter of extern var args not type checked
...
closes #601
2017-11-09 11:30:39 -05:00
Andrew Kelley
4f8c26d2c6
fix enum sizes too large
...
closes #598
2017-11-08 21:44:10 -05:00
Andrew Kelley
53b18c8542
fix travis linux script
2017-11-07 09:06:29 -05:00
Andrew Kelley
4543413491
std.io: introduce buffered I/O and change API
...
I started working on #465 and made some corresponding std.io
API changes.
New structs:
* std.io.FileInStream
* std.io.FileOutStream
* std.io.BufferedOutStream
* std.io.BufferedInStream
Removed:
* std.io.File.in_stream
* std.io.File.out_stream
Now instead of &file.out_stream or &file.in_stream to get access to
the stream API for a file, you get it like this:
var file_in_stream = io.FileInStream.init(&file);
const in_stream = &file_in_stream.stream;
var file_out_stream = io.FileOutStream.init(&file);
const out_stream = &file_out_stream.stream;
This is evidence that we might not need any OOP features -
See #130 .
2017-11-07 03:22:27 -05:00
Andrew Kelley
3a600297ca
Merge remote-tracking branch 'origin/master' into llvm6
2017-11-06 22:41:12 -05:00
Andrew Kelley
634e8713c3
add @memberType and @memberName builtin functions
...
see #383
there is a plan to unify most of the reflection into 2
builtin functions, as outlined in the above issue,
but this gives us needed features for now, and we can
iterate on the design in future commits
2017-11-06 22:07:19 -05:00
scurest
f0dafd3f20
fix typos in std.io ( #589 )
...
Fixes a bug that prevented InStream.realAllAlloc from compiling.
2017-11-06 11:40:58 -05:00
Andrew Kelley
52a2992862
Merge pull request #587 from scurest/c_alloc_redeclaration_of_mem
...
Fix #585
2017-11-05 19:38:50 -05:00
scurest
48c8181886
fix redeclaration of mem ( #585 )
2017-11-05 15:46:54 -06:00
scurest
bd6f8d99c5
add test for c_allocator
2017-11-05 15:46:10 -06:00
Andrew Kelley
4cc9fe90a8
fix build on MacOS
2017-11-04 16:40:55 -04:00
Andrew Kelley
f0d755153d
add compile-time reflection for function arg types
...
See #383
2017-11-04 16:20:02 -04:00
Andrew Kelley
4a6df04f75
slightly more verbose error message when building object file fails
2017-11-03 20:07:32 -04:00
Andrew Kelley
75afe73c66
Merge pull request #581 from Dimenus/line_endings
...
Add support for windows line endings with c macros within a c_import.
2017-11-03 18:40:38 -04:00
Andrew Kelley
d4c1ed95ac
Merge pull request #583 from Dimenus/libc_runtime
...
Win32 libc runtime fixes.
2017-11-03 18:32:03 -04:00
dimenus
1890760206
Windows libc & static libc are located in the same dir which is already covered by msvc_lib_dir
2017-11-03 17:09:35 -05:00
dimenus
1ef6cb1b64
Add support for windows line endings with c macros
2017-11-03 16:29:49 -05:00
Marc Tiehuis
795703a39c
Add emit command-line option ( #580 )
...
Add emit command-line option
2017-11-03 09:09:33 -04:00
Andrew Kelley
a31b23c46b
more compile-time type reflection
...
See #383
2017-11-03 00:00:57 -04:00
Andrew Kelley
dc8b011d61
fix incorrect debug info for empty structs
...
closes #579
now all tests pass for llvm master branch
2017-11-02 21:57:55 -04:00
Andrew Kelley
4a82c2d124
fix incorrect debug info for empty structs
...
now all tests pass for llvm master branch
2017-11-02 21:54:24 -04:00
Andrew Kelley
188fd47a51
add missing environment
2017-11-02 21:54:24 -04:00
Andrew Kelley
9a99bd3a71
use llvm named structs for const values when possible
...
normally we want to use llvm types for constants. but
union constants (which are found inside enums) when
they are initialized with the non-most-aligned-member
must be unnamed structs.
these bubble up to all aggregate types. if a constant of
an aggregate type contains, recursively, a union constant
with a non-most-aligned-member initialized, the aggregate
typed constant must be unnamed too.
this fixes all the asserts that were coming in from
llvm master branch.
2017-11-02 21:54:24 -04:00
Andrew Kelley
94ec2190f8
update to llvm master
2017-11-02 21:54:24 -04:00
Andrew Kelley
abff1b6884
windows: use the same libc search within a compilation unit
2017-11-01 23:08:34 -04:00
Andrew Kelley
f7837f445e
bump build_runner allocator to use 30 MB
2017-11-01 16:46:10 -04:00
Dimenus
38f05d4ac5
WIN32: Linking with the CRT at runtime. ( #570 )
...
Disclaimer: Forgive me if my format sucks, I've never submitted a PR before!
Fixes : #517
I added a few things to allow zig to link with the CRT properly both statically and dynamically. In Visual Studio 2017, Microsoft changed how the c-runtime is factored again. With this change, they also added a COM interface to allow you to query the respective Visual Studio instance for two of them. This does that and also falls back on a registry query for 2015 support. If you're using a Visual Studio instance older than 2015, you'll have to use the existing options available with the zig compiler. Changes are listed below along with a general description of the changes.
all_types.cpp:
The separate variables for msvc/kern32 have been removed and all win32 libc directory paths have been combined into a ZigList since we're querying more than two directories and differentiating one from another doesn't matter to lld.
analyze.cpp:
The existing functions were extended to support querying libc libs & libc headers at runtime.
codegen.cpp/hpp:
Microsoft uses the new 'Universal C Runtime' name now. Doesn't matter from a functionality standpoint. I left the compiler switches as is to not introduce any breaking changes.
link.cpp:
We're linking 4 libs and generating another in order to support the UCRT.
Dynamic: msvcrt/d, vcruntime/d, ucrt/d, legacy_stdio_definitions.lib
Static: libcmt/d, libvcruntime/d libucrt/d, legacy_stdio_definitions.lib
main.cpp:
Update function call names.
os.cpp/hpp:
COM/Registry interface for querying Windows UCRT/SDK.
Sources:
[Windows CRT](https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features )
[VS 2015 Breaking Changes](https://msdn.microsoft.com/en-us/library/bb531344.aspx )
2017-11-01 15:33:14 -04:00
Andreas Haferburg
b35689b70d
Enforce "\n" line endings on Windows ( #574 )
...
With Windows line endings, which seems to be the default on Windows, the
zig compiler won't understand std out of the box. This project should
not rely on git's global core.autocrlf setting.
2017-11-01 10:31:32 -04:00
Andrew Kelley
25972be45c
fix windows build from previous commit
2017-10-31 22:24:02 -04:00
Andrew Kelley
9e234d4208
breaking change to std.io API
...
* Merge io.InStream and io.OutStream into io.File
* Introduce io.OutStream and io.InStream interfaces
- io.File implements both of these
* Move mem.IncrementingAllocator to heap.IncrementingAllocator
Instead of:
```
%return std.io.stderr.printf("hello\n");
```
now do:
```
std.debug.warn("hello\n");
```
To print to stdout, see `io.getStdOut()`.
* Rename std.ArrayList.resizeDown to std.ArrayList.shrink.
2017-10-31 04:47:55 -04:00
Andrew Kelley
7a96aca39e
Merge branch 'master' into self-hosted
2017-10-27 12:54:46 -04:00
Andrew Kelley
1a414c7b6b
delete -municode command line argument
...
The solution to this is to always have it on and only
use the 'W' versions of respective windows APIs.
See the issue for this.
2017-10-27 01:29:58 -04:00
Andrew Kelley
540bac0928
Merge branch 'master' into self-hosted
2017-10-27 01:28:08 -04:00
Andrew Kelley
4c306af4eb
add test case for previous commit
2017-10-27 01:22:48 -04:00
Andrew Kelley
f1072d0d9f
use llvm named structs for const values when possible
...
normally we want to use llvm types for constants. but
union constants (which are found inside enums) when
they are initialized with the non-most-aligned-member
must be unnamed structs.
these bubble up to all aggregate types. if a constant of
an aggregate type contains, recursively, a union constant
with a non-most-aligned-member initialized, the aggregate
typed constant must be unnamed too.
this fixes some of the asserts that were coming in from
llvm master branch.
2017-10-27 00:14:56 -04:00
Marc Tiehuis
6663638195
Improve invalid character error messages ( #566 )
...
See #544
2017-10-26 10:00:23 -04:00
Andrew Kelley
f4ca3482f1
add guard to c_headers for duplicate va_list on darwin
2017-10-26 01:11:57 -04:00
Andrew Kelley
c7053bea20
better output when @cImport generates invalid zig
2017-10-26 00:32:30 -04:00
Andrew Kelley
300c83d893
fix crash on field access of opaque type
2017-10-25 23:18:18 -04:00
Andrew Kelley
5f28a9d238
cleaner verbose flags and zig build prints failed command
2017-10-25 23:10:41 -04:00
Andrew Kelley
6764a45223
Merge branch 'better-float-printing'
2017-10-24 21:58:09 -04:00
Andrew Kelley
73fe5f63c6
add some sanity tests for float printing
2017-10-24 21:57:58 -04:00
Andrew Kelley
1e784839f1
Merge branch 'float-printing' of https://github.com/scurest/zig into better-float-printing
2017-10-24 21:44:49 -04:00
Andrew Kelley
1828f8eb8e
fix missing compiler_rt in release modes
...
the optimizer was deleting compiler_rt symbols, so I changed
the linkage type from LinkOnce to Weak
also changed LinkOnce to mean linkonce_odr in llvm and
Weak to mean weak_odr in llvm.
See #563
2017-10-24 21:31:47 -04:00
scurest
262b7428cf
More corrections to float printing
...
Testing suggests all f32s are now printed accurately.
2017-10-24 14:18:50 -05:00
Andrew Kelley
4f4da3c10c
wip self hosted code
2017-10-24 10:08:20 -04:00
Andrew Kelley
d7e28f991d
remove CXX ABI workaround
...
the actual solution is you must compile zig with the same
compiler that compiled llvm, lld, and clang.
reverts 8d60ffe314
2017-10-23 22:37:59 -04:00
Andrew Kelley
643ab90ace
add maximum value for @setAlignStack
2017-10-23 22:33:00 -04:00
scurest
03a0dfbeca
Print better floats
2017-10-23 15:40:49 -05:00
Andrew Kelley
92751d5e24
self hosted zig: print usage
2017-10-21 17:31:06 -04:00
Andrew Kelley
c1642355f0
parse-c: improve performance
...
previously we did linear search to find existing global
declarations; now we index using a hash map.
building tetris went from taking 5.3 sec to 0.76 sec
2017-10-21 16:46:33 -04:00
Andrew Kelley
a1af7cbf00
report compile error instead of crashing for void in var args
...
See #557
2017-10-21 15:46:04 -04:00
Andrew Kelley
175893913d
fix compiler crash regarding type name of undefined
...
See #547
2017-10-21 13:14:10 -04:00
Andrew Kelley
9b91c76088
std.fmt.format supports ints smaller than u8
...
closes #546
thanks to @Dimenus for the fix
2017-10-21 13:03:08 -04:00
Andrew Kelley
b3d12d2c9e
zig build: fix system libraries not respected for C artifacts
...
closes #550
2017-10-21 12:58:47 -04:00
Andrew Kelley
3c3af4b332
fix docs link
2017-10-17 16:05:46 -04:00
Andrew Kelley
a27c0dd591
remove unsupported targets from readme
...
See #438
2017-10-17 14:15:50 -04:00