steakhal created this revision. steakhal added reviewers: aaron.ballman, whisperity, LegalizeAdulthood, alexfh. Herald added subscribers: carlosgalvezp, martong, rnkovacs, xazax.hun. Herald added a project: All. steakhal requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscriber: cfe-commits.
The end-user has no way of 'fixing' bugs in the system library anyway. Let's suppress these as well. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D125770 Files: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp Index: clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp +++ clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp @@ -34,8 +34,7 @@ #include <stdbool.h> // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers] -#include <mysystemlib.h> // FIXME: We should have no warning into system headers. -// CHECK-MESSAGES-WARN-INTO-HEADERS: mysystemlib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] +#include <mysystemlib.h> // no-warning: Don't warn into system headers. #include <mylib.h> // CHECK-MESSAGES-WARN-INTO-HEADERS: mylib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] Index: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp +++ clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp @@ -182,6 +182,10 @@ if (!Check.WarnIntoHeaders && !SM.isInMainFile(HashLoc)) return; + // Ignore system headers. + if (SM.isInSystemHeader(HashLoc)) + return; + // FIXME: Take care of library symbols from the global namespace. // // Reasonable options for the check:
Index: clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp +++ clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp @@ -34,8 +34,7 @@ #include <stdbool.h> // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers] -#include <mysystemlib.h> // FIXME: We should have no warning into system headers. -// CHECK-MESSAGES-WARN-INTO-HEADERS: mysystemlib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] +#include <mysystemlib.h> // no-warning: Don't warn into system headers. #include <mylib.h> // CHECK-MESSAGES-WARN-INTO-HEADERS: mylib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] Index: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp +++ clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp @@ -182,6 +182,10 @@ if (!Check.WarnIntoHeaders && !SM.isInMainFile(HashLoc)) return; + // Ignore system headers. + if (SM.isInSystemHeader(HashLoc)) + return; + // FIXME: Take care of library symbols from the global namespace. // // Reasonable options for the check:
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits