-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.
Description
Describe the bug
If you use only C functions from an imported module, the checker does not detect said module as being used. It gives the warning that the module is unused and should be used as _ to silence.
The import is definitely used because removing the import causes a failure in compilation.
Reproduction Steps
Create a project with the below files:
// main.v
module main
import cmod
fn main() {
println(C.add(1, 2))
}// cmod/test.h
int add(int a, int b) {
return a + b;
}// cmod/test.c.v
module cmod
#include "@VMODROOT/cmod/test.h"
fn C.add(a int, b int) intExpected Behavior
Should not print any warnings.
Current Behavior
❯ v run .
main.v:3:8: warning: module 'cmod' is imported but never used. Use `import cmod as _`, to silence this warning, or just remove the unused import line
1 | module main
2 |
3 | import cmod
| ~~~~
4 |
5 | fn main() {
3
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.12 0b0f380
Environment details (OS name and version, etc.)
| V full version | V 0.4.12 ba97785.0b0f380 |
|---|---|
| OS | linux, "CachyOS" |
| Processor | 12 cpus, 64bit, little endian, 13th Gen Intel(R) Core(TM) i5-1335U |
| Memory | 2.69GB/15.31GB |
| V executable | /home/dylan/Repos/v/v |
| V last modified time | 2025-12-29 19:31:41 |
| V home dir | OK, value: /home/dylan/Repos/v |
| VMODULES | OK, value: /home/dylan/.vmodules |
| VTMP | OK, value: /tmp/v_1000 |
| Current working dir | OK, value: /home/dylan/Repos/mod |
| Git version | git version 2.52.0 |
| V git status | weekly.2025.52-79-g0b0f380e-dirty |
| .git/config present | true |
| cc version | cc (GCC) 15.2.1 20251112 |
| gcc version | gcc (GCC) 15.2.1 20251112 |
| clang version | clang version 21.1.6 |
| tcc version | tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux) |
| tcc git status | thirdparty-linux-amd64 696c1d84 |
| emcc version | N/A |
| glibc version | ldd (GNU libc) 2.42 |
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
Metadata
Metadata
Assignees
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.