8311 Commits

Author SHA1 Message Date
Andrew Kelley
e643b414e4
zig cc: recognize .S and .C as source file extensions 2020-03-23 11:34:16 -04:00
LemonBoy
0cd953d40e ir: Prevent crash when slicing hardcoded pointer
Closes #4780
2020-03-23 09:13:52 -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
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
7ffdf59c44
Merge pull request #4774 from ziglang/zig-cc
ability to use `zig cc` as a drop-in C compiler
2020-03-22 19:20:02 -04:00
LemonBoy
9d19d9008e debug: Correct version check in debug_line parser
Version 3 is similar to version 2 plus more opcodes.
2020-03-22 19:19:41 -04:00
LemonBoy
6a89751025 ir: Implement cast from anon struct to union 2020-03-22 19:06:22 -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
dbandstra
a8fa1ecd89 fix build.zig addBuildOption function for stream refactor 2020-03-21 23:18:09 -04:00
momumi
29324e6f39 fix formatting in tokenizer tests 2020-03-22 12:41:11 +10:00
Andrew Kelley
2b65dc1032
zig cc: detect optimization and debug flags 2020-03-21 22:30:46 -04:00
LemonBoy
dc79f181a5
ir: Disallow comparison between enum literal and untagged enum
Closes #4770
2020-03-21 20:54:05 -04:00
momumi
138dab4524 add number _ separators for stage 2 tokenizer 2020-03-22 10:35:19 +10: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
4d9b458f8f
zig cc: support .cc and .cxx extensions 2020-03-21 16:51:43 -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
beea478acc
Merge pull request #4764 from LemonBoy/fix-1265
ir: Allow errdefer with payload
2020-03-21 14:19:52 -04:00
LemonBoy
28dbc58837 Address review comments 2020-03-21 09:54:49 +01:00
LemonBoy
128e70ff3a ir: Allow errdefer with payload
Closes #1265
2020-03-21 09:54:49 +01:00
Andrew Kelley
153c6cf92e
ci: disable test-gen-h on sr.ht and drone 2020-03-20 21:33:37 -04:00
Andrew Kelley
3a2c490889 "generate .h files" feature is no longer supported in stage1 2020-03-20 18:33:36 -04:00
Andrew Kelley
8429ddecf8
Merge branch 'glibc-add-ld' 2020-03-20 15:48:57 -04:00
Andrew Kelley
7438d0fc31
glibc: include ld symbols and proper soname for ld 2020-03-20 14:39:05 -04:00
Andrew Kelley
ef69e4efa0
Merge branch 'mt-panic' of https://github.com/LemonBoy/zig into glibc-add-ld 2020-03-20 13:02:19 -04:00
Andrew Kelley
245dc9d930
include ld symbols when generating glibc dummy objects
closes #4748
2020-03-20 12:59:37 -04:00
LemonBoy
541e763010 ir: Peer type resolution between ?[]T and *[N]T
Closes #4767
2020-03-20 12:23:05 -04:00
Andrew Kelley
28a6c136e9
revert std.mem.span to prefer len over sentinel; add spanZ 2020-03-19 19:30:09 -04:00
Andrew Kelley
dc04e97098
Merge pull request #4752 from ziglang/slice-array
slicing with comptime start and end indexes results in pointer-to-array
2020-03-19 18:06:16 -04:00
Andrew Kelley
160367e0dd
fix compile error for reading past end of pointer casted array 2020-03-19 17:23:53 -04:00
Andrew Kelley
6b6f2fcf96
std.net: remove the hack from earlier in the branch 2020-03-19 15:09:52 -04:00
Andrew Kelley
f614d94faa
update std lib to take advantage of slicing with comptime indexes 2020-03-19 14:48:47 -04:00
Andrew Kelley
555a2c0328
(breaking) std.fs.copyFile now integrates with Dir
Removed:
 * `std.fs.updateFile`
 * `std.fs.updateFileMode`
 * `std.fs.copyFile`
 * `std.fs.copyFileMode`

Added:
 * `std.fs.Dir.copyFile`
 * `std.fs.copyFileAbsolute`
 * `std.fs.updateFileAbsolute`

Moved:
 * `std.fs.Dir.UpdateFileOptions` => `std.fs.CopyFileOptions`

Deprecated:
 * `std.fs.deleteDir`
 * `std.fs.deleteDirC`
 * `std.fs.deleteDirW`
 * `std.fs.readLink`
 * `std.fs.readLinkC`
2020-03-19 14:43:41 -04:00
Andrew Kelley
1d7861a36e
fix incorrect sentinel check 2020-03-19 13:18:14 -04:00
Andrew Kelley
8ddf9d84ff
add behavior tests for slicing with comptime indexes 2020-03-19 11:17:46 -04:00
Andrew Kelley
f824658e13
slicing sentinel-terminated slice without end
now results in a sentinel-terminated slice.
2020-03-19 10:54:20 -04:00
Andrew Kelley
61266d2621
test & docs fixups to work with new semantics 2020-03-19 09:53:55 -04:00
Andrew Kelley
7fa88cc0a6
std lib fixups for new semantics
std lib tests are passing now
2020-03-19 09:53:55 -04:00
Andrew Kelley
b5dba702ff
fixes to std.meta
behavior tests are passing now
2020-03-19 09:53:55 -04:00
Andrew Kelley
2164b511cc
partial revert of an improvement this branch made
because it uncovered a result location bug, and I need to get this
branch merged before going into a result location rabbit hole.

also fix the result type of slicing when the indexes are runtime known
and the result should be sentinel terminated.
2020-03-19 09:53:55 -04:00
Andrew Kelley
8688c43745
when result loc is a slice, avoid evaluating lazy start..end
This prevents lazy values from being unnecessarily evaluated.
2020-03-19 09:53:55 -04:00
Andrew Kelley
e947f0c740
0-bit array type does not resolve child type 2020-03-19 09:53:55 -04:00
Andrew Kelley
72a261b4d3
fix runtime slice of pointer not setting length 2020-03-19 09:53:55 -04:00
Andrew Kelley
4435b05b6b
fix regression when slicing 0-bit pointers 2020-03-19 09:53:55 -04:00
Andrew Kelley
2b4134459d
fix alignment when slicing with comptime start and end index 2020-03-19 09:53:54 -04:00
Andrew Kelley
8ea0a00f40
improve std lib code for the new semantics 2020-03-19 09:53:54 -04:00
Andrew Kelley
8d0ac6dc4d
@ptrCast supports casting a slice to pointer 2020-03-19 09:53:54 -04:00
Andrew Kelley
c896c5001f
fix slice of string literal having the wrong type 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