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