Commit Graph

1759 Commits (0a280b6062c0b0a3c7a460499c72be40acfcac46)

Author SHA1 Message Date
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
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
tgschultz 20e2d8da61 Fixed Serializer and BitOutStream when used with streams that have empty error sets. 2019-02-06 00:06:27 -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
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
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
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 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 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 ecb0cb661a
darwin time code: don't cast to int until the end
See #1648
2019-01-30 02:53:59 -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
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
Marcio 5f26d1dddb freebsd: fix wrong call to clock_getres (#1871)
Reported-by: daurnimator
2019-01-05 13:34:47 -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
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
Andrew Kelley a918ce26b8
fixups 2018-12-26 15:25:54 -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
Marcio Giaxa de473d4423
freebsd: implement std.os.time.sleep 2018-12-24 10:27:08 -02:00
nebulaeonline fdea12b2d9 msvc subsystem option handling; added uefi os type 2018-12-23 22:44:02 -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 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
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
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
tgschultz f35ba34a88 Removed allocator from Linux version DynLib. Added dynamic_library.zig to std test list. 2018-12-20 14:49:34 -05:00
kristopher tate fb81b1978b
tests: re: 79db394;
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 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 260c3d9cc0 formatType can now format comptime_int 2018-12-19 11:50:29 +01:00
Andrew Kelley f75262b79f
fix comptime pointer reinterpretation array index offset
closes #1835
2018-12-17 11:05:50 -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 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
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
Jimmi Holst Christensen 518ff33e64 Allow packages in TestStep 2018-12-05 14:10:09 +01: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
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
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
Josh Wolfe 11e8afb37c fix child_process piped streams not getting closed 2018-11-28 18:33:55 -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
daurnimator 2baf0e2ffc add std.math.IntFittingRange 2018-11-27 10:19:06 -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
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
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 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
Andrew Kelley 89e82281be
fix incorrect --help text 2018-11-19 13:26:35 -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
Josh Wolfe 3c05ad4012 atomic.Int.set 2018-11-18 19:43:13 -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
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
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
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
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
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
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
kristopher tate 5d014d4b37 os.crypto: support for HmacBlake2s256 variety; 2018-11-03 15:03:48 -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 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
emekoi c7799ff2b2 fixed comments 2018-10-27 12:58:40 -05:00
Andrew Kelley 2b395d4ede
remove @minValue,@maxValue; add std.math.minInt,maxInt
closes #1466
closes #1476
2018-10-26 15:01:51 -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
Jimmi Holst Christensen 65b7d85524 Fixed code still using old ptr syntax 2018-10-20 17:59:06 +02:00
Greg V f3bc1c38bf Specify 16-byte stack alignment in _start on FreeBSD 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 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 e2b9c153bd Add initial freebsd stdlib functionality
Trivial program now compiles with now warnings.
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 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 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 84690ee05e
std/special/bootstrap: inline some functions to improve stack traces 2018-10-09 13:16:50 -04:00