Commit Graph

4103 Commits (169a789b343e9070b4658de9c8bd96c6736c6edc)

Author SHA1 Message Date
Andrew Kelley 169a789b34
fix test after merging ad8381e0d2
this test slipped through due to branching
2019-01-30 16:12:30 -05:00
Andrew Kelley 59c050e7ff
collapse os_file_mtime into os_file_open_r and check for directory
This is a manual merge of kristate's pull request #1754, due to
conflicts + a couple fixups.

closes #1754
2019-01-30 16:06:18 -05:00
Matthew McAllister ad8381e0d2 Move tokenizer error location to offending char
Previously, it pointed to the start of the current token, but this made
it difficult to tell where the error occurred when it was, say, in the
middle of a string.
2019-01-30 14:02:01 -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 9ca94bbba5
fix freebsd ci from previous commit 2019-01-30 02:53:50 -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
Andrew Kelley 9c328b4291
simpler implementation of `&&` and `||` hints
This accomplishes the same goal, but with less changes, so that
I can backport copy elision stuff easier.
2019-01-29 22:29:56 -05:00
kristopher tate 5bf9ffdc5b Hint at use of and/or when &&/|| is improperly used (#1886) 2019-01-25 21:10:40 +01:00
tharvik 3bec3b9f9b llvm-config sanity check 2019-01-21 15:58:54 -05:00
Andrew Kelley aee973829d
Merge branch 'kristate-zig-backport-issue1883' 2019-01-20 14:09:46 -05:00
Andrew Kelley 1357bc7430
add test case for previous commit 2019-01-20 14:09:17 -05:00
kristopher tate 0d1ce1fb5f
src/analyze.cpp: return type entry for `ZigTypeIdPointer` if it points to `ZigTypeIdOpaque`
ref: ziglang/zig#1883
2019-01-20 17:08:35 +09:00
Andrew Kelley c968d8756c
Merge pull request #1885 from Sahnvour/master
Fixed source lines printing of stack traces on windows.
2019-01-18 13:32:01 -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
Andrew Kelley 5864d92b40
when rendering llvm const values, ensure the types align
the representation of the const expr val in zig, and the
type that we tell LLVM it is.
2019-01-09 10:43:48 -05:00
Andrew Kelley 4d5d0d3ada
`@typeInfo`: more correct return type info 2019-01-08 14:40:56 -05:00
Andrew Kelley aa65b94671
fix debug info for function pointers
found when testing against LLVM 8

see https://bugs.llvm.org/show_bug.cgi?id=40198
2019-01-08 11:53:51 -05:00
Andrew Kelley 013c7b24d2
Merge pull request #1874 from ziglang/issue-1866
Fix #1866
2019-01-06 14:00:34 -05:00
Jimmi HC da08525bb3 Removed oops comments 2019-01-06 18:02:00 +01:00
Jimmi HC 97702988d1 Added test case 2019-01-06 17:58:00 +01:00
Jimmi HC 55e95daf54 Fixed issue where TypeInfo would use types from a prev CodeGen instance
When doing multible codegen passes (such as building
compiler_rt and then something else) the TypeInfo cache code would point
to types from the prev code gen (such as the prev 'bool' type), giving
us errors like "expected type 'bool', but found type 'bool'"
This disabling of caching might have a performance hit, but correctness is better than
speed, so let's have this for now, until someone optimizes this
correctly (probably in stage2)
2019-01-06 17:53:34 +01:00
Jimmi HC e410b1f915 Implemented buf_read_value_bytes for ZigTypeIdArray
* Only for x_array.special == ConstArraySpecialNone
2019-01-06 17:49:24 +01:00
Jimmi HC db92891587 Respect the type system instead of ConstExprValue when getting field 2019-01-06 17:48:31 +01:00
Marcio 5f26d1dddb freebsd: fix wrong call to clock_getres (#1871)
Reported-by: daurnimator
2019-01-05 13:34:47 -05:00
vegecode 1f08be4d7f Mark comptime int hardcoded address pointee as a run time variable #1171 (#1868)
* Mark comptime int hardcoded address as a run time variable #1171

* test case for dereferencing hardcoded address intToPtr
2019-01-04 17:34:21 -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
vegecode f6cd68386d @bitreverse intrinsic, part of #767 (#1865)
* bitreverse - give bswap behavior

* bitreverse, comptime_ints, negative values still not working?

* bitreverse working for negative comptime ints

* Finished bitreverse test cases

* Undo exporting a bigint function. @bitreverse test name includes ampersand

* added docs entry for @bitreverse
2019-01-02 16:47:47 -05:00
alexander 6df8e4bca7 Add DIFlagStaticMember flag to functions.
Prevents LLVM from generating debug info for
struct member functions with a pointer as the
first parameter as though the first parameter
were the implicit "this" pointer from C++.
2018-12-30 12:57:49 -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
Marcio Giaxa 2e08bd6be4
ci: update freebsd manifest 2018-12-28 15:36:43 -02:00
Marcio Giaxa 4ff23b668a
tests: remove freebsd from the test matrix
- Manually add all the native tests to CI manifest.
2018-12-28 11:38:58 -02:00
Andrew Kelley c464ecf3bf
Merge pull request #1857 from vegecode/boolean-switch
Switching on bools with duplicate and missing value detection: Issue …
2018-12-27 18:14:33 -05:00
alexander 64061cc1bf Test cases for compiler error and working behavior for switching on booleans 2018-12-27 13:46:32 -06:00
Andrew Kelley aaef6259c3
allow not having libc include paths and doing @cImport 2018-12-26 20:44:06 -05:00
Marcio Giaxa c29cae76b0
tests: add FreeBSD to the test matrix 2018-12-26 22:44:13 -02:00
Andrew Kelley 2b7e29f791
Merge branch 'nebulaeonline-nebulaeonline'
Zig gains the UEFI OS target
2018-12-26 15:26:53 -05:00
Andrew Kelley a918ce26b8
fixups 2018-12-26 15:25:54 -05:00
alexander 4a1f0e1418 Switching on bools with duplicate and missing value detection: Issue 1768 2018-12-26 10:44:25 -06:00
nebulaeonline f49b45b00f tabs to space fix. thanks visual studio. 2018-12-24 14:01:35 -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
nebulaeonline 28cd337d1f fixed formatting in options display 2018-12-24 07:49:15 -05:00
Marcio Giaxa de473d4423
freebsd: implement std.os.time.sleep 2018-12-24 10:27:08 -02:00
nebulaeonline 7dcee99510 fixed stricmp/strcasecmp between windows/posix 2018-12-23 23:59:59 -05:00
nebulaeonline 51baea184b Yet another git user error remnant fixed 2018-12-23 23:46:45 -05:00
nebulaeonline 480061d2c9 git user error fix 2018-12-23 23:09:07 -05:00
nebulaeonline e0af3d7b50 Merge branch 'nebulaeonline' of https://github.com/nebulaeonline/zig into nebulaeonline 2018-12-23 22:56:20 -05:00