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