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:
1717 Exceptions: Spaces around &&, || and <<
1818- Space after comma (parameter lists, argument lists, ...)
1919- 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;`
2023- No whitespaces at end of line
2124- No whitespaces in blank lines
2225- 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
88
99class temp_classt : public base_classt
1010{}
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 22main.cpp
33
44^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$
613^SIGNAL=0$
714--
Original file line number Diff line number Diff line change @@ -24,8 +24,11 @@ static void fun()
2424
2525 int x = 1 <<4 ;
2626
27+ // Ideally this should produce an error, see operator-spacing3
2728 status ()<<" Adding CPROVER library (" <<eom;
2829
2930 // Ideally this should produce an error, see operator-spacing3
3031 int x = 1 << 4 ;
32+
33+ int y = a<<b;
3134}
Original file line number Diff line number Diff line change 11CORE
22main.cpp
33
4- ^main\.cpp:27: Missing spaces around << \[whitespace/operators\] \[3\]
5- ^Total errors found: 1 $
4+ ^Total errors found: 0$
5+ ^EXIT=0 $
66^SIGNAL=0$
77--
Original file line number Diff line number Diff line change @@ -27,4 +27,6 @@ static void fun()
2727 status ()<<" Adding CPROVER library (" <<eom;
2828
2929 int x = 1 << 4 ;
30+
31+ result=((result<<1 )^it->hash ())-result;
3032}
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