platform_leak
Finds portable code imports something that asserts an operating system it is not built for.
Category restriction, allow by default.
Off by default; the example is shown with the rule enabled.
P :: #import "POSIX";
main :: () {
P.getpid();
}warning[platform_leak]: POSIX is not available on windows
--> example.jai:1:1
|
1 | P :: #import "POSIX";
| ^^^^^^^^^^^^^^^^^^^^ only builds on linux and macos
|
= help: guard the import with an `#if OS ==` check, or list this file under `[lint.portability.platforms]`
= note: the `#assert` at stdlib/POSIX/module.jai:1:9 fails on windows: POSIX requires its documented native platformCode meant to build everywhere that imports a module asserting an operating system it is not built for (#assert OS == .LINUX || OS == .MACOS in POSIX), found only when someone builds for that system.