opt_eei.c revision 1.4
1/* $NetBSD: opt_eei.c,v 1.4 2021/10/18 07:11:31 rillig Exp $ */ 2/* $FreeBSD$ */ 3 4/* 5 * Tests for the options '-eei' and '-neei'. 6 * 7 * The option '-eei' enables extra indentation on continuation lines of the 8 * expression part of 'if' and 'while' statements. These continuation lines 9 * are indented one extra level. 10 * 11 * The option '-neei' indents these conditions in the same way as all other 12 * continued statements. 13 */ 14 15#indent input 16bool 17less(int a, int b) 18{ 19 if (a < 20 b) 21 return true; 22 if (a 23 < 24 b) 25 return true; 26} 27#indent end 28 29#indent run -eei 30bool 31less(int a, int b) 32{ 33 if (a < 34 b) 35 return true; 36 if (a 37 < 38 b) 39 return true; 40} 41#indent end 42 43#indent run-equals-input -neei 44 45/* 46 * When the indentation level is the same as the continuation indentation, the 47 * indentation does not show the structure of the code. 48 */ 49#indent run -neei -i4 50bool 51less(int a, int b) 52{ 53 if (a < 54 b) 55 return true; 56 if (a 57 < 58 b) 59 return true; 60} 61#indent end 62 63/* 64 * Adding the extra level of indentation is useful when the standard 65 * indentation is the same as the indentation of statement continuations. In 66 * such a case, the continued condition would have the same indentation as the 67 * following statement, which would be confusing. 68 */ 69#indent run -eei -i4 70bool 71less(int a, int b) 72{ 73 if (a < 74 b) 75 return true; 76 if (a 77 < 78 b) 79 return true; 80} 81#indent end 82