mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
Support for the printf optimisation for windows and wide strings
This commit is contained in:

committed by
Alexander Medvednikov

parent
3794129c91
commit
acd28fa495
@ -404,7 +404,7 @@ string _STR_TMP(const char *fmt, ...) {
|
||||
// It can be skipped in single file programs
|
||||
if v.pref.is_script {
|
||||
//println('Generating main()...')
|
||||
cgen.genln('int main() { \n#ifdef _WIN32\n _setmode(_fileno(stdout), _O_U8TEXT); \n#endif\n init_consts(); $cgen.fn_main; return 0; }')
|
||||
cgen.genln('int main() { \n#ifdef _WIN32\n fflush(stdout); _setmode(_fileno(stdout), _O_U8TEXT); \n#endif\n init_consts(); $cgen.fn_main; return 0; }')
|
||||
}
|
||||
else {
|
||||
println('panic: function `main` is undeclared in the main module')
|
||||
@ -413,7 +413,7 @@ string _STR_TMP(const char *fmt, ...) {
|
||||
}
|
||||
// Generate `main` which calls every single test function
|
||||
else if v.pref.is_test {
|
||||
cgen.genln('int main() { \n#ifdef _WIN32\n _setmode(_fileno(stdout), _O_U8TEXT); \n#endif\n init_consts();')
|
||||
cgen.genln('int main() { \n#ifdef _WIN32\n fflush(stdout); _setmode(_fileno(stdout), _O_U8TEXT); \n#endif\n init_consts();')
|
||||
for key, f in v.table.fns {
|
||||
if f.name.starts_with('test_') {
|
||||
cgen.genln('$f.name();')
|
||||
|
Reference in New Issue
Block a user