From c7e6d379da870b910bb289fbb8d56fbdd37601f3 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 25 Oct 2019 18:32:44 +0300 Subject: [PATCH] $if glibc { --- vlib/compiler/comptime.v | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vlib/compiler/comptime.v b/vlib/compiler/comptime.v index f073dbefa0..5484053097 100644 --- a/vlib/compiler/comptime.v +++ b/vlib/compiler/comptime.v @@ -73,6 +73,14 @@ fn (p mut Parser) comp_time() { p.genln('#endif') } } + else if name == 'glibc' { + p.genln('#ifdef __GLIBC__') + p.check(.lcbr) + p.statements_no_rcbr() + if ! (p.tok == .dollar && p.peek() == .key_else) { + p.genln('#endif') + } + } else { println('Supported platforms:') println(supported_platforms) @@ -229,7 +237,7 @@ fn (p mut Parser) chash() { $if !js { if !p.can_chash { println('hash="$hash"') - if hash.starts_with('include') { println("include") } else {} + if hash.starts_with('include') { println("include") } else {} p.error('bad token `#` (embedding C code is no longer supported)') } }