fix repl tests; change asm syntax a bit

pull/2796/head
Alexander Medvednikov 2019-11-18 04:53:46 +03:00
parent f7c7ffecb3
commit 4c0269597d
5 changed files with 11 additions and 15 deletions

View File

@ -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"

View File

@ -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)
}

View File

@ -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',

View File

@ -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

View File

@ -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
}