Skip to content

[NFC][analyzer] Document optin.portability.UnixAPI #150005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion clang/docs/analyzer/checkers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,16 @@ To override this threshold to e.g. 4 bytes, use the

optin.portability.UnixAPI
"""""""""""""""""""""""""
Finds implementation-defined behavior in UNIX/Posix functions.
Reports situations where 0 is passed as the "size" argument of various
allocation functions ( ``calloc``, ``malloc``, ``realloc``, ``reallocf``,
``alloca``, ``__builtin_alloca``, ``__builtin_alloca_with_align``, ``valloc``).

Note that similar functionality is also supported by :ref:`unix-Malloc` which
reports code that *uses* memory allocated with size zero.

(The name of this checker is motivated by the fact that it was originally
introduced with the vague goal that it "Finds implementation-defined behavior
in UNIX/Posix functions.")


optin.taint
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
Original file line number Diff line number Diff line change
Expand Up @@ -1656,8 +1656,8 @@ def CloneChecker : Checker<"CloneChecker">,
let ParentPackage = PortabilityOptIn in {

def UnixAPIPortabilityChecker : Checker<"UnixAPI">,
HelpText<"Finds implementation-defined behavior in UNIX/Posix functions">,
Documentation<NotDocumented>;
HelpText<"Finds dynamic memory allocation with size zero">,
Documentation<HasDocumentation>;

} // end optin.portability

Expand Down
Loading