diff --git a/vlib/builtin/cdefs.v b/vlib/builtin/cdefs.v index 775331b5bd..697475b586 100644 --- a/vlib/builtin/cdefs.v +++ b/vlib/builtin/cdefs.v @@ -1,13 +1,17 @@ -// Copyright (c) 2019 Alexander Medvednikov. All rights reserved. -// Use of this source code is governed by an MIT license -// that can be found in the LICENSE file. - module builtin fn C.memcpy(byteptr, byteptr, int) fn C.memmove(byteptr, byteptr, int) //fn C.malloc(int) byteptr -fn C.realloc(byteptr, int) byteptr +fn C.realloc(a byteptr, b int) byteptr + +fn C.qsort(voidptr, int, int, voidptr) + +fn C.sprintf(a ...voidptr) byteptr + + +// Windows +fn C._setmode(int, int) +fn C._fileno(int) int -//fn C.qsort() diff --git a/vlib/compiler/parser.v b/vlib/compiler/parser.v index 28d6b73ccf..4db745b856 100644 --- a/vlib/compiler/parser.v +++ b/vlib/compiler/parser.v @@ -1264,7 +1264,7 @@ fn (p mut Parser) gen(s string) { // Generate V header from V source fn (p mut Parser) statement(add_semi bool) string { - //p.expected_type = '' + p.expected_type = '' if p.returns && !p.is_vweb { p.error('unreachable code') } @@ -1997,11 +1997,10 @@ fn (p mut Parser) get_c_func_type(name string) string { cfn := p.table.find_fn(name) or { // Not Found? Return 'void*' //return 'cvoid' //'void*' - //if false { - if p.expected_type != '' && p.expected_type != 'void' { - p.warn('\ndefine imported C function with ' + - '`fn C.$name([args]) [return_type]`\n') - } + //if p.expected_type != '' && p.expected_type != 'void' { + //p.warn('\n e=$p.expected_type define imported C function with ' + + //'`fn C.$name([args]) [return_type]`\n') + //} return 'void*' } // println("C fn $name has type $cfn.typ") diff --git a/vlib/compiler/tests/enum_test.v b/vlib/compiler/tests/enum_test.v index ce2a17a850..a413bc8c56 100644 --- a/vlib/compiler/tests/enum_test.v +++ b/vlib/compiler/tests/enum_test.v @@ -25,6 +25,7 @@ fn test_enum() { fn test_in() { color := Color.red - num := 3 + num := 3 // used to be an expr bug before `in` assert color in [.red, .green] + assert num == 3 }