Commit Graph

1639 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
Andrew Kelley
90b8cd4a45
add C pointer type to @typeInfo
See #1059
2019-02-11 16:07:40 -05:00
Andrew Kelley
4a1b910e03
zig fmt: support C pointers
See #1059
2019-02-11 14:07:19 -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
052800e952
zig fmt: support threadlocal 2019-02-09 00:19:24 -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
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