Commit Graph

4691 Commits

Author SHA1 Message Date
hryx
c76d51de97 zig fmt: Allow one-line for loops 2019-04-01 11:31:00 -04:00
Shritesh Bhattarai
d645500883 fmt: fix first line comment indent in struct init 2019-03-31 22:33:32 -04:00
vegecode
bfbfb7b3b0 Remove inline keywords in addXf3.zig pending #2154 2019-03-31 21:00:36 -05:00
hryx
0563e8e1d4 Always write a multiline struct literal if a field expr is multiline 2019-03-31 21:09:56 -04:00
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
Michael Dusan
aa794eb621 fix zig run to accept executable args
The `--` double-hyphen is now used to end further `zig` processing
of command line options. All arguments after `--` will be passed
on to the executable. eg. `--help` will be passed on.

`zig run foo.zig -- --help`

closes #2148
2019-03-31 17:01:11 -04:00
vegecode
937ff0cb6a Add all __aeabi functions (C versions) who alias currently existing functions to compiler-rt 2019-03-31 15:54:02 -05:00
vegecode
779137be41 Add __aeabi_{f,d}neg and __neg{s,d,X}f2 to compiler-rt 2019-03-31 15:54:02 -05:00
vegecode
38c2093500 Add __aeabi_{f,d}{add,sub} and __{add,sub}{s,d}f3 to compiler-rt 2019-03-31 15:54:02 -05:00
vegecode
310f91fb4f Add __aeabi_mem{cmp,clr,set,cpy,move} to compiler-rt 2019-03-31 15:54:02 -05:00
vegecode
e89b704293 Add memcmp to builtins 2019-03-31 15:54:02 -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
emekoi
8fdf8b6972 fixed libc command on mingw 2019-03-29 23:16:17 -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