Commit Graph

4580 Commits

Author SHA1 Message Date
emekoi
b7aa289ae4 fixed broken casts in std 2019-03-31 16:47:34 -05:00
emekoi
4a64f26627 added error for implicit cast from *const T to *[1]T. credit: @kristate 2019-03-31 16:47:34 -05:00
hryx
a4afacd182 Veritcally align array literal columns 2019-03-31 14:27:10 -04:00
Andrew Kelley
25ac2fe8cd
fix anon enum literal used with switch on union(enum)
closes #2141
closes #2142
2019-03-31 12:43:21 -04:00
MateuszOkulus
62af701804 Remove binary and octal float literals from documentation.
Part of #2093
2019-03-31 10:49:55 -04:00
Andrew Kelley
90a78866db
Merge pull request #2112 from shritesh/param_decl_doc_comments
Add doc_comments to param decl
2019-03-30 19:22:28 -04:00
Shritesh Bhattarai
b0d89cfe3f fmt: Fix param decl test 2019-03-30 14:58:18 -05:00
Shritesh Bhattarai
efa751c339 Add doc_comments to param decl 2019-03-30 14:50:08 -05:00
Rohlem
5703ab1d0c fix std.ascii type error and inverted logic
previously:
```
...\lib\zig\std\ascii.zig:203:20: error: unable to perform binary not operation on type 'comptime_int'
        return c | ~0b00100000;
                   ^
```
2019-03-29 12:18:42 -04:00
Rohlem
a824a8c687 add std.ascii to std.std test "std" 2019-03-29 12:18:42 -04:00
Shawn Landden
d494a5f4cf fix tests for math.mulWide 2019-03-29 12:17:48 -04:00
Shawn Landden
66f13ba807 stage1: better error message when comparing against null
Closes: #2104
2019-03-28 15:54:44 -04:00
Shawn Landden
85d1885375 std.mulWide() whose return is twice as wide 2019-03-28 15:51:10 -04:00
Andrew Kelley
64b2cf776c
implement target_c_type_size_in_bits for WASI 2019-03-27 16:08:45 -04:00
Andrew Kelley
fbe9233aa7
Merge pull request #2107 from shawnl/arm64
fix build on arm64
2019-03-27 13:11:01 -04:00
emekoi
cf4e9a27c5 removed static build flags on mingw 2019-03-27 12:49:26 -04:00
Shawn Landden
084724c689 use __ARM_EABI__, not __arm__
This is sort of pedantic and old OABI systems are unlikely to ever run zig.
2019-03-27 01:18:58 +00:00
Shawn Landden
65e234adfd fix build on arm64 2019-03-27 01:14:29 +00:00
Shritesh Bhattarai
85575704a4 Use linux.exit_group if not single threaded 2019-03-26 17:49:20 -04:00
Shritesh Bhattarai
5942797000 fmt: check for extra newline at end of file
`anything_changed` checks if `source_index` == `source.len`
Fixes #2074
2019-03-26 13:26:00 -04:00
Shawn Landden
51be449a57 std.ascii: respond to review
This won't generate as much mode in debug mode, as it doesn't check for overflow.
2019-03-26 12:00:55 -04:00
Andrew Kelley
1d09cdaa6a munmap allows address 0
fixes test suite regression on macOS from previous commit
2019-03-25 16:04:25 -04:00
Andrew Kelley
5eaead6a56
implement allowzero pointer attribute
closes #1953

only needed for freestanding targets.

also adds safety for `@intToPtr` when the address is zero.
2019-03-25 12:55:45 -04:00
Andrew Kelley
3306e43984
add compile error test for invalid enum literal implicit cast
See #683
2019-03-24 18:51:24 -04:00
Andrew Kelley
da9d8a6ecf
implement peer type resolution for enum literals
See #683
2019-03-24 18:47:36 -04:00
Andrew Kelley
aff7b38838
make switch expressions allow enum literal types
See #683
2019-03-24 01:15:21 -04:00
Andrew Kelley
a736dfe6a1
implement implicit cast from enum literal to enum
See #683
2019-03-24 00:55:55 -04:00
Andrew Kelley
d0551db5cd
introduce the enum literal type
see #683
2019-03-24 00:44:18 -04:00
Andrew Kelley
64dddd7afe
add compile error for ignoring error
closes #772
2019-03-23 19:33:00 -04:00
Andrew Kelley
6a9c32f759
add regression tests for a bug fixed by an older commit
closes #1914
2019-03-23 19:01:51 -04:00
Andrew Kelley
4d50bc3f8d
add peer type resolution for *const T and ?*T
closes #1298
2019-03-23 18:48:12 -04:00
Andrew Kelley
89953ec83d
character literals: allow unicode escapes
also make the documentation for character literals more clear.
closes #2089

