[PATCH] D70876: [clang-tidy] Add spuriously-wake-up-functions check

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 28 06:20:18 PST 2019


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/SpuriouslyWakeUpFunctionsCheck.cpp:60
+          .bind("wait"));
+  Finder->addMatcher(
+      ifStmt(anyOf(
----------------
Sorry for not noticing this earlier, but I think you can make two calls to `addMatcher()`, one for the C check and one for the C++ check. Then you can register only the matcher needed for the language mode you are currently in. e.g.,
```
if (getLangOpts().CPlusPlus)
  // Check for CON54-CPP
else
  // Check for CON36-C
```
This should make the check slightly more efficient because of the mutually exclusive nature of these APIs without changing the behavior.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/list.rst:75
    `bugprone-sizeof-expression <bugprone-sizeof-expression.html>`_, , "high"
+   `bugprone-spuriously-wake-up-functions <bugprone-spuriously-wake-up-functions.html>`_, , ""
    `bugprone-string-constructor <bugprone-string-constructor.html>`_, "Yes", "high"
----------------
sylvestre.ledru wrote:
> Could you try to evaluate the severity? :)
> thanks
> 
Given that these are essentially CERT rules, I'd go with the CERT severity for them -- however, I say that only because I'm not certain what approach is supposed to be taken for these severity markings.

CERT marks these two rules as having a low severity, FWIW.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D70876





More information about the cfe-commits mailing list