2013-08-03 06:24:50 +08:00
|
|
|
// Note: %s must be preceded by --, otherwise it may be interpreted as a
|
|
|
|
// command-line option, e.g. on Mac where %s is commonly under /Users.
|
2013-08-01 04:51:53 +08:00
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
|
|
|
|
// Alias options:
|
|
|
|
|
2014-06-12 03:44:53 +08:00
|
|
|
// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=c %s
|
|
|
|
// c: -c
|
|
|
|
|
|
|
|
// RUN: %clang_cl /C -### -- %s 2>&1 | FileCheck -check-prefix=C %s
|
|
|
|
// C: error: invalid argument '-C' only allowed with '/E, /P or /EP'
|
|
|
|
|
|
|
|
// RUN: %clang_cl /C /P -### -- %s 2>&1 | FileCheck -check-prefix=C_P %s
|
|
|
|
// C_P: "-E"
|
|
|
|
// C_P: "-C"
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2016-01-13 07:31:58 +08:00
|
|
|
// RUN: %clang_cl /Dfoo=bar /D bar=baz /DMYDEF#value /DMYDEF2=foo#bar /DMYDEF3#a=b /DMYDEF4# \
|
2016-01-13 07:17:03 +08:00
|
|
|
// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=D %s
|
2013-08-03 06:24:50 +08:00
|
|
|
// D: "-D" "foo=bar"
|
2016-01-13 07:17:03 +08:00
|
|
|
// D: "-D" "bar=baz"
|
|
|
|
// D: "-D" "MYDEF=value"
|
|
|
|
// D: "-D" "MYDEF2=foo#bar"
|
|
|
|
// D: "-D" "MYDEF3=a=b"
|
2016-01-13 07:31:58 +08:00
|
|
|
// D: "-D" "MYDEF4="
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2013-12-21 02:40:46 +08:00
|
|
|
// RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
|
|
|
|
// E: "-E"
|
|
|
|
// E: "-o" "-"
|
|
|
|
|
2014-06-14 04:59:54 +08:00
|
|
|
// RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s
|
|
|
|
// EP: "-E"
|
|
|
|
// EP: "-P"
|
|
|
|
// EP: "-o" "-"
|
|
|
|
|
2015-04-09 06:55:09 +08:00
|
|
|
// RUN: %clang_cl /fp:fast /fp:except -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept %s
|
|
|
|
// fpexcept-NOT: -menable-unsafe-fp-math
|
|
|
|
|
|
|
|
// RUN: %clang_cl /fp:fast /fp:except /fp:except- -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept_ %s
|
|
|
|
// fpexcept_: -menable-unsafe-fp-math
|
|
|
|
|
|
|
|
// RUN: %clang_cl /fp:precise /fp:fast -### -- %s 2>&1 | FileCheck -check-prefix=fpfast %s
|
|
|
|
// fpfast: -menable-unsafe-fp-math
|
|
|
|
// fpfast: -ffast-math
|
|
|
|
|
|
|
|
// RUN: %clang_cl /fp:fast /fp:precise -### -- %s 2>&1 | FileCheck -check-prefix=fpprecise %s
|
|
|
|
// fpprecise-NOT: -menable-unsafe-fp-math
|
|
|
|
// fpprecise-NOT: -ffast-math
|
|
|
|
|
|
|
|
// RUN: %clang_cl /fp:fast /fp:strict -### -- %s 2>&1 | FileCheck -check-prefix=fpstrict %s
|
|
|
|
// fpstrict-NOT: -menable-unsafe-fp-math
|
|
|
|
// fpstrict-NOT: -ffast-math
|
|
|
|
|
2016-08-26 02:24:35 +08:00
|
|
|
// RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck -check-prefix=gcolumn %s
|
|
|
|
// gcolumn: -dwarf-column-info
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck -check-prefix=gnocolumn %s
|
|
|
|
// gnocolumn-NOT: -dwarf-column-info
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s
|
|
|
|
// gdefcolumn-NOT: -dwarf-column-info
|
|
|
|
|
2015-05-20 12:39:56 +08:00
|
|
|
// RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s
|
|
|
|
// GA: -ftls-model=local-exec
|
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// RTTI is on by default; just check that we don't error.
|
|
|
|
// RUN: %clang_cl /Zs /GR -- %s 2>&1
|
|
|
|
|
|
|
|
// RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s
|
|
|
|
// GR_: -fno-rtti
|
|
|
|
|
2016-06-16 04:34:33 +08:00
|
|
|
// Security Buffer Check is on by default.
|
|
|
|
// RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=GS-default %s
|
|
|
|
// GS-default: "-stack-protector" "2"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /GS -### -- %s 2>&1 | FileCheck -check-prefix=GS %s
|
|
|
|
// GS: "-stack-protector" "2"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /GS- -### -- %s 2>&1 | FileCheck -check-prefix=GS_ %s
|
|
|
|
// GS_-NOT: -stack-protector
|
|
|
|
|
2014-03-24 01:47:22 +08:00
|
|
|
// RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s
|
|
|
|
// Gy: -ffunction-sections
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s
|
|
|
|
// Gy_-NOT: -ffunction-sections
|
|
|
|
|
2015-01-21 03:45:50 +08:00
|
|
|
// RUN: %clang_cl /Gs -### -- %s 2>&1 | FileCheck -check-prefix=Gs %s
|
|
|
|
// Gs: "-mstack-probe-size=0"
|
|
|
|
// RUN: %clang_cl /Gs0 -### -- %s 2>&1 | FileCheck -check-prefix=Gs0 %s
|
|
|
|
// Gs0: "-mstack-probe-size=0"
|
|
|
|
// RUN: %clang_cl /Gs4096 -### -- %s 2>&1 | FileCheck -check-prefix=Gs4096 %s
|
|
|
|
// Gs4096: "-mstack-probe-size=4096"
|
|
|
|
|
2014-04-08 00:14:38 +08:00
|
|
|
// RUN: %clang_cl /Gw -### -- %s 2>&1 | FileCheck -check-prefix=Gw %s
|
|
|
|
// Gw: -fdata-sections
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Gw /Gw- -### -- %s 2>&1 | FileCheck -check-prefix=Gw_ %s
|
|
|
|
// Gw_-NOT: -fdata-sections
|
|
|
|
|
2013-09-27 01:41:14 +08:00
|
|
|
// RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
|
|
|
|
// RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
|
|
|
|
// SLASH_I: "-I" "myincludedir"
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2016-04-13 03:04:37 +08:00
|
|
|
// RUN: %clang_cl /imsvcmyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
|
|
|
|
// RUN: %clang_cl /imsvc myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
|
|
|
|
// Clang's resource header directory should be first:
|
2016-04-14 23:32:24 +08:00
|
|
|
// SLASH_imsvc: "-internal-isystem" "{{[^"]*}}lib{{(64)?/|\\\\}}clang{{[^"]*}}include"
|
2016-04-13 03:04:37 +08:00
|
|
|
// SLASH_imsvc: "-internal-isystem" "myincludedir"
|
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s
|
|
|
|
// J: -fno-signed-char
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s
|
2015-07-27 15:32:11 +08:00
|
|
|
// O: /Ofoo
|
2013-08-03 06:24:50 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s
|
|
|
|
// Ob0: -fno-inline
|
|
|
|
|
2016-05-25 04:40:51 +08:00
|
|
|
// RUN: %clang_cl /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
|
2016-05-25 05:23:29 +08:00
|
|
|
// RUN: %clang_cl /Odb2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
|
2016-05-25 08:43:45 +08:00
|
|
|
// RUN: %clang_cl /O2 /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
|
|
|
|
// Ob2-NOT: warning: argument unused during compilation: '/O2'
|
2016-05-25 04:40:51 +08:00
|
|
|
// Ob2: -finline-functions
|
|
|
|
|
2016-06-23 00:56:16 +08:00
|
|
|
// RUN: %clang_cl /Ob1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
|
|
|
|
// RUN: %clang_cl /Odb1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
|
|
|
|
// Ob1: -finline-hint-functions
|
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s
|
|
|
|
// Od: -O0
|
|
|
|
|
2013-08-09 07:44:01 +08:00
|
|
|
// RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s
|
|
|
|
// Oi-NOT: -fno-builtin
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s
|
|
|
|
// Oi_: -fno-builtin
|
|
|
|
|
2015-10-03 15:15:28 +08:00
|
|
|
// RUN: %clang_cl /Os --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
|
|
|
|
// RUN: %clang_cl /Os --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
|
2015-07-27 15:32:11 +08:00
|
|
|
// Os-NOT: -mdisable-fp-elim
|
|
|
|
// Os: -momit-leaf-frame-pointer
|
2013-08-03 06:24:50 +08:00
|
|
|
// Os: -Os
|
|
|
|
|
2015-10-03 15:15:28 +08:00
|
|
|
// RUN: %clang_cl /Ot --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
|
|
|
|
// RUN: %clang_cl /Ot --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
|
2015-07-27 15:32:11 +08:00
|
|
|
// Ot-NOT: -mdisable-fp-elim
|
|
|
|
// Ot: -momit-leaf-frame-pointer
|
2013-08-03 06:24:50 +08:00
|
|
|
// Ot: -O2
|
|
|
|
|
2015-10-03 15:15:28 +08:00
|
|
|
// RUN: %clang_cl /Ox --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
|
|
|
|
// RUN: %clang_cl /Ox --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
|
2015-07-27 15:32:11 +08:00
|
|
|
// Ox-NOT: -mdisable-fp-elim
|
|
|
|
// Ox: -momit-leaf-frame-pointer
|
|
|
|
// Ox: -O2
|
|
|
|
|
2015-08-25 08:46:45 +08:00
|
|
|
// RUN: %clang_cl --target=i686-pc-win32 /O2sy- -### -- %s 2>&1 | FileCheck -check-prefix=PR24003 %s
|
2015-07-27 15:32:11 +08:00
|
|
|
// PR24003: -mdisable-fp-elim
|
|
|
|
// PR24003: -momit-leaf-frame-pointer
|
|
|
|
// PR24003: -Os
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2016-03-23 23:37:41 +08:00
|
|
|
// RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_2 %s
|
2016-01-22 07:01:11 +08:00
|
|
|
// Oy_2: -momit-leaf-frame-pointer
|
|
|
|
// Oy_2: -O2
|
|
|
|
|
2016-03-23 23:37:41 +08:00
|
|
|
// RUN: %clang_cl /Zs -Werror /Oy -- %s 2>&1
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2016-03-23 23:37:41 +08:00
|
|
|
// RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s
|
2013-08-03 06:24:50 +08:00
|
|
|
// Oy_: -mdisable-fp-elim
|
|
|
|
|
2015-05-14 13:19:17 +08:00
|
|
|
// RUN: %clang_cl /Qvec -### -- %s 2>&1 | FileCheck -check-prefix=Qvec %s
|
|
|
|
// Qvec: -vectorize-loops
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Qvec /Qvec- -### -- %s 2>&1 | FileCheck -check-prefix=Qvec_ %s
|
|
|
|
// Qvec_-NOT: -vectorize-loops
|
|
|
|
|
2013-08-09 08:32:23 +08:00
|
|
|
// RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s
|
|
|
|
// showIncludes: --show-includes
|
|
|
|
|
2014-07-22 07:42:07 +08:00
|
|
|
// RUN: %clang_cl /E /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
|
|
|
|
// RUN: %clang_cl /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
|
|
|
|
// showIncludes_E: warning: argument unused during compilation: '--show-includes'
|
|
|
|
|
2016-08-24 00:47:09 +08:00
|
|
|
// /source-charset: should warn on everything except UTF-8.
|
|
|
|
// RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
|
|
|
|
// source-charset-utf-16: invalid value 'utf-16'
|
|
|
|
|
2016-08-27 05:11:43 +08:00
|
|
|
// /execution-charset: should warn on everything except UTF-8.
|
|
|
|
// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s
|
|
|
|
// execution-charset-utf-16: invalid value 'utf-16'
|
|
|
|
//
|
2013-08-03 06:24:50 +08:00
|
|
|
// RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
|
|
|
|
// RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
|
|
|
|
// U: "-U" "mymacro"
|
|
|
|
|
2014-03-24 01:47:18 +08:00
|
|
|
// RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s
|
|
|
|
// VD2: -vtordisp-mode=2
|
|
|
|
|
2014-02-12 05:05:00 +08:00
|
|
|
// RUN: %clang_cl /vmg -### -- %s 2>&1 | FileCheck -check-prefix=VMG %s
|
|
|
|
// VMG: "-fms-memptr-rep=virtual"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /vmg /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMS %s
|
|
|
|
// VMS: "-fms-memptr-rep=single"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /vmg /vmm -### -- %s 2>&1 | FileCheck -check-prefix=VMM %s
|
|
|
|
// VMM: "-fms-memptr-rep=multiple"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /vmg /vmv -### -- %s 2>&1 | FileCheck -check-prefix=VMV %s
|
|
|
|
// VMV: "-fms-memptr-rep=virtual"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /vmg /vmb -### -- %s 2>&1 | FileCheck -check-prefix=VMB %s
|
|
|
|
// VMB: '/vmg' not allowed with '/vmb'
|
|
|
|
|
|
|
|
// RUN: %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s
|
|
|
|
// VMX: '/vms' not allowed with '/vmm'
|
|
|
|
|
2015-02-14 09:35:12 +08:00
|
|
|
// RUN: %clang_cl /volatile:iso -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-ISO %s
|
|
|
|
// VOLATILE-ISO-NOT: "-fms-volatile"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /volatile:ms -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-MS %s
|
|
|
|
// VOLATILE-MS: "-fms-volatile"
|
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s
|
|
|
|
// W0: -w
|
|
|
|
|
|
|
|
// RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
|
|
|
|
// RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
|
|
|
|
// RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
|
2015-12-12 06:31:16 +08:00
|
|
|
// RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s
|
2015-12-15 02:46:11 +08:00
|
|
|
// RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s
|
2013-08-03 06:24:50 +08:00
|
|
|
// W1: -Wall
|
2015-12-12 06:31:16 +08:00
|
|
|
// W4: -WCL4
|
2013-08-03 06:24:50 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s
|
|
|
|
// WX: -Werror
|
|
|
|
|
|
|
|
// RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s
|
|
|
|
// WX_: -Wno-error
|
|
|
|
|
|
|
|
// RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s
|
|
|
|
// w: -w
|
|
|
|
|
2014-07-26 01:30:10 +08:00
|
|
|
// RUN: %clang_cl /Zp -### -- %s 2>&1 | FileCheck -check-prefix=ZP %s
|
|
|
|
// ZP: -fpack-struct=1
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Zp2 -### -- %s 2>&1 | FileCheck -check-prefix=ZP2 %s
|
|
|
|
// ZP2: -fpack-struct=2
|
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s
|
|
|
|
// Zs: -fsyntax-only
|
|
|
|
|
2013-09-27 01:41:14 +08:00
|
|
|
// RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s
|
|
|
|
// FI: "-include" "asdf.h"
|
|
|
|
|
2013-10-30 03:42:01 +08:00
|
|
|
// RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s
|
|
|
|
// FI_: "-include" "asdf.h"
|
|
|
|
|
2016-02-29 09:40:36 +08:00
|
|
|
// RUN: %clang_cl /TP /c -### -- %s 2>&1 | FileCheck -check-prefix=NO-GX %s
|
2016-02-23 01:44:51 +08:00
|
|
|
// NO-GX-NOT: "-fcxx-exceptions" "-fexceptions"
|
|
|
|
|
2016-02-29 09:40:36 +08:00
|
|
|
// RUN: %clang_cl /TP /c /GX -### -- %s 2>&1 | FileCheck -check-prefix=GX %s
|
2016-02-20 17:23:44 +08:00
|
|
|
// GX: "-fcxx-exceptions" "-fexceptions"
|
|
|
|
|
2016-02-29 09:40:36 +08:00
|
|
|
// RUN: %clang_cl /TP /c /GX /GX- -### -- %s 2>&1 | FileCheck -check-prefix=GX_ %s
|
2016-02-20 17:23:44 +08:00
|
|
|
// GX_-NOT: "-fcxx-exceptions" "-fexceptions"
|
|
|
|
|
2013-09-04 07:18:43 +08:00
|
|
|
// We forward any unrecognized -W diagnostic options to cc1.
|
|
|
|
// RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s
|
|
|
|
// WJoined: "-cc1"
|
|
|
|
// WJoined: "-Wunused-pragmas"
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2014-04-10 04:07:39 +08:00
|
|
|
// We recognize -f[no-]strict-aliasing.
|
|
|
|
// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTSTRICT %s
|
|
|
|
// DEFAULTSTRICT: "-relaxed-aliasing"
|
|
|
|
// RUN: %clang_cl -c -fstrict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=STRICT %s
|
|
|
|
// STRICT-NOT: "-relaxed-aliasing"
|
|
|
|
// RUN: %clang_cl -c -fno-strict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=NOSTRICT %s
|
|
|
|
// NOSTRICT: "-relaxed-aliasing"
|
|
|
|
|
2014-04-04 09:36:55 +08:00
|
|
|
// For some warning ids, we can map from MSVC warning to Clang warning.
|
2015-12-16 01:07:16 +08:00
|
|
|
// RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s
|
2015-02-18 07:28:19 +08:00
|
|
|
// Wno: "-cc1"
|
|
|
|
// Wno: "-Wno-macro-redefined"
|
2015-12-16 01:07:16 +08:00
|
|
|
// Wno: "-Wno-unused-parameter"
|
2015-06-12 02:14:11 +08:00
|
|
|
// Wno: "-Wno-dllexport-explicit-instantiation-decl"
|
2015-12-16 01:07:16 +08:00
|
|
|
// Wno: "-Wno-deprecated-declarations"
|
2013-09-17 08:03:41 +08:00
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// Ignored options. Check that we don't get "unused during compilation" errors.
|
2015-03-03 06:09:05 +08:00
|
|
|
// RUN: %clang_cl /c \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /analyze- \
|
2015-09-19 04:49:33 +08:00
|
|
|
// RUN: /bigobj \
|
2014-12-14 06:24:16 +08:00
|
|
|
// RUN: /cgthreads4 \
|
|
|
|
// RUN: /cgthreads8 \
|
2016-03-30 03:41:02 +08:00
|
|
|
// RUN: /d2FastFail \
|
2014-11-15 02:24:08 +08:00
|
|
|
// RUN: /d2Zi+ \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /errorReport:foo \
|
2016-08-27 05:11:43 +08:00
|
|
|
// RUN: /execution-charset:utf-8 \
|
2016-03-22 01:19:31 +08:00
|
|
|
// RUN: /FC \
|
2015-02-26 03:17:50 +08:00
|
|
|
// RUN: /Fdfoo \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /FS \
|
2014-12-14 06:13:23 +08:00
|
|
|
// RUN: /Gd \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /GF \
|
|
|
|
// RUN: /GS- \
|
|
|
|
// RUN: /kernel- \
|
|
|
|
// RUN: /nologo \
|
2015-03-03 06:09:05 +08:00
|
|
|
// RUN: /openmp- \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /RTC1 \
|
|
|
|
// RUN: /sdl \
|
|
|
|
// RUN: /sdl- \
|
2016-08-24 00:47:09 +08:00
|
|
|
// RUN: /source-charset:utf-8 \
|
2016-08-27 05:26:29 +08:00
|
|
|
// RUN: /utf-8 \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /vmg \
|
2014-12-14 06:44:46 +08:00
|
|
|
// RUN: /volatile:iso \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /w12345 \
|
|
|
|
// RUN: /wd1234 \
|
2014-11-15 02:24:08 +08:00
|
|
|
// RUN: /Zo \
|
|
|
|
// RUN: /Zo- \
|
2014-03-29 04:45:05 +08:00
|
|
|
// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
|
|
|
|
// IGNORED-NOT: argument unused during compilation
|
2014-11-15 02:24:08 +08:00
|
|
|
// IGNORED-NOT: no such file or directory
|
2015-03-03 06:09:05 +08:00
|
|
|
// Don't confuse /openmp- with the /o flag:
|
|
|
|
// IGNORED-NOT: "-o" "penmp-.obj"
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2013-09-17 08:03:41 +08:00
|
|
|
// Ignored options and compile-only options are ignored for link jobs.
|
2013-09-17 08:50:43 +08:00
|
|
|
// RUN: touch %t.obj
|
2013-09-17 08:03:41 +08:00
|
|
|
// RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
|
|
|
|
// RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
|
|
|
|
// RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
|
|
|
|
// LINKUNUSED-NOT: argument unused during compilation
|
|
|
|
|
2013-09-05 18:09:03 +08:00
|
|
|
// Support ignoring warnings about unused arguments.
|
|
|
|
// RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s
|
2014-03-29 04:45:05 +08:00
|
|
|
// UNUSED-NOT: argument unused during compilation
|
2013-09-05 18:09:03 +08:00
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// Unsupported but parsed options. Check that we don't error on them.
|
|
|
|
// (/Zs is for syntax-only)
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: %clang_cl /Zs \
|
|
|
|
// RUN: /AIfoo \
|
|
|
|
// RUN: /clr:pure \
|
|
|
|
// RUN: /docname \
|
|
|
|
// RUN: /EHsc \
|
|
|
|
// RUN: /F \
|
|
|
|
// RUN: /FA \
|
|
|
|
// RUN: /FAc \
|
|
|
|
// RUN: /Fafilename \
|
|
|
|
// RUN: /FAs \
|
|
|
|
// RUN: /FAu \
|
|
|
|
// RUN: /favor:blend \
|
|
|
|
// RUN: /Fifoo \
|
|
|
|
// RUN: /Fmfoo \
|
|
|
|
// RUN: /FpDebug\main.pch \
|
|
|
|
// RUN: /Frfoo \
|
|
|
|
// RUN: /FRfoo \
|
|
|
|
// RUN: /FU foo \
|
|
|
|
// RUN: /Fx \
|
|
|
|
// RUN: /G1 \
|
|
|
|
// RUN: /G2 \
|
|
|
|
// RUN: /GA \
|
|
|
|
// RUN: /Gd \
|
|
|
|
// RUN: /Ge \
|
|
|
|
// RUN: /Gh \
|
|
|
|
// RUN: /GH \
|
|
|
|
// RUN: /GL \
|
|
|
|
// RUN: /GL- \
|
|
|
|
// RUN: /Gm \
|
|
|
|
// RUN: /Gm- \
|
|
|
|
// RUN: /Gr \
|
|
|
|
// RUN: /GS \
|
|
|
|
// RUN: /GT \
|
2015-11-05 00:11:56 +08:00
|
|
|
// RUN: /guard:cf \
|
|
|
|
// RUN: /guard:cf- \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /GX \
|
2014-12-14 06:06:23 +08:00
|
|
|
// RUN: /Gv \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /Gz \
|
|
|
|
// RUN: /GZ \
|
|
|
|
// RUN: /H \
|
|
|
|
// RUN: /homeparams \
|
|
|
|
// RUN: /hotpatch \
|
|
|
|
// RUN: /kernel \
|
|
|
|
// RUN: /LN \
|
|
|
|
// RUN: /MP \
|
|
|
|
// RUN: /o foo.obj \
|
|
|
|
// RUN: /ofoo.obj \
|
|
|
|
// RUN: /openmp \
|
|
|
|
// RUN: /Qfast_transcendentals \
|
|
|
|
// RUN: /QIfist \
|
|
|
|
// RUN: /Qimprecise_fwaits \
|
|
|
|
// RUN: /Qpar \
|
|
|
|
// RUN: /Qvec-report:2 \
|
|
|
|
// RUN: /u \
|
|
|
|
// RUN: /V \
|
2014-12-14 06:44:46 +08:00
|
|
|
// RUN: /volatile:ms \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /wfoo \
|
|
|
|
// RUN: /WL \
|
|
|
|
// RUN: /Wp64 \
|
|
|
|
// RUN: /X \
|
|
|
|
// RUN: /Y- \
|
|
|
|
// RUN: /Yc \
|
|
|
|
// RUN: /Ycstdafx.h \
|
|
|
|
// RUN: /Yd \
|
|
|
|
// RUN: /Yl- \
|
|
|
|
// RUN: /Ylfoo \
|
|
|
|
// RUN: /Yustdafx.h \
|
|
|
|
// RUN: /Z7 \
|
|
|
|
// RUN: /Za \
|
|
|
|
// RUN: /Ze \
|
|
|
|
// RUN: /Zg \
|
|
|
|
// RUN: /Zi \
|
|
|
|
// RUN: /ZI \
|
|
|
|
// RUN: /Zl \
|
|
|
|
// RUN: /ZW:nostdlib \
|
|
|
|
// RUN: -- %s 2>&1
|
2013-08-20 02:32:59 +08:00
|
|
|
|
|
|
|
// We support -Xclang for forwarding options to cc1.
|
|
|
|
// RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
|
|
|
|
// Xclang: "-cc1"
|
|
|
|
// Xclang: "hellocc1"
|
2013-09-17 08:03:41 +08:00
|
|
|
|
2014-07-02 06:24:56 +08:00
|
|
|
// RTTI is on by default. /GR- controls -fno-rtti-data.
|
|
|
|
// RUN: %clang_cl /c /GR- -### -- %s 2>&1 | FileCheck -check-prefix=NoRTTI %s
|
|
|
|
// NoRTTI: "-fno-rtti-data"
|
|
|
|
// NoRTTI-NOT: "-fno-rtti"
|
2014-02-26 02:36:22 +08:00
|
|
|
// RUN: %clang_cl /c /GR -### -- %s 2>&1 | FileCheck -check-prefix=RTTI %s
|
2014-07-02 06:24:56 +08:00
|
|
|
// RTTI-NOT: "-fno-rtti-data"
|
2014-02-26 02:36:22 +08:00
|
|
|
// RTTI-NOT: "-fno-rtti"
|
|
|
|
|
2015-03-22 16:39:22 +08:00
|
|
|
// thread safe statics are off for versions < 19.
|
2016-05-14 07:20:11 +08:00
|
|
|
// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
|
2015-03-22 16:39:22 +08:00
|
|
|
// RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
|
|
|
|
// NoThreadSafeStatics: "-fno-threadsafe-statics"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s
|
|
|
|
// ThreadSafeStatics-NOT: "-fno-threadsafe-statics"
|
|
|
|
|
2015-08-06 02:51:13 +08:00
|
|
|
// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s
|
|
|
|
// Zi: "-gcodeview"
|
2016-02-11 05:28:38 +08:00
|
|
|
// Zi: "-debug-info-kind=limited"
|
2015-08-06 02:51:13 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s
|
|
|
|
// Z7: "-gcodeview"
|
2016-02-11 05:28:38 +08:00
|
|
|
// Z7: "-debug-info-kind=limited"
|
2015-10-08 12:24:12 +08:00
|
|
|
|
2016-07-10 05:49:16 +08:00
|
|
|
// RUN: %clang_cl /Zd /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s
|
2016-03-19 02:42:56 +08:00
|
|
|
// Z7GMLT: "-gcodeview"
|
|
|
|
// Z7GMLT: "-debug-info-kind=line-tables-only"
|
|
|
|
|
2016-08-10 01:23:56 +08:00
|
|
|
// RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s
|
|
|
|
// ZGMLT: "-gcodeview"
|
|
|
|
// ZGMLT: "-debug-info-kind=line-tables-only"
|
|
|
|
|
2015-12-22 06:09:34 +08:00
|
|
|
// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s
|
|
|
|
// BreproDefault: "-mincremental-linker-compatible"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Brepro- /Brepro /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro %s
|
2016-08-24 03:32:02 +08:00
|
|
|
// Brepro-NOT: "-mincremental-linker-compatible"
|
2015-12-22 06:09:34 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cl /Brepro /Brepro- /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro_ %s
|
2016-08-24 03:32:02 +08:00
|
|
|
// Brepro_: "-mincremental-linker-compatible"
|
2015-12-22 06:09:34 +08:00
|
|
|
|
2015-10-08 12:24:12 +08:00
|
|
|
// This test was super sneaky: "/Z7" means "line-tables", but "-gdwarf" occurs
|
|
|
|
// later on the command line, so it should win. Interestingly the cc1 arguments
|
|
|
|
// came out right, but had wrong semantics, because an invariant assumed by
|
|
|
|
// CompilerInvocation was violated: it expects that at most one of {gdwarfN,
|
|
|
|
// line-tables-only} appear. If you assume that, then you can safely use
|
|
|
|
// Args.hasArg to test whether a boolean flag is present without caring
|
|
|
|
// where it appeared. And for this test, it appeared to the left of -gdwarf
|
|
|
|
// which made it "win". This test could not detect that bug.
|
2015-08-06 02:51:13 +08:00
|
|
|
// RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s
|
|
|
|
// Z7_gdwarf: "-gcodeview"
|
2015-10-08 12:24:12 +08:00
|
|
|
// Z7_gdwarf: "-debug-info-kind=limited"
|
|
|
|
// Z7_gdwarf: "-dwarf-version=4"
|
2015-08-06 02:51:13 +08:00
|
|
|
|
2015-05-18 12:49:30 +08:00
|
|
|
// RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s
|
|
|
|
// CXX11: -std=c++11
|
|
|
|
|
|
|
|
// RUN: %clang_cl -fmsc-version=1900 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX14 %s
|
|
|
|
// CXX14: -std=c++14
|
|
|
|
|
2016-06-27 10:32:12 +08:00
|
|
|
// RUN: %clang_cl -fmsc-version=1900 -TP -std:c++14 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX14 %s
|
|
|
|
// STDCXX14: -std=c++14
|
|
|
|
|
|
|
|
// RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | FileCheck -check-prefix=STDCXXLATEST %s
|
|
|
|
// STDCXXLATEST: -std=c++1z
|
|
|
|
|
2015-08-11 02:16:32 +08:00
|
|
|
// RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s
|
|
|
|
// ENV-CL: "-ffunction-sections"
|
|
|
|
|
|
|
|
// RUN: env CL="/Gy" _CL_="/Gy- -- %s" %clang_cl -### 2>&1 | FileCheck -check-prefix=ENV-_CL_ %s
|
|
|
|
// ENV-_CL_-NOT: "-ffunction-sections"
|
|
|
|
|
2014-07-17 00:03:56 +08:00
|
|
|
// Accept "core" clang options.
|
2015-04-11 19:44:44 +08:00
|
|
|
// (/Zs is for syntax-only, -Werror makes it fail hard on unknown options)
|
2014-07-17 00:29:00 +08:00
|
|
|
// RUN: %clang_cl \
|
|
|
|
// RUN: --driver-mode=cl \
|
2015-04-11 20:27:56 +08:00
|
|
|
// RUN: -fcolor-diagnostics \
|
|
|
|
// RUN: -fno-color-diagnostics \
|
2015-04-12 15:12:19 +08:00
|
|
|
// RUN: -fdiagnostics-color \
|
|
|
|
// RUN: -fno-diagnostics-color \
|
2015-04-22 07:12:03 +08:00
|
|
|
// RUN: -fdiagnostics-parseable-fixits \
|
2016-08-26 23:45:36 +08:00
|
|
|
// RUN: -fdiagnostics-absolute-paths \
|
2014-07-17 00:29:00 +08:00
|
|
|
// RUN: -ferror-limit=10 \
|
2014-07-17 00:03:56 +08:00
|
|
|
// RUN: -fmsc-version=1800 \
|
2014-07-17 00:29:00 +08:00
|
|
|
// RUN: -fno-strict-aliasing \
|
|
|
|
// RUN: -fstrict-aliasing \
|
2015-04-15 18:02:21 +08:00
|
|
|
// RUN: -fsyntax-only \
|
2015-10-09 07:13:28 +08:00
|
|
|
// RUN: -fms-compatibility \
|
|
|
|
// RUN: -fno-ms-compatibility \
|
|
|
|
// RUN: -fms-extensions \
|
|
|
|
// RUN: -fno-ms-extensions \
|
2014-07-17 00:29:00 +08:00
|
|
|
// RUN: -mllvm -disable-llvm-optzns \
|
2016-06-14 04:31:30 +08:00
|
|
|
// RUN: -resource-dir \
|
2015-04-11 19:44:44 +08:00
|
|
|
// RUN: -Wunused-variable \
|
|
|
|
// RUN: -fmacro-backtrace-limit=0 \
|
|
|
|
// RUN: -Werror /Zs -- %s 2>&1
|
2014-07-17 00:03:56 +08:00
|
|
|
|
2013-10-11 06:36:20 +08:00
|
|
|
|
2013-09-17 08:03:41 +08:00
|
|
|
void f() { }
|