Commit Graph
100 Commits
Author SHA1 Message Date
Andrew Kelley 051620dcaf Merge pull request #5097 from Vexu/field
Disallow declarations between fields
2020-04-19 03:52:53 -04:00
Andrew Kelley 44ff55091f Merge branch 'cshenton-patch-1'
closes #5085
2020-04-18 14:42:49 -04:00
Andrew Kelley 3817420d42 ziggurat uses @truncate instead of & 0xff
This makes it work on 32-bit targets.

closes #2939
2020-04-18 14:41:33 -04:00
Andrew Kelley ca38b18879 rand: ref the decls so they get tested 2020-04-18 14:41:25 -04:00
Andrew Kelley 6b2274fd99 Merge pull request #5088 from Vexu/varargs-fix
Add error for non-exter variadic functions
2020-04-18 14:35:35 -04:00
Andrew Kelley 986aa42d3e update cmake, update readme, in response to the dynamic linking fiasco 2020-04-17 18:41:21 -04:00
Andrew Kelley fc48c232e5 cli: add c++ subcommand to --help menu
closes #5034
2020-04-14 13:38:18 -04:00
Andrew Kelley 448f8c2eb8 langref: add link to 0.6.0 version 2020-04-13 21:33:08 -04:00
Andrew Kelley cf750a58d5 Release 0.6.0 2020-04-13 13:36:30 -04:00
Andrew Kelley b8796be79d disable flaky event loop test
See #4922
2020-04-12 23:02:39 -04:00
Andrew Kelley d27ef1aaef Zig treats -lstdc++ identically to -lc++
Thanks to Michael Dusan for figuring out what was happening here.

closes #5012
2020-04-12 00:50:16 -04:00
Andrew Kelley f79faf9008 cmake: allow not finding some clang libs
partial revert of aaf99371b2
because it broke the build for some people
2020-04-11 22:09:17 -04:00
Andrew Kelley 3c34c313cf revert Translate C: Add comment containing c source location for failed decls
This reverts 0db108101a.

Unfortunately this caused a regression. Closes #5007.
2020-04-11 17:56:48 -04:00
Andrew Kelley 4ceaa0595a move fs tests to separate file; disable flaky test
See #5006
2020-04-11 17:50:38 -04:00
Andrew Kelley c236cbff39 Merge pull request #5003 from emekoi/fix-mingw
fix compilation under mingw
2020-04-11 16:43:38 -04:00
Andrew Kelley eefe6956fd clarify what "not valid" means 2020-04-11 16:43:19 -04:00
Andrew Kelley a6e288d5fe Merge pull request #4711 from leroycep/feature-file-locks
Add lock option to File.OpenFlags and File.CreateFlags
2020-04-10 15:00:45 -04:00
Andrew Kelley 4871345545 update readme instructions for homebrew 2020-04-10 01:29:04 -04:00
Andrew Kelley e857190dab put the previous commit behind cmake option ZIG_PREFER_CLANG_CPP_DYLIB
Without this, building from source caused:

CommandLine Error: Option 'mc-relax-all' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

This is due to LLVM static libs compiled in multiple times. But without
the LLVM static libs on the linker line, it caused undefined symbol
linker errors.

