2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2007-11-22 07:27:34 +08:00
|
|
|
|
|
|
|
void f1() {
|
2010-07-22 15:11:21 +08:00
|
|
|
// PR7673: Some versions of GCC support an empty clobbers section.
|
|
|
|
asm ("ret" : : :);
|
2007-11-22 07:27:34 +08:00
|
|
|
}
|
2008-02-10 03:57:29 +08:00
|
|
|
|
|
|
|
void f2() {
|
|
|
|
asm("foo" : "=r" (a)); // expected-error {{use of undeclared identifier 'a'}}
|
|
|
|
asm("foo" : : "r" (b)); // expected-error {{use of undeclared identifier 'b'}}
|
2013-03-28 09:55:44 +08:00
|
|
|
|
|
|
|
asm const (""); // expected-warning {{ignored const qualifier on asm}}
|
|
|
|
asm volatile ("");
|
|
|
|
asm restrict (""); // expected-warning {{ignored restrict qualifier on asm}}
|
|
|
|
// FIXME: Once GCC supports _Atomic, check whether it allows this.
|
|
|
|
asm _Atomic (""); // expected-warning {{ignored _Atomic qualifier on asm}}
|
2008-02-10 03:57:29 +08:00
|
|
|
}
|
2008-05-28 07:32:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
// rdar://5952468
|
|
|
|
__asm ; // expected-error {{expected '(' after 'asm'}}
|
|
|
|
|
2011-12-02 08:35:46 +08:00
|
|
|
// <rdar://problem/10465079> - Don't crash on wide string literals in 'asm'.
|
|
|
|
int foo asm (L"bar"); // expected-error {{cannot use wide string literal in 'asm'}}
|
|
|
|
|
2013-12-11 05:29:48 +08:00
|
|
|
asm() // expected-error {{expected string literal in 'asm'}}
|
|
|
|
// expected-error@-1 {{expected ';' after top-level asm block}}
|
|
|
|
|
|
|
|
asm(; // expected-error {{expected string literal in 'asm'}}
|
|
|
|
|
|
|
|
asm("") // expected-error {{expected ';' after top-level asm block}}
|
|
|
|
|
|
|
|
// Unterminated asm strings at the end of the file were causing us to crash, so
|
|
|
|
// this needs to be last. rdar://15624081
|
|
|
|
// expected-warning@+3 {{missing terminating '"' character}}
|
|
|
|
// expected-error@+2 {{expected string literal in 'asm'}}
|
|
|
|
// expected-error@+1 {{expected ';' after top-level asm block}}
|
|
|
|
asm("
|