Patched llvm-project/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp to account for the user passing a nullptr to the implementation dependent function printf(). Invoked with bin/scan-build -enable-checker optin.portability bin/clang -g test.cpp where the contents of test.cpp is:
c++ #include <stdio.h> #include <stdlib.h> int main() { int *p = nullptr; printf("%p", p); }
now produces the warning:
test.cpp:6:5: warning: Passing a null pointer to printf() is implementation dependant. Portability warning [optin.portability.UnixAPI] printf("%p", p); ^~~~~~~~~~~~~~~ 1 warning generated.