lsym_do.c revision 1.6
1/* $NetBSD: lsym_do.c,v 1.6 2023/05/13 06:52:48 rillig Exp $ */ 2 3/* 4 * Tests for the token lsym_do, which represents the keyword 'do' that starts 5 * a 'do-while' loop. 6 * 7 * See also: 8 * psym_do.c 9 * psym_do_stmt.c 10 * C11 6.8.5 "Iteration statements" 11 * C11 6.8.5.2 "The 'do' statement" 12 */ 13 14//indent input 15void 16function(void) 17{ 18 do stmt();while(cond); 19} 20//indent end 21 22//indent run 23void 24function(void) 25{ 26 do 27 stmt(); 28 while (cond); 29} 30//indent end 31 32 33//indent input 34void 35else_do(int i) 36{ 37 if (i > 0) return; else do {} while (0); 38} 39//indent end 40 41//indent run 42void 43else_do(int i) 44{ 45 if (i > 0) 46 return; 47 else 48 do { 49 } while (0); 50} 51//indent end 52 53 54//indent input 55void 56variants(void) 57{ 58 do stmt(); while (0); 59 60 do { stmt(); } while (0); 61 62 do /* comment */ stmt(); while (0); 63 64 while (0) do {} while (0); 65} 66//indent end 67 68//indent run 69void 70variants(void) 71{ 72 do 73 stmt(); 74 while (0); 75 76 do { 77 stmt(); 78 } while (0); 79 80 do /* comment */ 81 stmt(); 82 while (0); 83 84 while (0) 85 do { 86 } while (0); 87} 88//indent end 89