-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 <sbergman@redhat.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user