1/* $NetBSD: lsym_return.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */ 2 3/* 4 * Tests for the token lsym_return, which represents the keyword 'return' that 5 * starts a 'return' statement for leaving the execution of a function. 6 */ 7 8/* 9 * Return statements having a single-line expression are simple to format. 10 * Since 'return' is not a function name, there is a space between the 11 * 'return' and the '('. 12 */ 13//indent input 14void 15function(bool cond) 16{ 17 if (cond) 18 return; 19} 20 21int 22calculate(int a, int b) 23{ 24 return a; 25 return (b); 26 return (((a))) + b; 27 return calculate(b, a); 28} 29//indent end 30 31//indent run-equals-input 32 33 34/* 35 * Returning complex expressions may spread the expression over several lines. 36 * The exact formatting depends on the option '-lp'. 37 */ 38//indent input 39int 40multi_line(int a) 41{ 42 return calculate(3, 43 4); 44 return calculate( 45 3, 46 4); 47 return calculate( 48 3, 49 4 50 ); 51} 52//indent end 53 54//indent run-equals-input 55 56//indent run -nlp 57int 58multi_line(int a) 59{ 60 return calculate(3, 61 4); 62 return calculate( 63 3, 64 4); 65 return calculate( 66 3, 67 4 68 ); 69} 70//indent end 71