1 /* $NetBSD: opt_pcs.c,v 1.13 2022/04/24 09:04:12 rillig Exp $ */ 2 3 /* 4 * Tests for the options '-pcs' and '-npcs'. 5 * 6 * The option '-pcs' adds a space in a function call expression, between the 7 * function name and the opening parenthesis. 8 * 9 * The option '-npcs' removes any whitespace from a function call expression, 10 * between the function name and the opening parenthesis. 11 */ 12 13 //indent input 14 void 15 example(void) 16 { 17 function_call(); 18 function_call (1); 19 function_call (1,2,3); 20 } 21 //indent end 22 23 //indent run -pcs 24 void 25 example(void) 26 { 27 function_call (); 28 function_call (1); 29 function_call (1, 2, 3); 30 } 31 //indent end 32 33 //indent run -npcs 34 void 35 example(void) 36 { 37 function_call(); 38 function_call(1); 39 function_call(1, 2, 3); 40 } 41 //indent end 42 43 44 //indent input 45 void ( * signal ( void ( * handler ) ( int ) ) ) ( int ) ; 46 int var = (function)(arg); 47 //indent end 48 49 //indent run -di0 -pcs 50 void (*signal (void (*handler) (int))) (int); 51 int var = (function) (arg); 52 //indent end 53 54 //indent run -di0 -npcs 55 void (*signal(void (*handler)(int)))(int); 56 int var = (function)(arg); 57 //indent end 58 59 60 /* 61 * The option '-pcs' also applies to 'sizeof' and 'offsetof', even though 62 * these are not functions. 63 */ 64 //indent input 65 int sizeof_type = sizeof (int); 66 int sizeof_type = sizeof(int); 67 int sizeof_expr = sizeof (0); 68 int sizeof_expr = sizeof(0); 69 int sizeof_expr = sizeof 0; 70 71 int offset = offsetof(struct s, member); 72 int offset = offsetof (struct s, member); 73 //indent end 74 75 /* The option '-pcs' overrides '-nbs'. */ 76 //indent run -pcs -di0 -nbs 77 int sizeof_type = sizeof (int); 78 int sizeof_type = sizeof (int); 79 int sizeof_expr = sizeof (0); 80 int sizeof_expr = sizeof (0); 81 int sizeof_expr = sizeof 0; 82 83 int offset = offsetof (struct s, member); 84 int offset = offsetof (struct s, member); 85 //indent end 86 87 /* 88 * If the option '-npcs' is given, '-bs' can still specialize it. This only 89 * applies to 'sizeof', but not 'offsetof'. 90 */ 91 //indent run -npcs -di0 -bs 92 int sizeof_type = sizeof (int); 93 int sizeof_type = sizeof (int); 94 int sizeof_expr = sizeof (0); 95 int sizeof_expr = sizeof (0); 96 int sizeof_expr = sizeof 0; 97 98 int offset = offsetof(struct s, member); 99 int offset = offsetof(struct s, member); 100 //indent end 101 102 //indent run -npcs -di0 103 int sizeof_type = sizeof(int); 104 int sizeof_type = sizeof(int); 105 int sizeof_expr = sizeof(0); 106 int sizeof_expr = sizeof(0); 107 int sizeof_expr = sizeof 0; 108 109 int offset = offsetof(struct s, member); 110 int offset = offsetof(struct s, member); 111 //indent end 112