File tree Expand file tree Collapse file tree 11 files changed +227
-43
lines changed Expand file tree Collapse file tree 11 files changed +227
-43
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ Whitespaces:
17
17
Exceptions: Spaces around &&, || and <<
18
18
- Space after comma (parameter lists, argument lists, ...)
19
19
- Space after colon inside 'for'
20
+ - For pointers and references, the */& should be attached to the variable name
21
+ as oppposed to the tyep. E.g. for a pointer to an int the syntax would be:
22
+ `int *x;`
20
23
- No whitespaces at end of line
21
24
- No whitespaces in blank lines
22
25
- Put argument lists on next line (and ident 2 spaces) if too long
Original file line number Diff line number Diff line change @@ -8,3 +8,36 @@ Author: Thomas Kiley, thomas@diffblue.com
8
8
9
9
class temp_classt : public base_classt
10
10
{}
11
+
12
+ class another_class : public base_classt
13
+ {}
14
+
15
+ class more_class :public base_classt
16
+ {}
17
+
18
+ class nonderived
19
+ {}
20
+
21
+ class nonderivedt
22
+ {}
23
+
24
+ #define ID_property_class dstring (23 , 0 )
25
+
26
+ int foo(class define );
27
+
28
+ int foo (class definet );
29
+
30
+ template <class U >
31
+ void bar (U t);
32
+
33
+ template <class U >
34
+ void bar (U t);
35
+
36
+ template < class U >
37
+ void bar (U t);
38
+
39
+ class testt
40
+ {
41
+ template <class U >
42
+ void bar (U t);
43
+ }
Original file line number Diff line number Diff line change 2
2
main.cpp
3
3
4
4
^main\.cpp:9: There shouldn.t be a space between class identifier and : \[readability/identifiers\] \[4\]$
5
- ^Total errors found: 1$
5
+ ^main\.cpp:12: There shouldn.t be a space between class identifier and : \[readability/identifiers\] \[4\]$
6
+ ^main\.cpp:12: Class or struct identifier should end with t \[readability/identifiers\] \[4\]$
7
+ ^main\.cpp:15: Class or struct identifier should end with t \[readability/identifiers\] \[4\]$
8
+ ^main\.cpp:18: Class or struct identifier should end with t \[readability/identifiers\] \[4\]$
9
+ ^main\.cpp:26: Class or struct identifier should end with t \[readability/identifiers\] \[4\]$
10
+ ^main\.cpp:30: Remove spaces around < \[whitespace/operators\] \[4\]$
11
+ ^main\.cpp:36: Remove spaces around < \[whitespace/operators\] \[4\]$
12
+ ^Total errors found: 8$
6
13
^SIGNAL=0$
7
14
--
Original file line number Diff line number Diff line change @@ -24,8 +24,11 @@ static void fun()
24
24
25
25
int x = 1 <<4 ;
26
26
27
+ // Ideally this should produce an error, see operator-spacing3
27
28
status ()<<" Adding CPROVER library (" <<eom;
28
29
29
30
// Ideally this should produce an error, see operator-spacing3
30
31
int x = 1 << 4 ;
32
+
33
+ int y = a<<b;
31
34
}
Original file line number Diff line number Diff line change 1
1
CORE
2
2
main.cpp
3
3
4
- ^main\.cpp:27: Missing spaces around << \[whitespace/operators\] \[3\]
5
- ^Total errors found: 1 $
4
+ ^Total errors found: 0$
5
+ ^EXIT=0 $
6
6
^SIGNAL=0$
7
7
--
Original file line number Diff line number Diff line change @@ -27,4 +27,6 @@ static void fun()
27
27
status ()<<" Adding CPROVER library (" <<eom;
28
28
29
29
int x = 1 << 4 ;
30
+
31
+ result=((result<<1 )^it->hash ())-result;
30
32
}
Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: Lint Examples
4
+
5
+ Author: Thomas Kiley, thomas@diffblue.com
6
+
7
+ \*******************************************************************/
8
+
9
+ /* ******************************************************************\
10
+
11
+ Function: fun
12
+
13
+ Inputs:
14
+
15
+ Outputs:
16
+
17
+ Purpose:
18
+
19
+ \*******************************************************************/
20
+
21
+ static void fun ()
22
+ {
23
+ bool *x=nullptr ; // Valid
24
+ bool * x=nullptr ; // Invalid
25
+
26
+ int &x=nullptr ; // Valid
27
+ int & x=nullptr ; // Invalid
28
+
29
+ int y=at*bt; // Valid
30
+
31
+ // Probably valid - could be a pointer to type yt or a
32
+ // variable called yt multilied by z. Would have to know
33
+ // it is a function call rather than a function declaration
34
+ foo (
35
+ x,
36
+ yt*z);
37
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.cpp
3
+
4
+ ^main\.cpp:24: Pointer type name must have \* attached to the type name \[whitespace/operators\] \[4\]$
5
+ ^main\.cpp:27: Reference type name must have & attached to the type name \[whitespace/operators\] \[4\]$
6
+ ^Total errors found: 2$
7
+ ^SIGNAL=0$
8
+ --
Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: Lint Examples
4
+
5
+ Author: Thomas Kiley, thomas@diffblue.com
6
+
7
+ \*******************************************************************/
8
+
9
+ /* ******************************************************************\
10
+
11
+ Function: fun
12
+
13
+ Inputs:
14
+
15
+ Outputs:
16
+
17
+ Purpose:
18
+
19
+ \*******************************************************************/
20
+
21
+ static void fun ()
22
+ {
23
+ bar (struct mystructt & struct_var);
24
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.cpp
3
+
4
+
5
+ ^Total errors found: 0$
6
+ ^EXIT=0$
7
+ ^SIGNAL=0$
8
+ --
You can’t perform that action at this time.
0 commit comments