1 // RUN: %clang_cc1 -std=c++11 -verify %s
2 
test_0(int * List,int Length)3 void test_0(int *List, int Length) {
4 /* expected-error@+1 {{missing option; expected 'contract', 'reassociate' or 'exceptions'}} */
5 #pragma clang fp
6   for (int i = 0; i < Length; i++) {
7     List[i] = i;
8   }
9 }
test_1(int * List,int Length)10 void test_1(int *List, int Length) {
11 /* expected-error@+1 {{invalid option 'blah'; expected 'contract', 'reassociate' or 'exceptions'}} */
12 #pragma clang fp blah
13   for (int i = 0; i < Length; i++) {
14     List[i] = i;
15   }
16 }
17 
test_3(int * List,int Length)18 void test_3(int *List, int Length) {
19 /* expected-error@+1 {{expected '('}} */
20 #pragma clang fp contract on
21   for (int i = 0; i < Length; i++) {
22     List[i] = i;
23   }
24 }
25 
test_4(int * List,int Length)26 void 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)
29   for (int i = 0; i < Length; i++) {
30     List[i] = i;
31   }
32 }
33 
test_5(int * List,int Length)34 void 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)
37   for (int i = 0; i < Length; i++) {
38     List[i] = i;
39   }
40 }
41 
test_6(int * List,int Length)42 void test_6(int *List, int Length) {
43 /* expected-error@+1 {{expected ')'}} */
44 #pragma clang fp contract(fast
45   for (int i = 0; i < Length; i++) {
46     List[i] = i;
47   }
48 }
49 
test_7(int * List,int Length)50 void 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) *
53   for (int i = 0; i < Length; i++) {
54     List[i] = i;
55   }
56 }
57 
test_8(int * List,int Length)58 void test_8(int *List, int Length) {
59   for (int i = 0; i < Length; i++) {
60     List[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 
test_9(float * dest,float a,float b)66 void 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 
test_10(float * dest,float a,float b)72 void test_10(float *dest, float a, float b) {
73 #pragma clang fp exceptions(maytrap) contract(fast) reassociate(on)
74   *dest = a + b;
75 }
76