From ea10f44fe6ba9b58491b372a66b6f48b69fc80bb Mon Sep 17 00:00:00 2001 From: yuyi Date: Tue, 3 Mar 2020 07:00:30 +0800 Subject: [PATCH] os api: flush_stdout => flush --- cmd/tools/vrepl.v | 2 +- cmd/v/compile_options.v | 6 +++--- vlib/compiler/main.v | 2 +- vlib/os/os.v | 5 +++++ vlib/v/scanner/scanner.v | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cmd/tools/vrepl.v b/cmd/tools/vrepl.v index aeb8770af0..4255a18b35 100644 --- a/cmd/tools/vrepl.v +++ b/cmd/tools/vrepl.v @@ -231,7 +231,7 @@ fn main() { pub fn rerror(s string) { println('V repl error: $s') - os.flush_stdout() + os.flush() exit(1) } diff --git a/cmd/v/compile_options.v b/cmd/v/compile_options.v index cc76381c28..818dd0fed5 100644 --- a/cmd/v/compile_options.v +++ b/cmd/v/compile_options.v @@ -33,7 +33,7 @@ pub fn new_v(args []string) &compiler.V { if target_os == 'msvc' { // notice that `-os msvc` became `-cc msvc` println('V error: use the flag `-cc msvc` to build using msvc') - os.flush_stdout() + os.flush() exit(1) } mut out_name := cmdline.option(args, '-o', '') @@ -103,7 +103,7 @@ pub fn new_v(args []string) &compiler.V { rdir_name := filepath.filename(rdir) if '-bare' in args { println('V error: use -freestanding instead of -bare') - os.flush_stdout() + os.flush() exit(1) } is_repl := '-repl' in args @@ -161,7 +161,7 @@ pub fn new_v(args []string) &compiler.V { $if !linux { if prefs.is_bare && !out_name.ends_with('.c') { println('V error: -freestanding only works on Linux for now') - os.flush_stdout() + os.flush() exit(1) } } diff --git a/vlib/compiler/main.v b/vlib/compiler/main.v index 7cc9627610..201b44c594 100644 --- a/vlib/compiler/main.v +++ b/vlib/compiler/main.v @@ -848,7 +848,7 @@ pub fn (v &V) log(s string) { pub fn verror(s string) { println('V error: $s') - os.flush_stdout() + os.flush() exit(1) } diff --git a/vlib/os/os.v b/vlib/os/os.v index d9d5adf69d..edabca651a 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -1074,7 +1074,12 @@ pub fn log(s string) { println('os.log: ' + s) } +[deprecated] pub fn flush_stdout() { + panic('Use `os.flush` instead of `os.flush_stdout`') +} + +pub fn flush() { C.fflush(stdout) } diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v index 8d895745d8..96cf70d92e 100644 --- a/vlib/v/scanner/scanner.v +++ b/vlib/v/scanner/scanner.v @@ -1028,7 +1028,7 @@ pub fn (s &Scanner) error(msg string) { pub fn verror(s string) { println('V error: $s') - os.flush_stdout() + os.flush() exit(1) }