From 27b728b600539ae7de373759b25fe2e7fe357bd3 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 21 Nov 2024 22:21:47 +0200 Subject: [PATCH] checker,cgen: move the `msvc compiler does not support inline assembly` to cgen (so it will only get triggered, when ASM blocks are still present, in what is passed to cgen) --- vlib/v/checker/checker.v | 3 --- vlib/v/gen/c/cgen.v | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 9fcadefba49685..9da0900d9d9004 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -2420,9 +2420,6 @@ fn (mut c Checker) asm_stmt(mut stmt ast.AsmStmt) { if c.pref.backend.is_js() { c.error('inline assembly is not supported in the js backend', stmt.pos) } - if c.pref.backend == .c && c.pref.ccompiler_type == .msvc { - c.error('msvc compiler does not support inline assembly', stmt.pos) - } mut aliases := c.asm_ios(mut stmt.output, mut stmt.scope, true) aliases2 := c.asm_ios(mut stmt.input, mut stmt.scope, false) aliases << aliases2 diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index a9e3323baa2fa9..33e11919e1a6d9 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -2348,6 +2348,9 @@ fn (mut g Gen) stmt(node ast.Stmt) { g.writeln('goto ${c_name(node.name)};') } ast.AsmStmt { + if g.is_cc_msvc { + g.error('msvc does not support inline assembly', node.pos) + } g.write_v_source_line_info_stmt(node) g.asm_stmt(node) }