Adam Nemet | 60d3264 | 2017-04-04 21:18:36 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -verify %s |
| 2 | |
| 3 | void test_0(int *List, int Length) { |
| 4 | /* expected-error@+1 {{missing option; expected contract}} */ |
| 5 | #pragma clang fp |
| 6 | for (int i = 0; i < Length; i++) { |
| 7 | List[i] = i; |
| 8 | } |
| 9 | } |
| 10 | void test_1(int *List, int Length) { |
| 11 | /* expected-error@+1 {{invalid option 'blah'; expected contract}} */ |
| 12 | #pragma clang fp blah |
| 13 | for (int i = 0; i < Length; i++) { |
| 14 | List[i] = i; |
| 15 | } |
| 16 | } |
| 17 | |
| 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 | |
| 26 | void test_4(int *List, int Length) { |
| 27 | /* expected-error@+1 {{unexpected argument 'while' to '#pragma clang fp contract'; expected 'on', 'fast' or 'off'}} */ |
| 28 | #pragma clang fp contract(while) |
| 29 | for (int i = 0; i < Length; i++) { |
| 30 | List[i] = i; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | void test_5(int *List, int Length) { |
| 35 | /* expected-error@+1 {{unexpected argument 'maybe' to '#pragma clang fp contract'; expected 'on', 'fast' or 'off'}} */ |
| 36 | #pragma clang fp contract(maybe) |
| 37 | for (int i = 0; i < Length; i++) { |
| 38 | List[i] = i; |
| 39 | } |
| 40 | } |
| 41 | |
| 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 | |
| 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 | |
| 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 | } |