checker: do not report .byte inside inline assembly as the deprecated byte type (fix #28739) - #28764
quaesitor-scientiam wants to merge 2 commits into
Conversation
|
Local AI Findings: P2 The added test covers |
|
Addressed in 193f983: the exemption now subtracts the spans of the block's operand expressions (the Added One thing I noticed while producing the |
|
Probably better to do the other fixes in this PR. The current changes are small... it shouldn't add much to extend them. |
…ed `byte` type
The deprecated-`byte` check rescans the raw source text of each file, so the
assembler directive `.byte` (and an Intel-syntax `byte ptr` operand) inside an
`asm` block was reported as the V type:
error: byte is deprecated, use u8 instead
Collect the spans of every `asm_stmt` node per file and skip `byte` tokens that
fall inside one. The existing checker error tests still report all three
`byte` type uses.
Fixes vlang#28739
Co-Authored-By: WOZCODE <contact@withwoz.com>
The inline-assembly exemption for the deprecated-`byte` check covered the whole `asm_stmt` span, so a V expression in the operand list such as `; r (byte(x))` was no longer reported. Subtract the spans of the block's operand expressions (its child nodes) from the exemption: assembler text stays exempt, operand expressions are checked as before. Add a checker fixture with both a `.byte` directive and a `byte(x)` operand; only the operand is reported. Co-Authored-By: WOZCODE <contact@withwoz.com>
193f983 to
aa49216
Compare
|
Rebased onto 15aa541 (aa49216). The only conflict was the skip condition in Still needed on master: with the PR's test and fixture copied into 15aa541, |
Fixes #28739
The deprecated-
bytecheck rescans the raw source text of each file, so the assembler directive.byte(or an Intel-syntaxbyte ptroperand) inside anasmblock was reported as the V type.vlib/v/slow_tests/assembly/asm_test.amd64.v:174and the.bytesnippet invlib/v/compiler_tests/inline_asm_c_lowering_test.vboth hit this under V3.Fix: collect the span of every
asm_stmtnode per file and skipbytetokens inside one. Text inside string literals was already skipped, so raw templates were unaffected; this covers V-syntax and Intel-syntax blocks.Tests:
vlib/v/tests/inline_asm_byte_directive_test.v—.byte 0x90in anasm amd64block; fails on master with the error above, passes with the fix (the$if amd64branch is parsed and text-scanned on every arch, so the checker path is exercised everywhere).vlib/v/checker/tests/use_byte_instead_of_u8_err.vvstill reports all threebytetype uses with a compiler built from this branch.Known limitation: a V expression in an asm operand list (e.g.
; =r (byte(x))) is inside the span and no longer reported; that spelling is deprecated regardless and I found no instance in the tree.The #28739 repro now passes the checker and fails at link on #28738 (top-level asm block not emitted), which is separate.
🧙 Built with WOZCODE