150
|
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
2
|
|
3 #if !__has_extension(gnu_asm)
|
|
4 #error Extension 'gnu_asm' should be available by default
|
|
5 #endif
|
|
6
|
|
7 void f1() {
|
|
8 // PR7673: Some versions of GCC support an empty clobbers section.
|
|
9 asm ("ret" : : :);
|
|
10 }
|
|
11
|
|
12 void f2() {
|
|
13 asm("foo" : "=r" (a)); // expected-error {{use of undeclared identifier 'a'}}
|
|
14 asm("foo" : : "r" (b)); // expected-error {{use of undeclared identifier 'b'}}
|
|
15 }
|
|
16
|
|
17 void a() __asm__(""); // expected-error {{cannot use an empty string literal in 'asm'}}
|
|
18 void a() {
|
|
19 __asm__(""); // ok
|
|
20 }
|
|
21
|
|
22 // rdar://5952468
|
|
23 __asm ; // expected-error {{expected '(' after 'asm'}}
|
|
24
|
|
25 // <rdar://problem/10465079> - Don't crash on wide string literals in 'asm'.
|
|
26 int foo asm (L"bar"); // expected-error {{cannot use wide string literal in 'asm'}}
|
|
27
|
|
28 asm() // expected-error {{expected string literal in 'asm'}}
|
|
29 // expected-error@-1 {{expected ';' after top-level asm block}}
|
|
30
|
|
31 asm(; // expected-error {{expected string literal in 'asm'}}
|
|
32
|
|
33 asm("") // expected-error {{expected ';' after top-level asm block}}
|
|
34
|
|
35 // Unterminated asm strings at the end of the file were causing us to crash, so
|
|
36 // this needs to be last. rdar://15624081
|
|
37 // expected-warning@+3 {{missing terminating '"' character}}
|
|
38 // expected-error@+2 {{expected string literal in 'asm'}}
|
|
39 // expected-error@+1 {{expected ';' after top-level asm block}}
|
|
40 asm("
|