see #2097
2019-03-23 17:35:21 -04:00
Andrew Kelley
55cb9ef138
docs: clarify NaN, inf, -inf
closes #2089
2019-03-23 15:25:38 -04:00
Andrew Kelley
3e9697bb35
remove octal and hex floats from the language
closes #2093

This is technically a breaking change but I would be
surprised if anyone was actually using this feature.
2019-03-23 14:04:52 -04:00
Andrew Kelley
14d416f83b
parse_f128.c: fix whitespace 2019-03-23 13:46:50 -04:00
Andrew Kelley
d83836825f
add mulXf3 to compiler-rt
this adds the following functions to compiler-rt:

 * `__mulsf3`
 * `__muldf3`
 * `__multf3`

See #1290
2019-03-22 17:46:49 -04:00
Andrew Kelley
324cbb9864
stage1: implement get_dynamic_linker for riscv 2019-03-22 17:12:41 -04:00
Andrew Kelley
e9f066acae fix macos build instructions in readme and fix warning 2019-03-22 16:57:41 -04:00
Shawn Landden
b76398c993 std: add ascii with C ASCII character classes
Does NOT look at the locale the way the C functions do.

       int isalnum(int c);
       int isalpha(int c);
       int iscntrl(int c);
       int isdigit(int c);
       int isgraph(int c);
       int islower(int c);
       int isprint(int c);
       int ispunct(int c);
       int isspace(int c);
       int isupper(int c);
       int isxdigit(int c);

       int isascii(int c);
       int isblank(int c);

       int toupper(int c);
       int tolower(int c);

Tested to match glibc (when using C locale) with this program:

const c = @cImport({
    // See https://github.com/ziglang/zig/issues/515
    @cDefine("_NO_CRT_STDIO_INLINE", "1");
    @cInclude("stdio.h");
    @cInclude("string.h");
    @cInclude("ctype.h");
});

const std = @import("std");
const ascii = std.ascii;
const abort = std.os.abort;

export fn main(argc: c_int, argv: **u8) c_int {
    var i: u8 = undefined;
    i = 0;
    while (true) {
        if (ascii.isAlNum(i) != (c.isalnum(i) > 0)) { abort(); }
        if (ascii.isAlpha(i) != (c.isalpha(i) > 0)) { abort(); }
        if (ascii.isCtrl(i) != (c.iscntrl(i) > 0)) { abort(); }
        if (ascii.isDigit(i) != (c.isdigit(i) > 0)) { abort(); }
        if (ascii.isGraph(i) != (c.isgraph(i) > 0)) { abort(); }
        if (ascii.isLower(i) != (c.islower(i) > 0)) { abort(); }
        if (ascii.isPrint(i) != (c.isprint(i) > 0)) { abort(); }
        if (ascii.isPunct(i) != (c.ispunct(i) > 0)) { abort(); }
        if (ascii.isSpace(i) != (c.isspace(i) > 0)) { abort(); }
        if (ascii.isUpper(i) != (c.isupper(i) > 0)) { abort(); }
        if (ascii.isXDigit(i) != (c.isxdigit(i) > 0)) { abort(); }
        if (i == 255) { break; }
        i += 1;
    }

    _ = c.printf(c"Success!\n");
    return 0;
}
2019-03-22 16:25:56 -04:00
Andrew Kelley
6272847917
Merge pull request #2094 from ziglang/f128-decimal-literal
float literals now parse using musl's 128 bit float code
2019-03-22 16:21:56 -04:00
Andrew Kelley
02767690e0 get rid of restrict; it's not supported by MSVC 2019-03-22 16:08:19 -04:00
Andrew Kelley
71c78cc9cf
avoid quad float literal syntax for MSVC 2019-03-22 16:06:18 -04:00
Andrew Kelley
4615ed5ea0
float literals now parse using musl's 128 bit float code
fixes float literals not having 128 bit precision
2019-03-22 14:56:03 -04:00
Matt Stancliff
1ca78e39e4 Fix typos around pointer usage 2019-03-22 14:10:17 -04:00
Andrew Kelley
127bb124a0
Merge pull request #2091 from ziglang/bigint-print-fix
Fix bigint_append_buf
2019-03-22 10:23:18 -04:00
Andrew Kelley
3560f61c16
Merge pull request #2087 from ziglang/float-parsing
fix some hex literal parsing bugs
2019-03-22 10:16:46 -04:00
Marc Tiehuis
a3f42a5fe1 Fix compile-error test case for large integer type 2019-03-23 00:20:03 +13:00
Marc Tiehuis
6f90d2c209 Fix bigint_append_buf
All current usages use base 10 and have a limb length of 1, hence why
we weren't hitting this error in practice.
2019-03-22 22:10:51 +13:00
Jimmi Holst Christensen
23af502d04 Updated langref to newest grammar 2019-03-22 09:01:30 +01:00
Marc Tiehuis
e3b70fe4ba Simplify hex-float parsing code 2019-03-22 17:11:57 +13:00