1 /* $NetBSD: opt_bad.c,v 1.6 2022/04/24 09:04:12 rillig Exp $ */ 2 3 /* 4 * Tests for the options '-bad' and '-nbad'. 5 * 6 * The option '-bad' forces a blank line after every block of declarations. 7 * It only affects declarations of local variables. It does not affect 8 * file-scoped declarations or definitions. 9 * 10 * The option '-nbad' leaves everything as is. 11 */ 12 13 /* Test global declarations. */ 14 //indent input 15 int global_variable; 16 void function_declaration(void); 17 #if 0 18 #endif 19 /* comment */ 20 //indent end 21 22 //indent run -bad 23 int global_variable; 24 void function_declaration(void); 25 #if 0 26 #endif 27 /* comment */ 28 //indent end 29 30 //indent run-equals-prev-output -nbad 31 32 33 /* See FreeBSD r303599. */ 34 //indent input 35 #if defined(__i386__) 36 int a; 37 #elif defined(__amd64__) 38 int b; 39 #else 40 #error "Port me" 41 #endif 42 //indent end 43 44 //indent run -bad 45 #if defined(__i386__) 46 int a; 47 #elif defined(__amd64__) 48 int b; 49 #else 50 #error "Port me" 51 #endif 52 //indent end 53 54 55 /* Test local declarations. */ 56 //indent input 57 void function_definition(void) { 58 int local_variable; 59 function_call(); 60 int local_variable_after_statement; 61 function_call(); 62 } 63 //indent end 64 65 //indent run -bad 66 void 67 function_definition(void) 68 { 69 int local_variable; 70 71 function_call(); 72 int local_variable_after_statement; 73 74 function_call(); 75 } 76 //indent end 77 78 //indent run -nbad 79 void 80 function_definition(void) 81 { 82 int local_variable; 83 /* $ No blank line here. */ 84 function_call(); 85 int local_variable_after_statement; 86 /* $ No blank line here. */ 87 function_call(); 88 } 89 //indent end 90