[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Sema / eval-method-with-unsafe-math.c
blobb68dc6e7505d379088dc5da3dc100e1820aaeccf
1 // RUN: not %clang_cc1 -fexperimental-strict-floating-point \
2 // RUN: -triple x86_64-linux-gnu \
3 // RUN: -verify %s 2>&1 | FileCheck %s --check-prefixes=CHECK-PRGM
5 // RUN: not %clang_cc1 -fexperimental-strict-floating-point \
6 // RUN: -triple x86_64-linux-gnu -freciprocal-math \
7 // RUN: -verify %s 2>&1 | FileCheck %s --check-prefixes=CHECK-RECPR,CHECK-PRGM
9 // RUN: not %clang_cc1 -fexperimental-strict-floating-point \
10 // RUN: -triple x86_64-linux-gnu -mreassociate \
11 // RUN: -verify %s 2>&1 | FileCheck %s --check-prefixes=CHECK-ASSOC,CHECK-PRGM
13 // RUN: not %clang_cc1 -fexperimental-strict-floating-point \
14 // RUN: -triple x86_64-linux-gnu -fapprox-func \
15 // RUN: -verify %s 2>&1 | FileCheck %s --check-prefixes=CHECK-FUNC,CHECK-PRGM
17 // RUN: not %clang_cc1 -fexperimental-strict-floating-point \
18 // RUN: -triple x86_64-linux-gnu -freciprocal-math -mreassociate -verify \
19 // RUN: %s 2>&1 | FileCheck %s --check-prefixes=CHECK-ASSOC,CHECK-RECPR,CHECK-PRGM
21 // RUN: not %clang_cc1 -fexperimental-strict-floating-point \
22 // RUN: -triple x86_64-linux-gnu -freciprocal-math -mreassociate -fapprox-func \
23 // RUN: -verify %s 2>&1 \
24 // RUN: | FileCheck %s --check-prefixes=CHECK-FUNC,CHECK-ASSOC,CHECK-RECPR,CHECK-PRGM
26 // RUN: not %clang_cc1 -fexperimental-strict-floating-point \
27 // RUN: -triple x86_64-linux-gnu -ffp-eval-method=source \
28 // RUN: -verify %s 2>&1 | FileCheck %s --check-prefixes=CHECK-FFP-OPT,CHECK-PRGM
30 // expected-no-diagnostics
32 float f1(float a, float b, float c) {
33 a = b + c;
34 return a * b + c;
37 float f2(float a, float b, float c) {
38 // CHECK-FFP-OPT: option 'ffp-eval-method' cannot be used with '#pragma clang fp reassociate'
39 #pragma clang fp reassociate(on)
40 return (a + b) + c;
43 float f3(float a, float b, float c) {
44 #pragma clang fp reassociate(off)
45 return (a - b) - c;
48 float f4(float a, float b, float c) {
49 #pragma clang fp eval_method(double)
50 // CHECK-FUNC: '#pragma clang fp eval_method' cannot be used with option 'fapprox-func'
51 // CHECK-ASSOC: '#pragma clang fp eval_method' cannot be used with option 'mreassociate'
52 // CHECK-RECPR: '#pragma clang fp eval_method' cannot be used with option 'freciprocal'
53 // CHECK-PRGM: '#pragma clang fp eval_method' cannot be used with '#pragma clang fp reassociate'
54 #pragma clang fp reassociate(on)
55 return (a * c) - (b * c);