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