Mercurial > hg > CbC > CbC_llvm
comparison clang/test/Parser/asm.c @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children | 0572611fdcc8 |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
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 asm const (""); // expected-warning {{ignored const qualifier on asm}} | |
17 asm volatile (""); | |
18 asm restrict (""); // expected-warning {{ignored restrict qualifier on asm}} | |
19 // FIXME: Once GCC supports _Atomic, check whether it allows this. | |
20 asm _Atomic (""); // expected-warning {{ignored _Atomic qualifier on asm}} | |
21 } | |
22 | |
23 void a() __asm__(""); // expected-error {{cannot use an empty string literal in 'asm'}} | |
24 void a() { | |
25 __asm__(""); // ok | |
26 } | |
27 | |
28 // rdar://5952468 | |
29 __asm ; // expected-error {{expected '(' after 'asm'}} | |
30 | |
31 // <rdar://problem/10465079> - Don't crash on wide string literals in 'asm'. | |
32 int foo asm (L"bar"); // expected-error {{cannot use wide string literal in 'asm'}} | |
33 | |
34 asm() // expected-error {{expected string literal in 'asm'}} | |
35 // expected-error@-1 {{expected ';' after top-level asm block}} | |
36 | |
37 asm(; // expected-error {{expected string literal in 'asm'}} | |
38 | |
39 asm("") // expected-error {{expected ';' after top-level asm block}} | |
40 | |
41 // Unterminated asm strings at the end of the file were causing us to crash, so | |
42 // this needs to be last. rdar://15624081 | |
43 // expected-warning@+3 {{missing terminating '"' character}} | |
44 // expected-error@+2 {{expected string literal in 'asm'}} | |
45 // expected-error@+1 {{expected ';' after top-level asm block}} | |
46 asm(" |