Commit graph

333 commits

Author SHA1 Message Date
Jakub Konka
7f5c96378d Refactor the code according to Andrew's suggestions 2020-11-02 18:38:09 +01:00
Jakub Konka
317c555a5c Fix linking issues on BigSur
This commit fixes linking issue on macOS 11 BigSur by appending
a prefix path to all lib and framework search paths known as
`-syslibroot`.

The reason this is needed is that in macOS 11, the system libraries
and frameworks are no longer readily available in the filesystem.
Instead, the new macOS ships with a built-in dynamic linker cache
of all system-provided libraries, and hence, when linking with either
`lld.ld64` or `ld64`, it is required to pass in `-syslibroot [dir]`.
The latter can usually be obtained by invoking `xcrun --show-sdk-path`.
With this commit, Zig will do this automatically when compiling natively
on macOS. However, it also provides a flag `-syslibroot` which can be
used to overwrite the automtically populated value.

To summarise, with this change, the user of Zig is not required to
generate and append their own syslibroot path. Standard invocations
such as `zig build-exe hello.zig` or `zig build` for projects will
work out of the box. The only missing bit is `zig cc` and `zig c++`
since the addition of the `-syslibroot` option would be a mismatch
between the values provided by `clang` itself and Zig's wrapper.
2020-11-02 17:06:09 +01:00
Travis
bb6e39e274 remove extra space in .** error message 2020-10-30 21:26:05 +02:00
Vexu
a63fd34c50
return a valid node even if invalid deref was used 2020-10-29 19:20:15 +02:00
Travis
d7f9128b5d add error message to zig side of tokenizing/parsing 2020-10-29 12:03:45 -05:00
Travis
960b5b518f updated zig tokenizer to handle .*** and added tests 2020-10-29 12:03:45 -05:00
LemonBoy
90f7034b69 std: Implement featureSetHasAny/featureSetHasAll
Introduce two helper functions to avoid writing short novels only to check for more
than a single feature.
2020-10-20 23:23:43 +03:00
Andrew Kelley
e51bc19e4a
Merge pull request #6394 from Vexu/fmt
std.fmt add specifier for printing Zig identifiers
2020-10-17 21:06:54 -04:00
Vexu
e8ca1b254d
std: remove renderStringLiteral in favor of std.fmt specifier 2020-10-17 23:20:38 +03:00
Sebastien Marie
35a7247a2c
Merge branch 'master' into openbsd-minimal 2020-10-17 17:38:23 +02:00
Andrew Kelley
d91e75f5ca getExternalExecutor fixups regarding dynamic linker
* std.Target.standardDynamicLinkerPath: macOS has a dynamic linker
 * no need to override the default dynamic linker in the macos
   CrossTarget initialization in the tests
 * in getExternalExecutor, when validating the dynamic linker path, take
   into account the standard dynamic linker path.
2020-10-15 16:44:16 -07:00
Jakub Konka
0e1afee732 Enable stage2 end-to-end tests on macOS run natively
This commit enables stage2 end-to-end tests to run natively on macOS
(where and when applicable). Since QEMU on macOS doesn't support
the same type of architecture emulation as it does on linux (i.e.,
there is no `qemu-x86_64` for instance), this commit ensures that we
specify a path to dynamic linker on macOS (`/usr/lib/dyld`) which
is then checked for existence in `std.CrossTarget.getExternalExecutor()`
function, and if exists, we can run the test natively.

Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-15 15:59:16 -07:00
Vignesh Rajagopalan
2ab0c7391a Rename .macosx to .macos 2020-10-12 18:56:25 -04:00
Sébastien Marie
f33a610c84 add minimal openbsd support 2020-10-11 08:23:36 +00:00
Andrew Kelley
95a37373e9
Merge pull request #6421 from tadeokondrak/opaque-syntax
Add opaque syntax that allows declarations
2020-10-07 16:58:50 -04:00
Tadeo Kondrak
069fbb3c01
Add opaque type syntax 2020-10-06 22:08:24 -06:00
Isaac Freund
0741505d6d std/zig: handle underscore in kernel version
On some distros (e.g. Void Linux) the release field of the tsname
struct may contain an underscore followed by a revision number at the
end. (e.g. 5.8.12_2).
2020-10-05 22:17:28 -04:00
Andrew Kelley
f69650a478 update wasm to use ".o.wasm" extension for objects
This is convenient for debugging purposes, as well as simplifying the
caching system since executable basenames will not conflict with their
corresponding object files.
2020-09-29 17:01:05 -07:00
Andrew Kelley
750b00c642 Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-29 00:27:48 -07:00
LemonBoy
5c6cd5e2c9 stage{1,2}: Fix parsing of range literals
stage1 was unable to parse ranges whose starting point was written in
binary/octal as the first dot in '...' was incorrectly interpreted as
decimal point.

stage2 forgot to reset the literal type to IntegerLiteral when it
discovered the dot was not a decimal point.

