annotate clang/test/Parser/asm.c @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children 0572611fdcc8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 #if !__has_extension(gnu_asm)
anatofuz
parents:
diff changeset
4 #error Extension 'gnu_asm' should be available by default
anatofuz
parents:
diff changeset
5 #endif
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 void f1() {
anatofuz
parents:
diff changeset
8 // PR7673: Some versions of GCC support an empty clobbers section.
anatofuz
parents:
diff changeset
9 asm ("ret" : : :);
anatofuz
parents:
diff changeset
10 }
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 void f2() {
anatofuz
parents:
diff changeset
13 asm("foo" : "=r" (a)); // expected-error {{use of undeclared identifier 'a'}}
anatofuz
parents:
diff changeset
14 asm("foo" : : "r" (b)); // expected-error {{use of undeclared identifier 'b'}}
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 asm const (""); // expected-warning {{ignored const qualifier on asm}}
anatofuz
parents:
diff changeset
17 asm volatile ("");
anatofuz
parents:
diff changeset
18 asm restrict (""); // expected-warning {{ignored restrict qualifier on asm}}
anatofuz
parents:
diff changeset
19 // FIXME: Once GCC supports _Atomic, check whether it allows this.
anatofuz
parents:
diff changeset
20 asm _Atomic (""); // expected-warning {{ignored _Atomic qualifier on asm}}
anatofuz
parents:
diff changeset
21 }
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 void a() __asm__(""); // expected-error {{cannot use an empty string literal in 'asm'}}
anatofuz
parents:
diff changeset
24 void a() {
anatofuz
parents:
diff changeset
25 __asm__(""); // ok
anatofuz
parents:
diff changeset
26 }
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 // rdar://5952468
anatofuz
parents:
diff changeset
29 __asm ; // expected-error {{expected '(' after 'asm'}}
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 // <rdar://problem/10465079> - Don't crash on wide string literals in 'asm'.
anatofuz
parents:
diff changeset
32 int foo asm (L"bar"); // expected-error {{cannot use wide string literal in 'asm'}}
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 asm() // expected-error {{expected string literal in 'asm'}}
anatofuz
parents:
diff changeset
35 // expected-error@-1 {{expected ';' after top-level asm block}}
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 asm(; // expected-error {{expected string literal in 'asm'}}
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 asm("") // expected-error {{expected ';' after top-level asm block}}
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 // Unterminated asm strings at the end of the file were causing us to crash, so
anatofuz
parents:
diff changeset
42 // this needs to be last. rdar://15624081
anatofuz
parents:
diff changeset
43 // expected-warning@+3 {{missing terminating '"' character}}
anatofuz
parents:
diff changeset
44 // expected-error@+2 {{expected string literal in 'asm'}}
anatofuz
parents:
diff changeset
45 // expected-error@+1 {{expected ';' after top-level asm block}}
anatofuz
parents:
diff changeset
46 asm("