Skip to content

Commit 0a30db8

Browse files
author
Daniel Kroening
authored
Merge pull request #554 from rjmunro/feature/lint-fixes
cpplint fixes
2 parents 4cfcb87 + addc5ee commit 0a30db8

File tree

295 files changed

+1801
-1801
lines changed

Some content is hidden

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

295 files changed

+1801
-1801
lines changed

regression/cpp-from-CVS/Assignment1/main.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@ struct A { int i;};
22

33
struct B
44
{
5-
int i;
6-
B& operator = (const B& b)
7-
{
8-
i = b.i;
9-
return *this;
10-
}
5+
int i;
6+
B& operator = (const B& b)
7+
{
8+
i = b.i;
9+
return *this;
10+
}
1111
};
1212

1313
A funcA()
1414
{
15-
A a;
16-
a.i = 10;
17-
return a;
15+
A a;
16+
a.i = 10;
17+
return a;
1818
}
1919

2020

2121
B funcB()
2222
{
23-
B b;
24-
b.i = 10;
25-
return b;
23+
B b;
24+
b.i = 10;
25+
return b;
2626
}
2727

2828
int main()
2929
{
30-
A a;
31-
a.i = 20;
32-
assert((funcA() = a).i == 20); // legal
30+
A a;
31+
a.i = 20;
32+
assert((funcA() = a).i == 20); // legal
3333

34-
B b;
35-
b.i = 20;
36-
assert((funcB() = b).i == 20); // legal
34+
B b;
35+
b.i = 20;
36+
assert((funcB() = b).i == 20); // legal
3737
}

regression/cpp-from-CVS/Comma_Operator1/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ int main()
22
{
33
int s=0;
44
int t=0;
5-
t=(s=3,s+2);
5+
t=(s=3, s+2);
66
assert(s==3);
77
assert(t==5);
88
}

regression/cpp-from-CVS/ConditionalExpression2/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ char b[2];
33