I've only stumbled across this bug because zig fmt keeps formatting the
ranges without any space around the ...
2020-09-28 14:16:26 -04:00
Andrew Kelley
b08fd0e8fc stage2: building musl libc from source 2020-09-23 20:48:47 -07:00
Lachlan Easton
4496a6c9cc zig fmt: Special case un-indent comma after multiline string in param list 2020-09-18 20:34:00 +10:00
Lachlan Easton
1aacedf6e1 zig fmt: Fix regression in ArrayInitializers 2020-09-18 20:34:00 +10:00
Lachlan Easton
40b6e86a99 zig fmt: fix #6171 2020-09-18 20:34:00 +10:00
Lachlan Easton
c06674e701 zig fmt: Small cleanup 2020-09-18 20:34:00 +10:00
Lachlan Easton
206a8cf670 zig fmt: fix comments and multiline literals in function args 2020-09-18 20:34:00 +10:00
Lachlan Easton
291482a031 zig fmt: Don't consider width of expressions containing multiline string literals when calculating padding for array initializers. fixes #3739
Changes some of the special casing for multiline string literals.
2020-09-18 20:34:00 +10:00
Lachlan Easton
e1bd271192 zig fmt: Allow trailing comments to do manual array formatting. close #5948 2020-09-18 20:34:00 +10:00
Lachlan Easton
9f0821e688 zig fmt: Fix erroneously commented out code, add passing test case to close #5722 2020-09-18 20:34:00 +10:00
Lachlan Easton
ea6181aaf6 zig fmt: Add test for nesting if expressions 2020-09-18 20:34:00 +10:00
Andrew Kelley
2a8fc1a18e stage2: caching system integration & Module/Compilation splitting
* update to the new cache hash API
 * std.Target defaultVersionRange moves to std.Target.Os.Tag
 * std.Target.Os gains getVersionRange which returns a tagged union
 * start the process of splitting Module into Compilation and "zig
   module".
   - The parts of Module having to do with only compiling zig code are
     extracted into ZigModule.zig.
   - Next step is to rename Module to Compilation.
   - After that rename ZigModule back to Module.
 * implement proper cache hash usage when compiling C objects, and
   properly manage the file lock of the build artifacts.
 * make versions optional to match recent changes to master branch.
 * proper cache hash integration for compiling zig code
 * proper cache hash integration for linking even when not compiling zig
   code.
 * ELF LLD linking integrates with the caching system. A comment from
   the source code:

   Here we want to determine whether we can save time by not invoking LLD when the
   output is unchanged. None of the linker options or the object files that are being
   linked are in the hash that namespaces the directory we are outputting to. Therefore,
   we must hash those now, and the resulting digest will form the "id" of the linking
   job we are about to perform.
   After a successful link, we store the id in the metadata of a symlink named "id.txt" in
   the artifact directory. So, now, we check if this symlink exists, and if it matches
   our digest. If so, we can skip linking. Otherwise, we proceed with invoking LLD.

 * implement disable_c_depfile option
 * add tracy to a few more functions
2020-09-13 19:29:07 -07:00
Lachlan Easton
601331833a Add passing test. close #5343 2020-09-09 21:54:42 +10:00
Lachlan Easton
283d441c19 zig fmt: fix #3978, fix #2748 2020-09-09 21:54:42 +10:00
Vexu
1174cb1517
stage2: fix tokenizer float bug 2020-09-03 15:05:47 +03:00
Lachlan Easton
bb848dbeee zig fmt: Patch rename stream to ais (auto indenting stream) & other small refactors 2020-09-02 20:16:28 +10:00
Lachlan Easton
7841c9b7d1 zig fmt: Fix merge errors 2020-09-01 21:59:27 +10:00
Lachlan Easton
671b3abe5d Merge remote-tracking branch 'ziglang/master' into fmt_indentation 2020-09-01 18:41:23 +10:00
Lachlan Easton
bc24b86d82 zig fmt: Fix regression not covered by testing 2020-09-01 13:19:34 +10:00
Jan200101
2148336a81 follow filesystem hierarchy standard when adding lib directories 2020-08-31 17:44:43 -04:00
Andrew Kelley
8dc58a4e94
Merge pull request #6208 from tadeokondrak/remove-@OpaqueType
Remove @OpaqueType
2020-08-31 17:44:03 -04:00
Lachlan Easton
029ec456bc zig fmt: Set indent_delta to 2 when rendering inline asm 2020-08-31 23:39:50 +10:00
Lachlan Easton
5aca3baea6 zig fmt: Remove dynamic stack from auto-indenting-stream 2020-08-31 23:39:50 +10:00
Tadeo Kondrak
96e46cdd6e
std.zig.render: specify when rewrite should be removed 2020-08-30 23:45:47 -06:00
Tadeo Kondrak
c51de3c266
std.zig.render: rewrite @OpaqueType() to @Type(.Opaque) 2020-08-30 23:41:40 -06:00
Tadeo Kondrak
d3e5105ecc
std.zig.ast: make getTrailer/setTrailer private and add getters/setters 2020-08-30 17:18:25 -06:00
Lachlan Easton
50c8a53188 Use ArrayList instead of fixed array for auto_indenting_stream 2020-08-30 10:32:21 +10:00
Lachlan Easton
a72b9d403d Refactor zig fmt indentation. Remove indent from rendering code and have a stream handle automatic indentation 2020-08-29 13:35:00 +10:00
Tadeo Kondrak
e4b61aa527
std.meta.TrailerFlags fixes 2020-08-27 16:02:00 -06:00
Tadeo Kondrak
ce8a3ef2de
std.zig: Update to new std.meta.TrailerFlags API 2020-08-27 15:21:18 -06:00
Rocknest
140c599559
Fix & update windows version stuff (#6157)
* Update windows version constants
* Add docs
2020-08-24 16:47:44 -04:00