From 1b5f724df0395ebea3b431777072765cc1e16bf3 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 6 Nov 2019 00:32:15 +0300 Subject: [PATCH] #include warning --- vlib/compiler/comptime.v | 5 +++++ vlib/compiler/struct.v | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/vlib/compiler/comptime.v b/vlib/compiler/comptime.v index d10ee01e3c..e4b28fbc57 100644 --- a/vlib/compiler/comptime.v +++ b/vlib/compiler/comptime.v @@ -201,6 +201,11 @@ fn (p mut Parser) chash() { } if hash.starts_with('include') { if p.first_pass() && !p.is_vh { + if !p.pref.building_v && !p.fileis('vlib') { + p.warn('C #includes will soon be removed from the language' + + '\ndefine the C structs and functions in V') + + } if p.file_pcguard.len != 0 { //println('p: $p.file_platform $p.file_pcguard') p.cgen.includes << '$p.file_pcguard\n#$hash\n#endif' diff --git a/vlib/compiler/struct.v b/vlib/compiler/struct.v index 2326b0e70e..e085545d89 100644 --- a/vlib/compiler/struct.v +++ b/vlib/compiler/struct.v @@ -37,6 +37,11 @@ fn (p mut Parser) struct_decl() { } is_c := name == 'C' && p.tok == .dot if is_c { + if !p.pref.building_v && !p.fileis('vlib') { + p.warn('Virtual C structs will soon be removed from the language' + + '\ndefine the C structs and functions in V') + } + p.check(.dot) name = p.check_name() cat = .c_struct