aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-19 12:34:28 +0000
committer_ov4 <ov4@ov4.org>2026-10-19 12:34:28 +0000
commit51213a7166196f38080cde61224daba034d16c60 (patch)
treea95cfd5d66021616de4708d6c3acdbc9d51ef0f3 /tests
parenta5ce1af261ec3890d1ae16cc3a8785ffa8ad7b43 (diff)
fix(driver): bind MinGW JIT stdio locks to the host CRT
Resolve _lock_file and _unlock_file to the host compatibility functions so JIT stdio cannot pick incompatible locks from another CRT DLL. Cover fprintf inside a C++ catch with exact stderr expectations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/i/extern-cc-runtime/expected-stderr.txt1
-rw-r--r--tests/i/extern-cc-runtime/notes.md2
-rw-r--r--tests/i/extern-cc-runtime/runtime.cc2
3 files changed, 4 insertions, 1 deletions
diff --git a/tests/i/extern-cc-runtime/expected-stderr.txt b/tests/i/extern-cc-runtime/expected-stderr.txt
new file mode 100644
index 0000000..df288aa
--- /dev/null
+++ b/tests/i/extern-cc-runtime/expected-stderr.txt
@@ -0,0 +1 @@
+string failure
diff --git a/tests/i/extern-cc-runtime/notes.md b/tests/i/extern-cc-runtime/notes.md
index 7ea9429..140c201 100644
--- a/tests/i/extern-cc-runtime/notes.md
+++ b/tests/i/extern-cc-runtime/notes.md
@@ -2,4 +2,4 @@
Review status: pending human review.
-A C++ string starts with 4096 x bytes and appends the three digits 123, giving 4099. The second EXTERN function catches and rethrows invalid_argument; pseudocode catches it once. These are C++ object and exception extensions.
+A C++ string starts with 4096 x bytes and appends the three digits 123, giving 4099. The second EXTERN function catches invalid_argument, prints its message followed by a newline to stderr using fprintf, and rethrows it; pseudocode catches it once. This also exercises MinGW stdio locking during exception handling. These are C++ object and exception extensions.
diff --git a/tests/i/extern-cc-runtime/runtime.cc b/tests/i/extern-cc-runtime/runtime.cc
index fd57538..be4e4c3 100644
--- a/tests/i/extern-cc-runtime/runtime.cc
+++ b/tests/i/extern-cc-runtime/runtime.cc
@@ -1,3 +1,4 @@
+#include <cstdio>
#include <string>
#include <stdexcept>
extern "C" int string_length() {
@@ -8,6 +9,7 @@ extern "C" int string_length() {
extern "C" void string_throw() {
try { throw std::invalid_argument("string failure"); }
catch (const std::exception &e) {
+ std::fprintf(stderr, "%s\n", e.what());
if (std::string(e.what()) == "string failure") throw;
}
}