diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2022-07-25 18:14:33 +0200 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2022-09-02 21:32:46 +0200 |
commit | 0a8a9f8f634306bbfaed8f924d71536f1ff50677 (patch) | |
tree | 1153e9636ce0fd20480b79a819f20b0f85acffde /util/check-format-test-positives.c | |
parent | 521f07eb08cc267001ecb4be67d46ea79dbb62b1 (diff) | |
download | openssl-new-0a8a9f8f634306bbfaed8f924d71536f1ff50677.tar.gz |
check-format.pl: further fixes for whitespace reporting within 'for (...)'
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/18812)
Diffstat (limited to 'util/check-format-test-positives.c')
-rw-r--r-- | util/check-format-test-positives.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/util/check-format-test-positives.c b/util/check-format-test-positives.c index bf750930ac..ed7ddd46b0 100644 --- a/util/check-format-test-positives.c +++ b/util/check-format-test-positives.c @@ -29,8 +29,8 @@ /*@ whitespace at EOL: */ // /*@ end-of-line comment style not allowed (for C90 compatibility) */ /*@0 intra-line comment indent off by 1, reported unless sloppy-cmt */ -/*X */ /*@2 no space nor '*' after comment start, reported unless sloppy-spc */ -/* X*/ /*@ no space before comment end , reported unless sloppy-spc */ +/*X */ /*@2 missing spc or '*' after comment start reported unless sloppy-spc */ +/* X*/ /*@ missing space before comment end , reported unless sloppy-spc */ /*@ comment starting delimiter: /* inside intra-line comment */ /*@0 *@ above multi-line comment start indent off by 1, reported unless sloppy-cmt; this comment line is too long @@ -67,7 +67,9 @@ typedef struct { /*@0 extra space in code, reported unless sloppy-spc */ } s_type; /*@ statement/type declaration indent off by 4 */ int* somefunc(); /*@ no space before '*' in type decl, r unless sloppy-spc */ void main(int n) { /*@ opening brace at end of function definition header */ - for (;;n++) { /*@ no space after ';', reported unless sloppy-spc */ + for (; ; ) ; /*@ space before ')', reported unless sloppy-spc */ + for ( ; x; y) ; /*@2 space after '(' and before ';', unless sloppy-spc */ + for (;;n++) { /*@ missing space after ';', reported unless sloppy-spc */ return; /*@0 (1-line) single statement in braces */ }} /*@2 code after '}' outside expr */ } /*@ unexpected closing brace (too many '}') outside expr */ @@ -102,13 +104,13 @@ int f (int a, /*@ space after fn before '(', reported unless sloppy-spc */ # define MAC(A) (A) /*@ nesting indent of preprocessor directive off by 1 */ ? 1 /*@ hanging expr indent off by 1 */ : 2); /*@ hanging expr indent off by 2, or 1 for leading ':' */ - if(a /*@ no space after 'if', reported unless sloppy-spc */ + if(a /*@ missing space after 'if', reported unless sloppy-spc */ /*@0 intra-line comment indent off by -1 (not: by 3 due to '&&') */ && ! 0 /*@2 space after '!', reported unless sloppy-spc */ || b == /*@ hanging expr indent off by 2, or -2 for leading '||' */ - (xx+= 2) + /*@ no space before '+=', reported unless sloppy-spc */ - (a^ 1) + /*@ no space before '^', reported unless sloppy-spc */ - a %2 / /*@ no space after '%', reported unless sloppy-spc */ + (xx+= 2) + /*@ missing space before '+=', reported unless sloppy-spc */ + (a^ 1) + /*@ missing space before '^', reported unless sloppy-spc */ + a %2 / /*@ missing space after '%', reported unless sloppy-spc */ 1 +/* */ /*@ no space before comment, reported unless sloppy-spc */ /* */+ /*@ no space after comment, reported unless sloppy-spc */ s. e_member) /*@ space after '.', reported unless sloppy-spc */ @@ -117,7 +119,7 @@ int f (int a, /*@ space after fn before '(', reported unless sloppy-spc */ if (a ++) /*@ space before postfix '++', reported unless sloppy-spc */ { /*@ {' not on same line as preceding 'if' */ c; /*@0 single stmt in braces, reported on 1-stmt */ - } else /*@ no '{' on same line after '} else' */ + } else /*@ missing '{' on same line after '} else' */ { /*@ statement indent off by 2 */ d; /*@0 single stmt in braces, reported on 1-stmt */ } /*@ statement indent off by 6 */ @@ -127,18 +129,18 @@ int f (int a, /*@ space after fn before '(', reported unless sloppy-spc */ while ( 2); /*@ space after '(', reported unless sloppy-spc */ b; c; /*@ more than one statement per line */ outer: /*@ outer label special indent off by 1 */ - do{ /*@ no space before '{', reported unless sloppy-spc */ + do{ /*@ missing space before '{', reported unless sloppy-spc */ inner: /*@ inner label normal indent off by 1 */ f (3, /*@ space after fn before '(', reported unless sloppy-spc */ 4); /*@0 false negative: should report single stmt in braces */ } /*@0 'while' not on same line as preceding '}' */ - while (a+ 0); /*@2 no space before '+', reported unless sloppy-spc */ + while (a+ 0); /*@2 missing space before '+', reported unless sloppy-spc */ switch (b ) { /*@ space before ')', reported unless sloppy-spc */ case 1: /*@ 'case' special statement indent off by -1 */ - case(2): /*@ no space after 'case', reported unless sloppy-spc */ + case(2): /*@ missing space after 'case', reported unless sloppy-spc */ default: ; /*@ code after 'default:' */ } /*@ statement indent off by -4 */ - return( /*@ no space after 'return', reported unless sloppy-spc */ + return( /*@ missing space after 'return', reported unless sloppy-spc */ x); } /*@ code before block-level '}' */ /* Here the tool should stop complaining apart from the below issues at EOF */ |