gcc_stmt_asm.c revision 1.2
1/*	$NetBSD: gcc_stmt_asm.c,v 1.2 2021/07/15 21:00:05 rillig Exp $	*/
2# 3 "gcc_stmt_asm.c"
3
4/*
5 * Tests for the GCC 'asm' statement.
6 */
7
8void
9function(void)
10{
11	/*
12	 * lint is not really interested in assembly language, therefore it
13	 * just skips everything until and including the closing parenthesis.
14	 */
15	asm(any "string" or 12345 || whatever);
16
17	/*
18	 * Parentheses are allowed in 'asm' statements, they have to be
19	 * properly nested.  Brackets and braces don't have to be nested
20	 * since they usually not occur in 'asm' statements.
21	 */
22	__asm(^(int = typedef[[[{{{));
23
24	__asm__();
25}
26
27/*
28 * Even on the top level, 'asm' is allowed.  It is interpreted as a
29 * declaration.
30 */
31__asm__();
32
33void
34syntax_error(void)
35{
36	/* expect+1: syntax error '__asm__' [249] */
37	int i = __asm__();
38}
39
40__asm__(
41/* cover ignore_up_to_rparen at EOF */
42/* expect+1: error: syntax error '' [249] */
43