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

1580 Commits

Author SHA1 Message Date
Delyan Angelov
fc5826b7ca
cgen: minimise sizeof(EmptyStruct) to 0 for gcc/clang and to 1 for tcc/msvc, by changing EMPTY_STRUCT_DECLARATION and EMPTY_STRUCT_INITIALIZATION (#16733) 2022-12-22 21:47:39 +02:00
yuyi
e01dac885c
builtin: fix m.len to 0, after calling map.clear() (#16720) 2022-12-22 21:36:33 +02:00
Delyan Angelov
f9043c84a7
builtin: optimise the initialisation of the common 1 byte element arrays []u8 2022-12-22 20:41:32 +02:00
Delyan Angelov
8f8a186158
builtin: support -d trace_vmemset, -d trace_vmemcmp, -d trace_vmemmove and -d trace_vmemcpy too 2022-12-22 20:08:53 +02:00
Delyan Angelov
b67705f568
builtin: move the -d trace_*alloc lines at the start of their corresponding functions, implement -d trace_memdup too 2022-12-22 19:36:15 +02:00
Delyan Angelov
3da4f37b01
cgen: improve generated source compatibility with latest Alpine (lacking libexecinfo-dev and execinfo.h) and the prebuilt tcc (#16743) 2022-12-22 15:01:51 +02:00
Alexander Medvednikov
88e33a83de gg: fix draw_image on macos native; vcreate: vweb template 2022-12-21 19:33:37 +03:00
pancake
c84eb29b78
js: use write() on the freestanding backend (#16704) 2022-12-20 13:16:06 +02:00
l-m
f0a252d0e6
builtin: apply .nogrow flags to gcboehm array (#16689) 2022-12-16 07:57:50 +02:00
l-m
acbd93b54c
builtin: add .nogrow and .nofree flags to array (#16661) 2022-12-14 09:44:14 +02:00
yuyi
69f7c45bec
builtin: fix array init with array default (#16664) 2022-12-13 18:05:33 +02:00
Carter
eb88f7e255
builtin: fix bug with string.split_into_lines, when lines have extra CR's at their end (#16620) 2022-12-09 09:15:50 +02:00
Delyan Angelov
7df8f063ed
builtin: fix typo 2022-11-29 14:42:44 +02:00
Delyan Angelov
1d24dbe602
builtin: document string.to_wide() and string_from_wide()/1 2022-11-28 09:46:04 +02:00
Delyan Angelov
73675dca87
builtin: move v_segmentation_fault_handler to builtin.c.v, make it more informative 2022-11-27 12:11:06 +02:00
yuyi
ef5be22f81
all: replace generic <> with [] - part 2 (#16536) 2022-11-26 18:23:26 +02:00
Hitalo Souza
45854882b9
builtin, cgen: support FieldData.unaliased_typ, use it for generalising x.json2 (able to encode type aliased struct fields) (#16469) 2022-11-20 11:18:14 +02:00
yuyi
017ace6ea7
vfmt: change all '$expr' to '${expr}' (#16428) 2022-11-15 16:53:13 +03:00
yuyi
c9ce5f89c7
builtin: fix f32.str() (#16391) 2022-11-11 13:56:45 +02:00
shove
26d643fc5d
all: rollback to old interpolation (step 3) (#16380) 2022-11-10 15:05:34 +03:00
Swastik Baranwal
ca484430e0
checker: check int overflow for const vars (#16332) 2022-11-06 08:22:28 +03:00
Delyan Angelov
9edb48571f
pref,cgen: support -no-bounds-checking, instead of -d no_bounds_checking, and make it enable direct_array_access for all fns/methods. 2022-10-30 14:39:45 +02:00
Alexander Medvednikov
cc58d6a919 all: string interpolation fixes 2022-10-27 17:52:30 +03:00
Alexander Medvednikov
e1ffc76efd tests: fix some interpolation tests 2022-10-27 11:12:15 +03:00
Alexander Medvednikov
18c7da9a5e all: new string interpolation "hello {name}!" 2022-10-27 11:01:01 +03:00
yuyi
7b8044b8c4
cgen: fix using 'array' name variable in array_init (#16168) 2022-10-23 22:23:15 +03:00
l-m
a139bed785
builtin: add string.trim_indexes method, that can be used in string.trim, but also separately from it (#16144) 2022-10-22 12:56:05 +03:00
locriacyber
a3b050aced
vrepl: add support for Home and End keys (#16116) 2022-10-20 20:07:57 +03:00
yuyi
612faac0f0
all: change index expr returning optional to result too (#16097) 2022-10-19 21:04:16 +03:00
Delyan Angelov
71bff213ef
builtin: make the C. WIN32 API declarations more precise, to catch errors earlier (#16090) 2022-10-17 20:23:33 +03:00
yuyi
126c4c5751
builtin,math: fix math.min_i64.str() (fix #16086) (#16089) 2022-10-17 19:36:46 +03:00
Subhomoy Haldar
43b9a716c5
builtin,strconv: append ".0", to float string representations, to ensure clarity (#16079) 2022-10-17 15:41:07 +03:00
yuyi
f6844e9766
all: change optional to result of io (#16075) 2022-10-16 09:28:57 +03:00
yuyi
fb3d093e01
builtin: remove opt_ok2() (part 2) (#16054) 2022-10-13 10:35:41 +03:00
Rasheed
12d3664a09
builtin: add a declaration for C.putchar (#16037) 2022-10-11 20:53:12 +03:00
ChAoS_UnItY
95f57e9206
builtin: deprecate array.reduce in favour of arrays.fold (#16001) 2022-10-09 10:29:50 +03:00
Swastik Baranwal
b584e1df98
checker: allow EnumName(number) casts only inside unsafe{} blocks (#15932) 2022-10-02 22:39:11 +03:00
Dominik Pytlewski
721328ef58
os: fix os.read_file and os.read_bytes for 0 sized /proc/ files on Linux (fix #15852) (#15853) 2022-09-25 22:54:46 +03:00
spaceface
201598e68a
builtin: fix gc.o compilation on macos (#15832) 2022-09-21 12:19:02 +03:00
Delyan Angelov
7e69619add
builtin, compiler: replace isnil(x) calls with x == unsafe { nil } (a little faster without -prod) (#15759) 2022-09-15 14:59:37 +03:00
shove
8b962f8446
checker: fix nested struct reference type field initialized check. (fix: #15741) (#15752) 2022-09-15 07:59:31 +03:00
Delyan Angelov
fc8e3d0971
builtin,strconv: speedup str.int() conversions (without -prod) 2022-09-08 11:28:19 +03:00
yuyi
a5aad6f791
cgen: fix alias of map delete (#15644) 2022-09-03 10:41:53 +03:00
ChAoS_UnItY
0b843b801f
checker: fix returning expression with void type (fix #15543) (#15554) 2022-08-27 09:00:14 +03:00
Larpon
9dd8228f91
arrays: move carray_to_varray from builtin, make it generic (#15503) 2022-08-23 11:12:50 +03:00
Larpon
dda475bcc8
builtin: add carray_to_varray, closes #15493 (#15499) 2022-08-22 20:15:54 +03:00
Delyan Angelov
18e737aee2 builtin,tests: fix int_test.v on macos, m1 2022-08-17 17:18:10 +03:00
Delyan Angelov
18cccb6caf
builtin: show non zero codes on bubbled error_with_code(msg,code) errors 2022-08-16 18:59:38 +03:00
Emily Hudson
90d9b200f9
gc: fix msvc not using libatomic_ops (#15418) 2022-08-14 13:16:52 +03:00
Delyan Angelov
4c0339242a
doc: fix example comment for string.strip_margin() 2022-08-14 08:06:52 +03:00
Delyan Angelov
77495c8d03
all: support assert condition, extra_message, evaluating and showing extra_message on assert failure (#15322) 2022-08-03 01:14:01 +03:00
Davide Beatrici
c9a5896468
bultin: always enable GC_THREADS, even with -d dynamic_boehm, otherwise multithread operation is unsafe (#15275)
According to upstream documentation, only GC_WIN32_THREADS is explicit.

This PR fixes a random memory corruption(s) with "-d dynamic_boehm" on OpenMandriva.
1679adc04d.log
```
DEBUG: + VFLAGS='-prod -d dynamic_boehm'
DEBUG: + /usr/bin/clang -Os -fomit-frame-pointer -g3 -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-all --param=ssp-buffer-size=4 -m64 -mtune=generic -flto -std=gnu99 -w -o tmp_1 v.c -lm -lpthread -Os -fomit-frame-pointer -g3 -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-all --param=ssp-buffer-size=4 -m64 -mtune=generic -flto -Wl,-O2 -Wl,--no-undefined -flto
DEBUG: + ./tmp_1 -no-parallel -o tmp_2 -prod -d dynamic_boehm cmd/v
DEBUG: + ./tmp_2 -o v -prod -d dynamic_boehm cmd/v
DEBUG: /var/tmp/rpm-tmp.mcjmqc: line 52:   644 Bus error               (core dumped) ./v build-tools
```
2022-07-30 14:59:12 +03:00
yuyi
6e8350a9c9
fmt: fix interface method with fntype argument (#15280) 2022-07-30 14:29:41 +03:00
l-m
10f3c9f127
builtin: add string.replace_char and string.normalize_tabs (#15239) 2022-07-27 22:04:39 +03:00
Alexander Medvednikov
d6de53362f checker: improve unused label check 2022-07-23 01:36:27 +03:00
Alexander Medvednikov
9099594a49 all: wrap up unsafe { nil } (p. 3) 2022-07-21 21:01:30 +03:00
Alexander Medvednikov
dc79f1392b all: voidptr(0) => unsafe { nil } (p.2) 2022-07-21 20:51:54 +03:00
Alexander Medvednikov
caa0c2f153 vfmt: voidptr(0) => unsafe { nil } (p.1) 2022-07-21 20:46:01 +03:00
Delyan Angelov
a4e0e0fa57
builtin: add drafts for __new_array_noscan, __new_array_with_default_noscan, __new_array_with_array_default_noscan for array_notd_gcboehm_opt.v 2022-07-12 10:00:58 +03:00
Larpon
9f3b6e3e3a
android: provide more predictable logging, add comptime termux support (#14984) 2022-07-07 18:28:29 +03:00
l-m
ed8c63cc0b
builtin: add a contains_only method on string (#14830) 2022-06-23 01:41:42 +03:00
Delyan Angelov
473d26ce47 builtin: enforce linking to libgc.a with -prod on macos 2022-06-20 21:29:27 +03:00
yuyi
01fdd5d07f
cgen: add a minor optimisation for array.push_many (#14770) 2022-06-17 09:44:13 +03:00
spaceface
26d051475a
cgen: ensure closures are kept alive when using the GC (#14736) 2022-06-10 19:48:50 +03:00
spaceface
4ed9780b80
all: enable -gc boehm by default (#14577) 2022-06-09 00:44:29 +03:00
Delyan Angelov
82d23dedf1
builtin: add flush_stdout and flush_stderr to builtin.js.v, for feature parity with builtin.c.v 2022-06-07 12:15:35 +03:00
ChAoS_UnItY
df80b33dc0
cgen: fix array init with it (fix #14679) (#14680) 2022-06-05 19:41:54 +03:00
Ikko Ashimine
7b25957a26
builtin: fix typo in array.v (#14688) 2022-06-05 18:49:40 +03:00
playX
db34adaec8
builtin.js: fix string.int method (#14564) 2022-05-31 11:52:11 +03:00
Delyan Angelov
0f3b2c2ae7
builtin: use C.fwrite (buffered) for _write_buf_to_fd (#14558) 2022-05-30 19:15:05 +03:00
Delyan Angelov
58ebc0680e
builtin: fix sporadic linking failures on v -cc gcc -gc boehm examples/hello_world.v 2022-05-30 15:17:01 +03:00
spaceface
ba859c584b
builtin: add static GC support on Windows with TCC (#14497) 2022-05-22 21:25:46 +03:00
Daniel Däschle
d3ffd983c8
markused: add _result_ok (#14495) 2022-05-22 14:52:38 +03:00
Vincenzo Palazzo
17bba712bd
checker: ban unsafe pointer/fn comparison (#14462) 2022-05-20 18:30:16 +03:00
yuyi
913164bc73
builtin: minor cleanup in string_interpolation.v (#14471) 2022-05-20 14:19:27 +03:00
Delyan Angelov
4e56147223 ci: vfmt builtin_d_use_libbacktrace.c.v 2022-05-17 19:41:57 +03:00
Ned
db4b49a5ca
builtin: print libbacktrace output to stderr, on panics/segfault crash (#14434) 2022-05-17 14:56:34 +03:00
WoodyAtHome
02c8a6057c
builtin.string: new fn (s string) is_ascii() bool (#14418) 2022-05-17 08:01:03 +03:00
Daniel Däschle
d679146a80
fmt: remove space in front of ? and ! (#14366) 2022-05-13 06:56:21 +03:00
CC
901b8f0c24
builtin: add a map.clear() method (#14373) 2022-05-12 09:43:01 +03:00
David 'Epper' Marshall
a91226c376
docs: cleanup (#14327) 2022-05-07 20:18:42 +03:00
Delyan Angelov
56cf0b0a2e
builtin: inline manually isnil calls in array.push_many (very frequently called) 2022-05-07 12:55:40 +03:00
Alexander Medvednikov
14f06ead1b cgen: fix c2v consts; enum_decl() 2022-05-07 00:58:37 +03:00
Hunam
0699f324b5
builtin: add map.values() (#14301) 2022-05-06 20:42:01 +03:00
Daniel Däschle
76cdf75299
builtin,cgen: rename Option to _option (#14317) 2022-05-06 19:25:54 +03:00
Andréas Livet
9fde5b067b
docs: add missing function names in the builtin example doc comments (#14318) 2022-05-05 17:22:25 +03:00
Ned
76a7354506
builtin: add libbacktrace as option for generating stack traces (#14277) 2022-05-04 21:17:05 +03:00
Ikko Ashimine
223b96a59a
builtin: fix typo in array_bare.v (#14299) 2022-05-04 19:25:17 +03:00
Delyan Angelov
1a4d9017e2
builtin: improve support for large arrays ([]int{len: 1_000_000_000} now works), fix an arr.repeat() bug (#14294) 2022-05-04 18:42:06 +03:00
Alexander Medvednikov
1e9156fd71 checker: c2v rune comparison fix 2022-05-04 06:49:45 +03:00
Delyan Angelov
0e5c1cee48
builtin: improve musl/Alpine support (define weak backtrace/backtrace_symbols/backtrace_symbols_fd symbols) (#14250) 2022-05-03 09:17:53 +03:00
Delyan Angelov
ab1c265679
builtin: add missing panic_result_not_set/1 callback function. 2022-05-02 22:40:26 +03:00
yuyi
b9cf2db6a8
parser: fix inline array's element access (#14253) 2022-05-02 16:16:32 +03:00
Daniel Däschle
9f8a34a528
all: rename result to _result (#14232) 2022-04-30 17:10:30 +03:00
David 'Epper' Marshall
a2338dbb7c
docs: document more builtin functions/methods (#14229) 2022-04-30 12:31:23 +03:00
Daniel Däschle
08fd0ce0de
all: basic implementation of result type (#14140) 2022-04-30 01:59:14 +03:00
Wertzui123
872f739396
builtin: ignore C++ 0xE06D7363 exception errors on windows (#14225) 2022-04-29 14:55:29 +03:00
StunxFS
995485c649
builtin: add string.len_utf8() method (#14208) 2022-04-29 10:23:57 +03:00
Alexander Medvednikov
77645fcf35 builtin: define atoi & ftell 2022-04-29 04:31:51 +03:00
Delyan Angelov
f72297c331
eval: add support for C.read/3, C.malloc/1, $if openbsd { 2022-04-28 11:30:36 +03:00