This check now also checks if any calls to pthread_* functions expect negative return values. These functions return either 0 on success or an errno on failure, which is positive only.
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 38182 Build 38181: arc lint + arc unit
Event Timeline
clang-tools-extra/clang-tidy/bugprone/PthreadReturnCheck.cpp | ||
---|---|---|
1 ↗ | (On Diff #216748) | Please make it single line, 80 characters long. |
23 ↗ | (On Diff #216748) | You could use const auto * here, because type is spelled in same statement. |
clang-tools-extra/clang-tidy/bugprone/PthreadReturnCheck.h | ||
1 ↗ | (On Diff #216748) | Please make line 80 characters long. |
clang-tools-extra/docs/ReleaseNotes.rst | ||
88 | Please keep new checks list sorted alphabetically. |
clang-tools-extra/clang-tidy/bugprone/PthreadReturnCheck.cpp | ||
---|---|---|
2 ↗ | (On Diff #216765) | Good catch! Thanks. |
Thanks for the contribution! In abstract, I think it is a good checker, however, the implementation largely duplicates clang-tidy/bugprone/PosixReturnCheck.cpp -- do you think you could factor out the common parts? I see at least two ways:
- Factor out a library, use it in both checkers.
- Put everything into one checker, if necessary, add configuration options to turn on/off POSIX and PThread parts. However, I don't even think configuration options would be necessary -- it is unlikely that someone would want one but not the other -- or is there a use case?
clang-tools-extra/test/clang-tidy/bugprone-pthread-return.cpp | ||
---|---|---|
101 ↗ | (On Diff #216768) | It does not seem like most of these functions are used in the test below. Could you leave only representative functions for each case in the code? |
clang-tools-extra/docs/ReleaseNotes.rst | ||
---|---|---|
70 | Check is not new, just modified. Such check should be after new checks. | |
71 | Please insert empty line below. | |
72 | Please omit This check. Please enclose pthread_* in double back-ticks. | |
clang-tools-extra/docs/clang-tidy/checks/bugprone-posix-return.rst | ||
6–8 | Please enclose pthread_* and posix_* in double back-ticks. |
clang-tools-extra/docs/ReleaseNotes.rst | ||
---|---|---|
70 | Is Modified the right keyword for modification? Thanks |
clang-tools-extra/docs/ReleaseNotes.rst | ||
---|---|---|
70 | I'd say "improved" instead of modified. |
Check is not new, just modified. Such check should be after new checks.