Module Name: src Committed By: rillig Date: Mon Oct 11 17:02:55 UTC 2021
Modified Files: src/tests/usr.bin/indent: opt-nsob.0 opt-nsob.0.stdout opt-sob.0 opt-sob.0.stdout Log Message: tests/indent: finally found some "optional" blank lines To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/opt-nsob.0 \ src/tests/usr.bin/indent/opt-nsob.0.stdout cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/opt-sob.0 \ src/tests/usr.bin/indent/opt-sob.0.stdout Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/indent/opt-nsob.0 diff -u src/tests/usr.bin/indent/opt-nsob.0:1.2 src/tests/usr.bin/indent/opt-nsob.0:1.3 --- src/tests/usr.bin/indent/opt-nsob.0:1.2 Sun Mar 7 10:12:18 2021 +++ src/tests/usr.bin/indent/opt-nsob.0 Mon Oct 11 17:02:55 2021 @@ -1,12 +1,39 @@ -/* $NetBSD: opt-nsob.0,v 1.2 2021/03/07 10:12:18 rillig Exp $ */ +/* $NetBSD: opt-nsob.0,v 1.3 2021/10/11 17:02:55 rillig Exp $ */ /* $FreeBSD$ */ void function_declaration(void); +int +function_with_0_blank_lines(void) +{ + int var; + var = value; + if (var > 0) + var--; + return var; +} + +int +function_with_1_blank_line(void) +{ + + int var; + + var = value; + + if (var > 0) +/* $ The following line is "optional" but is not removed due to '-nsob'. */ + + var--; + + return var; + +} + int -function_definition(void) +function_with_2_blank_lines(void) { @@ -16,6 +43,13 @@ function_definition(void) var = value; + if (var > 0) +/* $ The following 2 lines are "optional" and are not removed due to '-nsob'. */ + + + var--; + + return var; Index: src/tests/usr.bin/indent/opt-nsob.0.stdout diff -u src/tests/usr.bin/indent/opt-nsob.0.stdout:1.2 src/tests/usr.bin/indent/opt-nsob.0.stdout:1.3 --- src/tests/usr.bin/indent/opt-nsob.0.stdout:1.2 Sun Mar 7 10:12:18 2021 +++ src/tests/usr.bin/indent/opt-nsob.0.stdout Mon Oct 11 17:02:55 2021 @@ -1,12 +1,38 @@ -/* $NetBSD: opt-nsob.0.stdout,v 1.2 2021/03/07 10:12:18 rillig Exp $ */ +/* $NetBSD: opt-nsob.0.stdout,v 1.3 2021/10/11 17:02:55 rillig Exp $ */ /* $FreeBSD$ */ void function_declaration(void); +int +function_with_0_blank_lines(void) +{ + int var; + var = value; + if (var > 0) + var--; + return var; +} + +int +function_with_1_blank_line(void) +{ + + int var; + + var = value; + + if (var > 0) + + var--; + + return var; + +} + int -function_definition(void) +function_with_2_blank_lines(void) { @@ -16,6 +42,12 @@ function_definition(void) var = value; + if (var > 0) + + + var--; + + return var; Index: src/tests/usr.bin/indent/opt-sob.0 diff -u src/tests/usr.bin/indent/opt-sob.0:1.3 src/tests/usr.bin/indent/opt-sob.0:1.4 --- src/tests/usr.bin/indent/opt-sob.0:1.3 Mon Oct 11 16:30:54 2021 +++ src/tests/usr.bin/indent/opt-sob.0 Mon Oct 11 17:02:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opt-sob.0,v 1.3 2021/10/11 16:30:54 rillig Exp $ */ +/* $NetBSD: opt-sob.0,v 1.4 2021/10/11 17:02:55 rillig Exp $ */ /* $FreeBSD$ */ /* $ FIXME: There are lots of 'optional blank lines' here that should */ @@ -9,20 +9,27 @@ void function_declaration(void); int function_with_0_blank_lines(void) { - int var; - var = value; - return var; + int var; + var = value; + if (var > 0) + var--; + return var; } int function_with_1_blank_line(void) { - int var; + int var; + + var = value; + + if (var > 0) +/* $ The following line is "optional" and is removed due to '-sob'. */ - var = value; + var--; - return var; + return var; } @@ -38,6 +45,13 @@ function_with_2_blank_lines(void) var = value; + if (var > 0) +/* $ The following 2 lines are "optional" and are removed due to '-sob'. */ + + + var--; + + return var; Index: src/tests/usr.bin/indent/opt-sob.0.stdout diff -u src/tests/usr.bin/indent/opt-sob.0.stdout:1.3 src/tests/usr.bin/indent/opt-sob.0.stdout:1.4 --- src/tests/usr.bin/indent/opt-sob.0.stdout:1.3 Mon Oct 11 16:30:54 2021 +++ src/tests/usr.bin/indent/opt-sob.0.stdout Mon Oct 11 17:02:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opt-sob.0.stdout,v 1.3 2021/10/11 16:30:54 rillig Exp $ */ +/* $NetBSD: opt-sob.0.stdout,v 1.4 2021/10/11 17:02:55 rillig Exp $ */ /* $FreeBSD$ */ void function_declaration(void); @@ -9,6 +9,8 @@ function_with_0_blank_lines(void) { int var; var = value; + if (var > 0) + var--; return var; } @@ -20,6 +22,9 @@ function_with_1_blank_line(void) var = value; + if (var > 0) + var--; + return var; } @@ -36,6 +41,10 @@ function_with_2_blank_lines(void) var = value; + if (var > 0) + var--; + + return var;