Commit Graph

3813 Commits (4640853d1b49ec17e1e997901c58c2294aca30d6)

Author SHA1 Message Date
Andrew Kelley 4640853d1b
on linux, link statically if not linking any shared libs 2018-10-05 18:34:37 -04:00
Andrew Kelley 8700f4d2b1
docs: add comment about operator overloading 2018-10-05 18:25:20 -04:00
Andrew Kelley c81a4b3e3d
docs: fix double escaping html entities 2018-10-05 10:21:08 -04:00
Andrew Kelley 8d6601d7ce
improve pointer documentation
closes #1630
2018-10-04 22:51:36 -04:00
Andrew Kelley d07413f9b7
fix missing .h files
closes #1634
2018-10-04 18:14:57 -04:00
Andrew Kelley 23b07ad8d2
refactor ir.cpp
Analysis functions no longer return `ZigType *`. Instead they
return `IrInstruction *`.
2018-10-04 14:33:52 -04:00
emekoi 31469daca3 removed unneeded dll extension 2018-10-04 11:43:53 -04:00
Andrew Kelley 3f13a59cbc
better mutex implementation
based on Ulrich Drepper's "Futexes are tricky" paper, Mutex, Take 3

also includes tests
2018-10-03 14:55:12 -04:00
Andrew Kelley 66cb75d114
std.Mutex: implement blocking mutexes on linux
closes #1463

