Commit Graph
4562 Commits
Author SHA1 Message Date
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
Andrew Kelley d04a1456df hex float parsing: solve another case
this works now: 0x1.edcb34a235253948765432134674fp-1
2019-03-21 16:35:18 -04:00
Andrew Kelley af509c68b0 fix parsing of large hex float literals
closes #2083
2019-03-21 16:17:29 -04:00
Andrew Kelley b5cc92f163 ci: more quoting 2019-03-21 10:05:14 -04:00
Andrew Kelley 246304125a add documentation for zig test
closes #1518
2019-03-20 23:50:22 -04:00
Andrew Kelley bf4701562c ci: add FreeBSD to download page 2019-03-20 23:19:18 -04:00
Andrew Kelley b7fb63d696 ci: apt-get update before install as a workaround 2019-03-20 19:05:47 -04:00
Andrew Kelley 15c316b0d8 add docs for assembly and fix global assembly parsing
Previously, global assembly was parsed expecting it to have
the template syntax. However global assembly has no inputs,
outputs, or clobbers, and thus does not have template syntax.
This is now fixed.

This commit also adds a compile error for using volatile
on global assembly, since it is meaningless.

closes #1515
2019-03-20 19:00:23 -04:00
Andrew Kelley 3c7555cb67 Merge remote-tracking branch 'origin/llvm8' 2019-03-20 13:34:07 -04:00
Andrew Kelley 2fdf69bc40 Merge pull request #2079 from Sahnvour/issue-2050
Fixes c_ABI tests on windows
2019-03-20 00:11:11 -04:00
Sahnvour d669db7673 c_abi: activate tests on windows 2019-03-19 22:41:27 +01:00
Sahnvour 27d5e1f36c c_abi: add some tests for int and float parameter passing potentially using both registers and stack 2019-03-19 22:09:12 +01:00
Andrew Kelley ac34841270 build.zig: allow run() on non-native target artifacts 2019-03-19 17:08:50 -04:00
Sahnvour c17b1635ca c_abi: when compiling for x86_64, differenciate between system V and windows ABI 2019-03-19 22:08:19 +01:00
Andrew Kelley 9801a1df6a disable all C warnings when building musl 2019-03-19 15:04:39 -04:00
Andrew Kelley 3c36929603 zig targets prints the available libcs 2019-03-19 15:04:29 -04:00
Andrew Kelley af9ac0d548 better buffer length for formatIntUnsigned
see #1358
2019-03-19 10:11:28 -04:00
Jimmi Holst Christensen e508b85746 Updated parser to newest grammar 2019-03-19 10:36:37 +01:00
Andrew Kelley 1b25dcde96 freebsd ci: disable not working stuff 2019-03-19 00:53:36 -04:00