Commit Graph

1820 Commits

Author SHA1 Message Date
Andrew Kelley
dc8b011d61 fix incorrect debug info for empty structs
closes #579

now all tests pass for llvm master branch
2017-11-02 21:57:55 -04:00
Andrew Kelley
abff1b6884 windows: use the same libc search within a compilation unit 2017-11-01 23:08:34 -04:00
Andrew Kelley
f7837f445e bump build_runner allocator to use 30 MB 2017-11-01 16:46:10 -04:00
Dimenus
38f05d4ac5 WIN32: Linking with the CRT at runtime. (#570)
Disclaimer: Forgive me if my format sucks, I've never submitted a PR before!

Fixes: #517 

I added a few things to allow zig to link with the CRT properly both statically and dynamically. In Visual Studio 2017, Microsoft changed how the c-runtime is factored again. With this change, they also added a COM interface to allow you to query the respective Visual Studio instance for two of them. This does that and also falls back on a registry query for 2015 support. If you're using a Visual Studio instance older than 2015, you'll have to use the existing options available with the zig compiler. Changes are listed below along with a general description of the changes.

all_types.cpp:

The separate variables for msvc/kern32 have been removed and all win32 libc directory paths have been combined into a ZigList since we're querying more than two directories and differentiating one from another doesn't matter to lld.

analyze.cpp:

The existing functions were extended to support querying libc libs & libc headers at runtime.

codegen.cpp/hpp:

Microsoft uses the new 'Universal C Runtime' name now. Doesn't matter from a functionality standpoint. I left the compiler switches as is to not introduce any breaking changes.

link.cpp:

We're linking 4 libs and generating another in order to support the UCRT.
Dynamic: msvcrt/d, vcruntime/d, ucrt/d, legacy_stdio_definitions.lib
Static: libcmt/d, libvcruntime/d libucrt/d, legacy_stdio_definitions.lib

main.cpp:

Update function call names.

os.cpp/hpp:

COM/Registry interface for querying Windows UCRT/SDK.

Sources:
[Windows CRT](https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features)
[VS 2015 Breaking Changes](https://msdn.microsoft.com/en-us/library/bb531344.aspx)
2017-11-01 15:33:14 -04:00
Andreas Haferburg
b35689b70d Enforce "\n" line endings on Windows (#574)
With Windows line endings, which seems to be the default on Windows, the
zig compiler won't understand std out of the box. This project should
not rely on git's global core.autocrlf setting.
2017-11-01 10:31:32 -04:00
Andrew Kelley
25972be45c fix windows build from previous commit 2017-10-31 22:24:02 -04:00
Andrew Kelley
9e234d4208 breaking change to std.io API
* Merge io.InStream and io.OutStream into io.File
 * Introduce io.OutStream and io.InStream interfaces
   - io.File implements both of these
 * Move mem.IncrementingAllocator to heap.IncrementingAllocator

Instead of:

```
%return std.io.stderr.printf("hello\n");
```

now do:

```
std.debug.warn("hello\n");
```

To print to stdout, see `io.getStdOut()`.

 * Rename std.ArrayList.resizeDown to std.ArrayList.shrink.
2017-10-31 04:47:55 -04:00
Andrew Kelley
7a96aca39e Merge branch 'master' into self-hosted 2017-10-27 12:54:46 -04:00
Andrew Kelley
1a414c7b6b delete -municode command line argument
The solution to this is to always have it on and only
use the 'W' versions of respective windows APIs.

See the issue for this.
2017-10-27 01:29:58 -04:00
Andrew Kelley
540bac0928 Merge branch 'master' into self-hosted 2017-10-27 01:28:08 -04:00
Andrew Kelley
4c306af4eb add test case for previous commit 2017-10-27 01:22:48 -04:00
Andrew Kelley
f1072d0d9f use llvm named structs for const values when possible
normally we want to use llvm types for constants. but
union constants (which are found inside enums) when
they are initialized with the non-most-aligned-member
must be unnamed structs.

these bubble up to all aggregate types. if a constant of
an aggregate type contains, recursively, a union constant
with a non-most-aligned-member initialized, the aggregate
typed constant must be unnamed too.

this fixes some of the asserts that were coming in from
llvm master branch.
2017-10-27 00:14:56 -04:00
Marc Tiehuis
6663638195 Improve invalid character error messages (#566)
See #544
2017-10-26 10:00:23 -04:00
Andrew Kelley
f4ca3482f1 add guard to c_headers for duplicate va_list on darwin 2017-10-26 01:11:57 -04:00
Andrew Kelley
c7053bea20 better output when @cImport generates invalid zig 2017-10-26 00:32:30 -04:00
Andrew Kelley
300c83d893 fix crash on field access of opaque type 2017-10-25 23:18:18 -04:00
Andrew Kelley
5f28a9d238 cleaner verbose flags and zig build prints failed command 2017-10-25 23:10:41 -04:00
Andrew Kelley
6764a45223 Merge branch 'better-float-printing' 2017-10-24 21:58:09 -04:00
Andrew Kelley
73fe5f63c6 add some sanity tests for float printing 2017-10-24 21:57:58 -04:00
Andrew Kelley
1e784839f1 Merge branch 'float-printing' of https://github.com/scurest/zig into better-float-printing 2017-10-24 21:44:49 -04:00
Andrew Kelley
1828f8eb8e fix missing compiler_rt in release modes
the optimizer was deleting compiler_rt symbols, so I changed
the linkage type from LinkOnce to Weak

also changed LinkOnce to mean linkonce_odr in llvm and
Weak to mean weak_odr in llvm.

See #563
2017-10-24 21:31:47 -04:00
scurest
262b7428cf More corrections to float printing
Testing suggests all f32s are now printed accurately.
2017-10-24 14:18:50 -05:00
Andrew Kelley
4f4da3c10c wip self hosted code 2017-10-24 10:08:20 -04:00
Andrew Kelley
d7e28f991d remove CXX ABI workaround
the actual solution is you must compile zig with the same
compiler that compiled llvm, lld, and clang.

reverts 8d60ffe314
2017-10-23 22:37:59 -04:00
Andrew Kelley
643ab90ace add maximum value for @setAlignStack 2017-10-23 22:33:00 -04:00
scurest
03a0dfbeca Print better floats 2017-10-23 15:40:49 -05:00
Andrew Kelley
92751d5e24 self hosted zig: print usage 2017-10-21 17:31:06 -04:00
Andrew Kelley
c1642355f0 parse-c: improve performance
previously we did linear search to find existing global
declarations; now we index using a hash map.

building tetris went from taking 5.3 sec to 0.76 sec
2017-10-21 16:46:33 -04:00
Andrew Kelley
a1af7cbf00 report compile error instead of crashing for void in var args
See #557
2017-10-21 15:46:04 -04:00
Andrew Kelley
175893913d fix compiler crash regarding type name of undefined
See #547
2017-10-21 13:14:10 -04:00
Andrew Kelley
9b91c76088 std.fmt.format supports ints smaller than u8
closes #546

thanks to @Dimenus for the fix
2017-10-21 13:03:08 -04:00
Andrew Kelley
b3d12d2c9e zig build: fix system libraries not respected for C artifacts
closes #550
2017-10-21 12:58:47 -04:00
Andrew Kelley
3c3af4b332 fix docs link 2017-10-17 16:05:46 -04:00
Andrew Kelley
a27c0dd591 remove unsupported targets from readme
See #438
2017-10-17 14:15:50 -04:00
Andrew Kelley
78cb4ce030 Release 0.1.1 2017-10-17 08:50:00 -04:00
Andrew Kelley
79193ffed2 build: fix logic for version when there is a git tag 2017-10-17 08:47:27 -04:00
Andrew Kelley
ad07c68504 Release 0.1.0 2017-10-17 08:42:52 -04:00
Marc Tiehuis
09c0cf2dcf Add c allocator (#542) 2017-10-17 08:13:04 -04:00
Andrew Kelley
0744c83f51 add uwtable attribute to functions on windows
See #516

now we have at least a callstack. we still need updated LLD
to get stack traces.
2017-10-17 01:41:26 -04:00
Andrew Kelley
5866032e76 fix codegen of enum name table having wrong LLVM types
See https://bugs.llvm.org/show_bug.cgi?id=34952
2017-10-16 18:10:28 -04:00
Andrew Kelley
38a947c683 appveyor: update version to match zig version 2017-10-16 13:01:34 -04:00
Andrew Kelley
1d88f9b9a6 appveyor: build with msvc and publish artifacts
See #540
2017-10-16 12:22:13 -04:00
Andrew Kelley
cbb6d2239f look for libc at runtime on windows
See #539

before we close the issue we should also detect MSVC 2017
but this gets us started with supporting MSVC 2015
2017-10-16 12:21:46 -04:00
Andrew Kelley
8cfb0cfbce std.os.ChildProcess: on windows cwd affects exe search path
to match posix semantics

disabling non-passing build-examples tests. See #538
2017-10-16 02:30:03 -04:00
Andrew Kelley
4e2a5e6b13 fix regression on posix from previous commit 2017-10-16 01:16:51 -04:00
Andrew Kelley
d08c57741a ability to make a DLL
See #302
2017-10-16 01:14:28 -04:00
Andrew Kelley
78b753af9d fix debug safety tests on windows
See #302
2017-10-16 00:20:51 -04:00
Andrew Kelley
d6bfa3f639 fix compare-output tests on windows
the %a format specifier had different behavior so I
used %.013a instead to make it the same on all platforms
2017-10-15 23:52:13 -04:00
Andrew Kelley
2a08116788 LLD COFF: close handles to objects used to link
fixes test failures on windows
See #302

patch sent upstream:
http://lists.llvm.org/pipermail/llvm-dev/2017-October/118234.html
2017-10-15 22:09:25 -04:00
Andrew Kelley
562f91e875 clean up some resources 2017-10-15 21:06:04 -04:00