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

fix v -o foo.c build module foo

This commit is contained in:
Alexander Medvednikov 2019-11-16 21:49:55 +03:00
parent 328ccebf06
commit 8d1eb759f7
4 changed files with 6 additions and 5 deletions

View File

@ -8,9 +8,7 @@ pub:
pub fn strlen(s byteptr) int {
mut i := 0
for i = 0; s[i] != 0; i++ {
}
for ; s[i] != 0; i++ {}
return i
}

View File

@ -31,6 +31,7 @@ fn (v mut V) cc() {
vdir := os.dir(vexe)
// Just create a C/JavaScript file and exit
// for example: `v -o v.c compiler`
println('CC() $v.out_name')
if v.out_name.ends_with('.c') || v.out_name.ends_with('.js') {
// Translating V code to JS by launching vjs.
// Using a separate process for V.js is for performance mostly,

View File

@ -838,7 +838,9 @@ pub fn new_v(args[]string) &V {
mod = mod_path.replace(os.path_separator, '.')
println('Building module "${mod}" (dir="$dir")...')
//out_name = '$TmpPath/vlib/${base}.o'
out_name = mod
if !out_name.ends_with('.c') {
out_name = mod
}
// Cross compiling? Use separate dirs for each os
/*
if target_os != os.user_os() {

View File

@ -1501,7 +1501,7 @@ fn (p mut Parser) get_var_type(name string, is_ptr bool, deref_nr int) string {
// *var
if deref_nr > 0 {
/*
if !p.inside_unsafe {
if !p.inside_unsafe && !p.pref.building_v && p.mod != 'os' {
p.error('dereferencing can only be done inside an `unsafe` block')
}
*/