diff options
-rw-r--r-- | compilerplugins/clang/casttovoid.cxx | 6 | ||||
-rw-r--r-- | compilerplugins/clang/test/casttovoid.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 6 |
3 files changed, 11 insertions, 3 deletions
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 } } |