llvm-project
75 строк · 2.1 Кб
1// RUN: %clang_cc1 -std=c++11 -verify %s
2
3void test_0(int *List, int Length) {4/* expected-error@+1 {{missing option; expected 'contract', 'reassociate', 'reciprocal', or 'exceptions'}} */
5#pragma clang fp6for (int i = 0; i < Length; i++) {7List[i] = i;8}9}
10void test_1(int *List, int Length) {11/* expected-error@+1 {{invalid option 'blah'; expected 'contract', 'reassociate', 'reciprocal', or 'exceptions'}} */
12#pragma clang fp blah13for (int i = 0; i < Length; i++) {14List[i] = i;15}16}
17
18void test_3(int *List, int Length) {19/* expected-error@+1 {{expected '('}} */
20#pragma clang fp contract on21for (int i = 0; i < Length; i++) {22List[i] = i;23}24}
25
26void test_4(int *List, int Length) {27/* expected-error@+1 {{unexpected argument 'while' to '#pragma clang fp contract'; expected 'fast' or 'on' or 'off'}} */
28#pragma clang fp contract(while)29for (int i = 0; i < Length; i++) {30List[i] = i;31}32}
33
34void test_5(int *List, int Length) {35/* expected-error@+1 {{unexpected argument 'maybe' to '#pragma clang fp contract'; expected 'fast' or 'on' or 'off'}} */
36#pragma clang fp contract(maybe)37for (int i = 0; i < Length; i++) {38List[i] = i;39}40}
41
42void test_6(int *List, int Length) {43/* expected-error@+1 {{expected ')'}} */
44#pragma clang fp contract(fast45for (int i = 0; i < Length; i++) {46List[i] = i;47}48}
49
50void test_7(int *List, int Length) {51/* expected-warning@+1 {{extra tokens at end of '#pragma clang fp' - ignored}} */
52#pragma clang fp contract(fast) *53for (int i = 0; i < Length; i++) {54List[i] = i;55}56}
57
58void test_8(int *List, int Length) {59for (int i = 0; i < Length; i++) {60List[i] = i;61/* expected-error@+1 {{'#pragma clang fp' can only appear at file scope or at the start of a compound statement}} */
62#pragma clang fp contract(fast)63}64}
65
66void test_9(float *dest, float a, float b) {67/* expected-error@+1 {{unexpected argument 'on' to '#pragma clang fp exceptions'; expected 'ignore', 'maytrap' or 'strict'}} */
68#pragma clang fp exceptions(on)69*dest = a + b;70}
71
72void test_10(float *dest, float a, float b) {73#pragma clang fp exceptions(maytrap) contract(fast) reassociate(on)74*dest = a + b;75}
76