1/* $NetBSD: opt_v.c,v 1.13 2023/06/05 10:12:21 rillig Exp $ */ 2 3/* 4 * Tests for the options '-v' and '-nv'. 5 * 6 * The option '-v' enables verbose mode. 7 * 8 * The option '-nv' disables verbose mode. Only errors and warnings are output 9 * in this mode. 10 */ 11 12//indent input 13/* 14 * A block comment. 15 */ 16void 17example(void) 18{ 19 printf("A very long message template with %d arguments: %s, %s, %s", 3, "first", "second", "third"); 20} 21 22// $ Indent does not format comments in preprocessing lines. 23#define macro1 /* prefix */ suffix 24 25// $ Indent does not format comments in preprocessing lines. 26#define macro2 prefix /* suffix */ 27//indent end 28 29//indent run -v 30/* 31 * A block comment. 32 */ 33void 34example(void) 35{ 36 printf("A very long message template with %d arguments: %s, %s, %s", 3, "first", "second", "third"); 37} 38 39#define macro1 /* prefix */ suffix 40 41#define macro2 prefix /* suffix */ 42//indent end 43 44 45//indent input 46void 47example(void) 48{ 49 int sum1 = 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21; 50 int sum2 = (1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21); 51} 52//indent end 53 54//indent run -nv 55void 56example(void) 57{ 58/* $ XXX: The following lines are too long and should thus be broken. */ 59/* $ XXX: If they are broken, -nv does NOT output 'Line broken'. */ 60 int sum1 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21; 61 int sum2 = (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21); 62} 63//indent end 64 65 66/* 67 * Before 2023-05-12, indent wrote some wrong statistics to stdout, in which 68 * the line numbers were counted wrong. 69 */ 70//indent input 71#if 0 72int line = 1; 73int line = 2; 74int line = 3; 75#else 76int line = 5; 77#endif 78//indent end 79 80//indent run-equals-input -v -di0 81