Clang Project

clang_source_code/test/Driver/cl-zc.cpp
1// Note: %s must be preceded by --, otherwise it may be interpreted as a
2// command-line option, e.g. on Mac where %s is commonly under /Users.
3
4// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=TRIGRAPHS-DEFAULT %s
5// cc1 will disable trigraphs for -fms-compatibility as long as -ftrigraphs
6// isn't explicitly passed.
7// TRIGRAPHS-DEFAULT-NOT: "-ftrigraphs"
8
9// RUN: %clang_cl /c -### /Zc:trigraphs -- %s 2>&1 | FileCheck -check-prefix=TRIGRAPHS-ON %s
10// TRIGRAPHS-ON: "-ftrigraphs"
11
12// RUN: %clang_cl /c -### /Zc:trigraphs- -- %s 2>&1 | FileCheck -check-prefix=TRIGRAPHS-OFF %s
13// TRIGRAPHS-OFF: "-fno-trigraphs"
14
15// RUN: %clang_cl /c -### /Zc:sizedDealloc -- %s 2>&1 | FileCheck -check-prefix=SIZED-DEALLOC-ON %s
16// SIZED-DEALLOC-ON: "-fsized-deallocation"
17
18// RUN: %clang_cl /c -### /Zc:sizedDealloc- -- %s 2>&1 | FileCheck -check-prefix=SIZED-DEALLOC-OFF %s
19// SIZED-DEALLOC-OFF-NOT: "-fsized-deallocation"
20
21// RUN: %clang_cl /c /std:c++17 -### /Zc:alignedNew -- %s 2>&1 | FileCheck -check-prefix=ALIGNED-NEW-ON %s
22// ALIGNED-NEW-ON: "-faligned-allocation"
23
24// RUN: %clang_cl /c /std:c++17 -### /Zc:alignedNew- -- %s 2>&1 | FileCheck -check-prefix=ALIGNED-NEW-OFF %s
25// ALIGNED-NEW-OFF-NOT: "-faligned-allocation"
26
27// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=STRICTSTRINGS-DEFAULT %s
28// STRICTSTRINGS-DEFAULT-NOT: -Werror=c++11-compat-deprecated-writable-strings
29// RUN: %clang_cl /c -### /Zc:strictStrings -- %s 2>&1 | FileCheck -check-prefix=STRICTSTRINGS-ON %s
30// STRICTSTRINGS-ON: -Werror=c++11-compat-deprecated-writable-strings
31// RUN: %clang_cl /c -### /Zc:strictStrings- -- %s 2>&1 | FileCheck -check-prefix=STRICTSTRINGS-OFF %s
32// STRICTSTRINGS-OFF: argument unused during compilation
33
34
35// RUN: %clang_cl /c -### /Zc:foobar -- %s 2>&1 | FileCheck -check-prefix=FOOBAR-ON %s
36// FOOBAR-ON: argument unused during compilation
37// RUN: %clang_cl /c -### /Zc:foobar- -- %s 2>&1 | FileCheck -check-prefix=FOOBAR-ON %s
38// FOOBAR-OFF: argument unused during compilation
39
40// These are ignored if enabled, and warn if disabled.
41
42// RUN: %clang_cl /c -### /Zc:forScope -- %s 2>&1 | FileCheck -check-prefix=FORSCOPE-ON %s
43// FORSCOPE-ON-NOT: argument unused during compilation
44// RUN: %clang_cl /c -### /Zc:forScope- -- %s 2>&1 | FileCheck -check-prefix=FORSCOPE-OFF %s
45// FORSCOPE-OFF: argument unused during compilation
46
47// RUN: %clang_cl /c -### /Zc:wchar_t -- %s 2>&1 | FileCheck -check-prefix=WCHAR_T-ON %s
48// WCHAR_T-ON-NOT: argument unused during compilation
49// RUN: %clang_cl /c -### /Zc:wchar_t- -- %s 2>&1 | FileCheck -check-prefix=WCHAR_T-OFF %s
50// WCHAR_T-OFF: argument unused during compilation
51
52// RUN: %clang_cl /c -### /Zc:auto -- %s 2>&1 | FileCheck -check-prefix=AUTO-ON %s
53// AUTO-ON-NOT: argument unused during compilation
54// RUN: %clang_cl /c -### /Zc:auto- -- %s 2>&1 | FileCheck -check-prefix=AUTO-OFF %s
55// AUTO-OFF: argument unused during compilation
56
57// RUN: %clang_cl /c -### /Zc:inline -- %s 2>&1 | FileCheck -check-prefix=INLINE-ON %s
58// INLINE-ON-NOT: argument unused during compilation
59// RUN: %clang_cl /c -### /Zc:inline- -- %s 2>&1 | FileCheck -check-prefix=INLINE-OFF %s
60// INLINE-OFF: argument unused during compilation
61
62// RUN: %clang_cl /c -### /Zc:ternary -- %s 2>&1 | FileCheck -check-prefix=TERNARY-ON %s
63// TERNARY-ON-NOT: argument unused during compilation
64// RUN: %clang_cl /c -### /Zc:ternary- -- %s 2>&1 | FileCheck -check-prefix=TERNARY-OFF %s
65// TERNARY-OFF: argument unused during compilation
66
67
68// These never warn, but don't have an effect yet.
69
70// RUN: %clang_cl /c -### /Zc:rvalueCast -- %s 2>&1 | FileCheck -check-prefix=RVALUECAST-ON %s
71// RVALUECAST-ON-NOT: argument unused during compilation
72// RUN: %clang_cl /c -### /Zc:rvalueCast- -- %s 2>&1 | FileCheck -check-prefix=RVALUECAST-OFF %s
73// RVALUECAST-OFF: argument unused during compilation
74