From 66b04980ebcc111c54ba4f9374833930b2f2c730 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Mon, 20 Jul 2026 15:27:31 +0200 Subject: [PATCH] fix(mt): keep C declarations before statements The MT job callback added state publication before its Rust job-construction call, which left the result declaration after executable statements and emitted the repository's C90 mixed-declaration warning on every CLI/test build. Declare the result alongside the other callback-local projections and assign it at the existing call site. This is a warning-only cleanup with no runtime or ABI change. Test Plan: - `cc -fsyntax-only -Werror=incompatible-pointer-types -Ilib -Ilib/common -Ilib/compress -Ilib/decompress -Ilib/dict -Ilib/legacy lib/compress/zstdmt_compress.c` -- passed - `git diff --check` and `git diff --cached --check` -- passed - The prior capped suite reached `rustLibSmoke`; a fresh root library build is required because its archive predates the display-hook fix --- lib/compress/zstdmt_compress.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/compress/zstdmt_compress.c b/lib/compress/zstdmt_compress.c index cd0cd89d2..4bf8cc168 100644 --- a/lib/compress/zstdmt_compress.c +++ b/lib/compress/zstdmt_compress.c @@ -2724,6 +2724,7 @@ static size_t ZSTDMT_createCompressionJob(void* opaque, size_t srcSize, unsigned ZSTDMT_CCtx* const mtctx = (ZSTDMT_CCtx*)opaque; ZSTD_EndDirective const endOp = (ZSTD_EndDirective)end; ZSTDMT_RustCreateJobProjection projection; + ZSTDMT_RustCreateJobResult result; /* Rust fills the reusable input range in its local projection before * calling this C-owned job-construction callback. Publish that count * before the callback prepares a job and checks the C context. */ @@ -2743,7 +2744,7 @@ static size_t ZSTDMT_createCompressionJob(void* opaque, size_t srcSize, unsigned (unsigned)(endOp == ZSTD_e_end), (unsigned)mtctx->params.fParams.checksumFlag }; - ZSTDMT_RustCreateJobResult const result = ZSTDMT_rust_createCompressionJob( + result = ZSTDMT_rust_createCompressionJob( &projection, mtctx, ZSTDMT_prepareCompressionJob, ZSTDMT_writeEmptyCompressionJob, ZSTDMT_tryAddCompressionJob);