Skip to content

Commit 16c8bc8

Browse files
committed
Fixing CPPLINTer/cnang-formater issues.
1 parent 0624b69 commit 16c8bc8

28 files changed

+194
-178
lines changed

regression/cbmc-with-incr/Malloc17/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ unsigned char* init1()
44
if (size!=1) return 0;
55

66
assert(sizeof(unsigned char)==1);
7-
unsigned char* buffer=__CPROVER_allocate(1, 0);
7+
unsigned char *buffer = __CPROVER_allocate(1, 0);
88
assert(buffer!=0);
99

1010
buffer[0]=0;
@@ -18,7 +18,7 @@ unsigned char* init2()
1818
if (size!=1) return 0;
1919

2020
assert(sizeof(unsigned char)==1);
21-
unsigned char* buffer=__CPROVER_allocate(1*sizeof(unsigned char), 0);
21+
unsigned char *buffer = __CPROVER_allocate(1 * sizeof(unsigned char), 0);
2222
assert(buffer!=0);
2323

2424
buffer[0]=0;
@@ -32,7 +32,7 @@ unsigned char* init3()
3232
if (size!=1) return 0;
3333

3434
assert(sizeof(unsigned char)==1);
35-
unsigned char* buffer=__CPROVER_allocate(sizeof(unsigned char)*1, 0);
35+
unsigned char *buffer = __CPROVER_allocate(sizeof(unsigned char) * 1, 0);
3636
assert(buffer!=0);
3737

3838
buffer[0]=0;

regression/cbmc-with-incr/Malloc18/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ unsigned char* init()
44
if (size!=1) return 0;
55

66
assert(sizeof(unsigned char)==1);
7-
unsigned char* buffer=__CPROVER_allocate(size, 0);
7+
unsigned char *buffer = __CPROVER_allocate(size, 0);
88
assert(buffer!=0);
99

1010
buffer[0]=0;

regression/cbmc/Calloc1/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
int main()
55
{
6-
int *x=calloc(sizeof(int), 1);
7-
assert(*x==0);
6+
int *x = calloc(sizeof(int), 1);
7+
assert(*x == 0);
88
return 0;
99
}

regression/cbmc/Malloc17/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ unsigned char* init1()
44
if (size!=1) return 0;
55

66
assert(sizeof(unsigned char)==1);
7-
unsigned char* buffer=__CPROVER_allocate(1, 0);
7+
unsigned char *buffer = __CPROVER_allocate(1, 0);
88
assert(buffer!=0);
99

1010
buffer[0]=0;
@@ -18,7 +18,7 @@ unsigned char* init2()
1818
if (size!=1) return 0;
1919

2020
assert(sizeof(unsigned char)==1);
21-
unsigned char* buffer=__CPROVER_allocate(1*sizeof(unsigned char), 0);
21+
unsigned char *buffer = __CPROVER_allocate(1 * sizeof(unsigned char), 0);
2222
assert(buffer!=0);
2323

2424
buffer[0]=0;
@@ -32,7 +32,7 @@ unsigned char* init3()
3232
if (size!=1) return 0;
3333

3434
assert(sizeof(unsigned char)==1);
35-
unsigned char* buffer=__CPROVER_allocate(sizeof(unsigned char)*1, 0);
35+
unsigned char *buffer = __CPROVER_allocate(sizeof(unsigned char) * 1, 0);
3636
assert(buffer!=0);
3737

3838
buffer[0]=0;

regression/cbmc/Malloc18/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ unsigned char* init()
33
unsigned long buffer_size;
44
if(buffer_size!=1) return 0;
55

6-
unsigned char* buffer=__CPROVER_allocate(buffer_size, 0);
6+
unsigned char *buffer = __CPROVER_allocate(buffer_size, 0);
77
__CPROVER_assert(buffer!=0, "malloc did not return NULL");
88

99
buffer[0]=10;

regression/cbmc/Malloc24/main.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
struct node
44
{
5-
int value;
6-
struct node *next;
5+
int value;
6+
struct node *next;
77
};
88

99
struct list
@@ -12,7 +12,7 @@ struct list
1212
struct node *head;
1313
};
1414

15-
void removeLast(struct list * l)
15+
void removeLast(struct list *l)
1616
{
1717
int index = l->size - 1;
1818
struct node **current;
@@ -22,16 +22,17 @@ void removeLast(struct list * l)
2222
l->size--;
2323
}
2424

