I had seen a while ago the “hidden” MSVC flags that output interesting information such as /d2cgsummary or d1reportAllClassLayout.

At that moment I told myself:

Are there other hidden commands ?

I thought I should look into this, then forgot about it, but the recent article from Aras about /d1reportTime gave me enough motivation to take a few minutes to list all the unknown flags !

And here they are ! (it is quite easy to retrieve them from tools such as IDA Pro or OllyDbg)

The .dlls of the compiler

There are 3 .dll files involved with the cl.exe compiler (note their purpose is actually just a guess):

  • c1.dll: the C frontend
  • c1xx.dll: the C++ frontend
  • c2.dll: the optimizer

Each dll has its own set of commands, so you need the /dX prefix to tell what dll the argument should be forwarded to. /d1------ is for the frontend (C or C++) and /d2------ for the optimizer. Note that you need to replace the - in the exported list by /dx.

The list of commands you’ve all been waiting for ! Some are well-documented flags, but I might make another post with the most interesting ones that are not documented another day !

The flags list

Note the flags listed are from the 19.16.27025.1 build of the compiler (Visual Studio 2017 15.9.4).

c1xx.dll

  • -ACf*
  • -ACp*
  • -ACr
  • -AI#
  • -ATTRDBG
  • -Aall
  • -Aall-
  • -Adfanoisy
  • -Adisablecoreplugins
  • -Afull
  • -Alint
  • -Alint-
  • -Alocationregex#
  • -Amacroall
  • -Amacroall-
  • -Amacroreboot
  • -Amacroreboot-
  • -Amacrosrc
  • -Amacrosrc-
  • -Amaxmemory#
  • -Analyze
  • -Anew
  • -Anew*
  • -Anewfailure#
  • -Ao*
  • -Apch
  • -Apch*
  • -Aperfmessages
  • -Aprintast
  • -AssociatedSymbols
  • -Azm#
  • -BNOPPCH
  • -BPPCH
  • -BcomputeZmValue
  • -Bd%
  • -Bident
  • -Binl
  • -Bm#
  • -BnoWorkList
  • -Brepro
  • -Bscn
  • -BuildingMSVCDLL
  • -BuildingVCCorlib
  • -Bv%
  • -CompressPCH
  • -EHa
  • -EHc
  • -EHs
  • -ESc
  • -FI#
  • -FR#
  • -FU#
  • -FastFail
  • -Fd#
  • -Fi#
  • -Fo*
  • -Fp#
  • -Fr#
  • -Fv:#
  • -G%d
  • -Gil
  • -Gt#
  • -INCLUDE:
  • -MDd
  • -MLd
  • -MPdiagMutex$
  • -MTd
  • -NTcompat
  • -NewQname
  • -NewQname-
  • -NewReturnUDT
  • -NewReturnUDT-
  • -NonStandardNewDelete
  • -NonStandardNoThrow
  • -Ob#
  • -PMasMB
  • -ParseTrees:Errors
  • -ParseTrees:FTB
  • -ParseTrees:NewErrors
  • -ParseTrees:OOL
  • -ParseTrees:PT
  • -ParseTrees:Print
  • -ParseTrees:RDLU
  • -ParseTrees:SW
  • -ParseTrees:SWSig
  • -ParseTrees:Sema
  • -ParseTrees:SemaExtendedDecls
  • -ParseTrees:SemaExtendedDecls-
  • -ParseTrees:SemaMemberAccess
  • -ParseTrees:SemaMemberAccess-
  • -ParseTrees:TemplateId
  • -ParseTrees:identErrors
  • -ParseTrees:identErrors-
  • -ParseTrees:opBind-
  • -PrivateNativeTypes
  • -PublicPDB
  • -RTCc
  • -RTCs
  • -RTCu
  • -ReturnUdtEHInline
  • -ReturnUdtEHInline-
  • -SkipPchHash
  • -WL-
  • -WS-
  • -WT#
  • -Wall
  • -WarnOnGlobals
  • -Wv:#
  • -Yc*
  • -Yl*
  • -Yu*
  • -ZB*
  • -ZBe
  • -ZH:SHA_256
  • -ZILP#
  • -ZW:nostdlib
  • -ZWbad_alloc
  • -ZWcliboxing
  • -ZWdbglog
  • -ZWinstr
  • -ZWodr
  • -ZWoldTokenStreams
  • -ZWtokens
  • -ZWvirtPubAsNonVirt
  • -ZX*
  • -Zc:__cplusplus
  • -Zc:__cplusplus-
  • -Zc:alignedNew
  • -Zc:alignedNew-
  • -Zc:auto
  • -Zc:auto-
  • -Zc:externConstexpr
  • -Zc:forScope
  • -Zc:forScope-
  • -Zc:implicitNoexcept
  • -Zc:implicitNoexcept-
  • -Zc:noexceptTypes
  • -Zc:noexceptTypes-
  • -Zc:offsetof-
  • -Zc:referenceBinding
  • -Zc:referenceBinding-
  • -Zc:rvalueCast
  • -Zc:rvalueCast-
  • -Zc:sizedDealloc
  • -Zc:sizedDealloc-
  • -Zc:strictStrings
  • -Zc:strictStrings-
  • -Zc:ternary
  • -Zc:ternary-
  • -Zc:threadSafeInit
  • -Zc:threadSafeInit-
  • -Zc:trigraphs
  • -Zc:trigraphs-
  • -Zc:twoPhase
  • -Zc:twoPhase-
  • -Zc:wchar_t
  • -Zc:wchar_t-
  • -Zf-
  • -Zld
  • -Zm#
  • -Zp#
  • -Zt#
  • -acplog:*
  • -aliasParseTrees
  • -aliasParseTrees-
  • -allChunksReserved
  • -analyze:WX-
  • -analyze:autolog
  • -analyze:autolog-
  • -analyze:autolog:ext#
  • -analyze:log#
  • -analyze:max_paths#
  • -analyze:model#
  • -analyze:only
  • -analyze:plugin#
  • -analyze:quiet
  • -analyze:quiet-
  • -analyze:ruleset#
  • -analyze:stacksize#
  • -autoclassinit
  • -await
  • -breakOnIlKey#
  • -cbstring
  • -clr:nomscorlib
  • -clr:nostdlib
  • -clr:oldCustomModifiers
  • -clrNoPureCRT
  • -clrinitlocals
  • -clrpure
  • -clrsafe
  • -clrver$
  • -constexpr:backtrace#
  • -constexpr:depth#
  • -constexpr:steps#
  • -debugBreak%
  • -debugCounter#
  • -debugCounterBreak
  • -debugtype:allsource
  • -diagnostics:caret
  • -diagnostics:caret-
  • -diagnostics:column
  • -diagnostics:column-
  • -diagwarn#
  • -displayColumn
  • -doc#
  • -errorreport:none
  • -errorreport:prompt
  • -errorreport:queue
  • -errorreport:send
  • -execution-charset:#
  • -experimental:concepts
  • -experimental:concepts-
  • -experimental:deterministic
  • -experimental:deterministic-
  • -experimental:expressionEvaluationOrder
  • -experimental:expressionEvaluationOrder-
  • -experimental:module
  • -experimental:module-
  • -experimental:preprocessor
  • -experimental:preprocessor-
  • -exportStaticDataMembers
  • -exportStaticDataMembers-
  • -external:I#
  • -external:W#
  • -external:anglebrackets
  • -external:templates-
  • -forceDisplayColumn
  • -forceZ7
  • -fpexcept
  • -fpfast
  • -fpstrict
  • -gce
  • -gce-
  • -hybrid:x86arm64
  • -hybrid:x86native
  • -ignorePchTimestamp
  • -ignorePragmaWarningError
  • -il$
  • -import_no_path
  • -import_no_registry
  • -initall*
  • -kernel
  • -kernel-
  • -ltcg
  • -module:demandLoad
  • -module:demandLoad-
  • -module:displayToC
  • -module:displayTokens
  • -module:export
  • -module:exportActiveMacros
  • -module:exportMacro
  • -module:interface
  • -module:merge
  • -module:mergeParseTrees-
  • -module:name
  • -module:noStdIfc
  • -module:output
  • -module:parseTrees
  • -module:parseTrees-
  • -module:reference
  • -module:search
  • -module:stdIfcDir
  • -module:wrapper
  • -module:wrapperMacros
  • -noChunkWrite
  • -noCodegen
  • -noTypeTraitOptimization
  • -nodatetime
  • -noexpinl
  • -nologo
  • -nonUDToperators
  • -nothreadsafestatics
  • -omp
  • -parsePackExpressions
  • -parsePackExpressions-
  • -pathmap:#
  • -pc#
  • -permissive
  • -permissive-
  • -qualifiedEnumsOK
  • -reportAllClassLayout
  • -reportClassLayoutChanges
  • -reportMemory
  • -reportSingleClassLayout#
  • -reportTime
  • -rttiSections
  • -safedelete
  • -scalableIncludeMaxFilterSize#
  • -scalableinclude
  • -scalableinclude-
  • -scalableinclude1
  • -scalableincludeRemote1
  • -sdlMode
  • -showIncludes
  • -sm#
  • -source-charset:#
  • -std:c++*
  • -templateStats
  • -trimfile:#
  • -typedil
  • -uselinevar
  • -utf-8
  • -validate-charset
  • -validate-charset-
  • -variableTemplates
  • -variableTemplates-
  • -vc7dname
  • -vd#
  • -versionLKG171
  • -vmb
  • -vmg
  • -vmm
  • -vms
  • -vmv
  • -vtguard:lvl#
  • -w1#
  • -w2#
  • -w3#
  • -w4#
  • -warningLKG171
  • -wd#
  • -we#
  • -wo#
  • -zm#

