checker: do not require fn main when building an object file
parent
ce771876a3
commit
e89a6269e4
|
@ -368,7 +368,7 @@ pub fn (mut c Checker) check_files(ast_files []&ast.File) {
|
|||
if !has_main_mod_file {
|
||||
c.error('project must include a `main` module or be a shared library (compile with `v -shared`)',
|
||||
token.Pos{})
|
||||
} else if !has_main_fn {
|
||||
} else if !has_main_fn && !c.pref.is_o {
|
||||
c.error('function `main` must be declared in the main module', token.Pos{})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5486,8 +5486,9 @@ fn (mut g Gen) enum_val(node ast.EnumVal) {
|
|||
// && g.inside_switch
|
||||
if g.pref.translated && node.typ.is_number() {
|
||||
// Mostly in translated code, when C enums are used as ints in switches
|
||||
sym := g.table.sym(node.typ)
|
||||
g.write('/* $node enum val is_number $node.mod styp=$styp sym=$sym*/_const_main__$node.val')
|
||||
// sym := g.table.sym(node.typ)
|
||||
// g.write('/* $node enum val is_number $node.mod styp=$styp sym=$sym*/_const_main__$node.val')
|
||||
g.write('_const_main__$node.val')
|
||||
} else {
|
||||
g.write('${styp}__$node.val')
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue