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