annotate clang/test/Parser/asm.c @ 223:5f17cb93ff66 llvm-original

LLVM13 (2021/7/18)
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:43:00 +0900
parents 0572611fdcc8
children c4bab56944e8
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
anatofuz
parents:
diff changeset
17 void a() __asm__(""); // expected-error {{cannot use an empty string literal in 'asm'}}
anatofuz
parents:
diff changeset
18 void a() {
anatofuz
parents:
diff changeset
19 __asm__(""); // ok
anatofuz
parents:
diff changeset
20 }
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 // rdar://5952468
anatofuz
parents:
diff changeset
23 __asm ; // expected-error {{expected '(' after 'asm'}}
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 // <rdar://problem/10465079> - Don't crash on wide string literals in 'asm'.
anatofuz
parents:
diff changeset
26 int foo asm (L"bar"); // expected-error {{cannot use wide string literal in 'asm'}}
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 asm() // expected-error {{expected string literal in 'asm'}}
anatofuz
parents:
diff changeset
29 // expected-error@-1 {{expected ';' after top-level asm block}}
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 asm(; // expected-error {{expected string literal in 'asm'}}
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 asm("") // expected-error {{expected ';' after top-level asm block}}
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 // Unterminated asm strings at the end of the file were causing us to crash, so
anatofuz
parents:
diff changeset
36 // this needs to be last. rdar://15624081
anatofuz
parents:
diff changeset
37 // expected-warning@+3 {{missing terminating '"' character}}
anatofuz
parents:
diff changeset
38 // expected-error@+2 {{expected string literal in 'asm'}}
anatofuz
parents:
diff changeset
39 // expected-error@+1 {{expected ';' after top-level asm block}}
anatofuz
parents:
diff changeset
40 asm("