Commit Graph

2207 Commits

Author SHA1 Message Date
alexander 6df8e4bca7 Add DIFlagStaticMember flag to functions.
Prevents LLVM from generating debug info for
struct member functions with a pointer as the
first parameter as though the first parameter
were the implicit "this" pointer from C++.
2018-12-30 12:57:49 -05:00
Andrew Kelley d8b6fa9134 Merge pull request #1859 from mgxm/fbsd2
Progress towards tier 1 support for FreeBSD x86_64
2018-12-29 12:49:23 -05:00
Andrew Kelley c464ecf3bf Merge pull request #1857 from vegecode/boolean-switch
Switching on bools with duplicate and missing value detection: Issue …
2018-12-27 18:14:33 -05:00
Andrew Kelley aaef6259c3 allow not having libc include paths and doing @cImport 2018-12-26 20:44:06 -05:00
Andrew Kelley a918ce26b8 fixups 2018-12-26 15:25:54 -05:00
alexander 4a1f0e1418 Switching on bools with duplicate and missing value detection: Issue 1768 2018-12-26 10:44:25 -06:00
nebulaeonline f49b45b00f tabs to space fix. thanks visual studio. 2018-12-24 14:01:35 -05:00
nebulaeonline 28cd337d1f fixed formatting in options display 2018-12-24 07:49:15 -05:00
nebulaeonline 7dcee99510 fixed stricmp/strcasecmp between windows/posix 2018-12-23 23:59:59 -05:00
nebulaeonline 51baea184b Yet another git user error remnant fixed 2018-12-23 23:46:45 -05:00
nebulaeonline 480061d2c9 git user error fix 2018-12-23 23:09:07 -05:00
nebulaeonline fdea12b2d9 msvc subsystem option handling; added uefi os type 2018-12-23 22:44:02 -05:00
Marcio Giaxa 773bf80133 Merge branch 'master' into fbsd2 2018-12-23 23:21:59 -02:00
Andrew Kelley 218a4d4b30 comptime: ability to @ptrCast to an extern struct and read fields 2018-12-22 23:06:30 -05:00
Andrew Kelley 56fedbb524 translate-c: --verbose-cimport prints clang command 2018-12-20 19:56:24 -05:00
Andrew Kelley 0f54194e6a fixups 2018-12-20 12:36:15 -05:00
kristopher tate 39567e8b50 src/analyze.cpp: support alignOf(struct T) aligned member inside struct T;
ref: ziglang/zig#1832
2018-12-20 22:53:54 +09:00
Marcio Giaxa 1fc56b82ad freebsd: link against libc
Since the stable kernel ABI is through libc #1759
2018-12-19 18:42:00 -02:00
Jimmi Holst Christensen 45e72c0b39 Fixed intToPtr to fn type when the address is hardcoded (#1842)
* Fixed intToPtr to fn type

* Added test

* Import inttoptr.zig in behavior.zig
2018-12-19 09:39:18 -05:00
Andrew Kelley e077a44656 ir: delete dead code 2018-12-18 15:48:26 -05:00
Andrew Kelley f75262b79f fix comptime pointer reinterpretation array index offset
closes #1835
2018-12-17 11:05:50 -05:00
Andrew Kelley 757d0665ae implement comptime pointer cast
closes #955
closes #1835
2018-12-16 12:08:14 -05:00
Andrew Kelley d770333827 freebsd: fix os_self_exe_path function and update std lib 2018-12-12 22:28:15 -05:00
Andrew Kelley b883bc873d breaking API changes to all readInt/writeInt functions & more
* add `@bswap` builtin function. See #767
 * comptime evaluation facilities are improved to be able to
   handle a `@ptrCast` with a backing array.
 * `@truncate` allows "truncating" a u0 value to any integer
   type, and the result is always comptime known to be `0`.
 * when specifying pointer alignment in a type expression,
   the alignment value of pointers which do not have addresses
   at runtime is ignored, and always has the default/ABI alignment
 * threw in a fix to freebsd/x86_64.zig to update syntax from
   language changes
 * some improvements are pending #863

closes #638
closes #1733

std lib API changes
 * io.InStream().readIntNe renamed to readIntNative
 * io.InStream().readIntLe renamed to readIntLittle
 * io.InStream().readIntBe renamed to readIntBig
 * introduced io.InStream().readIntForeign
 * io.InStream().readInt has parameter order changed
 * io.InStream().readVarInt has parameter order changed
 * io.InStream().writeIntNe renamed to writeIntNative
 * introduced io.InStream().writeIntForeign
 * io.InStream().writeIntLe renamed to writeIntLittle
 * io.InStream().writeIntBe renamed to writeIntBig
 * io.InStream().writeInt has parameter order changed
 * mem.readInt has different parameters and semantics
 * introduced mem.readIntNative
 * introduced mem.readIntForeign
 * mem.readIntBE renamed to mem.readIntBig and different API
 * mem.readIntLE renamed to mem.readIntLittle and different API
 * introduced mem.readIntSliceNative
 * introduced mem.readIntSliceForeign
 * introduced mem.readIntSliceLittle
 * introduced mem.readIntSliceBig
 * introduced mem.readIntSlice
 * mem.writeInt has different parameters and semantics
 * introduced mem.writeIntNative
 * introduced mem.writeIntForeign
 * mem.writeIntBE renamed to mem.readIntBig and different semantics
 * mem.writeIntLE renamed to mem.readIntLittle and different semantics
 * introduced mem.writeIntSliceForeign
 * introduced mem.writeIntSliceNative
 * introduced mem.writeIntSliceBig
 * introduced mem.writeIntSliceLittle
 * introduced mem.writeIntSlice
 * removed mem.endianSwapIfLe
 * removed mem.endianSwapIfBe
 * removed mem.endianSwapIf
 * added mem.littleToNative
 * added mem.bigToNative
 * added mem.toNative
 * added mem.nativeTo
 * added mem.nativeToLittle
 * added mem.nativeToBig
2018-12-12 20:35:04 -05:00
Andrew Kelley 1b0f4d5976 implement compile error note for function parameter type mismatch 2018-12-05 15:32:25 -05:00
Andrew Kelley c54fe0d3ae work around to support debian's fork of llvm 7.0.1
it has a patch that adds an OS type, breaking the public API
this commit avoids depending on the last os type enum item,
but retains the safety assertion checks.

closes #1788
2018-11-28 22:58:52 -05:00
Andrew Kelley dd2450b1b2 tier 2 support for freebsd 2018-11-27 20:56:43 -05:00
Andrew Kelley e3bf40742d Merge branch 'master' into freebsd2 2018-11-27 20:36:44 -05:00
Andrew Kelley 67a39a4c99 stage1: better file path handling
* better message printed when cache hash fails
 * better handling of '/' as root source file
 * os_path_split parses '/' and '/a' correctly

closes #1693
closes #1746
2018-11-26 20:04:35 -05:00
Andrew Kelley d2ed4d3dd3 Merge branch 'zig-backport-os_file_read-EISDIR' of https://github.com/kristate/zig into kristate-zig-backport-os_file_read-EISDIR 2018-11-26 19:59:58 -05:00
Andrew Kelley 3d2752cc36 refactor type_requires_comptime to have possible error
fixes a compiler crash when building
https://github.com/AndreaOrru/zen
2018-11-24 16:15:58 -05:00
Andrew Kelley 56a8f2b018 fix @intCast not catching negative numbers to unsigned 2018-11-24 14:36:16 -05:00
Andrew Kelley 9493738e54 Merge branch 'freebsd-up' of https://github.com/myfreeweb/zig into freebsd2 2018-11-19 17:24:41 -05:00
Sahnvour 703c6684d1 Crash fixes and small improvements to inline asm. (#1756)
* codegen: LLVMConstInlineAsm is deprecated.

* codegen: replace commas in asm constraint strings by pipes as required by LLVM.

* ir: enforce usage of '=' constraint modifier for inline assembly outputs.

Others are not currently supported and this was just asserted alter in `ir_render_asm`.

* asm: forbid comptime_int/floats as inputs in favor of explicitely sized constants.

Fixes a crash due to comptime_int/floats having no type_ref.

* asm: handle inputs with integers of <8 or non power of 2 bitsize.

We widen them to the next highest power of two.
2018-11-19 16:22:21 -05:00
Andrew Kelley 89e82281be fix incorrect --help text 2018-11-19 13:26:35 -05:00
Andrew Kelley 2f5d1ec500 improve error message when wrong type returned
closes #1650
2018-11-19 11:22:57 -05:00
Andrew Kelley 3829e200ec fix assertion failure related to @intToEnum 2018-11-18 20:04:16 -05:00
Andrew Kelley f8a782fb2e all numbers with comptime known values implicitly cast
to all number types. If the value does not fit,
a compile error is emitted.

closes #422
closes #1712
2018-11-18 19:37:59 -05:00
kristopher tate 947cdafd91 src/os.cpp: os_file_read: return ErrorIsDir on case EISDIR; 2018-11-18 15:30:24 +09:00
Andrew Kelley 085d049a08 aarch64 improvements
* support C ABI for all return types
 * don't include __aeabi_uldivmod & co on aarch64 since
   it's 64 bit
2018-11-17 11:21:00 -05:00
Jimmi HC 2a580278c4 Updated comments in parser.cpp 2018-11-17 14:42:47 +01:00
Andrew Kelley 704374e512 rename section keyword to linksection
add zig fmt support for this syntax

closes #1152
2018-11-17 01:38:35 -05:00
Vallentin 398914eb71 Fixed typos 2018-11-16 14:03:39 -05:00
Jimmi Holst Christensen be9bb0a857 Fixed #1663 and removed IrInstructionArrayLen 2018-11-16 10:15:13 -05:00
Andrew Kelley 3666fbd9f9 ** and ++ operators force comptime on operands
closes #1707
2018-11-14 12:23:40 -05:00
Jimmi Holst Christensen 5b3f7a8e1f Fixed error where we didn't expect the return type of a function 2018-11-13 14:43:08 +01:00
Jimmi Holst Christensen 8139c5a516 New Zig formal grammar (#1685)
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-13 05:08:37 -08:00
Andrew Kelley 67fbb0434f ir: remove redundant casting code 2018-11-11 12:48:55 -05:00
Andrew Kelley ef5d7ce463 array type syntax implies comptime 2018-11-09 19:26:54 -05:00
emekoi 8e69a18d8c made colored output more consistent (#1706)
* made colored output more consistent
* added os.supportsAnsiEscapeCodes
2018-11-08 00:36:36 -05:00