compiler: remove -keepc option (it is now always on)
parent
c94038af89
commit
25771a1afe
4
Makefile
4
Makefile
|
@ -115,10 +115,10 @@ $(VC)/.git/config:
|
|||
$(MAKE) fresh_vc
|
||||
|
||||
selfcompile:
|
||||
./v -keepc -cg -o v cmd/v
|
||||
./v -cg -o v cmd/v
|
||||
|
||||
selfcompile-static:
|
||||
./v -keepc -cg -cflags '--static' -o v-static cmd/v
|
||||
./v -cg -cflags '--static' -o v-static cmd/v
|
||||
|
||||
modules: module_builtin module_strings module_strconv
|
||||
module_builtin:
|
||||
|
|
|
@ -34,10 +34,6 @@ These build flags are enabled on `build` and `run` as long as the backend is set
|
|||
-compress
|
||||
Strip the compiled executable to compress it.
|
||||
|
||||
-keepc
|
||||
Specify that you want V to not delete the intermediate generated C source code.
|
||||
Use with -cg for best debugging experience.
|
||||
|
||||
-freestanding
|
||||
Build the executable without dependency on libc.
|
||||
Supported only on `linux` targets currently.
|
||||
|
|
|
@ -6,7 +6,7 @@ Usage:
|
|||
Examples:
|
||||
v hello.v Compile the file `hello.v` and output it as `hello` or `hello.exe`.
|
||||
v run hello.v Same as above but also run the produced executable immediately after compilation.
|
||||
v -keepc -cg run hello.v Same as above, but make debugging easier (in case your program crashes).
|
||||
v -cg run hello.v Same as above, but make debugging easier (in case your program crashes).
|
||||
v -o h.c hello.v Translate `hello.v` to `h.c`. Do not compile further.
|
||||
|
||||
V supports the following commands:
|
||||
|
|
|
@ -1739,10 +1739,9 @@ To cast a `voidptr` to a V reference, use `user := &User(user_void_ptr)`.
|
|||
To debug issues in the generated C code, you can pass these flags:
|
||||
|
||||
- `-cg` - produces a less optimized executable with more debug information in it.
|
||||
- `-keepc` - keep the generated C file, so your debugger can also use it.
|
||||
- `-showcc` - prints the C command that is used to build the program.
|
||||
|
||||
For the best debugging experience, you can pass all of them at the same time: `v -cg -keepc -showcc yourprogram.v` , then just run your debugger (gdb/lldb) or IDE on the produced executable `yourprogram`.
|
||||
For the best debugging experience, you can pass all of them at the same time: `v -cg -showcc yourprogram.v` , then just run your debugger (gdb/lldb) or IDE on the produced executable `yourprogram`.
|
||||
|
||||
If you just want to inspect the generated C code, without further compilation, you can also use the `-o` flag (e.g. `-o file.c`). This will make V produce the `file.c` then stop.
|
||||
|
||||
|
|
|
@ -482,9 +482,6 @@ fn (mut v Builder) cc() {
|
|||
println('linux cross compilation done. resulting binary: "$v.out_name"')
|
||||
}
|
||||
*/
|
||||
if !v.pref.keep_c && v.out_name_c != 'v.c' {
|
||||
os.rm(v.out_name_c)
|
||||
}
|
||||
if v.pref.compress {
|
||||
$if windows {
|
||||
println('-compress does not work on Windows for now')
|
||||
|
|
|
@ -192,10 +192,6 @@ fn find_msvc() ?MsvcResult {
|
|||
|
||||
pub fn (mut v Builder) cc_msvc() {
|
||||
r := find_msvc() or {
|
||||
// TODO: code reuse
|
||||
if !v.pref.keep_c && v.out_name_c != 'v.c' && v.out_name_c != 'v_macos.c' {
|
||||
os.rm(v.out_name_c)
|
||||
}
|
||||
verror('Cannot find MSVC on this OS')
|
||||
return
|
||||
}
|
||||
|
@ -309,9 +305,6 @@ pub fn (mut v Builder) cc_msvc() {
|
|||
}
|
||||
// println(res)
|
||||
// println('C OUTPUT:')
|
||||
if !v.pref.keep_c && v.out_name_c != 'v.c' && v.out_name_c != 'v_macos.c' {
|
||||
os.rm(v.out_name_c)
|
||||
}
|
||||
// Always remove the object file - it is completely unnecessary
|
||||
os.rm(out_name_obj)
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ fn (g &Gen) generate_hotcode_reloading_main_caller() {
|
|||
file := util.cescaped_path( g.pref.path )
|
||||
msvc := if g.pref.ccompiler == 'msvc' { '-cc msvc' } else { '' }
|
||||
so_debug_flag := if g.pref.is_debug { '-cg' } else { '' }
|
||||
vopts := '$msvc $so_debug_flag -keepc -sharedlive -shared'
|
||||
vopts := '$msvc $so_debug_flag -sharedlive -shared'
|
||||
//
|
||||
g.writeln('\t\t// start background reloading thread')
|
||||
if g.pref.os == .windows {
|
||||
|
|
|
@ -69,7 +69,6 @@ pub mut:
|
|||
sanitize bool // use Clang's new "-fsanitize" option
|
||||
is_debug bool // false by default, turned on by -g or -cg, it tells v to pass -g to the C backend compiler.
|
||||
is_vlines bool // turned on by -g, false by default (it slows down .tmp.c generation slightly).
|
||||
keep_c bool // -keepc , tell v to leave the generated .tmp.c alone (since by default v will delete them after c backend finishes)
|
||||
show_cc bool // -showcc, print cc command
|
||||
// NB: passing -cg instead of -g will set is_vlines to false and is_g to true, thus making v generate cleaner C files,
|
||||
// which are sometimes easier to debug / inspect manually than the .tmp.c files by plain -g (when/if v line number generation breaks).
|
||||
|
@ -197,7 +196,7 @@ pub fn parse_args(args []string) (&Preferences, string) {
|
|||
res.use_cache = true
|
||||
}
|
||||
'-keepc' {
|
||||
res.keep_c = true
|
||||
eprintln('-keepc is deprecated. V always keeps the generated .tmp.c files now.')
|
||||
}
|
||||
'-parallel' {
|
||||
res.is_parallel = true
|
||||
|
|
|
@ -38,7 +38,7 @@ fn test_all() {
|
|||
full_test_path := os.real_path(test)
|
||||
println('x.v: $wrkdir/x.v')
|
||||
os.system('cp ${dir}/${test} $wrkdir/x.v') // cant run .vv file
|
||||
compile_cmd := '$vexe -cflags "-w" -verbose=3 -autofree -keepc -cg $wrkdir/x.v'
|
||||
compile_cmd := '$vexe -cflags "-w" -verbose=3 -autofree -cg $wrkdir/x.v'
|
||||
vprintln('compile cmd: $compile_cmd')
|
||||
res := os.exec(compile_cmd) or {
|
||||
bench.fail()
|
||||
|
|
Loading…
Reference in New Issue