• Home
  • Raw
  • Download

Lines Matching +full:missing +full:- +full:braces

2  * Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.
3 * Copyright Siemens AG 2015-2022
12 * This demonstrates/tests cases where check-format.pl should report issues.
14 * delimiters and parenthesis-like symbols, e.g., on unexpected/unclosed braces.
18 * The '@'s after '*' are used for self-tests: they mark lines containing
26 /*@ intra-line carriage return character:
28 /*@ non-printable ASCII character:  */
29 /*@ non-ASCII character: ä */
31 // /*@ end-of-line comment style not allowed (for C90 compatibility) */
32 /*@0 intra-line comment indent off by 1, reported unless sloppy-cmt */
33 /*X */ /*@2 missing spc or '*' after comment start reported unless sloppy-spc */
34 /* X*/ /*@ missing space before comment end , reported unless sloppy-spc */
35 /*@ comment starting delimiter: /* inside intra-line comment */
37 …*@ above multi-line comment start indent off by 1, reported unless sloppy-cmt; this comment line i…
38 *@ multi-line comment indent further off by 1 relative to comment start
39 *@ multi-line comment ending with text on last line */
40 /*@2 multi-line comment starting with text on first line
41 *@ comment starting delimiter: /* inside multi-line comment
42 *@ multi-line comment indent off by -1
43 *X*@ no spc after leading '*' in multi-line comment, reported unless sloppy-spc
47 */ /*@ multi-line comment end indent off by -1 (relative to comment start) */
49 /*- '-' for formatted comment not allowed in intra-line comment */
50 /*@ comment line is 4 columns tooooooooooooooooo wide, reported unless sloppy-len */
54 #define X (1 + 1) /*@0 extra space in body, reported unless sloppy-spc */
55 #define Y 1 /*@ extra space before body, reported unless sloppy-spc */ \
56 #define Z /*@2 preprocessor directive within multi-line directive */
57 typedef struct { /*@0 extra space in code, reported unless sloppy-spc */
58 enum { /*@1 extra space in intra-line comment, no more reported */
60 && 1, /*@ hanging expr indent off by 3, or -1 for leading '&&' */
61 x = 1, /*@ hanging expr indent off by -1 */
62 y,z /*@ no space after ',', reported unless sloppy-spc */
63 } e_member ; /*@ space before ';', reported unless sloppy-spc */
65 union { /*@ statement/type declaration indent off by -1 */
66 struct{} s; /*@ no space before '{', reported unless sloppy-spc */
67 }u_member; /*@ no space after '}', reported unless sloppy-spc */
69 int* somefunc(); /*@ no space before '*' in type decl, r unless sloppy-spc */
71 for (; ; ) ; /*@ space before ')', reported unless sloppy-spc */
72 for ( ; x; y) ; /*@2 space after '(' and before ';', unless sloppy-spc */
73 for (;;n++) { /*@ missing space after ';', reported unless sloppy-spc */
74 return; /*@0 (1-line) single statement in braces */
79 int f (int a, /*@ space after fn before '(', reported unless sloppy-spc */
80 int b, /*@ hanging expr indent off by -1 */
81 long I) /*@ single-letter name 'I' */
85 a] - /*@ unexpected closing bracket */
89 1* 1, /*@ no space etc. before '*', reported unless sloppy-spc */
95 s_type s; /*@2 local variable declaration indent off by -1 */
96 t_type t; /*@ local variable declaration indent again off by -1 */
97 /* */ /*@0 missing blank line after local decls */
98 somefunc(a, /*@2 statement indent off by -1 */
99 "aligned" /*@ expr indent off by -2 accepted if sloppy-hang */ "right"
100 , b, /*@ expr indent off by -1 */
101 b, /*@ expr indent as on line above, accepted if sloppy-hang */
102 b, /*@ expr indent off -8 but @ extra indent accepted if sloppy-hang */
103 "again aligned" /*@ expr indent off by -9 (left of stmt indent, */ "right",
104 abc == /*@ .. so reported also with sloppy-hang; this line is too long */ 456
108 if(a /*@ missing space after 'if', reported unless sloppy-spc */
109 /*@0 intra-line comment indent off by -1 (not: by 3 due to '&&') */
110 && ! 0 /*@2 space after '!', reported unless sloppy-spc */
111 || b == /*@ hanging expr indent off by 2, or -2 for leading '||' */
112 (x<<= 1) + /*@ missing space before '<<=' reported unless sloppy-spc */
113 (xx+= 2) + /*@ missing space before '+=', reported unless sloppy-spc */
114 (a^ 1) + /*@ missing space before '^', reported unless sloppy-spc */
115 (y *=z) + /*@ missing space after '*=' reported unless sloppy-spc */
116 a %2 / /*@ missing space after '%', reported unless sloppy-spc */
117 1 +/* */ /*@ no space before comment, reported unless sloppy-spc */
118 /* */+ /*@ no space after comment, reported unless sloppy-spc */
119 s. e_member) /*@ space after '.', reported unless sloppy-spc */
120 xx = a + b /*@ extra single-statement indent off by 1 */
121 + 0; /*@ two times extra single-statement indent off by 3 */
122 if (a ++) /*@ space before postfix '++', reported unless sloppy-spc */
124 c; /*@0 single stmt in braces, reported on 1-stmt */
125 } else /*@ missing '{' on same line after '} else' */
127 d; /*@0 single stmt in braces, reported on 1-stmt */
129 if (1) f(a, /*@ (non-brace) code after end of 'if' condition */
130 b); else /*@ (non-brace) code before 'else' */
131 do f(c, c); /*@ (non-brace) code after 'do' */
132 while ( 2); /*@ space after '(', reported unless sloppy-spc */
135 do{ /*@ missing space before '{', reported unless sloppy-spc */
137 f (3, /*@ space after fn before '(', reported unless sloppy-spc */
138 4); /*@0 false negative: should report single stmt in braces */
140 while (a+ 0); /*@2 missing space before '+', reported unless sloppy-spc */
141 switch (b ) { /*@ space before ')', reported unless sloppy-spc */
142 case 1: /*@ 'case' special statement indent off by -1 */
143 case(2): /*@ missing space after 'case', reported unless sloppy-spc */
145 } /*@ statement indent off by -4 */
146 return( /*@ missing space after 'return', reported unless sloppy-spc */
147 x); } /*@ code before block-level '}' */
352 ; /*@ 2 essentially blank lines before, if !sloppy-spc */
358 etyp /*@0 blank line follows just before EOF, if !sloppy-spc: */