Commit Graph

5466 Commits

Author SHA1 Message Date
Andrew Kelley
1d2fc446bd
cap getdents length argument to INT_MAX
the linux syscall treats this argument as having type int, so passing
extremely long buffer sizes would be misinterpreted by the kernel.
since "short reads" are always acceptable, just cap it down.

patch based on musl commit 3d178a7e2b75066593fbd5705742c5808395d90d
2019-07-08 17:52:28 -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
4953e84902
Merge pull request #2847 from ziglang/glibc-abi-versioning
support glibc version as part of the target
2019-07-08 13:51:48 -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
Andrew Kelley
56d8185650
expose glibc version in builtin 2019-07-07 17:56:43 -04:00
Andrew Kelley
3e36cad1c1
remove debug log 2019-07-07 17:56:43 -04:00
Andrew Kelley
336ddb8011
add -target-glibc to cli help and zig build 2019-07-07 17:56:43 -04:00
Andrew Kelley
7ccf7807b3
ability to target any glibc version 2019-07-07 17:56:08 -04:00
Andrew Kelley
3b97940fb3
add an update_glibc tool, delete dummy libc files
This is the beginning of supporting minimum GLIBC version as part of the
target. See #2509 for the motivation.

The dummy libc zig files are removed. A future commit will build them
on-the-fly, using the generated text files generated by the new tool,
which are checked into source control and distributed along with zig.

These generated text files are, together, 142KB (20KB gzipped).
Compare that to a naive bundling of the .abilist files, which would be
2.2MiB (375KB gzipped).

This is based on glibc 2.29.
2019-07-07 17:56:07 -04:00
Andrew Kelley
d39dcd6d9d
zig build: add setLibCFile API 2019-07-07 11:31:07 -04:00
Andrew Kelley
38ba412729
Merge pull request #2837 from daurnimator/linux-AT_
std: improvements to linux constants
2019-07-07 09:53:05 -04:00
Andrew Kelley
e12eb5e7f6
Merge pull request #2835 from hryx/de-keyword-anyerror
Make anyerror not a keyword
2019-07-07 09:44:48 -04:00
daurnimator
111e5ed0a2
std: MAP_FAILED is a libc concept on linux 2019-07-07 17:15:30 +10:00
daurnimator
e197968734
std: Make linux MAP_ definitions match kernel 2019-07-07 14:31:27 +10:00
daurnimator
7610d39413
std: Linux AT_ constants are the same across architectures 2019-07-07 14:11:43 +10:00
hryx
28b59a0be7
Remove reference to Keyword_anyerror in docgen 2019-07-06 18:19:04 -07:00
hryx
cce11a724c
Make anyerror not a keyword 2019-07-06 15:57:32 -07:00
SamTebbs33
b118806c69 Add implicit cast for *[N]T to [*c]T 2019-07-06 17:02:17 -04:00
Andrew Kelley
21c60922e3
Merge pull request #2823 from hryx/unicode-escape
Unicode escapes: support u{N...}
2019-07-06 13:14:43 -04:00
hryx
7f618184ad Prevent unreachable when file ends with struct field 2019-07-06 13:09:07 -04:00
Andrew Kelley
9471f16c79
zig fmt ignores "zig fmt: off" directive for whitespace fixes 2019-07-05 15:09:22 -04:00
Andrew Kelley
4f43a4b30f
zig fmt: fix whitespace
closes #2819
closes #2825
2019-07-05 14:46:21 -04:00
Andrew Kelley
5b42c76951
code formatting 2019-07-05 14:14:25 -04:00
Andrew Kelley
273c2b5c25
docs: mention @unionInit in the union section 2019-07-05 14:10:50 -04:00
Andrew Kelley
3ad9349f09
add std.os.windows.subsystem
The original issue that #2445 wanted to fix was solved in the previous
commit. However it also exposed the subsystem in the standard library,
which is still useful. So that's done in this commit, and #2445 can be
closed.
2019-07-05 14:08:56 -04:00
Andrew Kelley
0d84d52e37
std.os.abort no longer calls msvcrt abort() when linking libc
closes #2071
2019-07-05 12:53:36 -04:00
hryx
e35d49c4d0
Unicode escapes: documentation and grammar 2019-07-04 22:52:17 -07:00
hryx
6bfa8546bb
Unicode escapes: stage1 tokenizer and behavior tests 2019-07-04 22:40:19 -07:00
hryx
8365a7aab4
Unicode escapes: stage2 tokenizer and parser test 2019-07-04 14:48:23 -07:00
Andrew Kelley
72800f176e
zig build: search upwards for build.zig file
closes #2587
2019-07-04 17:44:33 -04:00
Michael Dusan
47addd87ac stage1: add missing help for --override-lib-dir 2019-07-04 15:36:34 -04:00
Andrew Kelley
a8b3b5f11c
zig build: install is now the default step; default prefix is zig-cache
closes #2817
2019-07-04 15:32:44 -04:00
Andrew Kelley
79e1fcfdda
Merge pull request #2787 from emekoi/fix-2768
forward error code in build.zig
2019-07-04 10:57:25 -04:00
emekoi
9e3189f1f4 forward error code on non-exits 2019-07-03 23:48:42 -05:00
emekoi
d8135c9e6e forward error code build.zig 2019-07-03 23:48:42 -05:00
Andrew Kelley
b109155528
Merge branch 'emekoi-impl-1107' 2019-07-04 00:35:47 -04:00
Andrew Kelley
96fd103073
improve the error message and test coverage 2019-07-04 00:35:28 -04:00
Andrew Kelley
bfe0bf695b
Merge branch 'impl-1107' of https://github.com/emekoi/zig into emekoi-impl-1107 2019-07-03 23:40:47 -04:00
Andrew Kelley
c2cf04086a
add docs for enum literals
closes #683
2019-07-03 23:09:58 -04:00
Andrew Kelley
d1cda00b36
workaround for no equality operator for enum literal and tagged union 2019-07-03 18:41:52 -04:00
Andrew Kelley
372b615ace
Merge branch 'timonkruiper-function-sections' 2019-07-03 15:47:40 -04:00
Andrew Kelley
4606baee07
add -ffunction-sections arg when building C objects
the other changes in this commit are minor tidying up
2019-07-03 15:46:27 -04:00
Andrew Kelley
2f4faf306d
Merge branch 'function-sections' of https://github.com/timonkruiper/zig into timonkruiper-function-sections 2019-07-03 14:43:33 -04:00
emekoi
a1b952f4b0 added tests for #1107 and a note in the reference 2019-07-03 13:12:14 -05:00
emekoi
53ca4118bd added segfault handler support for windows 2019-07-03 14:02:48 -04:00
Andrew Kelley
a1359ac3ab
Merge branch 'rbscott-comptime-union-init' 2019-07-03 13:55:50 -04:00
Andrew Kelley
4bae87764f
update @unionInit to integrate with result location semantics 2019-07-03 13:40:40 -04:00
Andrew Kelley
9da054095c
Merge branch 'comptime-union-init' of https://github.com/rbscott/zig into rbscott-comptime-union-init 2019-07-03 11:26:55 -04:00