https://github.com/melver created https://github.com/llvm/llvm-project/pull/152853
Both these attributes were introduced in ab1dc2d54db5 ("Thread Safety Analysis: add support for before/after annotations on mutexes") back in 2015 as "beta" features. Anecdotally, we've been using `-Wthread-safety-beta` for years without problems. Furthermore, this feature requires the user to explicitly use these attributes in the first place. After 10 years, let's graduate the feature to the stable feature set, and reserve `-Wthread-safety-beta` for new upcoming features. >From 234cc115f14863a139569343b93b35f0ca06fdb8 Mon Sep 17 00:00:00 2001 From: Marco Elver <el...@google.com> Date: Sat, 9 Aug 2025 14:40:36 +0200 Subject: [PATCH] Thread Safety Analysis: Graduate ACQUIRED_BEFORE() and ACQUIRED_AFTER() from beta features Both these attributes were introduced in ab1dc2d54db5 ("Thread Safety Analysis: add support for before/after annotations on mutexes") back in 2015 as "beta" features. Anecdotally, we've been using -Wthread-safety-beta for years without problems. Furthermore, this feature requires the user to explicitly use these attributes in the first place. After 10 years, let's graduate the feature to the stable feature set, an reserve -Wthread-safety-beta for new upcoming features. --- clang/docs/ThreadSafetyAnalysis.rst | 7 ------- clang/lib/Analysis/ThreadSafety.cpp | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/clang/docs/ThreadSafetyAnalysis.rst b/clang/docs/ThreadSafetyAnalysis.rst index 4fc7ff28e9931..853a8fae4a907 100644 --- a/clang/docs/ThreadSafetyAnalysis.rst +++ b/clang/docs/ThreadSafetyAnalysis.rst @@ -825,13 +825,6 @@ doesn't know that munl.mu == mutex. The SCOPED_CAPABILITY attribute handles aliasing for MutexLocker, but does so only for that particular pattern. -ACQUIRED_BEFORE(...) and ACQUIRED_AFTER(...) support is still experimental. ---------------------------------------------------------------------------- - -ACQUIRED_BEFORE(...) and ACQUIRED_AFTER(...) are currently being developed under -the ``-Wthread-safety-beta`` flag. - - .. _mutexheader: mutex.h diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp index 80e7c8eff671a..db12a3b4d9b06 100644 --- a/clang/lib/Analysis/ThreadSafety.cpp +++ b/clang/lib/Analysis/ThreadSafety.cpp @@ -1338,8 +1338,7 @@ void ThreadSafetyAnalyzer::addLock(FactSet &FSet, } // Check before/after constraints - if (Handler.issueBetaWarnings() && - !Entry->asserted() && !Entry->declared()) { + if (!Entry->asserted() && !Entry->declared()) { GlobalBeforeSet->checkBeforeAfter(Entry->valueDecl(), FSet, *this, Entry->loc(), Entry->getKind()); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits