Commit Graph

2928 Commits

Author SHA1 Message Date
Sam Tebbs
8621e3b5bd Don't emit clang error if source or filename pointer is null 2019-08-07 14:11:18 -07:00
Ryan Saunderson
8fcf21fefc modify header precedence for zig cc, resolves intrinsics issues (#3027) 2019-08-07 10:51:30 -07:00
Andrew Kelley
d105769926
fix regressions regarding writing through const pointers 2019-08-02 16:09:40 -04:00
Andrew Kelley
9069ee957c
fix discarding function call results 2019-08-02 15:17:02 -04:00
Andrew Kelley
90e64bc620
fix cmpxchg with discarded result 2019-08-02 14:47:26 -04:00
Andrew Kelley
a5cb0f77d1
assignment participates in result location
fix one regression with optionals but there are more
2019-08-02 13:54:58 -04:00
Andrew Kelley
38b5812c48
allow 128 bit cmpxchg on x86_64 2019-08-01 02:46:37 -04:00
Michael Dusan
8e4f3a6f15 align src for IrInstructionArrayToVector
closes #2942
2019-07-24 15:04:32 -04:00
Vexu
57aa8997bd fix escape sequence rendering 2019-07-23 14:49:19 -04:00
Andrew Kelley
bc31c1280e
disable segfault handler when panicking
this prevents a segfault in stack trace printing to activate the
segfault handler.
2019-07-22 12:41:59 -04:00
Andrew Kelley
a3327f0fbd
fix usingnamespace analyzing the expression multiple times 2019-07-22 12:33:24 -04:00
Andrew Kelley
af8661405b
fix usingnamespace
It used to be that usingnamespace was only allowed at top level. This
made it OK to put the state inside the AST node data structure. However,
now usingnamespace can occur inside any aggregate data structure, and
therefore the state must be in the TopLevelDeclaration rather than in
the AST node.

There were two other problems with the usingnamespace implementation:

 * It was passing the wrong destination ScopeDecl, so it could cause an
   incorrect error such as "import of file outside package path".
 * When doing `usingnamespace` on a file that already had
   `pub usingnamespace` in it would "steal" the usingnamespace, causing
   incorrect "use of undeclared identifier" errors in the target file.

closes #2632
closes #2580
2019-07-19 16:56:44 -04:00
Michael Dusan
e5d032982e closes #2916 2019-07-18 16:42:56 -04:00
Andrew Kelley
3879bebc37
WIN32 -> _WIN32 2019-07-17 16:10:54 -04:00
Andrew Kelley
95e04e3874
back to msvc as the default C ABI on Windows
Zig provides a libc for the GNU C ABI on Windows, and cannot (at least
yet) provide one for the MSVC C ABI. However when not linking libc,
zig has no problem targeting MSVC as the C ABI. And this should be the
default.

Related: #2911
2019-07-17 12:40:48 -04:00
Andrew Kelley
c0b4121ff2
libc headers before C language headers, and disable libunwind on arm32 2019-07-16 21:38:18 -04:00
Andrew Kelley
d994379173
update bundled musl source to 1.1.23 2019-07-16 19:54:14 -04:00
Andrew Kelley
f70ce707e2
update musl headers to musl v1.1.23 2019-07-16 19:02:51 -04:00
Andrew Kelley
b1f8b53d20
rename internal names regarding usingnamespace 2019-07-16 16:20:54 -04:00
Andrew Kelley
15ed47921f
Merge branch 'msvc-libc-2064' of https://github.com/dimenus/zig into dimenus-msvc-libc-2064 2019-07-16 12:51:02 -04:00
emekoi
0435026474 fixed size of ZigClangAPValue on mingw-w64 2019-07-16 09:34:02 -04:00
Andrew Kelley
776423bbf7
fix result location alignment in ir_render_call 2019-07-15 23:44:44 -04:00
Andrew Kelley
6fe3b20962
Merge branch 'translate-c-userland' of https://github.com/hryx/zig into hryx-translate-c-userland 2019-07-15 22:19:54 -04:00
Andrew Kelley
eaf545e24c fix build on windows 2019-07-15 19:50:56 -04:00
Andrew Kelley
851a7288a9
mingw libc can link against ntdll 2019-07-15 18:25:13 -04:00
Andrew Kelley
0cd660462f
move install_files.h to not be generated code 2019-07-15 01:47:26 -04:00
Andrew Kelley
b23ace27db
fix the build on windows 2019-07-15 01:45:26 -04:00
Andrew Kelley
6096dc5f94
move some of the installation from cmake to zig build
This moves the installation of shipped source files from large
CMakeLists.txt lists to zig build recursive directory installation.

On my computer a cmake `make install` takes 2.4 seconds even when it has
to do nothing, and prints a lot of unnecessary lines to stdout that say
"up-to-date: [some file it is installing]".

After this commit, the default output of `make` is down to 1
second, and it does not print any junk to stdout. Further, a `make
install` is no longer required and `make` is sufficient.

This closes #2874.

It also closes #2585. `make` now always invokes `zig build` for
installing files and libuserland.a, and zig's own caching system makes
that go fast.
2019-07-15 01:45:26 -04:00
Andrew Kelley
9c39d5720f
ir: add an assertion in phi analysis 2019-07-13 18:38:52 -04:00
Andrew Kelley
c0489abcdb
translate-c: fix incorrectly translated double function pointer
closes #2887
2019-07-13 12:38:10 -04:00
Andrew Kelley
107e57484f
Merge pull request #2868 from ziglang/windows-libc
provide a libc for windows using mingw-w64
2019-07-12 18:12:27 -04:00
Andrew Kelley
39b850c6cf
mingw libc: delete dead linker code regarding using system libc 2019-07-12 18:10:53 -04:00
Andrew Kelley
3621d54e57
handle mingw libc defs better
also zig build handles --verbose and linkSystemLibrary better
2019-07-12 17:25:25 -04:00
Andrew Kelley
7b8ba871a9
mingw libc: solve the segfault having to do with destructors
* fixed --verbose-cc printing an extra "zig" before the rest of
   the command line
 * windows-gnu targets use libfoo.a, foo.o extensions to match mingw
   conventions.
2019-07-12 14:44:34 -04:00
Andrew Kelley
4e58855a4a
translate-c: better detection of pointer to struct demoted to opaque 2019-07-12 12:11:26 -04:00
thomas
02b1aea291 fix typo in help text for bundle-compiler-rt 2019-07-12 10:23:39 -04:00
Andrew Kelley
d9c4c96bf2
add -Wno-pragma-pack when targeting windows-gnu
windows.h has files such as pshpack1.h which do #pragma packing,
triggering a clang warning. So for this target, this warning is
disabled.

this commit also improves the error message printed when no libc can be
used, printing the "zig triple" rather than the "llvm triple".
2019-07-11 23:48:13 -04:00
Andrew Kelley
b4bbfe8c05
the msvc target abi will have to be solved a different way 2019-07-11 12:56:51 -04:00
Andrew Kelley
e0670557b4 fix windows not able to build mingw 2019-07-10 20:20:53 -04:00
Andrew Kelley
3714d524c3
add some more windows defs 2019-07-10 19:40:46 -04:00
Andrew Kelley
2bb93784c6
mingw: build and link mingwex.lib
zig can now cross compile hello.c targeting windows
2019-07-10 17:41:34 -04:00
dimenus
540a40e2d9 fixing non system library linking 2019-07-10 15:37:25 -05:00
Andrew Kelley
67f3bc9101
mingw: building and linking msvcrt-os.lib 2019-07-10 16:19:51 -04:00
Andrew Kelley
ea90a3a9a1
mingw: building and linking mingw32.lib 2019-07-10 14:13:00 -04:00
dimenus
e9331dc5cf resolved #2064 & fixed hello_world libc build 2019-07-10 11:40:20 -05:00
Andrew Kelley
1c7f21852f
ship with mingw-w64 v6.0.0
See #514
2019-07-09 23:34:16 -04:00
Andrew Kelley
fc9e28ea37
std.os.getrandom does a libc version check
closes #397
2019-07-08 14:42:28 -04:00
Andrew Kelley
201033d83b
avoid dependency on linux/limits.h header
it was causing a problem on the CI
2019-07-08 11:38:14 -04:00
Andrew Kelley
8692c6fc0d
zero initialize target
Fixes glibc_version being set to garbage. I've made this mistake
before so this is an attempt to prevent future bugs. Zig doesn't
have zero-initialization, so are we being a hypocrite by using this
C feature? No, because C doesn't have the feature that forces you to
initialize all fields. That would have prevented this bug every single
time.
2019-07-08 02:10:26 -04:00
Andrew Kelley
f04782785f
fix not setting a target glibc version on non-linux 2019-07-07 19:24:44 -04:00