From c30f16a03823c72b589b1edd2ccaea69e0dc3c3c Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 25 Oct 2019 18:53:45 +0300 Subject: [PATCH] parser: add ; after a goto label --- vlib/compiler/cc.v | 24 ++++++++++++++---------- vlib/compiler/parser.v | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/vlib/compiler/cc.v b/vlib/compiler/cc.v index 801bfe811b..1de2f2a072 100644 --- a/vlib/compiler/cc.v +++ b/vlib/compiler/cc.v @@ -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 { - + // the command could not be found by the system if res.exit_code == 127 { - // the command could not be found by the system + $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 { diff --git a/vlib/compiler/parser.v b/vlib/compiler/parser.v index 14337c13b0..0e4894f6ff 100644 --- a/vlib/compiler/parser.v +++ b/vlib/compiler/parser.v @@ -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 '' }