Commit Graph

3813 Commits (4640853d1b49ec17e1e997901c58c2294aca30d6)

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