[PATCH] D45059: [clang-tidy] Add check to catch comparisons in TEMP_FAILURE_RETRY

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 30 09:33:58 PDT 2018


JonasToth added a comment.

You noted, that the C++ warning would catch this case, but does not get triggered in C. Would it be wort to generalize the concern and have a warning that catch the comparison, regardless of the macro?

Do other major libraries define a similar macro but name it differently? If so, including there names would be worthwhile.



================
Comment at: clang-tidy/bugprone/ComparisonInTempFailureRetryCheck.cpp:22
+namespace {
+AST_MATCHER(Expr, isBinOpComparison) {
+  const auto *BinOp = dyn_cast<BinaryOperator>(Node.IgnoreParenCasts());
----------------
I think this matcher already exists.

https://github.com/JonasToth/clang-tools-extra/blob/master/clang-tidy/utils/Matchers.h

`isEqualityOperator` would work? See the other matchers there too. If the matchers there would not do it, maybe add one there.


https://reviews.llvm.org/D45059





More information about the cfe-commits mailing list