From 4f6306f6d45c2fc4f040fda8548bd769e2336d75 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 19 Mar 2021 11:14:52 +0200 Subject: [PATCH] examples: fix `v -cflags "-Werror" test examples/` --- examples/dynamic_library_loading/use.v | 2 +- vlib/v/gen/c/comptime.v | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/dynamic_library_loading/use.v b/examples/dynamic_library_loading/use.v index 82bac72c32..3d9f456fed 100644 --- a/examples/dynamic_library_loading/use.v +++ b/examples/dynamic_library_loading/use.v @@ -9,7 +9,7 @@ fn main() { library_file_path := os.join_path(os.getwd(), dl.get_libname('library')) handle := dl.open(library_file_path, dl.rtld_lazy) eprintln('handle: ${ptr_str(handle)}') - mut f := &FNAdder(0) + mut f := FNAdder(0) f = dl.sym(handle, 'add_1') eprintln('f: ${ptr_str(f)}') res := f(1, 2) diff --git a/vlib/v/gen/c/comptime.v b/vlib/v/gen/c/comptime.v index 1b59babafe..7a64e662a4 100644 --- a/vlib/v/gen/c/comptime.v +++ b/vlib/v/gen/c/comptime.v @@ -249,11 +249,7 @@ fn (mut g Gen) comp_if(node ast.IfExpr) { } g.defer_ifdef = '' } - if node.is_expr { - g.write('#endif') - } else { - g.writeln('#endif') - } + g.writeln('#endif') } fn (mut g Gen) comp_if_cond(cond ast.Expr) bool {