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

cmd/v: remove clang-format (the generated code is pretty from the start)

This commit is contained in:
Alexander Medvednikov
2020-04-06 17:11:01 +02:00
parent 87c00a61da
commit 2006995020
6 changed files with 5 additions and 27 deletions

View File

@ -299,8 +299,6 @@ fn (gen_vc mut GenVC) generate() {
gen_vc.assert_file_exists_and_is_not_too_short(c_file, err_msg_gen_c)
// embed the latest v commit hash into the c file
gen_vc.cmd_exec('sed -i \'1s/^/#define V_COMMIT_HASH "$last_commit_hash_v_short"\\n/\' $c_file')
// run clang-format to make the c file more readable
gen_vc.cmd_exec('clang-format -i $c_file')
// move to vc repo
gen_vc.cmd_exec('mv $c_file $git_repo_dir_vc/$c_file')
// add new .c file to local vc repo

View File

@ -37,18 +37,6 @@ fn (v mut V) cc() {
// for example: `v -o v.c compiler`
ends_with_c := v.pref.out_name.ends_with('.c')
ends_with_js := v.pref.out_name.ends_with('.js')
if v.pref.is_pretty_c && !ends_with_js {
format_result := os.exec('clang-format -i -style=file "$v.out_name_c"') or {
eprintln('clang-format not found')
os.Result{exit_code:-1}
}
if format_result.exit_code > 0 {
eprintln('clang-format failed to format $v.out_name_c')
eprintln(format_result.output)
}
}
if ends_with_c || ends_with_js {
// Translating V code to JS by launching vjs.
// Using a separate process for V.js is for performance mostly,

View File

@ -42,10 +42,6 @@ fn parse_c_options(flag string, f mut flag.Instance, prefs mut pref.Preferences)
'keep' {
prefs.is_keep_c = true
}
'prettify' {
prefs.is_keep_c = true
prefs.is_pretty_c = true
}
'drop' {} //Default
else {
println('V error: Unknown argument for `-csource` (`$operation`).')

View File

@ -28,10 +28,8 @@ These build flags are enabled on `build` and `run` as long as the backend is set
-compress
Strip the compiled executable to compress it.
-csource <prettify|keep|drop>
-csource <keep|drop>
Specify how V deals with the intermediate C source code.
* `prettify` - The C source code will be kept.
`clang-format` is used to prettify the C source code before compiling it.
* `keep` - The C source code will be kept as generated by V.
* `drop` (default) - The C source code will be deleted after compiling the executable.