opt_dj.c revision 1.7
1/* $NetBSD: opt_dj.c,v 1.7 2022/04/24 09:04:12 rillig Exp $ */ 2 3/* 4 * Tests for the options '-dj' and '-ndj'. 5 * 6 * The option '-dj' left-justifies declarations of local variables. 7 * 8 * The option '-ndj' indents declarations the same as code. 9 */ 10 11/* For top-level declarations, '-dj' and '-ndj' produce the same output. */ 12//indent input 13int i; 14int *ip; 15const char *ccp; 16const void *****vppppp; 17const void ******vpppppp; 18const void ********vpppppppp; 19//indent end 20 21//indent run -dj 22int i; 23int *ip; 24const char *ccp; 25const void *****vppppp; 26const void ******vpppppp; 27const void ********vpppppppp; 28//indent end 29 30//indent run-equals-prev-output -ndj 31 32 33//indent input 34void example(void) { 35 int decl; 36 code(); 37} 38//indent end 39 40//indent run -dj 41void 42example(void) 43{ 44int decl; 45 code(); 46} 47//indent end 48 49//indent run -ndj 50void 51example(void) 52{ 53 int decl; 54 code(); 55} 56//indent end 57 58 59/* 60 * The option '-dj' does not influence traditional function definitions. 61 */ 62//indent input 63double 64dbl_plus3(a, b, c) 65double a, b, c; 66{ 67 return a + b + c; 68} 69//indent end 70 71//indent run -dj 72double 73dbl_plus3(a, b, c) 74 double a, b, c; 75{ 76 return a + b + c; 77} 78//indent end 79