summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/check-format-test-negatives.c7
-rw-r--r--util/check-format-test-positives.c3
-rwxr-xr-xutil/check-format.pl2
3 files changed, 10 insertions, 2 deletions
diff --git a/util/check-format-test-negatives.c b/util/check-format-test-negatives.c
index d1de4104bc..3ce0740bc1 100644
--- a/util/check-format-test-negatives.c
+++ b/util/check-format-test-negatives.c
@@ -282,10 +282,17 @@ static void *fun(void)
/* comment */
return NULL;
+label0:
+ label1: /* allow special indent 1 for label at outermost level in body */
do {
+ label2:
size_t available_len, data_len;
const char *curr = txt, *next = txt;
char *tmp;
+
+ {
+ label3:
+ }
} while (1);
char *intraline_string_with_comment_delimiters_and_dbl_space = "1 /*1";
diff --git a/util/check-format-test-positives.c b/util/check-format-test-positives.c
index 7d9bbea5c7..c2ad61f0d2 100644
--- a/util/check-format-test-positives.c
+++ b/util/check-format-test-positives.c
@@ -117,7 +117,9 @@ int f (int a, /*@ space after fn before '(', reported unless sloppy-spc */
do f(c, c); /*@ (non-brace) code after 'do' */
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 */
+ 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 '}' */
@@ -127,7 +129,6 @@ int f (int a, /*@ space after fn before '(', reported unless sloppy-spc */
case(2): /*@ no space after 'case', reported unless sloppy-spc */
default: ; /*@ code after 'default:' */
} /*@ statement indent off by -4 */
- label: /*@ label special statement indent off by 1 */
return( /*@ no 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 */
diff --git a/util/check-format.pl b/util/check-format.pl
index 8852f3df8c..3230dc31fb 100755
--- a/util/check-format.pl
+++ b/util/check-format.pl
@@ -798,7 +798,7 @@ while (<>) { # loop over all lines of all input files
$local_offset = -INDENT_LEVEL;
} else {
if (m/^([\s@]*)(\w+):/) { # (leading) label, cannot be "default"
- $local_offset = -INDENT_LEVEL + 1 ;
+ $local_offset = -INDENT_LEVEL;
$has_label = 1;
}
}