mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: do not allow #define everywhere
This commit is contained in:
parent
235ef23588
commit
22dac71b33
@ -10,7 +10,7 @@
|
|||||||
- [ ] Recursive structs via optionals: `struct Node { next ?Node }`
|
- [ ] Recursive structs via optionals: `struct Node { next ?Node }`
|
||||||
- [ ] Handle function pointers safely, remove `if function == 0 {`
|
- [ ] Handle function pointers safely, remove `if function == 0 {`
|
||||||
- [ ] Bundle OpenSSL like GC
|
- [ ] Bundle OpenSSL like GC
|
||||||
- [ ] Anonymous structs
|
- [x] Anonymous structs
|
||||||
- [ ] -usecache on by default
|
- [ ] -usecache on by default
|
||||||
- [ ] -skip-unused on by default
|
- [ ] -skip-unused on by default
|
||||||
|
|
||||||
|
@ -1900,7 +1900,13 @@ fn (mut c Checker) hash_stmt(mut node ast.HashStmt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if node.kind != 'define' {
|
if node.kind == 'define' {
|
||||||
|
if !c.is_builtin_mod && !c.file.path.ends_with('.c.v')
|
||||||
|
&& !c.file.path.contains('vlib/') {
|
||||||
|
c.error("#define can only be used in vlib (V's standard library) and *.c.v files",
|
||||||
|
node.pos)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
c.error('expected `#define`, `#flag`, `#include`, `#insert` or `#pkgconfig` not $node.val',
|
c.error('expected `#define`, `#flag`, `#include`, `#insert` or `#pkgconfig` not $node.val',
|
||||||
node.pos)
|
node.pos)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user