diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4f360c08f..2af79c4f3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,7 +85,7 @@ jobs: echo $VFLAGS sudo ln -s $PWD/thirdparty/tcc/tcc.exe /usr/local/bin/tcc ## TODO: remove make -j4 - ./v -cg -o v cmd/v + ./v -cg -cflags -Werror -o v cmd/v - name: Test v->c run: | thirdparty/tcc/tcc.exe -version @@ -145,7 +145,7 @@ jobs: ## brew install sdl2 sdl2_ttf sdl2_mixer sdl2_image export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/" - name: Build V - run: make -j4 && ./v -o v cmd/v + run: make -j4 && ./v -cg -cflags -Werror -o v cmd/v - name: Build V using V run: ./v -o v2 cmd/v && ./v2 -o v3 cmd/v - name: Test symlink @@ -206,7 +206,7 @@ jobs: sudo apt-get install --quiet -y libglfw3 libglfw3-dev libfreetype6-dev libxi-dev libxcursor-dev libasound2-dev ## sudo apt-get install --quiet -y libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev - name: Build V - run: make -j4 && ./v -cc gcc -o v cmd/v + run: make -j4 && ./v -cc gcc -cg -cflags -Werror -o v cmd/v # - name: Test V # run: ./v -silent test-compiler # - name: Test v binaries @@ -357,7 +357,7 @@ jobs: gcc --version .\make.bat -gcc - name: Test new v.c - run: .\v.exe -o v.c cmd/v && gcc -municode -w v.c + run: .\v.exe -o v.c cmd/v && gcc -Werror -municode -w v.c - name: Install dependencies run: | .\v.exe setup-freetype @@ -392,6 +392,7 @@ jobs: echo %VFLAGS% echo $VFLAGS .\make.bat -msvc + .\v.exe -cflags /WX self - name: Install dependencies run: | .\v.exe setup-freetype @@ -433,7 +434,7 @@ jobs: move "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe.old" .\make.bat - name: Test new v.c - run: .\v.exe -o v.c cmd/v && .\thirdparty\tcc\tcc.exe -w -ladvapi32 -bt10 v.c + run: .\v.exe -o v.c cmd/v && .\thirdparty\tcc\tcc.exe -Werror -w -ladvapi32 -bt10 v.c - name: Install dependencies run: | .\v.exe setup-freetype diff --git a/vlib/builtin/builtin_nix.c.v b/vlib/builtin/builtin_nix.c.v index b305465b8a..c14a3ae302 100644 --- a/vlib/builtin/builtin_nix.c.v +++ b/vlib/builtin/builtin_nix.c.v @@ -48,7 +48,7 @@ fn print_backtrace_skipping_top_frames(xskipframes int) bool { // so there is no need to have their twins in builtin_windows.v fn print_backtrace_skipping_top_frames_mac(skipframes int) bool { $if macos { - buffer := [100]byteptr{} + buffer := [100]voidptr{} nr_ptrs := C.backtrace(buffer, 100) if nr_ptrs < 2 { eprintln('C.backtrace returned less than 2 frames') @@ -61,7 +61,7 @@ fn print_backtrace_skipping_top_frames_mac(skipframes int) bool { fn print_backtrace_skipping_top_frames_freebsd(skipframes int) bool { $if freebsd { - buffer := [100]byteptr{} + buffer := [100]voidptr{} nr_ptrs := C.backtrace(buffer, 100) if nr_ptrs < 2 { eprintln('C.backtrace returned less than 2 frames') diff --git a/vlib/os/process_nix.c.v b/vlib/os/process_nix.c.v index 104ab12add..9710f4dff6 100644 --- a/vlib/os/process_nix.c.v +++ b/vlib/os/process_nix.c.v @@ -45,16 +45,16 @@ fn (mut p Process) unix_spawn_process() int { } mut cargv := []charptr{} mut cenvs := []charptr{} - cargv << p.filename.str + cargv << charptr(p.filename.str) for i in 0 .. p.args.len { - cargv << p.args[i].str + cargv << charptr(p.args[i].str) } for i in 0 .. p.env.len { - cenvs << p.env[i].str + cenvs << charptr(p.env[i].str) } cargv << charptr(0) cenvs << charptr(0) - C.execve(p.filename.str, cargv.data, cenvs.data) + C.execve(charptr(p.filename.str), cargv.data, cenvs.data) // NB: normally execve does not return at all. // If it returns, then something went wrong... eprintln(posix_get_error_msg(C.errno)) diff --git a/vlib/time/time_darwin.c.v b/vlib/time/time_darwin.c.v index d516961c39..6839e5d252 100644 --- a/vlib/time/time_darwin.c.v +++ b/vlib/time/time_darwin.c.v @@ -28,10 +28,10 @@ pub struct C.timeval { tv_usec u64 } -fn init_time_base() InternalTimeBase { +fn init_time_base() C.mach_timebase_info_data_t { tb := C.mach_timebase_info_data_t{} C.mach_timebase_info(&tb) - return InternalTimeBase{numer:tb.numer, denom:tb.denom} + return C.mach_timebase_info_data_t{numer:tb.numer, denom:tb.denom} } fn sys_mono_now_darwin() u64 { diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 10380e416f..a8701448da 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -316,7 +316,7 @@ fn (mut v Builder) cc() { // if is_cc_clang { if debug_mode { - debug_options = '-g3 -O0 -no-pie' + debug_options = '-g3 -O0' } optimization_options = '-O3' mut have_flto := true diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index c60b935f9c..047aa3e2b3 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -1191,7 +1191,7 @@ fn (mut g Gen) for_in(it ast.ForInStmt) { g.writeln(' = (*$atmp)[$i];') } } else if it.kind == .map { - // `for key, val in map {` + // `for key, val in map { g.writeln('// FOR IN map') idx := g.new_tmp_var() atmp := g.new_tmp_var() @@ -1199,7 +1199,7 @@ fn (mut g Gen) for_in(it ast.ForInStmt) { g.write('$atmp_styp $atmp = ') g.expr(it.cond) g.writeln(';') - g.writeln('for (int $idx = 0; $idx < ${atmp}.key_values.len; ++$idx) {') + g.writeln('for (int $idx = 0; $idx < (int)${atmp}.key_values.len; ++$idx) {') g.writeln('\tif (${atmp}.key_values.keys[$idx].str == 0) {continue;}') if it.key_var != '_' { key_styp := g.typ(it.key_type) diff --git a/vlib/v/parser/comptime.v b/vlib/v/parser/comptime.v index ca2660e448..9e9be823c6 100644 --- a/vlib/v/parser/comptime.v +++ b/vlib/v/parser/comptime.v @@ -23,14 +23,14 @@ fn (mut p Parser) hash() ast.HashStmt { val := p.tok.lit kind := val.all_before(' ') p.next() - mut main := '' + mut main_str := '' mut msg := '' content := val.all_after('$kind ').all_before('//') if content.contains(' #') { - main = content.all_before(' #').trim_space() + main_str = content.all_before(' #').trim_space() msg = content.all_after(' #').trim_space() } else { - main = content.trim_space() + main_str = content.trim_space() msg = '' } // p.trace('a.v', 'kind: ${kind:-10s} | pos: ${pos:-45s} | hash: $val') @@ -38,7 +38,7 @@ fn (mut p Parser) hash() ast.HashStmt { mod: p.mod val: val kind: kind - main: main + main: main_str msg: msg pos: pos } diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 3ad42b4f3c..31a6ae15cc 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -1367,6 +1367,7 @@ fn (mut p Parser) dot_expr(left ast.Expr) ast.Expr { field_name: field_name pos: name_pos is_mut: is_mut + mut_pos: mut_pos } mut node := ast.Expr{} node = sel_expr