opt_sob.c revision 1.5
1/* $NetBSD: opt_sob.c,v 1.5 2022/04/24 09:04:12 rillig Exp $ */ 2 3/* 4 * Tests for the options '-sob' and '-nsob'. 5 * 6 * The option '-sob' swallows optional blank lines. 7 * 8 * XXX: The manual page says: "You can use this to get rid of blank lines 9 * after declarations."; double check this. 10 * 11 * The option '-nsob' keeps optional blank lines as is. 12 */ 13 14/* 15 * FIXME: There are lots of 'optional blank lines' here that should be 16 * swallowed. 17 */ 18//indent input 19void function_declaration(void); 20 21 22int 23function_with_0_blank_lines(void) 24{ 25 int var; 26 var = value; 27 if (var > 0) 28 var--; 29 return var; 30} 31 32int 33function_with_1_blank_line(void) 34{ 35 36 int var; 37 38 var = value; 39 40 if (var > 0) 41/* $ The following line is "optional" and is removed due to '-sob'. */ 42 43 var--; 44 45 return var; 46 47} 48 49 50int 51function_with_2_blank_lines(void) 52{ 53 54 55 int var; 56 57 58 var = value; 59 60 61 if (var > 0) 62/* $ The following 2 lines are "optional" and are removed due to '-sob'. */ 63 64 65 var--; 66 67 68 return var; 69 70 71} 72//indent end 73 74//indent run -sob 75void function_declaration(void); 76 77 78int 79function_with_0_blank_lines(void) 80{ 81 int var; 82 var = value; 83 if (var > 0) 84 var--; 85 return var; 86} 87 88int 89function_with_1_blank_line(void) 90{ 91 92 int var; 93 94 var = value; 95 96 if (var > 0) 97 var--; 98 99 return var; 100 101} 102 103 104int 105function_with_2_blank_lines(void) 106{ 107 108 109 int var; 110 111 112 var = value; 113 114 115 if (var > 0) 116 var--; 117 118 119 return var; 120 121 122} 123//indent end 124 125//indent run -nsob 126void function_declaration(void); 127 128 129int 130function_with_0_blank_lines(void) 131{ 132 int var; 133 var = value; 134 if (var > 0) 135 var--; 136 return var; 137} 138 139int 140function_with_1_blank_line(void) 141{ 142 143 int var; 144 145 var = value; 146 147 if (var > 0) 148 149 var--; 150 151 return var; 152 153} 154 155 156int 157function_with_2_blank_lines(void) 158{ 159 160 161 int var; 162 163 164 var = value; 165 166 167 if (var > 0) 168 169 170 var--; 171 172 173 return var; 174 175 176} 177//indent end 178