Home | History | Annotate | Line # | Download | only in indent
      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
     13 static void one_liner(void){}
     14 static void several_lines(void)
     15 {
     16 	action();
     17 }
     18 int main(void){}
     19 int global_variable;
     20 
     21 void already_has_blank_line_below(void)
     22 {
     23 }
     24 
     25 void has_several_blank_lines_below(void)
     26 {
     27 }
     28 
     29 
     30 
     31 int		the_end;
     32 //indent end
     33 
     34 //indent run -bap
     35 static void
     36 one_liner(void)
     37 {
     38 }
     39 
     40 static void
     41 several_lines(void)
     42 {
     43 	action();
     44 }
     45 
     46 int
     47 main(void)
     48 {
     49 }
     50 
     51 int		global_variable;
     52 
     53 void
     54 already_has_blank_line_below(void)
     55 {
     56 }
     57 
     58 void
     59 has_several_blank_lines_below(void)
     60 {
     61 }
     62 
     63 
     64 
     65 int		the_end;
     66 //indent end
     67 
     68 //indent run -nbap
     69 static void
     70 one_liner(void)
     71 {
     72 }
     73 static void
     74 several_lines(void)
     75 {
     76 	action();
     77 }
     78 int
     79 main(void)
     80 {
     81 }
     82 int		global_variable;
     83 
     84 void
     85 already_has_blank_line_below(void)
     86 {
     87 }
     88 
     89 void
     90 has_several_blank_lines_below(void)
     91 {
     92 }
     93 
     94 
     95 
     96 int		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
    106 void
    107 example(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
    122 void
    123 f(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