Group :: Development/C
RPM: capnproto
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: capnproto-e2k.patch
Download
Download
diff --git a/c++/src/kj/async.c++ b/c++/src/kj/async.c++
index 59948cc2..dcbb0b4b 100644
--- a/c++/src/kj/async.c++
+++ b/c++/src/kj/async.c++
@@ -839,7 +839,11 @@ FiberBase::FiberBase(size_t stackSizeParam, _::ExceptionOrValue& result)
int arg1 = ptr & ((uintptr_t(1) << (sizeof(ptr) * 4)) - 1);
int arg2 = ptr >> (sizeof(ptr) * 4);
+#ifdef __e2k__
+ KJ_SYSCALL(makecontext_e2k(&impl.fiberContext, reinterpret_cast<void(*)()>(&StartRoutine::run), 2, arg1, arg2));
+#else
makecontext(&impl.fiberContext, reinterpret_cast<void(*)()>(&StartRoutine::run), 2, arg1, arg2);
+#endif
#else
KJ_UNIMPLEMENTED(
@@ -854,6 +858,9 @@ FiberBase::~FiberBase() noexcept(false) {
#if _WIN32 || __CYGWIN__
DeleteFiber(osFiber);
#elif !__BIONIC__
+#ifdef __e2k__
+ freecontext_e2k(&impl.fiberContext);
+#endif
Impl::free(impl, stackSize);
#endif
}
diff --git a/c++/src/kj/debug.h b/c++/src/kj/debug.h
index 77b8fe2d..cc299296 100644
--- a/c++/src/kj/debug.h
+++ b/c++/src/kj/debug.h
@@ -274,6 +274,17 @@ namespace kj {
::kj::_::Debug::ContextImpl<decltype(KJ_UNIQUE_NAME(_kjContextFunc))> \
KJ_UNIQUE_NAME(_kjContext)(KJ_UNIQUE_NAME(_kjContextFunc))
+#ifdef __EDG__
+#define KJ_REQUIRE_NONNULL(value, ...) \
+ (*[&] { \
+ auto _kj_result = ::kj::_::readMaybe(value); \
+ if (KJ_UNLIKELY(!_kj_result)) { \
+ ::kj::_::Debug::Fault(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \
+ #value " != nullptr", #__VA_ARGS__, ##__VA_ARGS__).fatal(); \
+ } \
+ return _kj_result; \
+ }())
+#else
#define KJ_REQUIRE_NONNULL(value, ...) \
(*({ \
auto _kj_result = ::kj::_::readMaybe(value); \
@@ -283,6 +294,7 @@ namespace kj {
} \
kj::mv(_kj_result); \
}))
+#endif
#define KJ_EXCEPTION(type, ...) \
::kj::Exception(::kj::Exception::Type::type, __FILE__, __LINE__, \
diff --git a/c++/src/kj/units.h b/c++/src/kj/units.h
index e8f07ae4..b1807428 100644
--- a/c++/src/kj/units.h
+++ b/c++/src/kj/units.h
@@ -733,6 +733,16 @@ inline constexpr Bounded<Number(kj::maxValue), Number> bounded(Number value) {
return Bounded<Number(kj::maxValue), Number>(value, unsafe);
}
+#ifdef __EDG__
+inline constexpr Bounded<65535, uint16_t> bounded(uint16_t value) {
+ return Bounded<65535, uint16_t>(value, unsafe);
+}
+
+inline constexpr Bounded<255, uint8_t> bounded(uint8_t value) {
+ return Bounded<255, uint8_t>(value, unsafe);
+}
+#endif
+
inline constexpr Bounded<1, uint8_t> bounded(bool value) {
return Bounded<1, uint8_t>(value, unsafe);
}