Commit Graph

1663 Commits

Author SHA1 Message Date
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
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
d213708333
this empty import workaround no longer necessary 2019-03-13 14:13:09 -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
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
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
918dbd4551
std.zig: this is no longer a keyword 2019-03-10 15:55:54 -04: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
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
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
Andrew Kelley
1e634a384c
Merge branch 'glibc'
See #514
2019-03-07 16:55:31 -05:00
Andrew Kelley
3d2c48e4c9 disable some tests until coroutine rewrite is finished 2019-03-07 16:11:00 -05:00
Andrew Kelley
ce76de35f1
multi-arch glibc headers 2019-03-07 12:16:10 -05:00
Andrew Kelley
b554f6294f
add popcountdi2 to compiler_rt 2019-03-05 23:09:00 -05:00
Andrew Kelley
e2f4df6065
std.os.changeCurDir no longer needs an allocator 2019-03-05 18:43:39 -05:00
Andrew Kelley
e3b275fa47
fix build.zig not respecting --static
closes #2027
2019-03-03 12:35:09 -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
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
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
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
Andrew Kelley
76b4e49178
add mprotect syscall 2019-02-28 20:11:36 -05:00
Andrew Kelley
5424b4320d
remove namespace type; files are empty structs
closes #1047
2019-02-28 10:11:32 -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
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
John Schmidt
0eed72d687 Add priority queue 2019-02-26 13:21:11 -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
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
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
daurnimator
7bbccfc7f3
Use valgrind marks from Allocator 2019-02-21 11:43:09 +11: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
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
b0ceea1831
zig fmt: fix infix operator before multiline string literal 2019-02-18 18:11:12 -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
Jimmi HC
d2fb95af88 Fixed std.testing.expectEqual 2019-02-18 17:22:14 +01:00
Andrew Kelley
3e586264e5
Merge pull request #1972 from coypoop/netbsd
Add NetBSD support
2019-02-18 00:10:31 -05:00
Quetzal Bradley
7e54954052 fix openWriteNoClobber and add test 2019-02-17 23:21:45 -05:00
Maya Rashish
b93405c24b Don't provide a bogus definition of EVFILT_USER 2019-02-17 23:50:30 +02: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
Maya Rashish
8d2a902945 freebsd: fix pointer cast in mmap 2019-02-17 02:25:37 -05:00