mirror of
https://github.com/vlang/v.git
synced 2025-09-18 11:56:57 -04:00
os: workaround a -prod -cc gcc
bug, affecting os.open_file (fix #20923) (related to #20872) (#20960)
This commit is contained in:
parent
6f4d9aecf3
commit
a58f980b02
@ -315,7 +315,7 @@ fn (a string) clone_static() string {
|
||||
|
||||
// clone returns a copy of the V string `a`.
|
||||
pub fn (a string) clone() string {
|
||||
if a.len == 0 {
|
||||
if a.len <= 0 {
|
||||
return ''
|
||||
}
|
||||
mut b := string{
|
||||
|
@ -47,6 +47,7 @@ fn fix_windows_path(path string) string {
|
||||
}
|
||||
|
||||
// open_file tries to open or create a file with custom flags and permissions.
|
||||
@[noinline]
|
||||
pub fn open_file(path string, mode string, options ...int) !File {
|
||||
mut flags := 0
|
||||
mut seek_to_end := false
|
||||
|
15
vlib/v/gen/c/testdata/self_printer_with_prod.out
vendored
Normal file
15
vlib/v/gen/c/testdata/self_printer_with_prod.out
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// vtest vflags: -prod -skip-unused
|
||||
// See https://github.com/vlang/v/issues/20923
|
||||
module main
|
||||
|
||||
import os
|
||||
import io
|
||||
|
||||
fn main() {
|
||||
mut file := os.open_file(@FILE, 'r')!
|
||||
mut buff_reader := io.new_buffered_reader(reader: file)
|
||||
for {
|
||||
a := buff_reader.read_line() or { break }
|
||||
println(a)
|
||||
}
|
||||
}
|
15
vlib/v/gen/c/testdata/self_printer_with_prod.vv
vendored
Normal file
15
vlib/v/gen/c/testdata/self_printer_with_prod.vv
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// vtest vflags: -prod -skip-unused
|
||||
// See https://github.com/vlang/v/issues/20923
|
||||
module main
|
||||
|
||||
import os
|
||||
import io
|
||||
|
||||
fn main() {
|
||||
mut file := os.open_file(@FILE, 'r')!
|
||||
mut buff_reader := io.new_buffered_reader(reader: file)
|
||||
for {
|
||||
a := buff_reader.read_line() or { break }
|
||||
println(a)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user