[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Parser / asm-qualifiers.c
blobd18336dfd7c8c18f6081d6bad949094e9b3efc3b
1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -verify %s
3 void qualifiers(void) {
4 asm("");
5 asm volatile("");
6 asm inline("");
7 asm goto("" ::::foo);
8 foo:;
11 void unknown_qualifiers(void) {
12 asm noodle(""); // expected-error {{expected 'volatile', 'inline', 'goto', or '('}}
13 asm goto noodle("" ::::foo); // expected-error {{expected 'volatile', 'inline', 'goto', or '('}}
14 asm volatile noodle inline(""); // expected-error {{expected 'volatile', 'inline', 'goto', or '('}}
15 foo:;
18 void underscores(void) {
19 __asm__("");
20 __asm__ __volatile__("");
21 __asm__ __inline__("");
22 // Note: goto is not supported with underscore prefix+suffix.
23 __asm__ goto("" ::::foo);
24 foo:;
27 void permutations(void) {
28 asm goto inline volatile("" ::::foo);
29 asm goto inline("");
30 asm goto volatile inline("" ::::foo);
31 asm goto volatile("");
32 asm inline goto volatile("" ::::foo);
33 asm inline goto("" ::::foo);
34 asm inline volatile goto("" ::::foo);
35 asm inline volatile("");
36 asm volatile goto("" ::::foo);
37 asm volatile inline goto("" ::::foo);
38 asm volatile inline("");
39 foo:;
42 void duplicates(void) {
43 asm volatile volatile(""); // expected-error {{duplicate asm qualifier 'volatile'}}
44 __asm__ __volatile__ __volatile__(""); // expected-error {{duplicate asm qualifier 'volatile'}}
45 asm inline inline(""); // expected-error {{duplicate asm qualifier 'inline'}}
46 __asm__ __inline__ __inline__(""); // expected-error {{duplicate asm qualifier 'inline'}}
47 asm goto goto("" ::::foo); // expected-error {{duplicate asm qualifier 'goto'}}
48 __asm__ goto goto("" ::::foo); // expected-error {{duplicate asm qualifier 'goto'}}
49 foo:;
52 // globals
53 asm ("");
54 // <rdar://problem/7574870>
55 asm volatile (""); // expected-error {{meaningless 'volatile' on asm outside function}}
56 asm inline (""); // expected-error {{meaningless 'inline' on asm outside function}}
57 asm goto (""::::noodle); // expected-error {{meaningless 'goto' on asm outside function}}
58 // expected-error@-1 {{expected ')'}}
59 // expected-note@-2 {{to match this '('}}