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

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 8 06:32:47 PST 2022


Szelethus added a comment.

In D135360#3862260 <https://reviews.llvm.org/D135360#3862260>, @martong wrote:

> 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.

Mind that dependencies also establish the order of callbacks (dependent checkers are called after their dependencies).

> 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.



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

> About the "ftell" problem: The POSIX rules are really an extension of the C standard rules. At `ftell` according to C standard `errno` should be set to a positive value if error occurs. The POSIX rules extend this: `errno` is not changed if no error occurs. [...] It may be best to use the POSIX rules for the checker, because the C standard does not say much and may need to require setting of `errno` to 0 before a standard function call.

Interesting pair of perspectives, I think a reasonable checker should be a little more conservative, more akin to what POSIX seems to specify.

In D135360#3885556 <https://reviews.llvm.org/D135360#3885556>, @martong wrote:

> In D135360#3885494 <https://reviews.llvm.org/D135360#3885494>, @balazske wrote:
>
>> [...] Probably this should be a discourse question?
>
> Okay then, I think it is worth to have a discourse question. But you could ask the wider "Clang" community, so I would not post the question as something that is related strictly to the static analyzer.

Did this thread ever materialize? I admit I didn't follow :)


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