Author: gribozavr Date: Thu Sep 26 16:28:31 2019 New Revision: 373032 URL: http://llvm.org/viewvc/llvm-project?rev=373032&view=rev Log: Revert "[clang-tidy] New check to warn when storing dispatch_once_t in non-static, non-global storage"
This reverts commit r373028, because the new test fails on Linux. Removed: clang-tools-extra/trunk/clang-tidy/darwin/ clang-tools-extra/trunk/docs/clang-tidy/checks/darwin-dispatch-once-nonstatic.rst clang-tools-extra/trunk/test/clang-tidy/darwin-dispatch-once-nonstatic.mm Modified: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/ClangTidyForceLinker.h clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt clang-tools-extra/trunk/clangd/CMakeLists.txt clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/CMakeLists.txt?rev=373032&r1=373031&r2=373032&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/CMakeLists.txt Thu Sep 26 16:28:31 2019 @@ -43,7 +43,6 @@ add_subdirectory(boost) add_subdirectory(bugprone) add_subdirectory(cert) add_subdirectory(cppcoreguidelines) -add_subdirectory(darwin) add_subdirectory(fuchsia) add_subdirectory(google) add_subdirectory(hicpp) Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyForceLinker.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyForceLinker.h?rev=373032&r1=373031&r2=373032&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/ClangTidyForceLinker.h (original) +++ clang-tools-extra/trunk/clang-tidy/ClangTidyForceLinker.h Thu Sep 26 16:28:31 2019 @@ -50,11 +50,6 @@ extern volatile int CppCoreGuidelinesMod static int LLVM_ATTRIBUTE_UNUSED CppCoreGuidelinesModuleAnchorDestination = CppCoreGuidelinesModuleAnchorSource; -// This anchor is used to force the linker to link the DarwinModule. -extern volatile int DarwinModuleAnchorSource; -static int LLVM_ATTRIBUTE_UNUSED DarwinModuleAnchorDestination = - DarwinModuleAnchorSource; - // This anchor is used to force the linker to link the FuchsiaModule. extern volatile int FuchsiaModuleAnchorSource; static int LLVM_ATTRIBUTE_UNUSED FuchsiaModuleAnchorDestination = Modified: clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt?rev=373032&r1=373031&r2=373032&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt Thu Sep 26 16:28:31 2019 @@ -14,7 +14,6 @@ add_clang_library(clangTidyPlugin clangTidyBugproneModule clangTidyCERTModule clangTidyCppCoreGuidelinesModule - clangTidyDarwinModule clangTidyFuchsiaModule clangTidyGoogleModule clangTidyHICPPModule Modified: clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt?rev=373032&r1=373031&r2=373032&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt Thu Sep 26 16:28:31 2019 @@ -23,7 +23,6 @@ target_link_libraries(clang-tidy clangTidyBugproneModule clangTidyCERTModule clangTidyCppCoreGuidelinesModule - clangTidyDarwinModule clangTidyFuchsiaModule clangTidyGoogleModule clangTidyHICPPModule Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CMakeLists.txt?rev=373032&r1=373031&r2=373032&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clangd/CMakeLists.txt Thu Sep 26 16:28:31 2019 @@ -123,7 +123,6 @@ add_clang_library(clangDaemon clangTidyBugproneModule clangTidyCERTModule clangTidyCppCoreGuidelinesModule - clangTidyDarwinModule clangTidyFuchsiaModule clangTidyGoogleModule clangTidyHICPPModule Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=373032&r1=373031&r2=373032&view=diff ============================================================================== --- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original) +++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Thu Sep 26 16:28:31 2019 @@ -79,12 +79,6 @@ Improvements to clang-tidy Finds obvious infinite loops (loops where the condition variable is not changed at all). -- New :doc:`darwin-dispatch-once-nonstatic - <clang-tidy/checks/darwin-dispatch-once-nonstatic>`check. - - Finds instances of ``dispatch_once_t`` variables not having static or global - storage. - - New :doc:`linuxkernel-must-use-errs <clang-tidy/checks/linuxkernel-must-use-errs>` check. Removed: clang-tools-extra/trunk/docs/clang-tidy/checks/darwin-dispatch-once-nonstatic.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/darwin-dispatch-once-nonstatic.rst?rev=373031&view=auto ============================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/darwin-dispatch-once-nonstatic.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/checks/darwin-dispatch-once-nonstatic.rst (removed) @@ -1,22 +0,0 @@ -.. title:: clang-tidy - darwin-dispatch-once-nonstatic - -darwin-dispatch-once-nonstatic -============================== - -Finds declarations of ``dispatch_once_t`` variables without static or global -storage. The behavior of using ``dispatch_once_t`` predicates with automatic or -dynamic storage is undefined by libdispatch, and should be avoided. - -It is a common pattern to have functions initialize internal static or global -data once when the function runs, but programmers have been known to miss the -static on the ``dispatch_once_t`` predicate, leading to an uninitialized flag -value at the mercy of the stack. - -Programmers have also been known to make ``dispatch_once_t`` variables be -members of structs or classes, with the intent to lazily perform some expensive -struct or class member initialization only once; however, this violates the -libdispatch requirements. - -See the discussion section of -`Apple's dispatch_once documentation <https://developer.apple.com/documentation/dispatch/1447169-dispatch_once>`_ -for more information. Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst?rev=373032&r1=373031&r2=373032&view=diff ============================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Thu Sep 26 16:28:31 2019 @@ -212,7 +212,6 @@ Clang-Tidy Checks cppcoreguidelines-pro-type-vararg cppcoreguidelines-slicing cppcoreguidelines-special-member-functions - darwin-dispatch-once-nonstatic fuchsia-default-arguments-calls fuchsia-default-arguments-declarations fuchsia-header-anon-namespaces (redirects to google-build-namespaces) <fuchsia-header-anon-namespaces> Removed: clang-tools-extra/trunk/test/clang-tidy/darwin-dispatch-once-nonstatic.mm URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/darwin-dispatch-once-nonstatic.mm?rev=373031&view=auto ============================================================================== --- clang-tools-extra/trunk/test/clang-tidy/darwin-dispatch-once-nonstatic.mm (original) +++ clang-tools-extra/trunk/test/clang-tidy/darwin-dispatch-once-nonstatic.mm (removed) @@ -1,48 +0,0 @@ -// RUN: %check_clang_tidy %s darwin-dispatch-once-nonstatic %t - -typedef int dispatch_once_t; -extern void dispatch_once(dispatch_once_t *pred, void(^block)(void)); - - -void bad_dispatch_once(dispatch_once_t once, void(^block)(void)) {} -// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: dispatch_once_t variables must have static or global storage duration; function parameters should be pointer references [darwin-dispatch-once-nonstatic] - -// file-scope dispatch_once_ts have static storage duration. -dispatch_once_t global_once; -static dispatch_once_t file_static_once; -namespace { -dispatch_once_t anonymous_once; -} // end anonymous namespace - -int Correct(void) { - static int value; - static dispatch_once_t once; - dispatch_once(&once, ^{ - value = 1; - }); - return value; -} - -int Incorrect(void) { - static int value; - dispatch_once_t once; - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: dispatch_once_t variables must have static or global storage duration [darwin-dispatch-once-nonstatic] - // CHECK-FIXES: static dispatch_once_t once; - dispatch_once(&once, ^{ - value = 1; - }); - return value; -} - -struct OnceStruct { - static dispatch_once_t staticOnce; // Allowed - int value; - dispatch_once_t once; // Allowed (at this time) -}; - -@interface MyObject { - dispatch_once_t _once; - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: dispatch_once_t variables must have static or global storage duration and cannot be Objective-C instance variables [darwin-dispatch-once-nonstatic] - // CHECK-FIXES: dispatch_once_t _once; -} -@end _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits