[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Parser / fp-floatcontrol-syntax.cpp
blob7f5a665252c0efb873c4785d1c2936d5095010e2
1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -DCHECK_ERROR %s -verify
3 float function_scope(float a) {
4 #pragma float_control(precise, on) junk // expected-warning {{extra tokens at end of '#pragma float_control' - ignored}}
5 return a;
8 // Ok, at namespace scope.
9 namespace foo {
10 #pragma float_control(push)
11 #pragma float_control(pop)
14 // Ok, within a language linkage specification.
15 extern "C" {
16 #pragma float_control(push)
17 #pragma float_control(pop)
20 // Same.
21 extern "C++" {
22 #pragma float_control(push)
23 #pragma float_control(pop)
26 #ifdef CHECK_ERROR
27 // Ok at file scope.
28 #pragma float_control(push)
29 #pragma float_control(pop)
30 #pragma float_control(precise, on, push)
31 void check_stack() {
32 // Not okay within a function declaration.
33 #pragma float_control(push) // expected-error {{can only appear at file or namespace scope or within a language linkage specification}}
34 #pragma float_control(pop) // expected-error {{can only appear at file or namespace scope or within a language linkage specification}}
35 #pragma float_control(precise, on, push) // expected-error {{can only appear at file or namespace scope or within a language linkage specification}}
36 #pragma float_control(except, on, push) // expected-error {{can only appear at file or namespace scope or within a language linkage specification}}
37 #pragma float_control(except, on, push, junk) // expected-error {{float_control is malformed}}
38 return;
40 #endif
42 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fdenormal-fp-math=preserve-sign,preserve-sign -fsyntax-only %s -DDEFAULT -verify
43 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only %s -ffp-contract=fast -DPRECISE -verify
44 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only %s -ffp-contract=off -frounding-math -ffp-exception-behavior=strict -DSTRICT -verify
45 // RUN: %clang_cc1 -triple x86_64-linux-gnu -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math -ffp-contract=fast -ffast-math -ffinite-math-only -fsyntax-only %s -DFAST -verify
46 double a = 0.0;
47 double b = 1.0;
49 #ifdef STRICT
50 #pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when except is enabled}}
51 #else
52 #ifndef FAST
53 #pragma STDC FENV_ACCESS ON
54 #pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when except is enabled}}
55 #endif
56 #endif
58 #pragma float_control(precise, on)
59 #pragma float_control(except, on) // OK
60 #ifndef STRICT
61 #pragma float_control(except, on)
62 #pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when except is enabled}}
63 #endif
64 int main() {
65 #ifdef STRICT
66 #pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when except is enabled}}
67 #else
68 #pragma float_control(precise, off) // expected-error {{'#pragma float_control(precise, off)' is illegal when except is enabled}}
69 #endif
70 #pragma float_control(except, on)
71 // error: '#pragma float_control(except, on)' is illegal when precise is disabled
72 double x = b / a; // only used for fp flag setting
73 if (a == a) // only used for fp flag setting
74 return 0; //(int)x;