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

#include warning

This commit is contained in:
Alexander Medvednikov 2019-11-06 00:32:15 +03:00
parent 7fc7c05e9d
commit 1b5f724df0
2 changed files with 10 additions and 0 deletions

View File

@ -201,6 +201,11 @@ fn (p mut Parser) chash() {
} }
if hash.starts_with('include') { if hash.starts_with('include') {
if p.first_pass() && !p.is_vh { 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 { if p.file_pcguard.len != 0 {
//println('p: $p.file_platform $p.file_pcguard') //println('p: $p.file_platform $p.file_pcguard')
p.cgen.includes << '$p.file_pcguard\n#$hash\n#endif' p.cgen.includes << '$p.file_pcguard\n#$hash\n#endif'

View File

@ -37,6 +37,11 @@ fn (p mut Parser) struct_decl() {
} }
is_c := name == 'C' && p.tok == .dot is_c := name == 'C' && p.tok == .dot
if is_c { 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) p.check(.dot)
name = p.check_name() name = p.check_name()
cat = .c_struct cat = .c_struct