1 /* $NetBSD: psym_stmt.c,v 1.7 2023/06/14 07:20:55 rillig Exp $ */ 2 3 /* 4 * Tests for the parser symbol psym_stmt, which represents a statement on the 5 * stack. 6 * 7 * TODO: Explain why the stack contains 'lbrace' 'stmt' instead of only 'lbrace'. 8 */ 9 10 //indent input 11 #define unless(cond) if (!(cond)) 12 13 void function(void)14function(void) 15 { 16 stmt(); 17 stmt; /* probably some macro */ 18 19 unless(cond) 20 stmt(); 21 } 22 //indent end 23 24 /* 25 * There is no space after 'unless' since indent cannot know that it is a 26 * syntactic macro, especially not when its definition is in a header file. 27 */ 28 //indent run-equals-input 29 30 31 // Ensure that '(something) {' is not treated as a cast expression. 32 //indent input 33 { TAILQ_FOREACH(a,b,c)34 TAILQ_FOREACH(a, b, c) { 35 a = 36 b; 37 } 38 } 39 //indent end 40 41 //indent run-equals-input -di0 -nlp -ci4 42 43 44 //indent input 45 void function(void)46function(void) 47 { 48 stmt(); 49 int var; 50 stmt(); 51 { 52 stmt(); 53 int var; 54 stmt(); 55 } 56 } 57 //indent end 58 59 //indent run-equals-input -ldi0 60 61 62 //indent input 63 void return_after_rbrace(void)64return_after_rbrace(void) 65 { 66 {}return; 67 } 68 //indent end 69 70 //indent run 71 void return_after_rbrace(void)72return_after_rbrace(void) 73 { 74 { 75 } 76 return; 77 } 78 //indent end 79