Skip to content

Commit 247f81a

Browse files
committed
Use std::size_t when referring to object size
1 parent 1895375 commit 247f81a

File tree

80 files changed

+344
-346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+344
-346
lines changed

jbmc/src/java_bytecode/java_bmc_util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ void java_setup_symex(
2929
symex.add_loop_unwind_handler(
3030
[&goto_model](
3131
const call_stackt &context,
32-
unsigned loop_num,
33-
unsigned unwind,
34-
unsigned &max_unwind)
32+
std::size_t loop_num,
33+
std::size_t unwind,
34+
std::size_t &max_unwind)
3535
{ // NOLINT (*)
3636
return java_enum_static_init_unwind_handler(
3737
context, loop_num, unwind, max_unwind, goto_model.get_symbol_table());

jbmc/src/java_bytecode/java_enum_static_init_unwind_handler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ static irep_idt find_enum_function_on_stack(const call_stackt &context)
6969
/// otherwise.
7070
tvt java_enum_static_init_unwind_handler(
7171
const call_stackt &context,
72-
unsigned loop_number,
73-
unsigned unwind_count,
74-
unsigned &unwind_max,
72+
std::size_t loop_number,
73+
std::size_t unwind_count,
74+
std::size_t &unwind_max,
7575
const symbol_tablet &symbol_table)
7676
{
7777
(void)loop_number; // unused parameter

jbmc/src/java_bytecode/java_enum_static_init_unwind_handler.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class symbol_tablet;
1919

2020
tvt java_enum_static_init_unwind_handler(
2121
const call_stackt &context,
22-
unsigned loop_number,
23-
unsigned unwind_count,
24-
unsigned &unwind_max,
22+
std::size_t loop_number,
23+
std::size_t unwind_count,
24+
std::size_t &unwind_max,
2525
const symbol_tablet &symbol_table);
2626

2727
#endif // CPROVER_JAVA_BYTECODE_JAVA_ENUM_STATIC_INIT_UNWIND_HANDLER_H

jbmc/src/java_bytecode/java_local_variable_table.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,19 +203,19 @@ static void gather_transitive_predecessors(
203203
/// slot `slotidx`
204204
static bool is_store_to_slot(
205205
const java_bytecode_convert_methodt::instructiont &inst,
206-
unsigned slotidx)
206+
std::size_t slotidx)
207207
{
208208
const std::string prevstatement = bytecode_info[inst.bytecode].mnemonic;
209209

210210
if(!(prevstatement.size()>=1 && prevstatement.substr(1, 5)=="store"))
211211
return false;
212212

213-
unsigned storeslotidx;
213+
std::size_t storeslotidx;
214214
if(inst.args.size()==1)
215215
{
216216
// Store with an argument:
217217
const auto &arg=inst.args[0];
218-
storeslotidx = numeric_cast_v<unsigned>(to_constant_expr(arg));
218+
storeslotidx = numeric_cast_v<std::size_t>(to_constant_expr(arg));
219219
}
220220
else
221221
{

src/analyses/custom_bitvector_analysis.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Author: Daniel Kroening, [email protected]
2323

2424
void custom_bitvector_domaint::set_bit(
2525
const irep_idt &identifier,
26-
unsigned bit_nr,
26+
std::size_t bit_nr,
2727
modet mode)
2828
{
2929
switch(mode)
@@ -48,7 +48,7 @@ void custom_bitvector_domaint::set_bit(
4848

4949
void custom_bitvector_domaint::set_bit(
5050
const exprt &lhs,
51-
unsigned bit_nr,
51+
std::size_t bit_nr,
5252
modet mode)
5353
{
5454
irep_idt id=object2id(lhs);
@@ -174,8 +174,7 @@ custom_bitvector_domaint::vectorst
174174
return vectorst();
175175
}
176176

177-
unsigned custom_bitvector_analysist::get_bit_nr(
178-
const exprt &string_expr)
177+
std::size_t custom_bitvector_analysist::get_bit_nr(const exprt &string_expr)
179178
{
180179
if(string_expr.id()==ID_typecast)
181180
return get_bit_nr(to_typecast_expr(string_expr).op());
@@ -327,7 +326,8 @@ void custom_bitvector_domaint::transform(
327326
{
328327
if(instruction.call_arguments().size() == 2)
329328
{
330-
unsigned bit_nr = cba.get_bit_nr(instruction.call_arguments()[1]);
329+
const std::size_t bit_nr =
330+
cba.get_bit_nr(instruction.call_arguments()[1]);
331331

332332
// initialize to make Visual Studio happy
333333
modet mode = modet::SET_MUST;
@@ -456,7 +456,7 @@ void custom_bitvector_domaint::transform(
456456
DATA_INVARIANT(
457457
code.operands().size() == 2, "set/clear_may/must has two operands");
458458

459-
unsigned bit_nr = cba.get_bit_nr(code.op1());
459+
const std::size_t bit_nr = cba.get_bit_nr(code.op1());
460460

461461
// initialize to make Visual Studio happy
462462
modet mode = modet::SET_MUST;
@@ -578,7 +578,7 @@ void custom_bitvector_domaint::output(
578578
out << bit.first << " MAY:";
579579
bit_vectort b=bit.second;
580580

581-
for(unsigned i=0; b!=0; i++, b>>=1)
581+
for(std::size_t i = 0; b != 0; i++, b >>= 1)
582582
if(b&1)
583583
{
584584
INVARIANT(i < cba.bits.size(), "inconsistent bit widths");
@@ -594,7 +594,7 @@ void custom_bitvector_domaint::output(
594594
out << bit.first << " MUST:";
595595
bit_vectort b=bit.second;
596596

597-
for(unsigned i=0; b!=0; i++, b>>=1)
597+
for(std::size_t i = 0; b != 0; i++, b >>= 1)
598598
if(b&1)
599599
{
600600
INVARIANT(i < cba.bits.size(), "inconsistent bit widths");
@@ -706,7 +706,7 @@ exprt custom_bitvector_domaint::eval(
706706
{
707707
if(src.operands().size()==2)
708708
{
709-
unsigned bit_nr =
709+
const std::size_t bit_nr =
710710
custom_bitvector_analysis.get_bit_nr(to_binary_expr(src).op1());
711711

712712
exprt pointer = to_binary_expr(src).op0();
@@ -773,7 +773,7 @@ void custom_bitvector_analysist::check(
773773
bool use_xml,
774774
std::ostream &out)
775775
{
776-
unsigned pass=0, fail=0, unknown=0;
776+
std::size_t pass = 0, fail = 0, unknown = 0;
777777

778778
for(const auto &gf_entry : goto_model.goto_functions.function_map)
779779
{

src/analyses/custom_bitvector_analysis.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,21 @@ class custom_bitvector_domaint:public ai_domain_baset
116116
private:
117117
enum class modet { SET_MUST, CLEAR_MUST, SET_MAY, CLEAR_MAY };
118118

119-
void set_bit(const exprt &, unsigned bit_nr, modet);
120-
void set_bit(const irep_idt &, unsigned bit_nr, modet);
119+
void set_bit(const exprt &, std::size_t bit_nr, modet);
120+
void set_bit(const irep_idt &, std::size_t bit_nr, modet);
121121

122-
static inline void set_bit(bit_vectort &dest, unsigned bit_nr)
122+
static inline void set_bit(bit_vectort &dest, std::size_t bit_nr)
123123
{
124124
dest|=(1ll<<bit_nr);
125125
}
126126

127-
static inline void clear_bit(bit_vectort &dest, unsigned bit_nr)
127+
static inline void clear_bit(bit_vectort &dest, std::size_t bit_nr)
128128
{
129129
dest|=(1ll<<bit_nr);
130130
dest^=(1ll<<bit_nr);
131131
}
132132

133-
static inline bool get_bit(const bit_vectort src, unsigned bit_nr)
133+
static inline bool get_bit(const bit_vectort src, std::size_t bit_nr)
134134
{
135135
return (src&(1ll<<bit_nr))!=0;
136136
}
@@ -153,7 +153,7 @@ class custom_bitvector_analysist:public ait<custom_bitvector_domaint>
153153
return operator[](loc).eval(src, *this);
154154
}
155155

156-
unsigned get_bit_nr(const exprt &);
156+
std::size_t get_bit_nr(const exprt &);
157157

158158
typedef numberingt<irep_idt> bitst;
159159
bitst bits;

src/analyses/invariant_propagation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class invariant_propagationt:public
5454

5555
inv_object_storet object_store;
5656

57-
typedef std::list<unsigned> object_listt;
57+
typedef std::list<std::size_t> object_listt;
5858

5959
void add_objects(const goto_programt &goto_program);
6060
void add_objects(const goto_functionst &goto_functions);

0 commit comments

Comments
 (0)