25-
int main () {
25+
int main()
26+
{
2627
//build a 2-nodes list
2728
struct node *n0 = malloc(sizeof(struct node));
2829
struct node *n1 = malloc(sizeof(struct node));
2930
struct list *l = malloc(sizeof(struct list));
3031
l->size = 2;
3132
l->head = n0;
3233

33-
n0->next=n1;
34-
n1->next=NULL;
34+
n0->next = n1;
35+
n1->next = NULL;
3536

3637
//remove last node from list
3738

@@ -43,5 +44,5 @@ int main () {
4344
//this doesn't
4445
removeLast(l);
4546

46-
__CPROVER_assert(n0->next == NULL , "not NULL");
47+
__CPROVER_assert(n0->next == NULL, "not NULL");
4748
}

src/analyses/constant_propagator.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,12 @@ bool constant_propagator_domaint::valuest::is_constant(const exprt &expr) const
276276
to_side_effect_expr(expr).get_statement()==ID_nondet)
277277
return false;
278278

279-
if(expr.id()==ID_side_effect &&
280-
to_side_effect_expr(expr).get_statement()==ID_allocate)
279+
if(
280+
expr.id() == ID_side_effect &&
281+
to_side_effect_expr(expr).get_statement() == ID_allocate)
282+
{
281283
return false;
284+
}
282285

283286
if(expr.id()==ID_symbol)
284287
if(replace_const.expr_map.find(to_symbol_expr(expr).get_identifier())==

src/analyses/goto_check.cpp

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Author: Daniel Kroening, [email protected]
2727
#include <util/pointer_predicates.h>
2828
#include <util/cprover_prefix.h>
2929
#include <util/options.h>
30+
#include <util/invariant.h>
3031

3132
#include "local_bitvector_analysis.h"
3233

@@ -1658,24 +1659,23 @@ void goto_checkt::goto_check(
16581659
{
16591660
if(enable_pointer_check)
16601661
{
1661-
assert(i.code.operands().size()==1);
1662+
INVARIANT(i.code.operands().size() == 1, "The num-operands must be 1.");
16621663
const symbol_exprt &variable=to_symbol_expr(i.code.op0());
16631664

16641665
// is it dirty?
16651666
if(local_bitvector_analysis->dirty(variable))
16661667
{
16671668
// need to mark the dead variable as dead
16681669
goto_programt::targett t=new_code.add_instruction(ASSIGN);
1669-
exprt address_of_expr=address_of_exprt(variable);
1670+
exprt address_of_expr = address_of_exprt(variable);
16701671
exprt lhs=ns.lookup(CPROVER_PREFIX "dead_object").symbol_expr();
16711672
if(!base_type_eq(lhs.type(), address_of_expr.type(), ns))
16721673
address_of_expr.make_typecast(lhs.type());
1673-
exprt rhs=
1674-
if_exprt(
1675-
side_effect_expr_nondett(bool_typet()),
1676-
address_of_expr,
1677-
lhs,
1678-
lhs.type());
1674+
exprt rhs = if_exprt(
1675+
side_effect_expr_nondett(bool_typet()),
1676+
address_of_expr,
1677+
lhs,
1678+
lhs.type());
16791679
t->source_location=i.source_location;
16801680
t->code=code_assignt(lhs, rhs);
16811681
t->code.add_source_location()=i.source_location;
@@ -1686,27 +1686,26 @@ void goto_checkt::goto_check(
16861686
{
16871687
if(enable_pointer_check)
16881688
{
1689-
assert(i.code.operands().size()==1);
1690-
const symbol_exprt &variable=to_symbol_expr(i.code.op0());
1689+
INVARIANT(i.code.operands().size() == 1, "There must be 1 operand.");
1690+
const symbol_exprt &variable = to_symbol_expr(i.code.op0());
16911691

16921692
// is it dirty?
16931693
if(local_bitvector_analysis->dirty(variable))
16941694
{
16951695
// reset the dead marker
1696-
goto_programt::targett t=new_code.add_instruction(ASSIGN);
1697-
exprt address_of_expr=address_of_exprt(variable);
1698-
exprt lhs=ns.lookup(CPROVER_PREFIX "dead_object").symbol_expr();
1696+
goto_programt::targett t = new_code.add_instruction(ASSIGN);
1697+
exprt address_of_expr = address_of_exprt(variable);
1698+
exprt lhs = ns.lookup(CPROVER_PREFIX "dead_object").symbol_expr();
16991699
if(!base_type_eq(lhs.type(), address_of_expr.type(), ns))
17001700
address_of_expr.make_typecast(lhs.type());
1701-
exprt rhs=
1702-
if_exprt(
1703-
equal_exprt(lhs, address_of_expr),
1704-
null_pointer_exprt(to_pointer_type(address_of_expr.type())),
1705-
lhs,
1706-
lhs.type());
1707-
t->source_location=i.source_location;
1708-
t->code=code_assignt(lhs, rhs);
1709-
t->code.add_source_location()=i.source_location;
1701+
exprt rhs = if_exprt(
1702+
equal_exprt(lhs, address_of_expr),
1703+
null_pointer_exprt(to_pointer_type(address_of_expr.type())),
1704+
lhs,
1705+
lhs.type());
1706+
t->source_location = i.source_location;
1707+
t->code = code_assignt(lhs, rhs);
1708+
t->code.add_source_location() = i.source_location;
17101709
}
17111710
}
17121711
}

src/analyses/local_bitvector_analysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ local_bitvector_analysist::flagst local_bitvector_analysist::get_rec(
232232
const side_effect_exprt &side_effect_expr=to_side_effect_expr(rhs);
233233
const irep_idt &statement=side_effect_expr.get_statement();
234234

235-
if(statement==ID_allocate)
235+
if(statement == ID_allocate)
236236
return flagst::mk_dynamic_heap();
237237
else
238238
return flagst::mk_unknown();

src/analyses/local_may_alias.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void local_may_aliast::get_rec(
298298
const side_effect_exprt &side_effect_expr=to_side_effect_expr(rhs);
299299
const irep_idt &statement=side_effect_expr.get_statement();
300300

301-
if(statement==ID_allocate)
301+
if(statement == ID_allocate)
302302
{
303303
dest.insert(objects.number(exprt(ID_dynamic_object)));
304304
}

0 commit comments

Comments
 (0)