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

cgen: add requires to c_reserved, so that V generated code, can be compiled with -cc g++-11 -no-std -cflags -std=c++20 as well (#17404)

This commit is contained in:
Delyan Angelov 2023-02-25 16:50:48 +02:00 committed by GitHub
parent cf47a5f978
commit 524c500146
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -81,17 +81,20 @@ jobs:
sudo apt-get update
sudo apt-get install --quiet -y libsodium-dev libssl-dev sqlite3 libsqlite3-dev postgresql libpq-dev valgrind
sudo apt-get install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev xfonts-75dpi xfonts-base
sudo apt-get install --quiet -y g++-9
sudo apt-get install --quiet -y g++-9 g++-11
- name: Build v
run: make
- name: g++ version
- name: g++-9 version
run: g++-9 --version
- name: V self compilation with g++
- name: V self compilation with g++ and -std=c++11
run: ./v -cc g++-9 -no-std -cflags -std=c++11 -o v2 cmd/v && ./v2 -cc g++-9 -no-std -cflags -std=c++11 -o v3 cmd/v
## - name: Running tests with g++
## run: ./v -cc g++-9 test-self
- name: g++-11 version
run: g++-11 --version
- name: V self compilation with g++ and -std=c++20
run: ./v -cc g++-11 -no-std -cflags -std=c++20 -o v2 cmd/v && ./v2 -cc g++-11 -no-std -cflags -std=c++20 -o v3 cmd/v
- name: Ensure V can be compiled with -autofree
run: ./v -autofree -o v2 cmd/v ## NB: this does not mean it runs, but at least keeps it from regressing
@ -150,4 +153,3 @@ jobs:
./v test-parser -S examples/cli_fuzz.v
./v test-parser -S examples/regex_example_fuzz.v
./v test-parser -S examples/2048/2048_fuzz.v

View File

@ -25,7 +25,7 @@ const (
'long', 'malloc', 'namespace', 'new', 'nil', 'panic', 'register', 'restrict', 'return',
'short', 'signed', 'sizeof', 'static', 'string', 'struct', 'switch', 'typedef', 'typename',
'union', 'unix', 'unsigned', 'void', 'volatile', 'while', 'template', 'true', 'small',
'stdout', 'stdin', 'stderr', 'far', 'near', 'huge']
'stdout', 'stdin', 'stderr', 'far', 'near', 'huge', 'requires']
c_reserved_chk = token.new_keywords_matcher_from_array_trie(c_reserved)
// same order as in token.Kind
cmp_str = ['eq', 'ne', 'gt', 'lt', 'ge', 'le']