Commit Graph

686 Commits

Author SHA1 Message Date
SuperAuguste
9298d38cee remove debug statement 2020-04-07 13:33:01 -04:00
SuperAuguste
94841d0292 Nameless struct field consistency 2020-04-07 13:26:17 -04:00
SuperAuguste
6106cf4419 fixes 2020-04-05 19:06:43 -04:00
SuperAuguste
027e2a1673 fix multichar literals in translate_c 2020-04-04 17:56:25 -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
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
Rejean Loyer
2b6dfdd3d4 zig cc: add support for -L linker arguments 2020-04-01 17:21:11 -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
c211b8f91d
fix regressions from previous commit 2020-04-01 15:02:31 -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
daurnimator
7eb938c909
Use length field as passed in stage2 libc_installation instead of relying on zero termination 2020-04-01 10:36:38 -04:00
daurnimator
e535057364
std: use std.ArrayList(u8).OutStream instead of std.Buffer.OutStream 2020-04-01 10:36:38 -04:00
daurnimator
3fb030e78a
std: use std.ArrayList(u8) instead of std.Buffer in src-self-hosted/translate_c.zig 2020-04-01 10:36:38 -04:00
daurnimator
3cf302a71d
Tidy up some mem.spanZ use-sites now that null is accepted 2020-04-01 01:50:34 +11:00
Andrew Kelley
839d85e440 fixes to 32-bit handling, to support 32-bit arm 2020-03-31 10:10:31 -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
9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
Layne Gustafson
2a05ca1c94 Conv macro string concat to ++ 2020-03-28 20:40:13 -04:00
Ryan Liptak
cc7c670851 Sync clang_options_data.zig with update_clang_options
Some of the recent c++ related options were added to update_clang_options but didn't make it into clang_options_data.zig
2020-03-28 00:39:33 -07:00
Ryan Liptak
874b4618ca zig cc: Add support for -z
This is only the first step; it makes zig cc recognize -z and append it to the linker args, but the linker arg parsing doesn't support -z yet so it will just give the warning 'unsupported linker arg: -z'
2020-03-28 00:35:54 -07:00
Ryan Liptak
b0b29b8a2f zig cc: Add support for -Xlinker, --for-linker, --for-linker= 2020-03-27 23:32:01 -07:00
Andrew Kelley
107b5196f6
Merge pull request #4827 from ziglang/zig-cpp
support compiling and linking c++ code
2020-03-27 22:35:13 -04:00
Andrew Kelley
a258741084
initial support of response files
See #4833

It doesn't support comments or quotes yet.
2020-03-27 22:24:40 -04:00
Michael Dusan
33819ecfbc windows: don't hard-code forward-slash paths
`zig targets` -> unable to list targets: BadPathName
2020-03-27 21:28:52 -04:00
Andrew Kelley
f407109070
zig c++: get it working with musl and mingw-w64 2020-03-27 12:38:52 -04:00
Andrew Kelley
db17c0d88c
ability to compile c++ hello world with zig c++
closes #4786
2020-03-26 22:48:37 -04:00
Andrew Kelley
fae6cf0961
improved handling of native system directories
* `-isystem` instead of `-I` for system include directories
   fixes a problem with native system directories interfering with zig's
   bundled libc.
 * separate Stage2Target.is_native into Stage2Target.is_native_os and
   Stage2Target.is_native_cpu.
2020-03-25 20:34:15 -04:00
Michael Dusan
dd66fbb96a
Merge pull request #4811 from mikdusan/fix4634
self-hosted: use fs.selfExePathAlloc
2020-03-25 19:49:52 -04:00
Andrew Kelley
e3fec6cce9
zig cc: add detection for -###
it turns on --verbose-cc and --verbose-link
2020-03-25 19:32:12 -04:00
Michael Dusan
d554070de1
self-hosted: use fs.selfExePathAlloc
- add fs.selfExePathAlloc
- use fs.selfExePathAlloc instead of fs.selfExeDirPathAlloc
- remove redundant code from fs.selfExeDirPath

closes #4634
2020-03-25 18:40:28 -04:00
Andrew Kelley
6cbe589b51
zig cc: support -T linker script option 2020-03-25 12:05:48 -04:00
Andrew Kelley
93c7fa105f
Merge remote-tracking branch 'origin/llvm10'
LLVM 10 was released today
2020-03-24 09:57:09 -04:00
Andrew Kelley
13d04f9963
Merge pull request #4741 from momumi/master
allow `_` separators in number literals (stage 1)
2020-03-23 00:54:54 -04:00
Andrew Kelley
94f7c56001
riscv: add -mrelax arg for C to work around upstream issue
See #4485
2020-03-22 21:47:19 -04:00
Andrew Kelley
e5e5196d8e
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-22 20:48:21 -04:00
momumi
2d18178c27 minor fixes and more tests for _ separators
* Make the tokenizer spit out an Invalid token on the first invalid
  character found in the number literal.
* More parsing and tokenizer tests for number literals
* fix invalid switch statement in ir.zig
2020-03-23 09:21:34 +10:00
Andrew Kelley
23c263776c
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-22 15:09:29 -04:00
momumi
8de45e5143 update parsing of int literals in self-hosted
* update std.math.big.Int.setString() to ignore underscores and make it
  case insensitive
* fix issue in ir.zig with leading zeroes in integer literals
2020-03-22 13:59:14 +10:00
Andrew Kelley
2b65dc1032
zig cc: detect optimization and debug flags 2020-03-21 22:30:46 -04:00
Andrew Kelley
4b0ddb817b
zig cc: better support for the preprocessor option (-E) 2020-03-21 20:32:48 -04:00
Michael Dusan
28ad78cb7f
rename "passthrough" → "driver_punt"
- punt when `-E` is supplied
- punt when `-S` is supplied
2020-03-21 16:53:59 -04:00
Andrew Kelley
0eee98edc1
zig cc improvements
* The generated options data file is sorted now in a way that
   makes sure longer prefixes are first. This prevents collisions
   with some parameters.
 * Add support for `-fPIC`, `-fno-PIC`, `-nostdlib`, `-shared`,
   `-rdynamic`, `-Wl,-soname`, `-Wl,-rpath`
 * Better support for `-o`.
 * Disable generating h files
 * Shared library support.
 * Better positional argument support.
2020-03-21 15:40:49 -04:00
Andrew Kelley
a4eaeee720
ability to use zig cc as a drop-in C compiler
The basics are working
2020-03-21 15:39:39 -04:00
Andrew Kelley
7438d0fc31
glibc: include ld symbols and proper soname for ld 2020-03-20 14:39:05 -04:00
Andrew Kelley
53b5aa812b
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-19 22:19:24 -04:00
Andrew Kelley
8ea0a00f40
improve std lib code for the new semantics 2020-03-19 09:53:54 -04:00
Andrew Kelley
0707be8de8
fixes in semantic analysis needed to support this feature 2020-03-19 09:53:54 -04:00
Andrew Kelley
46ffc798b6
fix swapped logic for Windows
Remove `std.fs.deleteTree`. Callers instead should use
`std.fs.cwd().deleteTree`.

Add `std.fs.deleteTreeAbsolute` for when the caller has an absolute
path.
2020-03-18 16:42:47 -04:00