obiwan87 / odin-intellij

Odin Support plugin for JetBrains IDEs
https://plugins.jetbrains.com/plugin/22933-odin-support
MIT License
37 stars 3 forks source link

Incorrect errors reported on some libexec files with 'odin check stdio.odin -no-entry-point -file' #57

Closed Dima-369 closed 2 months ago

Dima-369 commented 2 months ago

I noticed that using -file gives false positives for:

/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin

OdinBuildProcessRunner.java runs it like this:

odin check stdio.odin -no-entry-point -file

But using odin check . on the entire libc directory works correctly and does not report any errors. Let's drop -file and always check the directory the containing file is in, maybe?

CleanShot 2024-08-15 at 08 30 34@2x


/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(204:26) Error: Undeclared name: char
    tmpnam    :: proc(s: [^]char) -> [^]char ---
                            ^~~^
    Suggestion: Did you mean 'u8', 'i8', or 'c.char' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(204:38) Error: Undeclared name: char
    tmpnam    :: proc(s: [^]char) -> [^]char ---
                                        ^~~^
    Suggestion: Did you mean 'u8', 'i8', or 'c.char' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(211:43) Error: Undeclared name: char
    setbuf    :: proc(stream: ^FILE, buf: [^]char) ---
                                             ^~~^
    Suggestion: Did you mean 'u8', 'i8', or 'c.char' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(212:43) Error: Undeclared name: char
    ... stream: ^FILE, buf: [^]char, mode: int, size: size_t) -> int ---
                               ^~~^
    Suggestion: Did you mean 'u8', 'i8', or 'c.char' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(212:66) Error: 'size_t' is not a type
    ... stream: ^FILE, buf: [^]char, mode: int, size: size_t) -> int ---
                                                      ^~~~~^
    Suggestion: Did you mean 'uint', or 'c.size_t' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(219:26) Error: Undeclared name: char
    ... c(s: [^]char, n: size_t, format: cstring, #c_vararg args: ..any ...
                ^~~^
    Suggestion: Did you mean 'u8', 'i8', or 'c.char' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(219:35) Error: 'size_t' is not a type
    ... har, n: size_t, format: cstring, #c_vararg args: ..any) -> int  ...
                ^~~~~^
    Suggestion: Did you mean 'uint', or 'c.size_t' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(221:58) Error: Undeclared name: va_list
    ... : proc(stream: ^FILE, format: cstring, arg: ^va_list) -> int ---
                                                     ^~~~~~^

/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(222:58) Error: Undeclared name: va_list
    ... : proc(stream: ^FILE, format: cstring, arg: ^va_list) -> int ---
                                                     ^~~~~~^

/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(223:43) Error: Undeclared name: va_list
    vprintf   :: proc(format: cstring, arg: ^va_list) -> int ---
                                             ^~~~~~^

/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(224:43) Error: Undeclared name: va_list
    vscanf    :: proc(format: cstring, arg: ^va_list) -> int ---
                                             ^~~~~~^

/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(225:26) Error: Undeclared name: char
    ... c(s: [^]char, n: size_t, format: cstring, arg: ^va_list) -> int ...
                ^~~^
    Suggestion: Did you mean 'u8', 'i8', or 'c.char' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(225:35) Error: Undeclared name: size_t
    ... : [^]char, n: size_t, format: cstring, arg: ^va_list) -> int ---
                      ^~~~~^
    Suggestion: Did you mean 'uint', or 'c.size_t' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(225:66) Error: Undeclared name: va_list
    ... : [^]char, n: size_t, format: cstring, arg: ^va_list) -> int ---
                                                     ^~~~~~^

/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(226:26) Error: Undeclared name: char
    ...   :: proc(s: [^]char, format: cstring, arg: ^va_list) -> int ---
                        ^~~^
    Suggestion: Did you mean 'u8', 'i8', or 'c.char' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(226:55) Error: Undeclared name: va_list
    ...   :: proc(s: [^]char, format: cstring, arg: ^va_list) -> int ---
                                                     ^~~~~~^

/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(227:46) Error: Undeclared name: va_list
    vsscanf   :: proc(s, format: cstring, arg: ^va_list) -> int ---
                                                ^~~~~~^

/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(231:26) Error: 'char' is not a type
    ... ts     :: proc(s: [^]char, n: int, stream: ^FILE) -> [^]char ---
                             ^~~^
    Suggestion: Did you mean 'u8', 'i8', or 'c.char' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(231:61) Error: Undeclared name: char
    ... ts     :: proc(s: [^]char, n: int, stream: ^FILE) -> [^]char ---
                                                                ^~~^
    Suggestion: Did you mean 'u8', 'i8', or 'c.char' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(239:39) Error: Undeclared name: size_t
    ... awptr, size: size_t, nmemb: size_t, stream: ^FILE) -> size_t ---
                     ^~~~~^
    Suggestion: Did you mean 'uint', or 'c.size_t' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(239:54) Error: Undeclared name: size_t
    ... awptr, size: size_t, nmemb: size_t, stream: ^FILE) -> size_t ---
                                    ^~~~~^
    Suggestion: Did you mean 'uint', or 'c.size_t' (which is part of 'core:c')?
/opt/homebrew/Cellar/odin/2024-07/libexec/core/c/libc/stdio.odin(239:80) Error: Undeclared name: size_t
    ... awptr, size: size_t, nmemb: size_t, stream: ^FILE) -> size_t ---
                                                              ^~~~~^
    Suggestion: Did you mean 'uint', or 'c.size_t' (which is part of 'core:c')?
obiwan87 commented 2 months ago

Oh, I actually thought that this might happen and also thought I tested against it. But ok, the fix should be a very quick. This might be worth another release.

Edit: Yes, I think checking the dir instead of the file should be fine.

Dima-369 commented 2 months ago

With your recent commits, this works fine in all the handful of files, I tested with.