1/* $NetBSD: opt_bap.c,v 1.11 2023/06/23 20:44:51 rillig Exp $ */ 2 3/* 4 * Tests for the options '-bap' and '-nbap' ("blank line after procedure 5 * body"). 6 * 7 * The option '-bap' forces a blank line after every function body. 8 * 9 * The option '-nbap' keeps everything as is. 10 */ 11 12//indent input 13static void one_liner(void){} 14static void several_lines(void) 15{ 16 action(); 17} 18int main(void){} 19int global_variable; 20 21void already_has_blank_line_below(void) 22{ 23} 24 25void has_several_blank_lines_below(void) 26{ 27} 28 29 30 31int the_end; 32//indent end 33 34//indent run -bap 35static void 36one_liner(void) 37{ 38} 39 40static void 41several_lines(void) 42{ 43 action(); 44} 45 46int 47main(void) 48{ 49} 50 51int global_variable; 52 53void 54already_has_blank_line_below(void) 55{ 56} 57 58void 59has_several_blank_lines_below(void) 60{ 61} 62 63 64 65int the_end; 66//indent end 67 68//indent run -nbap 69static void 70one_liner(void) 71{ 72} 73static void 74several_lines(void) 75{ 76 action(); 77} 78int 79main(void) 80{ 81} 82int global_variable; 83 84void 85already_has_blank_line_below(void) 86{ 87} 88 89void 90has_several_blank_lines_below(void) 91{ 92} 93 94 95 96int the_end; 97//indent end 98 99 100/* 101 * Don't insert a blank line between the end of a function body and an '#endif' 102 * line, as both are closing elements. 103 */ 104//indent input 105#if 0 106void 107example(void) 108{ 109} 110#endif 111//indent end 112 113//indent run-equals-input -bap 114 115 116/* 117 * A preprocessing line after the end of a function body does not force a blank 118 * line, as these lines are from a different syntactic layer. 119 */ 120//indent input 121#if 0 122void 123f(void) 124{ 125} 126#else 127#endif 128//indent end 129 130//indent run-equals-input -bacc -bap 131 132 133/* 134 * Do not add a blank line between the end of a function body and an '#undef', 135 * as this is a common way to undefine a function-local macro. 136 */ 137//indent input 138#define replace 139{ 140} 141#undef replace 142//indent end 143 144//indent run-equals-input -bap 145 146//indent run-equals-input -bap -bacc 147