1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: add ; after a goto label

This commit is contained in:
Alexander Medvednikov 2019-10-25 18:53:45 +03:00
parent 090e1a87b7
commit c30f16a038
2 changed files with 15 additions and 11 deletions

View File

@ -9,6 +9,10 @@ import (
time
)
fn todo() {
}
fn (v mut V) cc() {
v.build_thirdparty_obj_files()
vexe := vexe_path()
@ -222,7 +226,8 @@ fn (v mut V) cc() {
args := a.join(' ')
start:
777 // TODO remove
todo()
// TODO remove
cmd := '${v.pref.ccompiler} $args'
// Run
if v.pref.show_c_cmd || v.pref.is_verbose {
@ -232,22 +237,21 @@ start:
ticks := time.ticks()
res := os.exec(cmd) or { verror(err) return }
if res.exit_code != 0 {
if res.exit_code == 127 {
// the command could not be found by the system
if res.exit_code == 127 {
$if linux {
// TCC problems on linux? Try GCC.
if v.pref.ccompiler == 'tcc' {
v.pref.ccompiler = 'cc'
goto start
}
}
verror('C compiler error, while attempting to run: \n' +
'-----------------------------------------------------------\n' +
'$cmd\n' +
'-----------------------------------------------------------\n' +
'Probably your C compiler is missing. \n' +
'Please reinstall it, or make it available in your PATH.')
// TCC problems on linux? Try gcc
$if linux {
if v.pref.ccompiler == 'tcc' {
v.pref.ccompiler = 'cc'
goto start
}
}
}
if v.pref.is_debug {

View File

@ -1065,7 +1065,7 @@ fn (p mut Parser) statement(add_semi bool) string {
p.fmt_dec()
label := p.check_name()
p.fmt_inc()
p.genln(label + ':')
p.genln(label + ': ;')
p.check(.colon)
return ''
}