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

cgen: 4 byte bool flagg for compatibility with some C software

This commit is contained in:
Alexander Medvednikov 2021-12-06 12:35:56 +03:00
parent 09955b7ce8
commit 325e116b7a
2 changed files with 6 additions and 3 deletions

View File

@ -2913,7 +2913,7 @@ pub fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool)
if call_arg.typ != param.typ
&& (param.typ == ast.voidptr_type || final_param_sym.idx == ast.voidptr_type_idx)
&& !call_arg.typ.is_any_kind_of_pointer() && func.language == .v
&& !call_arg.expr.is_lvalue() && func.name != 'json.encode' {
&& !call_arg.expr.is_lvalue() && func.name != 'json.encode' && !c.pref.translated {
c.error('expression cannot be passed as `voidptr`', call_arg.expr.position())
}
// Handle expected interface

View File

@ -542,8 +542,11 @@ typedef struct sync__Channel* chan;
#ifndef __cplusplus
#ifndef bool
//typedef int bool;
#ifdef CUSTOM_DEFINE_4bytebool
typedef int bool;
#else
typedef byte bool;
#endif
#define true 1
#define false 0
#endif