From 4c0269597d8cc7964a575f436b19f8200bc2a316 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Mon, 18 Nov 2019 04:53:46 +0300 Subject: [PATCH] fix repl tests; change asm syntax a bit --- Makefile | 6 +++--- vlib/compiler/asm.v | 7 ++----- vlib/compiler/cc.v | 2 +- vlib/compiler/main.v | 3 +-- vlib/compiler/tests/asm_test.v | 8 ++++---- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index e453ea746e..813ad658c4 100644 --- a/Makefile +++ b/Makefile @@ -29,9 +29,9 @@ else echo "Self rebuild ($$VC_V => $$V_V)"; \ ./v -o v v.v; \ fi) - ./v build module vlib/builtin - ./v build module vlib/strings - ./v build module vlib/strconv + ./v build module vlib/builtin > /dev/null + ./v build module vlib/strings > /dev/null + ./v build module vlib/strconv > /dev/null endif rm -rf vc/ @echo "V has been successfully built" diff --git a/vlib/compiler/asm.v b/vlib/compiler/asm.v index dce43e817f..da006dc031 100644 --- a/vlib/compiler/asm.v +++ b/vlib/compiler/asm.v @@ -9,7 +9,7 @@ fn (p mut Parser) inline_asm() { p.error('asm() needs to be run unside `unsafe {}`') } p.next() - p.check(.lpar) + p.check(.lcbr) s := p.check_string() p.genln('asm("$s"') for p.tok == .str { @@ -28,11 +28,8 @@ fn (p mut Parser) inline_asm() { } p.check(.rpar) p.genln('($var_name)') - } - } p.genln(');') - p.check(.rpar) - + p.check(.rcbr) } diff --git a/vlib/compiler/cc.v b/vlib/compiler/cc.v index b8da92e047..cc32a10e85 100644 --- a/vlib/compiler/cc.v +++ b/vlib/compiler/cc.v @@ -82,7 +82,7 @@ fn (v mut V) cc() { // TODO : try and remove the below workaround options when the corresponding // warnings are totally fixed/removed '-Wno-unused-variable', - '-Wno-unused-but-set-variable', + //'-Wno-unused-but-set-variable', '-Wno-unused-parameter', '-Wno-unused-result', '-Wno-missing-braces', diff --git a/vlib/compiler/main.v b/vlib/compiler/main.v index 94f31d90b7..ecf64e48f9 100644 --- a/vlib/compiler/main.v +++ b/vlib/compiler/main.v @@ -433,7 +433,7 @@ pub fn (v mut V) generate_main() { if !v.table.main_exists() && !v.pref.is_test { // It can be skipped in single file programs // But make sure that there's some code outside of main() - if v.pref.is_script && cgen.fn_main.trim_space() != ''{ + if (v.pref.is_script && cgen.fn_main.trim_space() != '') || v.pref.is_repl { //println('Generating main()...') v.gen_main_start(true) cgen.genln('$cgen.fn_main;') @@ -955,7 +955,6 @@ pub fn new_v(args[]string) &V { is_vlines: '-g' in args && !('-cg' in args) is_keep_c: '-keep_c' in args is_cache: '-cache' in args - is_stats: '-stats' in args obfuscate: obfuscate is_prof: '-prof' in args diff --git a/vlib/compiler/tests/asm_test.v b/vlib/compiler/tests/asm_test.v index 941c48bdee..d5fd09f91a 100644 --- a/vlib/compiler/tests/asm_test.v +++ b/vlib/compiler/tests/asm_test.v @@ -2,25 +2,25 @@ fn test_inline_asm() { a := 10 b := 0 unsafe { - asm ( + asm { "movl %1, %%eax;" "movl %%eax, %0;" :"=r"(b) :"r"(a) :"%eax" - ) + } } assert a == 10 assert b == 10 // e := 0 unsafe { - asm( + asm { //".intel_syntax noprefix;" //"mov %0, 5" "movl $5, %0" :"=a"(e) - ) + } } assert e == 5 }