c2.dll

  • -AlignFuncs
  • -AllowCompatibleILVersions
  • -AmpShaderInformation
  • -AssertRecursiveInline
  • -Bd
  • -BinaryDevirt+
  • -BinaryDevirt-
  • -Brepro
  • -CollapseAtExit+
  • -CollapseAtExit-
  • -ConservativeInteriorPointers
  • -CoroOptsWorkaround
  • -CoroOptsWorkaround-
  • -DisablePGIMT
  • -DisableWPABUMT
  • -DisableWPATDMT
  • -EHa
  • -EHr
  • -EHs
  • -EmitExProcDbgSym
  • -EmitExProcDbgSym-
  • -EnablePGIMT
  • -EnableWPABUMT
  • -EnableWPATDMT
  • -FA#
  • -FAF
  • -FAf
  • -FH4
  • -FH4-
  • -Fa#
  • -FastFail
  • -FastFail-
  • -FatObjData
  • -FatObjFunc
  • -Fd#
  • -Fg#
  • -FitObjData
  • -FitObjFunc
  • -Fl#
  • -Fo#
  • -Fs#
  • -FuncCache#
  • -FuncletComdat+
  • -FuncletComdat-
  • -G#
  • -Gil
  • -Gs#
  • -Gt#
  • -H#
  • -InlineDecisions:#
  • -JMC
  • -JMC-
  • -Loop#
  • -MD
  • -MDd
  • -ML
  • -MLd
  • -MPX
  • -MPdiagMutex#
  • -MT
  • -MTd
  • -MakeHotPatch
  • -MarkStaticBodiesCold+
  • -MarkStaticBodiesCold-
  • -MixDataCode
  • -NewPerfectLoopUnroll+
  • -NewPerfectLoopUnroll-
  • -NoLUR
  • -NoPrefetch
  • -NoSmallFunctionOpt
  • -NoTypeChanges
  • -Ob#
  • -ObjSubDir#
  • -Og
  • -OnlyPrePass
  • -OnlySpecDevirtForInlining+
  • -OnlySpecDevirtForInlining-
  • -OptimizeAMP
  • -OptimizeHugeFunctions
  • -OptimizeHugeFunctions-
  • -OptimizeMagicStatics+
  • -OptimizeMagicStatics-
  • -Os
  • -Ot
  • -PGCMemMax#
  • -PGCMemMin#
  • -PPhase#
  • -PgoPdbOff
  • -PogoAggressive
  • -PogoAlwaysSize#
  • -PogoCodeCoverage
  • -PogoColdOff
  • -PogoColdOpt
  • -PogoDFInline
  • -PogoDeadOff
  • -PogoDeadOpt
  • -PogoDiagnose
  • -PogoDwordProbe
  • -PogoDynamicRatio
  • -PogoInlineSimpleProbe+
  • -PogoInlineSimpleProbe-
  • -PogoKmode
  • -PogoNoDataDiff
  • -PogoNoDllMainCallback
  • -PogoNoMDS
  • -PogoNoMDSBoost#
  • -PogoNoMDSInlTh#
  • -PogoNoRDataLayout
  • -PogoNoShare
  • -PogoNoThunks
  • -PogoNotEmitCGNodeDbgInfo
  • -PogoNotOptEditedFunc
  • -PogoNtoskrnl
  • -PogoPBInline
  • -PogoProbeCalls+
  • -PogoProbeCalls-
  • -PogoRedirConsiderArgs
  • -PogoRedirLimit#
  • -PogoSafeMode
  • -PogoUseX86Pgd
  • -PoolPageSize#
  • -PreExec+
  • -PreExec-
  • -PureFuncOpt
  • -PureFuncOpt-
  • -Qfast_transcendentals
  • -Qimprecise_fwaits
  • -Qpar
  • -Qpar-report:#
  • -Qsafe_fp_loads
  • -Qslpvec-
  • -Qvec-
  • -Qvec-mathlib-
  • -Qvec-report:#
  • -Qvec-sse2only
  • -ReturnUdtEHInline
  • -ReturnUdtEHInline-
  • -S
  • -SHPAddrTaken+
  • -SHPAddrTaken-
  • -SHPLinkInclude+
  • -SHPLinkInclude-
  • -SHPVerifyFuncs+
  • -SHPVerifyFuncs-
  • -SIAuthor
  • -SSAOPT_REJECT:#
  • -SSAOPT_STOP:#
  • -SSAOptimizer+
  • -SSAOptimizer-
  • -SSAOptimizerCFG+
  • -SSAOptimizerCFG-
  • -SecureHotPatch:#
  • -SecureHotPatchFile:#
  • -SepFallback+
  • -SepFallback-
  • -ShowDecisionFile
  • -SpecDevirt+
  • -SpecDevirt-
  • -SpgoDensityTH#
  • -SpgoMinCoverTH#
  • -StrictInlineDecisions
  • -TPReport
  • -ThrowingNew
  • -ThrowingNew-
  • -Timing
  • -TurnOffWarn746
  • -TypeModLimit#
  • -TypeProp+
  • -TypeProp-
  • -UI#
  • -UndefIntOverflow+
  • -UndefIntOverflow-
  • -UseExPgd
  • -UseVTableDevirt+
  • -UseVTableDevirt-
  • -VolatileMetadata
  • -VolatileMetadata-
  • -W#
  • -Wall
  • -Y-
  • -Yc
  • -Z7
  • -ZI
  • -ZW
  • -ZW:nometadata
  • -ZX
  • -Za
  • -Zi
  • -Zi+
  • -Zl
  • -Zo-
  • -Zvc6
  • -alignedVec
  • -archAVX
  • -archAVX2
  • -archAVX512
  • -archAVX512F
  • -archSSE42
  • -atom
  • -await:heapelide
  • -bigobj
  • -callcap
  • -cands
  • -cap
  • -cbstring
  • -cgsummary
  • -cgsummary+
  • -cgthreads#
  • -clinesize#
  • -clrinitlocals
  • -clrpure
  • -clrsafe
  • -coldfuncs:#
  • -compiler:
  • -cvtcil
  • -datalayoutoff
  • -db#
  • -disablefirstbitfieldopts
  • -doforcealign
  • -dos
  • -dshigh#
  • -dslow#
  • -dumpCallGraph:#
  • -ef#
  • -ehopt
  • -entry:
  • -epilogunwind
  • -epilogunwindrequirev2
  • -errorreport:none
  • -errorreport:prompt
  • -errorreport:queue
  • -errorreport:send
  • -experimental:deterministic
  • -f#
  • -fastcap
  • -fixupsymbol:#
  • -forceZ7
  • -framechain
  • -guard#
  • -guard32bytealign
  • -guardcfemu
  • -guardcfgcheckfptrname:#
  • -guardcfgcheckname:#
  • -guardcfgdispatch
  • -guardcfgdispatch-
  • -guardcfgdispatchfptrname:#
  • -guardcfgdispatchname:#
  • -guardcfgfuncptr
  • -guardcheckesp#
  • -guardcompat#
  • -guardfastfail
  • -guardfidsreloc
  • -guardfidsreloc-
  • -guardgsforcfg
  • -guardgsforcfg-
  • -guardgsnoshadow
  • -guardignoresuppress
  • -guardignoresuppress-
  • -guardimmportthunk
  • -guardjumptables
  • -guardjumptables-
  • -guardjumptables_dbgbreak
  • -guardlongjmp
  • -guardnochecks
  • -guardnolongjmp
  • -guardnolongjmp-
  • -guardnopadglobals
  • -guardnothunkchecks
  • -guardopttable
  • -guardretpoline
  • -guardretpoline-
  • -guardrevokeonexception
  • -guardspecload
  • -guardspecload-
  • -guardspecmode#
  • -guardss#
  • -guardssepistub
  • -guardssepistub-
  • -guardssleafopt
  • -guardssleafopt-
  • -guardssnogs
  • -guardssnogs-
  • -guardssverifysp
  • -guardssverifysp-
  • -guardswtablesuppress
  • -guardswtablesuppress-
  • -hft#
  • -home
  • -hotfuncs:#
  • -hotpatch
  • -ignoreC1007
  • -il#
  • -incltcgcglimit#
  • -incltcgclimit#
  • -incltcgdiag
  • -incltcgsummary
  • -incremental
  • -incremental_rebuild
  • -initialAppDomain
  • -inlLimitCount#
  • -inlLimitFuncId#
  • -inlLnDbg#
  • -inlS#
  • -inlT#
  • -inlcasw#
  • -inlcrmax#
  • -inlcsw#
  • -inld#
  • -inldasw#
  • -inlfcsa#
  • -inlfcsw#
  • -inlflcsw#
  • -inlinelog
  • -inlinelog2
  • -inlinelog3
  • -inlinelogdetails:#
  • -inlinelogfull:#
  • -inlinestats
  • -inlipfw#
  • -inlld#
  • -inlmlsa#
  • -inlnild#
  • -inlniln#
  • -inlnlw
  • -inlnobr#
  • -inlnold#
  • -inlnoln#
  • -inlocsa1#
  • -inlocsa2#
  • -inlocsa3#
  • -inlocsa4#
  • -inluserinl#
  • -iobj#
  • -iobjin:#
  • -ipdb#
  • -ipdbin:#
  • -isize#
  • -iso_volatile
  • -iso_volatile-
  • -jumptablerdata
  • -kernel
  • -layoutD2D#
  • -layoutF2Doff
  • -linscan
  • -loopopt
  • -ltcg
  • -ltcgEditFid#
  • -ltcgEditNum#
  • -ltcgEditVid#
  • -ltcgNoDiff
  • -ltcgNoRecompileCheck
  • -ltcgTime
  • -ltcgVCallsiteIgnore#
  • -memoryBarriers
  • -mnunmrf#
  • -msilDebug
  • -mtschedlimit#
  • -new.obj
  • -newcolor
  • -newcolor-
  • -nocfgrngchk
  • -nodatasort
  • -noehopt
  • -noguardshadowall
  • -nolock
  • -nomtdeps
  • -nomttddeps
  • -notypeopt
  • -nowarn4715
  • -nowarn4786
  • -nowinrtopts
  • -objdir:#
  • -off#
  • -omp
  • -optref
  • -pagepackeroff
  • -pagesize#
  • -palwinth#
  • -pathmap:#
  • -pchmap#
  • -pgi#
  • -pgo#
  • -pgu#
  • -pi#
  • -pinssr#
  • -pinth#
  • -po#
  • -preventIntermediateNaNs
  • -psavepgd#
  • -psepcodorder
  • -psepcodth#
  • -psickratio#
  • -psinvalidoff
  • -psinvalidon
  • -pspeed#
  • -pspinth#
  • -pstypeth#
  • -psvcalllimit#
  • -psvcallopt#
  • -psweight#
  • -pv#
  • -queuerand#
  • -queueseed#
  • -schdat#
  • -sdlMode
  • -searchAltPathForScope
  • -siltcginstrs#
  • -singleMethodCompile:#
  • -size
  • -spdname:#
  • -speed
  • -spgo
  • -stkfill#
  • -threads#
  • -thunklayout
  • -trimfile:#
  • -tsiobj#
  • -typedil
  • -typeoptcfg#
  • -useoldhandlers
  • -vol#
  • -wbrd#
  • -winmdonly
  • -wpasummary