opt_lpl.c revision 1.5
11.5Srillig/* $NetBSD: opt_lpl.c,v 1.5 2021/11/20 16:54:17 rillig Exp $ */ 21.1Srillig/* $FreeBSD$ */ 31.1Srillig 41.3Srillig/* 51.3Srillig * Tests for the options '-lpl' and '-nlpl'. 61.3Srillig * 71.3Srillig * The option '-lpl' lines up code surrounded by parentheses in continuation 81.3Srillig * lines, even if it would extend past the right margin. 91.3Srillig * 101.3Srillig * The option '-nlpl' moves continuation lines that would stick over the right 111.5Srillig * margin to the left, to keep them within the margin, as long as that does 121.5Srillig * not require placing them to the left of the prevailing indentation level. 131.3Srillig * 141.3Srillig * These switches have no effect if '-nlp' is selected. 151.3Srillig */ 161.3Srillig 171.3Srillig/* $ TODO: Add code that differs between -lpl and -nlpl. */ 181.3Srillig 191.1Srillig#indent input 201.1Srilligvoid 211.1Srilligexample(void) 221.1Srillig{ 231.1Srillig int sum1 = 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21; 241.1Srillig int sum2 = (1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21); 251.1Srillig 261.1Srillig int sum3 = 1+2+3+4+5+ 271.1Srillig 6+7+8+9+10+ 281.1Srillig 11+12+13+14+15+ 291.1Srillig 16+17+18+19+20+ 301.1Srillig 21; 311.1Srillig int sum4 = (1+2+3+4+5+ 321.1Srillig 6+7+8+9+10+ 331.1Srillig 11+12+13+14+15+ 341.1Srillig 16+17+18+19+20+ 351.1Srillig 21); 361.1Srillig 371.1Srillig call_function(call_function(call_function(call_function(call_function(call_function()))))); 381.1Srillig 391.1Srillig call_function((call_function(call_function(call_function(call_function(call_function())))))); 401.1Srillig} 411.1Srillig#indent end 421.1Srillig 431.1Srillig#indent run -lpl 441.1Srilligvoid 451.1Srilligexample(void) 461.1Srillig{ 471.1Srillig int sum1 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21; 481.1Srillig int sum2 = (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21); 491.1Srillig 501.1Srillig/* $ XXX: There should be at least _some_ indentation for the */ 511.1Srillig/* $ continuation lines. */ 521.1Srillig int sum3 = 1 + 2 + 3 + 4 + 5 + 531.1Srillig 6 + 7 + 8 + 9 + 10 + 541.1Srillig 11 + 12 + 13 + 14 + 15 + 551.1Srillig 16 + 17 + 18 + 19 + 20 + 561.1Srillig 21; 571.1Srillig int sum4 = (1 + 2 + 3 + 4 + 5 + 581.1Srillig 6 + 7 + 8 + 9 + 10 + 591.1Srillig 11 + 12 + 13 + 14 + 15 + 601.1Srillig 16 + 17 + 18 + 19 + 20 + 611.1Srillig 21); 621.1Srillig 631.1Srillig call_function(call_function(call_function(call_function(call_function(call_function()))))); 641.1Srillig 651.1Srillig call_function((call_function(call_function(call_function(call_function(call_function())))))); 661.1Srillig} 671.1Srillig#indent end 681.1Srillig 691.4Srillig#indent run-equals-prev-output -nlpl 70