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