Skip to content

Commit

Permalink
Merge pull request #411 from vibe-d/fix_unittest_error
Browse files Browse the repository at this point in the history
Fix CI errors and unittest compile error on certain compiler versions
  • Loading branch information
l-kramer authored Sep 11, 2024
2 parents f26f33b + e871fbe commit 6bbcb27
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
dc: [dmd-latest, ldc-latest]
arch: [x86_64]
include:
- { os: ubuntu-latest, dc: dmd-2.096.1, arch: x86_64 }
- { os: windows-latest, dc: dmd-2.092.0, arch: x86_64 }
- { os: windows-latest, dc: dmd-2.092.0, arch: x86_mscoff }
- { os: windows-latest, dc: dmd-2.091.1, arch: x86_64 }
Expand Down
6 changes: 3 additions & 3 deletions dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ configuration "select" {
subConfiguration "eventcore" "select"
versions "Windows7" platform="windows"
}
configuration "libasync" {
subConfiguration "eventcore" "libasync"
}
//configuration "libasync" {
// subConfiguration "eventcore" "libasync"
//}

buildType "unittest" {
buildOptions "unittests" "debugMode" "debugInfo"
Expand Down
7 changes: 7 additions & 0 deletions source/vibe/core/file.d
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,13 @@ scope:

~this()
nothrow {
if (this.isOpen) {
if (m_ctx.driver is (() @trusted => cast(shared)eventDriver)()) {
try close();
catch (Exception e) logException(e, "Closing unclosed FileStream during destruction failed");
} else logWarn("Destroying FileStream that is still open in a foreign thread (leaked to GC?). This may lead to crashes.");
}

if (m_fd != FileFD.invalid)
releaseHandle!"files"(m_fd, m_ctx.driver);
}
Expand Down
3 changes: 2 additions & 1 deletion source/vibe/core/log.d
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,6 @@ final class SyslogLogger(StreamCallback) : Logger
@safe nothrow {
ubyte[4096] buf;


try {
auto ostr = m_streamCallback();

Expand All @@ -846,6 +845,8 @@ final class SyslogLogger(StreamCallback) : Logger
while (m_buffer.empty) {
if (m_buffer.capacity == 0) {
ostr.finalize();
static if (is(typeof(ostr.close())))
ostr.close();
return;
}
() @trusted { m_bufferCondition.wait(); } ();
Expand Down
2 changes: 1 addition & 1 deletion source/vibe/core/task.d
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct Task {
m_taskCounter = task_counter;
}

this(in Task other)
this(const Task other)
@safe nothrow {
m_fiber = () @trusted { return cast(shared(TaskFiber))other.m_fiber; } ();
m_taskCounter = other.m_taskCounter;
Expand Down
2 changes: 1 addition & 1 deletion source/vibe/internal/async.d
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ private template hasAnyScopeParameter(Callback) {
else enum hasAnyScopeParameter = any!(c => c & ParameterStorageClass.scope_)([SC]);
}

static if (is(noreturn)) // issue 299, requires newer host compilers
static if (is(noreturn)) static if (is(ReturnType!(() => assert(0)) == noreturn)) // issue 299, requires newer host compilers
version (unittest) {
alias CB = noreturn delegate(int) @safe nothrow;
alias wait = delegate noreturn(_) => assert(0);
Expand Down

0 comments on commit 6bbcb27

Please sign in to comment.