compilerplugins/clang/casttovoid.cxx | 6 ++++++ compilerplugins/clang/test/casttovoid.cxx | 2 ++ sw/source/core/doc/docredln.cxx | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-)
New commits: commit 1e84c0b8d161e05c19c3aa227cbf7de15cc363a3 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Mon Mar 28 17:34:58 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Mon Mar 28 23:27:28 2022 +0200 -Werror,-Wunused-but-set-variable ...which was apparently meant as a "Possible debugger breakpoint" in DBG_UTIL-only sw_DebugRedline. The obvious fix is to mark nDummy as volatile, but increment of a volatile variable is deprecated, so replace those with reads of the variable, but which triggered false loplugin:casttovoid so fix that too. Change-Id: I07376e665caa4fd9befaba06d261a50df7a63a10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132237 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/compilerplugins/clang/casttovoid.cxx b/compilerplugins/clang/casttovoid.cxx index 63f1efdd85a5..bddfcb4da503 100644 --- a/compilerplugins/clang/casttovoid.cxx +++ b/compilerplugins/clang/casttovoid.cxx @@ -202,6 +202,9 @@ public: if (var == nullptr) { return true; } + if (var->getType().isVolatileQualified()) { + return true; + } auto & usage = vars_[var->getCanonicalDecl()]; if (!castToVoid_.empty() && castToVoid_.top().sub == expr) { usage.castToVoid.push_back(castToVoid_.top().cast); @@ -506,6 +509,9 @@ private: if (var == nullptr) { return; } + if (var->getType().isVolatileQualified()) { + return; + } auto & usage = vars_[var->getCanonicalDecl()]; if (usage.firstConsumption != nullptr) { return; diff --git a/compilerplugins/clang/test/casttovoid.cxx b/compilerplugins/clang/test/casttovoid.cxx index c3b5eee17c96..3d8c22b49c7e 100644 --- a/compilerplugins/clang/test/casttovoid.cxx +++ b/compilerplugins/clang/test/casttovoid.cxx @@ -115,6 +115,8 @@ int main() { int n8 = 0; ASSERT(USE(USE(n8 == 0))); (void) n8; + int volatile n9 = 0; + (void) n9; return n1 // expected-note 8 {{first consumption is here [loplugin:casttovoid]}} + n2 // expected-note {{first consumption is here [loplugin:casttovoid]}} + n3; diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index bb139a1b1781..428f67026f29 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -69,13 +69,13 @@ using namespace com::sun::star; const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); for( SwRedlineTable::size_type n = 0; n < rTable.size(); ++n ) { - SwRedlineTable::size_type nDummy = 0; + volatile SwRedlineTable::size_type nDummy = 0; const SwRangeRedline* pCurrent = rTable[ n ]; const SwRangeRedline* pNext = n+1 < rTable.size() ? rTable[ n+1 ] : nullptr; if( pCurrent == pNext ) - ++nDummy; + (void) nDummy; if( n == nWatch ) - ++nDummy; // Possible debugger breakpoint + (void) nDummy; // Possible debugger breakpoint } }