Thanks to Shawn Landden for the original pull request.
This commit is based on that code.
2018-10-03 13:19:10 -04:00
Andrew Kelley acefcdbca5
add std.os.linux.vfork and std.os.linux.exit_group 2018-10-02 14:08:32 -04:00
Andrew Kelley 364bc66924
Merge pull request #1619 from bnoordhuis/fix1570
fix build-exe for --target-arch wasm32 (#1570)
2018-10-02 09:02:14 -04:00
Ben Noordhuis 24bbade217 fix build-exe for --target-arch wasm32 (#1570)
Pass --no-entry instead of --relocatable to lld. Both stop a reference
to the _start() entry point from being emitted but --relocatable also
prevents public symbols from being exported when creating an executable.
2018-10-02 12:31:21 +02:00
Wink Saville cd211bcc20 Add doc comment for tokenLocationPtr (#1618)
The algorithm seemed unusual and I had spent some effort understanding
it, so I thought I'd add a comment.
2018-10-02 00:51:53 -04:00
Jimmi Holst Christensen bc3e99c5e5
Fixed StackTrace not being resolved when panic is invalid (#1615) 2018-10-01 20:30:34 +02:00
Andrew Kelley d4d22df1d9 increase stack size on windows for all executables
fixes test failures

See #157
2018-10-01 14:10:18 -04:00
Andrew Kelley af229c1fdc
std lib (breaking): posixRead can return less than buffer size
closes #1414

std.io.InStream.read now can return less than buffer size
introduce std.io.InStream.readFull for previous behavior

add std.os.File.openWriteNoClobberC
rename std.os.deleteFileWindows to std.os.deleteFileW
remove std.os.deleteFilePosix
add std.os.deleteFileC

std.os.copyFile no longer takes an allocator
std.os.copyFileMode no longer takes an allocator
std.os.AtomicFile no longer takes an allocator

add std.os.renameW
add windows support for std.os.renameC

add a test for std.os.AtomicFile
2018-10-01 13:50:55 -04:00
Andrew Kelley d1ec8377d1
std lib: flesh out the async I/O streaming API a bit 2018-10-01 10:53:39 -04:00
Andrew Kelley 9d4eaf1e07
update std lib API for I/O
std.io.FileInStream -> std.os.File.InStream
std.io.FileInStream.init(file) -> file.inStream()
std.io.FileOutStream -> std.os.File.OutStream
std.io.FileOutStream.init(file) -> file.outStream()

remove a lot of error code possibilities from os functions

std.event.net.socketRead -> std.event.net.read
std.event.net.socketWrite -> std.event.net.write
add std.event.net.readv
add std.event.net.writev
add std.event.net.readvPosix
add std.event.net.writevPosix
add std.event.net.OutStream
add std.event.net.InStream

add std.event.io.InStream
add std.event.io.OutStream
2018-09-30 17:28:35 -04:00
Sahnvour ba78ae0ae7 Fixes --emit asm on windows and makes C header file generation explicit. (#1612)
* build: only do codegen_link when emitting an actual binary. Fixes #1371

* build: only output C header file when explicitely asked to
2018-09-30 16:59:45 -04:00
Andrew Kelley 418b2e7d47
build: omit finding libxml2, zlib since no direct dependency 2018-09-30 16:56:06 -04:00
Andrew Kelley 57c4d38c55
rename std.event.tcp to std.event.net 2018-09-30 10:37:58 -04:00
Andrew Kelley a42a213e35
Merge pull request #1594 from emekoi/master
added dynamic library loading for windows
2018-09-30 09:31:24 -04:00
emekoi e6446dfc86 fixed native target detection 2018-09-30 09:27:53 -04:00
emekoi 623f5085f1 merged windows dll apis 2018-09-30 01:05:13 -05:00
emekoi 42ba206c5d fixed compilation on mingw 2018-09-30 01:05:13 -05:00
emekoi d3bf267136 added dynamic library loading for windows 2018-09-30 01:05:13 -05:00
Jimmi Holst Christensen 1428ef3b07 Expose failing_allocator as *Allocator instead of const FailingAllocator 2018-09-30 01:23:05 +02:00
Andrew Kelley 40da2c6098
Merge pull request #1599 from ziglang/zig-build-arg0
zig build: use os_self_exe_path to determine exe path not arg0
2018-09-28 18:45:50 -04:00
Andrew Kelley 779881b978
zig build: use os_self_exe_path to determine exe path not arg0 2018-09-28 16:41:23 -04:00
Andrew Kelley e242f6a609
Release 0.3.0 2018-09-28 09:03:40 -04:00
Andrew Kelley f4a0658585 rely on gcc for static builds on macos 2018-09-27 22:27:52 -04:00
Andrew Kelley fe524a1fa5 build: add support for ZIG_STATIC on MacOS 2018-09-27 15:09:14 -04:00
Andrew Kelley cc490f0026
update @typeInfo docs 2018-09-27 12:34:41 -04:00
Andrew Kelley af3263d7a8 add dll export storage class where appropriate
closes #1443
2018-09-27 10:22:16 -04:00
Josh Wolfe e7d9d00ac8 overhaul api for getting random integers (#1578)
* rand api overhaul
* no retry limits. instead documented a recommendation
  to call int(T) % len directly.
2018-09-27 00:35:38 -04:00
Andrew Kelley 1c26c2f4d5
fix crash when compile error evaluating return...
...type of inferred error set. closes #1591
2018-09-26 16:59:08 -04:00
Andrew Kelley 589201b104
fix variables which are pointers to packed struct fields
closes #1121
2018-09-26 14:54:53 -04:00
Andrew Kelley dcfd15a7f0
the last number in a packed ptr is host int bytes
See #1121
2018-09-26 14:54:52 -04:00
Wink Saville 631851f8b5 Tweak SYMBOL_CHAR define in tokenizer.cpp
Make it a little clearer what a SYMBOL_CHAR is, use ALPHA instead of
ALPHA_EXCEPT_C and case 'c', which is ALPHA's definition.
2018-09-26 11:29:01 -04:00
Andrew Kelley 9485043b3c
fix implicit casting to *c_void
closes #1588

also some small std lib changes regarding posix sockets
and one doc typo fix
2018-09-26 11:06:09 -04:00
Jay Weisskopf 7b204649e3 stage1: Added `zig help` to show usage on stdout
This will make it easier to do things like `zig help | grep something`.

Invalid arguments will now display a short notice for `zig help`
instead of showing the full usage information. This will make it easier
to see the actual error.
2018-09-25 22:05:44 -04:00
Andrew Kelley 2e562a5f36
fix crash on runtime index into slice of comptime type
closes #1435
2018-09-25 12:03:39 -04:00
Andrew Kelley 839492d0e8
fix not syntax highlighting builtin module 2018-09-25 12:03:09 -04:00
Andrew Kelley eafb8e8572
fix self reference through fn ptr field crash
closes #1208
2018-09-25 10:45:11 -04:00
Wink Saville 0e6c18c820 Remove StrLitKind enum
I was looking at the tokenizer specifically fn testTokenize and the
this statement looked odd:

  if (@TagType(Token.Id)(token.id) != @TagType(Token.Id)(expected_token_id)) {

I then saw the TODO and thought I'd remove StrLitKind figuring that
would make testTokenize simpler. It did so I thought I'd prepare this PR.

The tests are still working and stage2 zig seems to work, it compiles and
I was able to use the fmt command.
2018-09-24 19:28:46 -04:00
Andrew Kelley 4241cd666d
fix more bigint code paths and add tests 2018-09-24 16:31:22 -04:00
Andrew Kelley 877036e7ef fix translate-c test expecting incorrect C ABI on windows 2018-09-24 15:14:20 -04:00
Andrew Kelley 32c91ad892
fix comptime bitwise operations with negative values
closes #1387
closes #1529
2018-09-24 14:38:51 -04:00
Andrew Kelley 422269ea6e
minor langref improvements 2018-09-24 14:38:51 -04:00
Wink Saville c5509a07ca Ignore class-memaccess error for gcc 8 and above
On Arch Linux the current default compiler is gcc 8.2.1 and this change
is needed to ignore the following errors:

  In file included from /home/wink/local/include/llvm/ADT/STLExtras.h:21,
                   from /home/wink/local/include/llvm/ADT/StringRef.h:13,
                   from /home/wink/local/include/llvm/ADT/StringMap.h:17,
                   from /home/wink/local/include/llvm/Support/Host.h:17,
                   from /home/wink/local/include/llvm/ADT/Hashing.h:49,
                   from /home/wink/local/include/llvm/ADT/ArrayRef.h:13,
                   from /home/wink/local/include/llvm/ADT/APFloat.h:21,
                   from /home/wink/local/include/clang/AST/APValue.h:18,
                   from /home/wink/local/include/clang/AST/Decl.h:17,
                   from /home/wink/local/include/clang/AST/ASTTypeTraits.h:20,
                   from /home/wink/local/include/clang/AST/ASTContext.h:18,
                   from /home/wink/local/include/clang/Frontend/ASTUnit.h:18,
                   from /home/wink/prgs/ziglang/zig/src/translate_c.cpp:18:
  /home/wink/local/include/llvm/ADT/SmallVector.h: In instantiation of ‘void llvm::SmallVectorTemplateBase<T, true>::push_back(const T&) [with T = std::pair<void*, long unsigned int>]’:
  /home/wink/local/include/llvm/Support/Allocator.h:249:33:   required from ‘void* llvm::BumpPtrAllocatorImpl<AllocatorT, SlabSize, SizeThreshold>::Allocate(size_t, size_t) [with AllocatorT = llvm::MallocAllocator; long unsigned int SlabSize = 4096; long unsigned int SizeThreshold = 4096; size_t = long unsigned int]’
  /home/wink/local/include/clang/AST/ASTContext.h:659:42:   required from here
  /home/wink/local/include/llvm/ADT/SmallVector.h:313:11: error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct std::pair<void*, long unsigned int>’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
       memcpy(this->end(), &Elt, sizeof(T));
       ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from /usr/include/c++/8.2.1/utility:70,
                   from /home/wink/local/include/llvm/Support/type_traits.h:19,
                   from /home/wink/local/include/llvm/Support/Casting.h:19,
                   from /home/wink/local/include/clang/Basic/LLVM.h:22,
                   from /home/wink/local/include/clang/AST/APValue.h:17,
                   from /home/wink/local/include/clang/AST/Decl.h:17,
                   from /home/wink/local/include/clang/AST/ASTTypeTraits.h:20,
                   from /home/wink/local/include/clang/AST/ASTContext.h:18,
                   from /home/wink/local/include/clang/Frontend/ASTUnit.h:18,
                   from /home/wink/prgs/ziglang/zig/src/translate_c.cpp:18:
  /usr/include/c++/8.2.1/bits/stl_pair.h:198:12: note: ‘struct std::pair<void*, long unsigned int>’ declared here
       struct pair
              ^~~~
2018-09-24 14:01:59 -04:00