Skip to content

Commit

Permalink
Merge branch 'master' into pe-refactor
Browse files Browse the repository at this point in the history
* master: (128 commits)
  ci: update containers_ci.yml to not try to install libexecinfo-static, which is not present on the latest Alpine image
  checker: disallow module name duplicates in local names (vlang#18118)
  cgen: cleanup go_before_stmt(0) (vlang#19308)
  parser: disallow using `sql` as name (vlang#19298)
  fmt: cleanup fmt comments (vlang#19306)
  tests: supplement test cases in fixed_array_const_size_test.v (vlang#19303)
  vdoc: prevent main-content outline with certain devices / browsers (vlang#19304)
  cgen: fix printing struct with thread field (vlang#19302)
  vlib: replace macros that resolve to __builtin_bswapnn calls for tcc (vlang#19305)
  time: add `MMM` in the doc comment for parse_format() (vlang#19299)
  os: include sys/sysctl.h on FreeBSD to avoid implicit definition of sysctl function (vlang#19293)
  parser, transformer: fix transformer.infix_expr() and cleanup parse_types.v (related vlang#19269) (vlang#19276)
  fmt: simplify the processing logic for removing inline comments (vlang#19297)
  db.pg: allow postgres connection using service definitions (vlang#19288)
  builtin: use `libgc-threaded` on FreeBSD, to get the threaded version of libgc (vlang#19294)
  ci: test the pure V math versions without .c.v overrides on the CI too (vlang#19292)
  all: support `./v -exclude @vlib/math/*.c.v vlib/math/math_test.v`, for using the pure V math module implementation, without the .c.v overrides there. (vlang#19290)
  .cirrus.yml: change test_zip_modules -> test_zip_modules_script, so that the CI can recognise the new task name and execute it
  thirdparty/zip: properly include utime.h and set defines for FreeBSD (vlang#19285)
  math: fix pure v math.pow (vlang#19287)
  ...
  • Loading branch information
spytheman committed Sep 8, 2023
2 parents 8a62267 + 9f7902b commit e3bef2e
Show file tree
Hide file tree
Showing 279 changed files with 7,982 additions and 2,112 deletions.
40 changes: 31 additions & 9 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
env:
LANG: en_US.UTF-8

freebsd_instance:
image_family: freebsd-13-0

## Note: all tasks should end with _script: here, otherwise they will not be picked up!
freebsd_task:
name: Code CI / freebsd
skip: "!changesInclude('.cirrus.yml', '**.{v,vsh}')"
name: FreeBSD Code CI
timeout_in: 31m
skip: "!changesInclude('.cirrus.yml', '**.{v,vsh}', '**.c', '**.h')"
install_script: pkg install -y git
script: |
echo 'Building V'
git clone https://github.com/vlang/v
cd v
make
diagnose_env_script: |
## env ## CIRRUS_WORKING_DIR is /tmp/cirrus-ci-build
pwd
ls -la
whoami
git log -n1
echo 'number of detected processors:'
getconf _NPROCESSORS_ONLN
build_script: |
echo 'Building local V'
cc --version
make CFLAGS=
build_fast_script: |
##.github/workflows/freebsd_build_tcc.sh
##tcc -v -v
echo 'Build cmd/tools/fast'
cd cmd/tools/fast && ../../../v fast.v && ./fast -clang
cd cmd/tools/fast && ../../../v fast.v ## && ./fast -clang
test_math_script: |
echo 'Test the math module'
./v test vlib/math
test_math_pure_v_script: |
echo 'Test the math module, using only the pure V versions, without the .c.v overrides'
./v -exclude @vlib/math/*.c.v test vlib/math
test_zip_modules_script: |
echo 'Test modules using thirdparty/zip'
./v test vlib/compress/ vlib/szip/
test_self_script: |
echo 'Run test-self'
cd /tmp/cirrus-ci-build/v
VTEST_JUST_ESSENTIAL=1 ./v test-self
28 changes: 14 additions & 14 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ body:
validations:
required: true

- type: textarea
id: reproduction
attributes:
label: Reproduction Steps
description: |
Provide a self-contained, concise snippet of code that can be used to reproduce the issue.
For more complex issues provide a repo with the smallest sample that reproduces the bug.
Avoid including business logic or unrelated code, it makes diagnosis more difficult.
The code sample should be an SSCCE. See http://sscce.org/ for details.
In short, please provide a code sample that we can copy/paste, run and reproduce.
validations:
required: true

- type: textarea
id: expected
attributes:
Expand All @@ -30,20 +44,6 @@ body:
validations:
required: true

- type: textarea
id: reproduction
attributes:
label: Reproduction Steps
description: |
Provide a self-contained, concise snippet of code that can be used to reproduce the issue.
For more complex issues provide a repo with the smallest sample that reproduces the bug.
Avoid including business logic or unrelated code, it makes diagnosis more difficult.
The code sample should be an SSCCE. See http://sscce.org/ for details.
In short, please provide a code sample that we can copy/paste, run and reproduce.
validations:
required: true

- type: textarea
id: solution
attributes:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/containers_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ jobs:
echo "C Compiler:"
gcc --version
## TODO: fix the container thevlang/vlang:alpine-build, instead of using apk add here:
- name: Add dependencies
run: |
apk add libexecinfo-static
apk add libexecinfo-dev
apk add libc6-compat
- name: Build V
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/linux_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ jobs:
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: ./v test-cleancode
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: ./v test-self
# - name: Self tests (-cstrict)
Expand Down Expand Up @@ -212,6 +214,8 @@ jobs:
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: ./v test-cleancode
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: ./v test-self
- name: Self tests (-prod)
Expand Down Expand Up @@ -315,6 +319,8 @@ jobs:
- name: All code is formatted
run: ./v test-cleancode

- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: ./v test-self
- name: Self tests (vprod)
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/macos_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ jobs:
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: VJOBS=1 ./v test-cleancode
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: VJOBS=1 ./v test-self
- name: Build examples
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/windows_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: ./v test-cleancode
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: .\v.exe test-self
# - name: Test
Expand Down Expand Up @@ -111,6 +113,8 @@ jobs:
### TODO: test-cleancode fails with msvc. Investigate why???
## - name: All code is formatted
## run: ./v test-cleancode
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: |
./v -cg cmd\tools\vtest-self.v
Expand Down Expand Up @@ -166,6 +170,8 @@ jobs:
run: ./v -W build-tools
- name: All code is formatted
run: ./v test-cleancode
- name: Test pure V math module
run: ./v -exclude @vlib/math/*.c.v test vlib/math/
- name: Self tests
run: ./v test-self
- name: Test v->js
Expand Down
173 changes: 173 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,176 @@
## V 0.4.1
*3 September 2023*

#### Improvements in the language
- Pure `array.sorted()` and `array.sorted_with_compare()` methods, that do not modify their receivers (#19251)
- UB overflow has been removed
- Implement `Enum.from_string(name string)` for converting strings to enum values (#19156)
- Disallow casting string to enum, suggest using Enum.from_string() instead (#19260)
- Use autocasting in complex conditions (#18839)
- Allow alias as fixed array on return (#18817)
- Do not allow uninitialized function pointers
- Fix compiling V programs with latest clang 16 on windows (clang 16 is stricter than clang 14) (#19095)
- Fix anonymous struct with default expr (#19257)
- Allow using consts as enum values (#19193)
- `@[attr]` syntax to replace `[attr]` (`[]` is used for too many things). Most likely to be replaced with `@attr()` in the future.
- Allow `none` for not first values on map initialization (#18821)
- Make all .trace() methods generic on the type of the passed expression

#### Breaking changes
- `arr[1..4]` now requires `unsafe` if the slice can modify the original immutable array.

#### Checker improvements/fixes
- Disallow assigning `nil` to struct fields (#18725)
- Use autocasting in complex if conditions (#18753)
- Disallow invalid prefix on left side of assign stmt (#18750)
- Allow no return in compile_error else block (#18758)
- Fix interface param resolution (#18780)
- Add an error for `$tmpl` function type mismatches (#18826)
- Disallow voidptr cast to struct (#18845)
- Fix type checker on auto deref var (#18842)
- Check generic sumtype declaration (fix #18741) (#18865)
- Fix closure with inherited sumtype variable (#18894)
- "v -line-info" for a quick run to fetch info about objects on one line
- Make sure vweb actions return vweb.Result
- Do not allow modifying immutable vars via arrays with refs
- Support @STRUCT in static methods
- Fix generic struct field init recursively (related #19014) (#19025)
- Fix struct field fntype value call (#19067)
- Explicitly disallow creating type aliases of `none`, i.e. `type Abc = none` (#19078)
- Fix assigning an array slice (fix #19120) (#19137)
- Fix assigning array slice in struct init (#19150)
- Check enum static from_string arguments errors (#19163)
- Disallow taking the address of consts with int literal values (#19160)
- Check struct embed with wrong position (#19245)
- Optimize out needless string interpolations from the most common case in `Checker.expr_or_block_err`
- Check error for or_expr inside infix expression (#19213)
- Disallow `thread` as var name (#19174)
- Check error for sumtype in array (#19183)
- Disallow an empty `chan` type (#19167)

#### Parser improvements
- Change warn to error, for const names with upper letter (fix #18838) (#18840)
- Disallow declaring static functions as method receivers (#19007)
- Disallow having builtin type as type names for `enum`, `sum type` and `alias` (#19043)
- Support `const x := 123`, to make extracting locals as constants less annoying while prototyping
- Fix struct field fn type with default value (fix #19099) (#19106)
- Fix `for i++; i<10; i++ {` (fix #18445) (#19035)
- Fix fn return alias of fixed array (#19116)
- Fix generic struct init (Stack[&Person]{}) (fix #19119) (#19122)

#### Compiler internals
- pref: make -autofree work without -gc none
- builder,pref: allow thirdparty objects compilation with CPP compiler (#19124)
- scanner: fix string interpolation with nested string interpolation in inner quotes p. 3 (#19121)
- scanner: error early on an unsupported escape sequence in a string, like `\_` (fix #19131) (#19134)
- v.token: add inline next_to() and cleanup related calls (#19226)

#### Standard library
- eventbus: add generic support for event name (#18805)
- readline: add support for ctlr+w and ctrl+u shortcuts (#18921)
- strconv.atoi: fix string.int() returning numbers for non number characters (fix #18875) (#18925)
- builtin: reduce the number of array allocations for consts in all V programs (#18889)
- builtin: move array.data to the top of the struct
- os.notify: implement the kqueue backend for notify.FdNotifier (#19057)
- vlib: add a new module `builtin.wchar`, to ease dealing with C APIs that accept `wchar_t*` (#18794)
- arrays: add more util functions and tests for them - find_first, find_last, join_to_string (#18784)
- vlib: use sync.new_mutex() consistently for initialising all vlib structures containing mutex fields
- crypto.pem: add a static method `Block.new`, to replace `new` (#18846)
- crypto.pem: add decode_only and general improvements to decoding (#18908)
- log: improve the most common use case, it's no longer necessary to create a `Log` instance (#19242)
- crypto.sha512: make the new384/0, new512_256/0, new512_224/0 functions public
- json: fix option alias support (#18801)
- time: fix `parse_format` with `YY` (#18887)
- math.big: allow bitwise ops on negative signum (#18912)
- math.big: make is_odd public and add test cases (#18916)
- math.big: add checked division methods (#18924)
- math.big: add `isqrt_checked` and standardize error format (#18939)
- sokol: use GLCORE33 on linux
- os,term.termios: add termios.set_state/2, state.disable_echo/0, use them in os.input_password, to fix `v -os wasm32_emscripten examples/2048/`
- gg: implement Android specific APK asset loading for the `create_image` function (#19015)
- sync: make sync.Direction public (#19047)
- time: store time with nanosecond resolution in time.Time, deprecate Time.microsecond, add utility methods and tests (#19062)
- time: add a format_rfc3339_nano() method to time.Time
- time: add 'i', 'ii' in custom_format() for 12-hours clock(0-12-1-11) (#19083)
- gg: expand the `-d show_fps` background, so fps>100 will not overflow it
- Math.big: restore gdc_euclid, use it for smaller numbers, fix bench_euclid.v .
- Add new generic `arrays.uniq, arrays.uniq_only, arrays.uniq_only_repeated, arrays.uniq_all_repeated, arrays.distinct`
- builtin: add support for `-d bultin_writeln_should_write_at_once` and `-d bultin_write_buf_to_fd_should_use_c_write` (#19243)
- builtin: always show the assert message, if it was defined in the source, in non test programs too (fix #19240)
- time: check if a day is a valid day of its month (#19232)
- toml: Add generic automatic decoding and encoding of simple structs, when they don't implement custom methods (#17970)

#### Web
- http: Request.host
- net.ftp: fix dir() for file names, which contain spaces (fix #18800) (#18804)
- net.http: make listener public, and add addr in Server struct (#18871)
- net.http.chunked: return `!string` on decode (#18928)
- net.conv: rename functions to match other langs, making them easier t… (#18937)
- wasm: remove dependency on thirdparty/binaryen, webassembly backend rewrite (#18120)
- wasm: add a -wasm-stack-top flag to compiler (#19157)
- net.mbedtls: add SSLListener to allow creating SSL servers (#19022)
- picoev, picohttparser: reimplement in V (#18506)
- vweb: fix parsing of form fields, send with multipart/form-data (by JS fetch)
- vweb: make vweb route paths case sensitive (#18973)
- net.mbedtls: have shutdown close accepted connections too (#19164)
- http: add support for stream connections, and custom .on_redirect, .on_progress, .on_finish callbacks to http.fetch() (#19184)
- vweb: add a user_agent utility method to the vweb context (#19204)
- vweb: avoid the controllers having to be defined in specific order (#19182)

#### ORM
- orm: fix inserting sequential values (id=0), in tables with an i64 primary field (#18791)
- Add OR in where on update and delete (#19172)

#### Database drivers
- vlib: remove deprecated `pg`, `mysql`, `sqlite`, `mssql` modules. Leave only the `db.` prefixed `db.pg`, `db.mysql` etc
- db.mysql: add the exec family of methods (#19132)
- db.sqlite: add exec_param_many and exec_param methods (#19071)
- db.sqlite: make functions return results, breaking change (#19093)

#### Native backend
- native: move functions out of amd64.v (#18857)

#### C backend
- Fix selector code to use interface method table on closure when needed (#18736)
- Fix nested or expr call (fix #18803) (#18807)
- Ensure that `<<` and `>>` has higher precedence in the generated C code, than arithmetic operations (diff between C and V precedences) (#18814)
- Fix cross assign with aliased array (#18830)
- Fix generated code for returning generic result/option to comptime var (#18834)
- Fix option map with fn type value (#18849)
- Fix returning an option tuple - `fn f() ?(int,int) { return g() }` (#18851)
- Fix printing multiple fixed array (fix #18866) (#18879)
- Fix infix expr with number overflow (fix #18905) (#18936)
- Remove \r for consistency (#18962)
- Allow dump(unsafe{nil}) and dump(voidptr(123)) in the same program
- Implement fixed array of threads wait() (#19032)
- Fix an error with ptr interpolation (fix #19048) (#19049)
- Fix spawn call fn struct field(fix #18862) (#19096)
- Fix bootstrapping on older macOS Catalina
- Fix alias of array method call(fix #19125) (#19129)
- Simplifications and clean up.
- Fix mixed fixed array and array initializing (#19246)
- Fix array sort with fn call parameter (fix #19220) (#19221)
- Fix generic struct with option fn field (#19218)
- Fix comptime assign with generic result return type (#19192)
- Fix match with comptime if expr in branch (#19189)

#### Tools
- ci: add v-analyzer builds (#18835)
- ci: cleanup more the contents of the generated v_linux.zip, v_macos.zip, and v_windows.zip, use -skip-unused
- tools: fix vcomplete for zsh (#18950)
- tools: support a toc for projects, with single exposing module, in `v doc` (#19001)
- Add support for `v should-compile-all -c examples/`, which will delete all the produced executables at the end
- vgret: add install commands for ubuntu and arch to doc string (#19247)
- fast.v: add favicon to the html produced by fast.v
- vpm: implement multithreading (#19208)
- Make performance_compare.v more robust and easier to use, by allowing `v run cmd/tools/performance_compare.v` too
- Improve oldv windows support, make it use -municode for windows builds, make it support cmd.exe
- Make repeated runs of `oldv SAME_COMMIT -c "./v file.v"`, not use the network at all
- Help: add link to the TESTS.md at the bottom of `v help test`, run CI checks on help markdown files as well
- v.builder: show the number of files, types, modules, when a program is compiled with -stats
- Improve the output of parser_speed.v and scanner_speed.v


## V 0.4
*1 July 2023*

Expand Down
3 changes: 3 additions & 0 deletions TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ will keep the existing source nice and clean.
Ensure that all .md files in the project are formatted properly,
and that the V code block examples in them can be compiled/formatted too.

Note: if that command finds formatting errors, they can be fixed with:
`VAUTOFIX=1 ./v check-md -hide-warnings file.md`

## `v test-self`

Run `vlib` module tests, *including* the compiler tests.
Expand Down
15 changes: 15 additions & 0 deletions bench/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Vectors

```bash
Benchmark 1: ./boids_test/bin/Release/net7.0/linux-x64/publish/boids_test
Time (mean ± σ): 262.2 ms ± 5.7 ms [User: 231.6 ms, System: 14.1 ms]
Range (min … max): 255.4 ms … 275.3 ms 11 runs

Benchmark 2: ./vinted_report_generator/main
Time (mean ± σ): 208.3 ms ± 1.9 ms [User: 205.4 ms, System: 1.6 ms]
Range (min … max): 204.9 ms … 210.6 ms 14 runs

Summary
./vinted_report_generator/main ran
1.26 ± 0.03 times faster than ./boids_test/bin/Release/net7.0/linux-x64/publish/boids_test
```

0 comments on commit e3bef2e

Please sign in to comment.