xref: /netbsd-src/tests/usr.bin/xlint/lint1/stmt_goto.c (revision 122b5006ee1bd67145794b4cde92f4fe4781a5ec)
1 /*	$NetBSD: stmt_goto.c,v 1.1 2021/07/14 20:39:13 rillig Exp $	*/
2 # 3 "stmt_goto.c"
3 
4 /*
5  * Tests for the 'goto' statement.
6  */
7 
8 /* expect+1: syntax error 'goto' [249] */
9 goto invalid_at_top_level;
10 
11 void
12 function(void)
13 {
14 	goto label;
15 label:
16 	/* expect+1: syntax error '"' [249] */
17 	goto "string";
18 
19 	/* Reset the error handling of the parser. */
20 	goto ok;
21 ok:
22 
23 	/* Numeric labels work in Pascal, but not in C. */
24 	/* expect+1: syntax error '12345' [249] */
25 	goto 12345;
26 }
27