1. 24 Jan, 2017 14 commits
    • Harris Hancock's avatar
      1633318a
    • Harris Hancock's avatar
      Convert brand-pointer to constexpr-function (1/3) · 1572e754
      Harris Hancock authored
      MSVC erroneously refuses to compile code which calculates the address of
      objects of static storage duration at compile-time, despite this being
      legal. Work around this by changing `_capnpPrivate::brand` from constexpr
      pointers to static constexpr functions returning pointers. The compiler
      is then free to calculate it at compile-time if it can (gcc, clang), but
      can also defer it to run-time if it can't (MSVC).
      
      This change is split into three commits:
      
      1. Changes to the code generator (this commit).
      2. A bootstrap regeneration, after which the codebase will not compile.
      3. Changes to the generated code support header, after which the codebase
      will again compile.
      1572e754
    • Harris Hancock's avatar
      Port serialize-async-test.c++ to Windows · b2e23c1a
      Harris Hancock authored
      b2e23c1a
    • Harris Hancock's avatar
      Work around MSVC bug affecting KJ_CONTEXT · cff9ba05
      Harris Hancock authored
      cff9ba05
    • Harris Hancock's avatar
      MSVC non-const copy capture workaround · f87b3068
      Harris Hancock authored
      MSVC refuses the following code:
      
      struct Foo { Foo(Foo&) {} };
      Foo foo;
      [foo] {}();
      
      because it only seems to want to consider const copy constructors when
      capturing objects by value in lambda capture lists.
      f87b3068
    • Harris Hancock's avatar
      Use std::atomic sentWake in async-win32.{h,c++} · 9d5c1579
      Harris Hancock authored
      We could also port this by using the deprecated MSVC compiler intrinsics,
      but:
      
      1) They're deprecated,
      2) I've never used them,
      3) We'd need to sprinkle some #if's in the code to support both MinGW and
      MSVC, increasing the maintenance burden.
      9d5c1579
    • Harris Hancock's avatar
      Add async-win32 code to CMakeLists.txt · 3a02012a
      Harris Hancock authored
      3a02012a
    • Harris Hancock's avatar
      Implement atomic operations for MSVC · d6d06e54
      Harris Hancock authored
      Reads and writes of volatile aligned words are automatically blessed with
      atomic acquire and release semantics at compile-time by MSVC, leaving only
      CPU operation reordering to worry about. x86 and x64 CPUs will not reorder
      the operations, but MSVC targets Xbox, which notably will reorder them,
      thus I added fences out of an abundance of caution. While Cap'n Proto
      likely will not compile for Xbox as-is, I would hate for someone to port
      it only to have to debug obscure atomic-operation-related crashes later.
      
      I implemented the fences using std::atomic_thread_fence rather than
      MemoryBarrier(), because including windows.h in raw-schema.h is a
      non-starter, and it would be silly to reimplement it with in-line assembly
      and intrinsics for every targeted CPU when <atomic> is available.
      
      Another possible implementation could have been to use the InterlockedXxx
      functions, however they present a few issues:
      
      1. They're defined in windows.h. We could define them in terms of their
         underlying _InterlockedXxx intrinsics, but we'd need more #if blocks to
         handle both 32-bit and 64-bit pointers. If we go this route, it'd
         probably be better to go all-in and define some kj::atomic{Load,Store}
         functions.
      2. We cannot implement atomic load-acquire semantics with them for const
         variables without const_casting.
      d6d06e54
    • Harris Hancock's avatar
      Move RawSchema, RawBrandedSchema to raw-schema.h · ecb0c9d6
      Harris Hancock authored
      This is necessary to resolve an MSVC compile error in capability.h:
      
      struct RawSchema;
      extern const RawSchema NULL_INTERFACE_SCHEMA;
      constexpr RawSchema const* schema = &NULL_INTERFACE_SCHEMA;
      
      causes MSVC to complain that `schema` is not initialized by a constant
      expression. Providing the full definition of RawSchema resolves this
      spurious error, so I moved it out of generated-header-support.h and into
      its own raw-schema.h.
      ecb0c9d6
    • Harris Hancock's avatar
      373e4ea4
    • Harris Hancock's avatar
      Adjust Dbghelp function pointer syntax to compile with MSVC · a8106dea
      Harris Hancock authored
      The calling convention must go inside the parentheses when declaring a
      function pointer.
      
      WINBOOL is apparently a MinGW-ism.
      a8106dea
    • Harris Hancock's avatar
    • Harris Hancock's avatar
      Only build parsing code if we're not using MSVC · 6c7014a2
      Harris Hancock authored
      Disallow MSVC from building the parsing code by default because the latest
      stable MSVC (VS2015 Update 3) ICEs when trying to compile the `anyOfChars`
      combinator.
      
      Note that VS2015 Update 2 and VS2017 can compile the parsing code, with a
      little help. To experiment with this, you can override the default
      behavior with -DCAPNP_BUILD_TOOLS=ON.
      6c7014a2
    • Harris Hancock's avatar
      Allow MSVC to build non-lite mode · d6d5c792
      Harris Hancock authored
      d6d5c792
  2. 23 Jan, 2017 1 commit
  3. 22 Jan, 2017 2 commits
  4. 05 Jan, 2017 2 commits
  5. 03 Jan, 2017 1 commit
    • Ross Light's avatar
      Add getFd method to FdInputStream and FdOutputStream · 1c2fb362
      Ross Light authored
      These methods are useful if you're receiving a generic stream in
      application code and would like to check some non-stream behavior about
      the file (e.g. stat or isatty).  Of course, downcasting can fail and
      code should not rely on the file descriptor being available.
      1c2fb362
  6. 29 Dec, 2016 1 commit
  7. 13 Dec, 2016 1 commit
  8. 12 Dec, 2016 2 commits
  9. 05 Dec, 2016 1 commit
  10. 01 Dec, 2016 2 commits
  11. 27 Nov, 2016 1 commit
  12. 25 Nov, 2016 1 commit
  13. 19 Nov, 2016 5 commits
  14. 18 Nov, 2016 2 commits
  15. 15 Nov, 2016 4 commits