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