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