[RISCV] Reduce redundancy in vnsrl tests
[llvm-project.git] / clang / test / Parser / asm.c
blobecc0ef95a25b8e114e28a2c1a2be71092575d348
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 #if !__has_extension(gnu_asm)
4 #error Extension 'gnu_asm' should be available by default
5 #endif
7 void f1(void) {
8 // PR7673: Some versions of GCC support an empty clobbers section.
9 asm ("ret" : : :);
12 void f2(void) {
13 asm("foo" : "=r" (a)); // expected-error {{use of undeclared identifier 'a'}}
14 asm("foo" : : "r" (b)); // expected-error {{use of undeclared identifier 'b'}}
16 [[]] asm("");
17 [[gnu::deprecated]] asm(""); // expected-warning {{'deprecated' attribute ignored}}
20 void a(void) __asm__(""); // expected-error {{cannot use an empty string literal in 'asm'}}
21 void a(void) {
22 __asm__(""); // ok
25 __asm ; // expected-error {{expected '(' after 'asm'}}
27 // Don't crash on wide string literals in 'asm'.
28 int foo asm (L"bar"); // expected-error {{cannot use wide string literal in 'asm'}}
30 asm() // expected-error {{expected string literal in 'asm'}}
31 // expected-error@-1 {{expected ';' after top-level asm block}}
33 asm(; // expected-error {{expected string literal in 'asm'}}
35 asm("") // expected-error {{expected ';' after top-level asm block}}
37 // Unterminated asm strings at the end of the file were causing us to crash, so
38 // this needs to be last.
39 // expected-warning@+3 {{missing terminating '"' character}}
40 // expected-error@+2 {{expected string literal in 'asm'}}
41 // expected-error@+1 {{expected ';' after top-level asm block}}
42 asm("