44
int main()
55
{
6-
char* c = true ? a : b;
7-
assert(*c == a[0]);
8-
return 0;
6+
char* c = true ? a : b;
7+
assert(*c == a[0]);
8+
return 0;
99
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
class A
22
{
3-
public:
4-
int a;
5-
A(int a):a(a){}
3+
public:
4+
int a;
5+
A(int a):a(a){}
66
};
77

88

99
A f()
1010
{
11-
return A(0);
11+
return A(0);
1212
}
1313

14-
int main(){}
14+
int main() {}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
struct A
22
{
3-
A(){};
3+
A(){};
44
};
55

66
int main()
77
{
8-
A a;
9-
a.A();
8+
A a;
9+
a.A();
1010
}
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
struct A
22
{
3-
int i;
4-
A():i(10){}
5-
private:
6-
A(const A& a); // disabled
3+
int i;
4+
A():i(10) {}
5+
private:
6+
A(const A& a); // disabled
77
};
88

99

1010
class B: A {
11-
public:
12-
B(){};
13-
int get_i(){return i;}
14-
private:
15-
B(B& b); // disabled
11+
public:
12+
B(){};
13+
int get_i() {return i;}
14+
private:
15+
B(B& b); // disabled
1616
};
1717

1818
int main()
1919
{
20-
B b;
21-
assert(b.get_i() == 10);
20+
B b;
21+
assert(b.get_i() == 10);
2222
}
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
int g;
22
class A {
3-
public:
4-
A(int i){g=i;};
5-
private:
6-
A();
3+
public:
4+
A(int i){g=i;};
5+
private:
6+
A();
77
};
88

99
class B: A {
10-
public:
11-
typedef A base_type;
12-
typedef B this_type;
13-
B():base_type(10){}
14-
B(const this_type& b): A(20) {g++;}
10+
public:
11+
typedef A base_type;
12+
typedef B this_type;
13+
B():base_type(10) {}
14+
B(const this_type& b): A(20) {g++;}
1515
};
1616

1717
class C: B
1818
{
19-
typedef B base_type;
20-
typedef C this_type;
21-
public:
22-
C(): base_type(){}
23-
C(const base_type& b): base_type(b){g++;}
19+
typedef B base_type;
20+
typedef C this_type;
21+
public:
22+
C(): base_type() {}
23+
C(const base_type& b): base_type(b){g++;}
2424
};
2525

2626

2727
C c;
2828

2929
int main()
3030
{
31-
assert(g==10);
32-
B b;
33-
C c2 = b;
34-
assert(g==22);
31+
assert(g==10);
32+
B b;
33+
C c2 = b;
34+
assert(g==22);
3535
}

regression/cpp-from-CVS/Constructor14/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
struct A
22
{
3-
A(int i):i(i){}
3+
A(int i):i(i) {}
44
int i;
55
};
66

regression/cpp-from-CVS/Constructor16/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ class B: public A
1515

1616
int main()
1717
{
18-
B b1,b2;
18+
B b1, b2;
1919
b1 = b2; // not ok
2020
}

regression/cpp-from-CVS/Constructor17/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class C
22
{
33
public:
4-
C(int& v):v(v){};
4+
C(int& v):v(v) {}
55
int v;
66
};
77

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
struct A {};
22

33
struct B {
4-
explicit B(A&){}
4+
explicit B(A&){}
55
};
66

7-
void test(const B& b){};
7+
void test(const B& b) {}
88

99
int main()
1010
{
11-
A a;
12-
test(a); // conversion error
11+
A a;
12+
test(a); // conversion error
1313
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
char* func(){return (void*)0; }
1+
char* func() {return (void*)0; }
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
int main()
22
{
3-
char c = 'c';
4-
int& i = c; // ill-formed
5-
i++;
3+
char c = 'c';
4+
int& i = c; // ill-formed
5+
i++;
66
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
int main()
22
{
3-
const char c = 'c';
4-
const int &i = c;
5-
assert(i == 'c');
3+
const char c = 'c';
4+
const int &i = c;
5+
assert(i == 'c');
66
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
int main()
22
{
3-
unsigned i = 1;
4-
unsigned j;
5-
j = i + 1;
6-
assert(j==2);
3+
unsigned i = 1;
4+
unsigned j;
5+
j = i + 1;
6+
assert(j==2);
77
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
struct A
22
{
3-
int i;
3+
int i;
44
};
55

66
struct B: public A {
7-
int j;
7+
int j;
88
};
99

1010
int func(A a)
1111
{
12-
return a.i;
12+
return a.i;
1313
}
1414

1515
int main()
1616
{
17-
B b;
18-
b.i = 1;
17+
B b;
18+
b.i = 1;
1919

20-
assert((* ((A*)&b)).i == 1); // This works fine.
20+
assert((* ((A*)&b)).i == 1); // This works fine.
2121

22-
int bi = func( * ((A*)&b)); // Satabs Ok.
23-
// cbmc error
24-
assert(bi == 1);
22+
int bi = func( * ((A*)&b)); // Satabs Ok.
23+
// cbmc error
24+
assert(bi == 1);
2525
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
struct A{
2-
int i;
2+
int i;
33
};
44

55
struct B: public A{
66
};
77

88
int main()
99
{
10-
B b;
11-
b.i=4;
10+
B b;
11+
b.i=4;
1212

13-
A(b).i++; // Not a lvalue?
14-
assert(b.i==4);
13+
A(b).i++; // Not a lvalue?
14+
assert(b.i==4);
1515
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
int main() {
2-
const char c[1] = {'c'};
3-
char* pc;
4-
const char** pcc = &pc; //1: not allowed
5-
*pcc = &c;
6-
*pc = 'C'; //2: modifies a const object
7-
assert(c[0]=='c');
2+
const char c[1] = {'c'};
3+
char* pc;
4+
const char** pcc = &pc; // 1: not allowed
5+
*pcc = &c;
6+
*pc = 'C'; // 2: modifies a const object
7+
assert(c[0]=='c');
88
}

regression/cpp-from-CVS/Conversion9/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ struct B: A {};
66

77
int main()
88
{
9-
A a = B();
9+
A a = B();
1010
}

regression/cpp-from-CVS/Conversion_Operator1/main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
struct Char {
2-
char c;
3-
Char(char c):c(c){}
2+
char c;
3+
Char(char c):c(c){}
44
};
55

66
struct Int {
7-
int i;
8-
operator int& ();
9-
Int(int i):i(i){}
7+
int i;
8+
operator int& ();
9+
Int(int i):i(i){}
1010
};
1111

12-
Int::operator int&(){return i;}
12+
Int::operator int&() {return i;}
1313

1414
int main()
1515
{

0 commit comments

Comments
 (0)