Commit Graph

5072 Commits

Author SHA1 Message Date
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