[PATCH] D135360: [clang][analyzer] Add some more functions to StreamChecker and StdLibraryFunctionsChecker.

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 17 07:29:23 PDT 2022


martong added a comment.

In D135360#3839890 <https://reviews.llvm.org/D135360#3839890>, @balazske wrote:

> I found some anomalies during development:
>
> - If the checker **StdCLibraryFunctions** is added as dependency for **alpha.unix.Stream** in //checkers.td// I get some "unexplainable" test failures.

Could you please elaborate? I don't see how to help you with it without seeing more details.

> - In the comments section at CERT ERR30-C <https://wiki.sei.cmu.edu/confluence/display/c/ERR30-C.+Take+care+when+reading+errno> is pointed out that function `ftell` can change the value of `errno` if it is successful. This is the "normal" expected behavior of all standard functions unless the documentation tells other. But this place (search for ftell) <https://pubs.opengroup.org/onlinepubs/9699919799/> tells that `ftell` should not change `errno` if successful. The persons commented at the CERT rule probably checked only one or more of the C standards. But there should be no conflict between POSIX and C ("Any conflict between the requirements described here and the ISO C standard is unintentional."). It would be unconventional if different check rules are needed (and add of a global analyzer option for POSIX or C mode).

When it is ambiguous then I'd check the latest standards of both POSIX and C. If it is still doubtful then I'd vote for the C standard and would report a defect towards the POSIX community.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135360/new/

https://reviews.llvm.org/D135360



More information about the cfe-commits mailing list