From 1162606afd44b177d65cdc9d9d8dd0f054b24422 Mon Sep 17 00:00:00 2001 From: Chris Speciale Date: Fri, 27 Nov 2026 14:38:19 -0500 Subject: [PATCH] Put ThreadPool's AtomicInt import before its first class The WorkerExit class that 7c475bae added for the compile threads (#471) went above the "#if cpp import cpp.AtomicInt; #end" block, and Haxe refuses an import after a declaration, so haxe compile-cpp.hxml in tools/hxcpp stopped with "import and using may not appear after a declaration". The neko build tool never sees that import, so hxcpp.n built, and CI, which builds only hxcpp.n, passed. run.n prefers bin//BuildTool once someone has built it, so only rebuilding the C++ build tool failed. The import sits with the others now, and the check-headers job type-checks the C++ build tool with --no-output, which fails with that error before this change and passes after it. Tests: haxe compile-cpp.hxml -D HXCPP_M64 builds bin/Windows64/BuildTool.exe on Windows x64 with Haxe 4.3.7. Through it, a small threaded program builds and runs, and test/compile_errors/check.sh passes, its four builds failing as they should. The binary was deleted afterwards. --- .github/workflows/main.yml | 10 ++++++++++ Changes.md | 2 ++ tools/hxcpp/ThreadPool.hx | 8 ++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 43941127..4e479679 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,6 +49,16 @@ jobs: - name: Check the build tool's depend lists run: python3 tools/check-depends.py + - uses: krdlab/setup-haxe@v2 + with: + haxe-version: 4.3.7 + + # The jobs build the build tool for neko only, so a change that broke the + # C++ build tool, which run.n prefers once someone has built it, went + # unseen (libhxcpp #471) + - name: Type-check the C++ build tool + run: haxe -cp tools/hxcpp -main BuildTool -D HXCPP_NEKO_BUILDTOOL=1 -cpp out --no-output + check-gc-defines: name: Check GC defines runs-on: ubuntu-latest diff --git a/Changes.md b/Changes.md index e52f55d4..e70e4593 100644 --- a/Changes.md +++ b/Changes.md @@ -2,6 +2,8 @@ libhxcpp 6.0.3 (unreleased) ------------------------------------------------------------ +* Fixed the C++ build tool, built with haxe compile-cpp.hxml in tools/hxcpp, not compiling since 6.0.0: ThreadPool.hx declared the class that ends a compile thread's job before one of its imports, which Haxe refuses with "import and using may not appear after a declaration". The neko build tool, hxcpp.n, was unaffected, and run.n uses a C++ build tool only once one is built, so only rebuilding it failed. CI now type-checks it (libhxcpp #471) + libhxcpp 6.0.2 ------------------------------------------------------------ diff --git a/tools/hxcpp/ThreadPool.hx b/tools/hxcpp/ThreadPool.hx index 33da2f61..d088956f 100755 --- a/tools/hxcpp/ThreadPool.hx +++ b/tools/hxcpp/ThreadPool.hx @@ -14,16 +14,16 @@ #end #end +#if cpp +import cpp.AtomicInt; +#end + // Thrown by Tools.exit on a compile thread, to end its job class WorkerExit { public function new() { } } -#if cpp -import cpp.AtomicInt; -#end - class ThreadPool { static var worker = new Tls();