xref: /minix3/external/bsd/llvm/dist/clang/test/Parser/asm.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc void f1() {
4*f4a2713aSLionel Sambuc   // PR7673: Some versions of GCC support an empty clobbers section.
5*f4a2713aSLionel Sambuc   asm ("ret" : : :);
6*f4a2713aSLionel Sambuc }
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc void f2() {
9*f4a2713aSLionel Sambuc   asm("foo" : "=r" (a)); // expected-error {{use of undeclared identifier 'a'}}
10*f4a2713aSLionel Sambuc   asm("foo" : : "r" (b)); // expected-error {{use of undeclared identifier 'b'}}
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc   asm const (""); // expected-warning {{ignored const qualifier on asm}}
13*f4a2713aSLionel Sambuc   asm volatile ("");
14*f4a2713aSLionel Sambuc   asm restrict (""); // expected-warning {{ignored restrict qualifier on asm}}
15*f4a2713aSLionel Sambuc   // FIXME: Once GCC supports _Atomic, check whether it allows this.
16*f4a2713aSLionel Sambuc   asm _Atomic (""); // expected-warning {{ignored _Atomic qualifier on asm}}
17*f4a2713aSLionel Sambuc }
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc // rdar://5952468
21*f4a2713aSLionel Sambuc __asm ; // expected-error {{expected '(' after 'asm'}}
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc // <rdar://problem/10465079> - Don't crash on wide string literals in 'asm'.
24*f4a2713aSLionel Sambuc int foo asm (L"bar"); // expected-error {{cannot use wide string literal in 'asm'}}
25*f4a2713aSLionel Sambuc 
26