1 /* $NetBSD: opt_psl.c,v 1.5 2021/11/20 11:13:18 rillig Exp $ */ 2 /* $FreeBSD$ */ 3 4 /* 5 * Tests for the options '-psl' and '-npsl'. 6 * 7 * The option '-psl' starts a new line for the function name in a function 8 * definition. 9 * 10 * The option '-npsl' puts the function name in the same line as its return 11 * type. 12 */ 13 14 /* Single-line function declarations are not affected by these options. */ 15 #indent input 16 void function_declaration(void); 17 #indent end 18 19 #indent run -psl 20 void function_declaration(void); 21 #indent end 22 23 #indent run-equals-prev-output -npsl 24 25 26 /* 27 * Multi-line function declarations are affected by these options since indent 28 * wrongly assumes they were function definitions, not declarations. 29 */ 30 #indent input 31 void function_declaration( 32 void); 33 #indent end 34 35 #indent run -psl 36 void 37 function_declaration( 38 void); 39 #indent end 40 41 /* 42 * In a function definition (which indent wrongly assumes here), in contrast 43 * to a declaration, the function name is not indented to column 17. 44 */ 45 #indent run -npsl 46 void function_declaration( 47 void); 48 #indent end 49 50 51 /* 52 * In a function definition, in contrast to a declaration, the function name 53 * is not indented to column 17 since the other function definitions are too 54 * far away. 55 */ 56 #indent input 57 void function_definition(void) {} 58 #indent end 59 60 #indent run -psl 61 void 62 function_definition(void) 63 { 64 } 65 #indent end 66 67 #indent run -npsl 68 void function_definition(void) 69 { 70 } 71 #indent end 72