So our hands are tied. Homebrew users will have to specify
`-DZIG_PREFER_CLANG_CPP_DYLIB`.
2020-04-10 01:25:15 -04:00
Andrew Kelley aaf99371b2 look for clang-cpp shared lib when it exists
See #4799
2020-04-10 00:38:19 -04:00
Andrew Kelley 543031db35 Merge pull request #4982 from MageJohn/fix/binarySearch
sort.binarySearch: fix integer underflow (#4980)
2020-04-09 14:58:07 -04:00
Andrew Kelley beae932e0f Merge pull request #4975 from Vexu/param-reassign
Fix missing compile error on assign to slice and array parameters
2020-04-08 21:02:50 -04:00
Andrew Kelley c45ba49b8b fix formatted printing warning
needed to use ZIG_PRI_u64 instead of %lu
2020-04-08 19:30:18 -04:00
Andrew Kelley d5087ccbc8 cmake: expose ZIG_TARGET_MCPU option 2020-04-08 17:41:51 -04:00
Andrew Kelley 29ea425ca2 Merge branch 'LakeByTheWoods-translate_ptr_int'
closes #4688
2020-04-08 14:11:16 -04:00
Andrew Kelley b3aef49eea zig provides shlwapi.lib for *-windows-gnu
closes #3711
2020-04-08 01:21:00 -04:00
Andrew Kelley ed23dad487 fix the new runtime-safety tests
Thanks to Vexu's work in e62671f643, compile errors were identified in
these test cases! This commit fixes them to use `const` as appropriate.
2020-04-07 16:05:42 -04:00
Andrew Kelley 4d290758bb fix compile errors in some std.Target functions
The `ve` architecture needed to be added to a couple switch statements.
2020-04-07 15:06:58 -04:00
Andrew Kelley 22dbeab29d Merge pull request #4857 from LemonBoy/fix-4777
Rewrite the bound checks in slice operator
2020-04-07 14:51:25 -04:00
Andrew Kelley 87a7ea4c42 Merge pull request #4971 from Vexu/const-ref
Fix missing const on address of literal
2020-04-07 14:24:50 -04:00
Andrew Kelley a20f3e3f02 Merge pull request #4972 from mneumann/dragonfly-fix-compile
Fix compile on Dragonfly
2020-04-07 13:04:37 -04:00
Andrew Kelley ab05766674 Merge pull request #4966 from ziglang/bootstrap-windows
cmake: improvements to cross-compiling for Windows
2020-04-06 23:16:31 -04:00
Andrew Kelley fc662ddd54 mingw-w64: add 32-bit version.def
fixes -lversion on 32-bit windows builds
2020-04-06 20:31:00 -04:00
Andrew Kelley 41cb49eb58 stage1 fixes to support building with 32-bit mingw-w64 2020-04-06 20:30:34 -04:00
Andrew Kelley 9ed00b3829 provide ___mb_cur_max_func for i386-windows-gnu 2020-04-06 19:26:31 -04:00
Andrew Kelley 64d0960244 zig cc: recognize a few more linker options
* `--major-image-version`
 * `--minor-image-version`
 * `--stack`
2020-04-06 19:13:36 -04:00
Andrew Kelley 15ab61b2a0 cmake: improvements to cross-compiling for Windows
* don't unconditionally pass -lz3 for mingw builds. If mingw builds
   require this then the llvm-config executable should put it as part of
   --system-libs. If there is a bug and it does not do that, and we need
   a workaround, then the workaround should be an explicit cmake option.
 * don't link libstage2.a against -lntdll. This causes zig to set
   `builtin.link_mode == .Dynamic` and include the TLS definitions,
   which then collide with the mingw-w64 symbols. This should probably
   be addressed separately, but for now this solves the problem and
   there is no reason to link a static library against a DLL.
 * Findllvm.cmake no longer treats the libraries as "optional" and will
   emit a cmake error if one is not found. Additionally, the
   not-required LLVM library LLVMTableGen is omitted.
2020-04-06 18:38:09 -04:00
Andrew Kelley afa24ccd99 fix the build on Windows
Workaround for issue #2668

Zig std lib currently does not allow forward slashes in Windows path
names.
2020-04-06 18:35:49 -04:00
Andrew Kelley e4eb817f79 libc_installation.zig: don't special-case based on C ABI
Whether the C ABI is mingw-w64 or msvc, detection of native libc paths
should be the same. In the future we may want to allow passing a C ABI
parameter to detectNativeCPaths() but for now we have the same behavior
regardless.
2020-04-06 13:33:32 -04:00
Andrew Kelley 96ed544665 build.zig supports specifying config.h location explicitly
also it does not try to run llvm-config executable when -Dlib-files-only

This fixes cross-compiling using the bootstrap repository.
2020-04-06 13:07:19 -04:00
Andrew Kelley 701c03d083 zig uses mingw-w64 to provide -lpsapi 2020-04-05 23:06:47 -04:00
Andrew Kelley 28d9696617 use mingw-w64 to provide -luuid if requested 2020-04-05 23:06:47 -04:00
Andrew Kelley 05b587fcde Merge branch 'LemonBoy-vec-div'
closes #4737
2020-04-05 18:34:47 -04:00
Andrew Kelley e84b9b70ff annotate disabled tests with github issue links 2020-04-05 18:34:32 -04:00
Andrew Kelley 5597b11a52 add runtime safety tests for SIMD integer division 2020-04-05 18:34:31 -04:00
Andrew Kelley e2dc63644a type_has_one_possible_value takes comptime struct fields into account
Before, type_has_one_possible_value would return false for the value
`.{1}`. But actually, that type is a tuple with a single comptime field.
Such a type, in fact, has one possible value.

This plus the corresponding adjustment to get_the_one_possible_value
solves #3878.
2020-04-05 17:09:01 -04:00
Andrew Kelley 607b2661a0 Merge pull request #4942 from daurnimator/tidy-atomics
Tidy up compiler_rt/atomics
2020-04-05 11:13:31 -04:00
Andrew Kelley e5d479b06e detect an endless loop when trying to detect native libc installation
closes #4810
2020-04-04 15:03:22 -04:00
Andrew Kelley 52db13738b zig cc looks for native include directories unless -nostdinc
closes #4938
2020-04-04 14:58:24 -04:00
Andrew Kelley d02838b71a add libutil to zig's glibc support 2020-04-04 14:43:51 -04:00
Andrew Kelley dc7e8b2fdc build.zig: better detection of using outside zig executable
As pointed out by gereeter, dirname("/") successfully returns "/" again.
So checking for null is not sufficient.
2020-04-04 14:05:49 -04:00
Andrew Kelley cf8728aabd Merge pull request #4935 from LemonBoy/stage1-eb
Big-endian fixes for stage1
2020-04-04 13:45:49 -04:00
Andrew Kelley d73808f3ff remove zig BUILD_INFO hack
Rather than stuffing configuration information into the Zig binary, the
build script reads it from config.h. This solves a problem for package
maintainers and improves the use case of deterministic builds.

closes #3758
2020-04-04 11:57:28 -04:00
Andrew Kelley e89c42655c Merge pull request #4868 from xackus/new-arraylist-api
new ArrayList API
2020-04-03 22:31:15 -04:00
Andrew Kelley f1425fd9da gitattributes: note that libcxxabi is vendored 2020-04-03 18:36:42 -04:00
Andrew Kelley a2cad9a3d9 add issue links to disabled test cases 2020-04-03 18:36:13 -04:00
Andrew Kelley 7beea47178 Merge branch 'LemonBoy-compiler-rt-atomics'
closes #4924
2020-04-03 16:08:52 -04:00
Andrew Kelley e03cbb117e compiler-rt: don't forget to export these functions 2020-04-03 16:07:32 -04:00
Andrew Kelley cf52f3f99a zig cc: add -allow-shlib-undefined alias 2020-04-03 13:45:16 -04:00
Andrew Kelley 11b50e3ad8 change the default ABI of riscv64-linux-musl
Before, this would cause a link failure when mixing Zig and C code for
RISC-V targets.

Now, the ABIs match and Zig and C code can be mixed successfully.

I will file a follow-up issue for the ability to deal more explicitly
with ABIs.

closes #4863
2020-04-03 13:13:09 -04:00
Andrew Kelley 048da6f631 ci: enable riscv64-linux tests
Thanks to Michael Dusan's work in
deef063bbf these tests can be enabled.
2020-04-02 21:44:03 -04:00
Andrew Kelley f8cc6a1917 zig cc: fix ambiguity with -MT
In an MSVC context, `-MT` means
"Use static run-time"
and it is a flag with no parameter.

On POSIX it means
"Specify name of main file output in depfile"
and it is "joined or separate".

The former was interfering with the latter. Now, the MT flag is required
to be specified with a `/` to disambiguate: `/MT`.
2020-04-02 21:15:36 -04:00
Andrew Kelley e7f555ca55 stage1: fix build for i386-linux 2020-04-02 19:07:52 -04:00
Andrew Kelley 5314641e11 zig cc: support more linker args 2020-04-02 17:29:22 -04:00
Andrew Kelley c1778bd41f zig cc: support --version-script linker arg
See #4784
2020-04-02 16:59:08 -04:00
Andrew Kelley c4b3c84b3f zig cc: support -F and -framework 2020-04-02 15:59:48 -04:00
Andrew Kelley e4edc6d118 zig cc: respect -MF -MV -MD options
Zig disables its caching and forwards these args when any are provided.

see #4784
2020-04-02 15:47:27 -04:00
Andrew Kelley 4aa797b6bb Merge branch 'ilmaria-master'
closes #4608
2020-04-02 15:06:50 -04:00
Andrew Kelley 8bf7cffe29 slight modification of the semantics of std.os.getenvW
Now, this function first attempts a case-sensitive lookup.
If no match is found, and `key` is ASCII, then it attempts a
second case-insensitive lookup.

It is not planned to support full Unicode case-insensitivity
on Windows, and in fact relying on non-ASCII case-insensitive
environment variables is fundamentally problematic.
2020-04-02 15:04:42 -04:00
Andrew Kelley 503c420797 Merge pull request #4908 from daurnimator/fifo-refactor
Modernize LinearFifo for new stream conventions
2020-04-02 12:13:44 -04:00
Andrew Kelley 4848b28ec8 zig cc: detect -mcpu, -march, -mtune
However these are all treated like zig's -mcpu parameter.

See #4784
2020-04-01 18:06:04 -04:00
Andrew Kelley 783f73c7e3 zig cc properly handles -S flag and .ll, .bc extensions 2020-04-01 16:01:06 -04:00
Andrew Kelley 0f1f56bb69 Merge pull request #4896 from FireFox317/fix-arm32-stuff
fix some nullptr dereferences on arm-linux-musleabhif
2020-04-01 15:55:31 -04:00
Andrew Kelley c211b8f91d fix regressions from previous commit 2020-04-01 15:02:31 -04:00
Andrew Kelley c2e8788259 Merge branch 'daurnimator-less-buffer'
closes #4665
2020-04-01 13:44:19 -04:00
Andrew Kelley 2e806682f4 (breaking) std.Buffer => std.ArrayListSentineled(u8, 0)
This new name (and the fact that it is a function returning a type) will
make it more clear which use cases are better suited for ArrayList and
which are better suited for ArrayListSentineled.

Also for consistency with ArrayList,
 * `append` => `appendSlice`
 * `appendByte` => `append`

Thanks daurnimator for pointing out the confusion of std.Buffer.
2020-04-01 13:30:07 -04:00
Andrew Kelley 553f0e0546 fixups and revert a few things 2020-04-01 11:56:39 -04:00
Andrew Kelley e8a1e2a1d8 Merge pull request #4894 from LemonBoy/netbsd-p2
More NetBSD bits
2020-04-01 10:24:54 -04:00
Andrew Kelley 0628c2e2ba Merge pull request #4895 from vrischmann/fix-io-tests
Fix io tests
2020-04-01 10:21:27 -04:00
Andrew Kelley d23f9a164e Remove unneeeded address-of operator 2020-04-01 10:21:17 -04:00
Andrew Kelley c7a3796734 ci: export master branch version for update-download-page 2020-03-31 14:54:13 -04:00
Andrew Kelley d34a3c66b3 Merge pull request #4543 from daurnimator/cleanup-json
std.json improvements
2020-03-31 12:07:25 -04:00
Andrew Kelley 28b7306a31 Merge pull request #4880 from daurnimator/use-spanZ
Take advantage of mem.spanZ accepting null
2020-03-31 11:57:31 -04:00
Andrew Kelley d9d8c42426 remove unnecessary inline
works around a bug triggered by previous commit
2020-03-31 11:18:11 -04:00
Andrew Kelley 47a0e3ec5e Merge pull request #4871 from boothby/issue4769
Address bugs when //, /// or //! are immediately followed by EOF
2020-03-31 10:56:21 -04:00
Andrew Kelley 6d25e45123 Merge branch 'LemonBoy-more-cache' 2020-03-31 10:49:06 -04:00
Andrew Kelley 0e372ccff5 clean up the duplicate export logic for __clear_cache 2020-03-31 10:48:48 -04:00
Andrew Kelley 839d85e440 fixes to 32-bit handling, to support 32-bit arm 2020-03-31 10:10:31 -04:00
Andrew Kelley 1df85d1509 Merge branch 'FireFox317-clear-cache' 2020-03-30 23:15:33 -04:00
Andrew Kelley 83ff94b1cc compiler-rt: don't export __clear_cache when no impl available 2020-03-30 23:15:07 -04:00
Andrew Kelley cfedd3aca2 revert detection of rtti and exceptions
This caused link errors in c++ code because it was not correct to pass
these flags to child codegens. And that was the only reason to detect
these flags. Otherwise we can safely rely on non-explicitly-detected
flag forwarding.
2020-03-30 17:42:30 -04:00
Andrew Kelley 6408766d6b linking: remove check for target_supports_libunwind
I'm not sure why this was ever there. Maybe it was working around a
problem with LLVM 9. Anyway this fixes linking C++ code for 32 bit
arm and riscv.
2020-03-30 15:50:53 -04:00
Andrew Kelley 9e7ae06249 std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
Andrew Kelley b980568c81 add peer type resolution for mixed-const []T and *[N]T
closes #4766

This commit also fixes the implementation of some utility functions for
adjusting properties of pointer types. Previously these functions would
incorrectly drop vector, sentinel, and inference metadata.
2020-03-30 13:02:50 -04:00
Andrew Kelley b717df786b Merge pull request #4845 from xackus/fix-parseFloat
fix overflow in parseFloat and cleanup
2020-03-29 22:40:32 -04:00
Andrew Kelley f9f7deaeda linking against c++ does not trigger system library directories 2020-03-29 20:58:59 -04:00
Andrew Kelley 5aa2812507 linking is now aware -lm is provided by mingw-w64 2020-03-29 13:17:21 -04:00
Andrew Kelley c70471fae6 enable now-passing test cases
These can now be enabled thanks to bug fixes that landed in
LLVM 10.
2020-03-29 10:34:12 -04:00
Andrew Kelley 38a1af5d4f zig cc: -O0 also counts as debug mode 2020-03-29 10:34:12 -04:00
Andrew Kelley 86795c03f9 Merge pull request #4844 from layneson/translatec_string_concat
Support string concatenation in Translate-C
2020-03-29 00:31:50 -04:00