Commit bab217b2 authored by Kenton Varda's avatar Kenton Varda

Fix GCC problems.

parent edbc2a5a
......@@ -115,6 +115,7 @@ includekj_HEADERS = \
src/kj/common.h \
src/kj/units.h \
src/kj/memory.h \
src/kj/refcount.h \
src/kj/array.h \
src/kj/vector.h \
src/kj/string.h \
......@@ -124,6 +125,7 @@ includekj_HEADERS = \
src/kj/arena.h \
src/kj/io.h \
src/kj/tuple.h \
src/kj/one-of.h \
src/kj/function.h \
src/kj/mutex.h \
src/kj/thread.h \
......@@ -142,7 +144,10 @@ includecapnp_HEADERS = \
src/capnp/layout.h \
src/capnp/orphan.h \
src/capnp/list.h \
src/capnp/object.h \
src/capnp/message.h \
src/capnp/capability.h \
src/capnp/capability-context.h \
src/capnp/schema.capnp.h \
src/capnp/schema.h \
src/capnp/schema-loader.h \
......@@ -152,7 +157,6 @@ includecapnp_HEADERS = \
src/capnp/serialize.h \
src/capnp/serialize-packed.h \
src/capnp/pointer-helpers.h \
src/capnp/object.h \
src/capnp/generated-header-support.h
lib_LTLIBRARIES = libkj.la libcapnp.la libcapnpc.la
......@@ -164,6 +168,7 @@ libkj_la_SOURCES= \
src/kj/common.c++ \
src/kj/units.c++ \
src/kj/memory.c++ \
src/kj/refcount.c++ \
src/kj/array.c++ \
src/kj/string.c++ \
src/kj/string-tree.c++ \
......@@ -187,7 +192,10 @@ libcapnp_la_SOURCES= \
src/capnp/arena.c++ \
src/capnp/layout.c++ \
src/capnp/list.c++ \
src/capnp/object.c++ \
src/capnp/message.c++ \
src/capnp/capability.c++ \
src/capnp/capability-context.c++ \
src/capnp/schema.capnp.c++ \
src/capnp/schema.c++ \
src/capnp/schema-loader.c++ \
......@@ -289,6 +297,7 @@ capnp_test_CPPFLAGS = -Igtest/include -I$(srcdir)/gtest/include
capnp_test_SOURCES = \
src/kj/common-test.c++ \
src/kj/memory-test.c++ \
src/kj/refcount-test.c++ \
src/kj/array-test.c++ \
src/kj/string-test.c++ \
src/kj/string-tree-test.c++ \
......@@ -297,6 +306,7 @@ capnp_test_SOURCES = \
src/kj/arena-test.c++ \
src/kj/units-test.c++ \
src/kj/tuple-test.c++ \
src/kj/one-of-test.c++ \
src/kj/function-test.c++ \
src/kj/mutex-test.c++ \
src/kj/async-test.c++ \
......@@ -308,14 +318,15 @@ capnp_test_SOURCES = \
src/capnp/endian-fallback-test.c++ \
src/capnp/endian-reverse-test.c++ \
src/capnp/layout-test.c++ \
src/capnp/object-test.c++ \
src/capnp/message-test.c++ \
src/capnp/capability-test.c++ \
src/capnp/schema-test.c++ \
src/capnp/schema-loader-test.c++ \
src/capnp/dynamic-test.c++ \
src/capnp/stringify-test.c++ \
src/capnp/encoding-test.c++ \
src/capnp/orphan-test.c++ \
src/capnp/object-test.c++ \
src/capnp/serialize-test.c++ \
src/capnp/serialize-packed-test.c++ \
src/capnp/test-util.c++ \
......
......@@ -245,8 +245,9 @@ public:
auto promise = loop.there(kj::mv(promiseAndPipeline.promise),
kj::mvCapture(context, [=](kj::Own<LocalCallContext> context) {
return Response<ObjectPointer>(context->getResults(1).asReader(),
kj::mv(context->response));
// Do not inline `reader` -- kj::mv on next line may occur first.
auto reader = context->getResults(1).asReader();
return Response<ObjectPointer>(reader, kj::mv(context->response));
}));
return RemotePromise<ObjectPointer>(
......@@ -309,7 +310,8 @@ public:
uint64_t interfaceId, uint16_t methodId, uint firstSegmentWordSize) const override {
auto hook = kj::heap<LocalRequest>(
loop, interfaceId, methodId, firstSegmentWordSize, kj::addRef(*this));
return Request<ObjectPointer, ObjectPointer>(hook->message->getRoot(), kj::mv(hook));
auto root = hook->message->getRoot(); // Do not inline `root` -- kj::mv may happen first.
return Request<ObjectPointer, ObjectPointer>(root, kj::mv(hook));
}
VoidPromiseAndPipeline call(uint64_t interfaceId, uint16_t methodId,
......@@ -456,7 +458,8 @@ public:
uint64_t interfaceId, uint16_t methodId, uint firstSegmentWordSize) const override {
auto hook = kj::heap<LocalRequest>(
eventLoop, interfaceId, methodId, firstSegmentWordSize, kj::addRef(*this));
return Request<ObjectPointer, ObjectPointer>(hook->message->getRoot(), kj::mv(hook));
auto root = hook->message->getRoot(); // Do not inline `root` -- kj::mv may happen first.
return Request<ObjectPointer, ObjectPointer>(root, kj::mv(hook));
}
VoidPromiseAndPipeline call(uint64_t interfaceId, uint16_t methodId,
......
......@@ -41,7 +41,7 @@ TEST(OneOf, Basic) {
EXPECT_FALSE(var.is<String>());
EXPECT_EQ(123, var.get<int>());
#if !KJ_NO_EXCEPTIONS
#if !KJ_NO_EXCEPTIONS && defined(KJ_DEBUG)
EXPECT_ANY_THROW(var.get<float>());
EXPECT_ANY_THROW(var.get<String>());
#endif
......
......@@ -100,7 +100,7 @@ private:
inline void doAll(T... t) {}
template <typename T>
KJ_ALWAYS_INLINE(bool destroyVariant()) {
inline bool destroyVariant() {
if (tag == typeIndex<T>()) {
tag = 0;
dtor(*reinterpret_cast<T*>(space));
......@@ -112,7 +112,7 @@ private:
}
template <typename T>
KJ_ALWAYS_INLINE(bool copyVariantFrom(const OneOf& other)) {
inline bool copyVariantFrom(const OneOf& other) {
if (other.is<T>()) {
ctor(*reinterpret_cast<T*>(space), other.get<T>());
tag = typeIndex<T>();
......@@ -126,7 +126,7 @@ private:
}
template <typename T>
KJ_ALWAYS_INLINE(bool moveVariantFrom(OneOf& other)) {
inline bool moveVariantFrom(OneOf& other) {
if (other.is<T>()) {
ctor(*reinterpret_cast<T*>(space), kj::mv(other.get<T>()));
tag = typeIndex<T>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment