[PATCH] D75229: [clang-tidy] Add signal-in-multithreaded-program check

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 3 04:35:39 PDT 2020


whisperity added a comment.

In D75229#2189666 <https://reviews.llvm.org/D75229#2189666>, @abelkocsis wrote:

> I have managed to improve the checker, but could not set up the test files to work only in POSIX platforms. Could you help me or show me an example?

It's more so that, if I understand correctly, you **don't** want the diagnostics to be emitted when dealing with POSIX multithreading.

Also, have you checked in the test if `__unix__` is defined? I'm not seeing any indication of targets in the test configuration, nor checking for this macro. Maybe a Windows-specific test file should be added? `clang/test/Preprocessor/init.c` lists a bunch of macros that are supposedly pre-defined based on the target.

Or maybe the `OSType` in the triple would be more useful than the vendor?



================
Comment at: clang-tools-extra/clang-tidy/bugprone/SignalInMultithreadedProgramCheck.cpp:68
+    const SourceManager &SM, Preprocessor *pp, Preprocessor *ModuleExpanderPP) {
+  PP = pp;
+}
----------------
Global state is always a potential problem. Are you sure this is the right way to do things? Most other tidy checks that actively use this function define their own `PPCallback` subclass and use the existing preprocessor here to ensure the preprocessor executes the callback.


================
Comment at: clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp:50-85
         "cert-con54-cpp");

----------------
Please upload the diff with full context.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/list.rst:102
    `bugprone-virtual-near-miss <bugprone-virtual-near-miss.html>`_, "Yes"
+   `cert-con37-c <cert-con37-c.html>`_,
    `cert-dcl21-cpp <cert-dcl21-cpp.html>`_,
----------------
There is a table in this file towards the end where alias checks are explicitly listed in a "which check is alias of which other check" format.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D75229



More information about the cfe-commits mailing list