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

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 5 06:53:57 PDT 2018


alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.

The TEMP_FAILURE_RETRY macro is specific to the GNU C library (and environments that attempt to mimic it). The generic bugprone- module is not the best place for this check. I suggest moving it to android- as other similar checks are already there (and I suspect that your interest in this check is also related to android?). Alternatively, if there are other checks specific to the GNU C library planned, we could add a new module for it.



================
Comment at: clang-tidy/bugprone/ComparisonInTempFailureRetryCheck.cpp:77
+  diag(BinOp.getOperatorLoc(),
+       "Top-level comparisons should be moved out of TEMP_FAILURE_RETRY");
+
----------------
Diagnostic messages are not full sentences and should not start with a capital letter.


================
Comment at: docs/clang-tidy/checks/bugprone-comparison-in-temp-failure-retry.rst:7
+Diagnoses comparisons that appear to be incorrectly placed in the argument to
+the ``TEMP_FAILURE_RETRY`` macro. Having such a use is incorrect in the vast
+majority of cases, and will often silently defeat the purpose of the
----------------
The documentation should provide some context w.r.t what the TEMP_FAILURE_RETRY macro is and where it comes from (maybe also link to its documentation).


https://reviews.llvm.org/D45059





More information about the cfe-commits mailing list