Hans Wennborg | 1907610 | 2013-07-31 20:51:53 +0000 | [diff] [blame] | 1 | // Don't attempt slash switches on msys bash. |
| 2 | // REQUIRES: shell-preserves-root |
| 3 | |
Hans Wennborg | 96d5484 | 2013-08-02 22:24:50 +0000 | [diff] [blame^] | 4 | // Note: %s must be preceded by --, otherwise it may be interpreted as a |
| 5 | // command-line option, e.g. on Mac where %s is commonly under /Users. |
Hans Wennborg | 1907610 | 2013-07-31 20:51:53 +0000 | [diff] [blame] | 6 | |
Hans Wennborg | 96d5484 | 2013-08-02 22:24:50 +0000 | [diff] [blame^] | 7 | |
| 8 | // Alias options: |
| 9 | |
| 10 | // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=C %s |
| 11 | // C: -c |
| 12 | |
| 13 | // RUN: %clang_cl /Dfoo=bar -### -- %s 2>&1 | FileCheck -check-prefix=D %s |
| 14 | // RUN: %clang_cl /D foo=bar -### -- %s 2>&1 | FileCheck -check-prefix=D %s |
| 15 | // D: "-D" "foo=bar" |
| 16 | |
| 17 | // RTTI is on by default; just check that we don't error. |
| 18 | // RUN: %clang_cl /Zs /GR -- %s 2>&1 |
| 19 | |
| 20 | // RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s |
| 21 | // GR_: -fno-rtti |
| 22 | |
| 23 | // RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=I %s |
| 24 | // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=I %s |
| 25 | // I: "-I" "myincludedir" |
| 26 | |
| 27 | // RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s |
| 28 | // J: -fno-signed-char |
| 29 | |
| 30 | // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s |
| 31 | // O: -Ofoo |
| 32 | |
| 33 | // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s |
| 34 | // Ob0: -fno-inline |
| 35 | |
| 36 | // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s |
| 37 | // Od: -O0 |
| 38 | |
| 39 | // RUN: %clang_cl /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s |
| 40 | // Os: -Os |
| 41 | |
| 42 | // RUN: %clang_cl /Ot -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s |
| 43 | // Ot: -O2 |
| 44 | |
| 45 | // RUN: %clang_cl /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s |
| 46 | // Ox: -O3 |
| 47 | |
| 48 | // RUN: %clang_cl /Zs /Oy -- %s 2>&1 |
| 49 | |
| 50 | // RUN: %clang_cl /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s |
| 51 | // Oy_: -mdisable-fp-elim |
| 52 | |
| 53 | // RUN: %clang_cl /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s |
| 54 | // P: -E |
| 55 | |
| 56 | // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s |
| 57 | // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s |
| 58 | // U: "-U" "mymacro" |
| 59 | |
| 60 | // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s |
| 61 | // W0: -w |
| 62 | |
| 63 | // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s |
| 64 | // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s |
| 65 | // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s |
| 66 | // RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s |
| 67 | // RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s |
| 68 | // W1: -Wall |
| 69 | |
| 70 | // RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s |
| 71 | // WX: -Werror |
| 72 | |
| 73 | // RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s |
| 74 | // WX_: -Wno-error |
| 75 | |
| 76 | // RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s |
| 77 | // w: -w |
| 78 | |
| 79 | // RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s |
| 80 | // Zs: -fsyntax-only |
| 81 | |
| 82 | |
| 83 | // Ignored options. Check that we don't get "unused during compilation" errors. |
| 84 | // (/Zs is for syntax-only, /WX is for -Werror) |
| 85 | // RUN: %clang_cl /Zs /WX /analyze- /errorReport:foo /nologo /Ob1 /Ob2 -- %s |
| 86 | // RUN: %clang_cl /Zs /WX /Zc:forScope /Zc:wchar_t -- %s |
| 87 | |
| 88 | |
| 89 | // Unsupported but parsed options. Check that we don't error on them. |
| 90 | // (/Zs is for syntax-only) |
| 91 | // RUN: %clang_cl /Zs /EHsc /Fdfoo /Fobar /fp:precise /Gd /GL /GL- -- %s 2>&1 |
| 92 | // RUN: %clang_cl /Zs /Gm /Gm- /GS /Gy /Gy- /GZ /MD /MT /MDd /MTd /Oi -- %s 2>&1 |
| 93 | // RUN: %clang_cl /Zs /RTC1 /Tcfoo /TC /Tpbar /TP /wfoo /Zc:wchar_t- -- %s 2>&1 |
| 94 | // RUN: %clang_cl /Zs /ZI /Zi /showIncludes -- %s 2>&1 |