Skip to content

Commit b00c377

Browse files
committed
Fix invariant warnings
1 parent 39bee77 commit b00c377

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

src/goto-instrument/wmm/data_dp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Date: 2012
1313

1414
#include "data_dp.h"
1515

16+
#include <util/invariant.h>
1617
#include <util/message.h>
1718

1819
#include "abstract_event.h"
@@ -151,7 +152,7 @@ void data_dpt::dp_merge()
151152
it3->eq_class=to;
152153

153154
/* strictly monotonous => converges */
154-
assert(initial_size>data.size());
155+
INVARIANT(initial_size>data.size(), "strictly monotonous => converges");
155156

156157
/* repeat until classes are disjunct */
157158
dp_merge();

src/goto-instrument/wmm/event_graph.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Date: 2012
2020
#include <iosfwd>
2121

2222
#include <util/graph.h>
23+
#include <util/invariant.h>
2324

2425
#include "abstract_event.h"
2526
#include "data_dp.h"
@@ -213,7 +214,7 @@ class event_grapht
213214
{
214215
critical_cyclet reduced(egraph, id);
215216
this->hide_internals(reduced);
216-
assert(!reduced.data.empty());
217+
INVARIANT(!reduced.data.empty(), "reduced must not be empty");
217218
return print_name(reduced, model);
218219
}
219220
else

src/util/numbering.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Author: Daniel Kroening, [email protected]
1515
#include <unordered_map>
1616
#include <vector>
1717

18+
#include <util/invariant.h>
1819

1920
template <typename T>
2021
// NOLINTNEXTLINE(readability/identifiers)
@@ -48,7 +49,7 @@ class numbering final
4849
if(result.second) // inserted?
4950
{
5051
data.push_back(a);
51-
assert(data.size()==numbers.size());
52+
INVARIANT(data.size()==numbers.size(), "vector sizes must match");
5253
}
5354

5455
return (result.first)->second;

src/util/union_find.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class union_find final
238238
if(n>=uuf.size())
239239
uuf.resize(numbers.size());
240240

241-
assert(uuf.size()==numbers.size());
241+
INVARIANT(uuf.size()==numbers.size(), "container sizes must match");
242242

243243
return n;
244244
}

0 commit comments

Comments
 (0)