Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

dmd.globals

Stores command line options and contains other miscellaneous declarations.
Authors:

Source globals.d

enum DiagnosticReporting: ubyte;
Defines a setting for how compiler warnings and deprecations are handled
error
generate an error
inform
generate a warning
off
disable diagnostic
enum CHECKENABLE: ubyte;
In which context checks for assertions, contracts, bounds checks etc. are enabled
_default
initial value
off
never do checking
on
always do checking
safeonly
do checking only in @safe functions
enum CHECKACTION: ubyte;
What should happend when an assertion fails
D
call D assert on failure
C
call C assert on failure
halt
cause program halt on failure
context
call D assert with the error context on failure
enum JsonFieldFlags: uint;
Each flag represents a field that can be included in the JSON output.

NOTE set type to uint so its size matches C++ unsigned type

enum CppStdRevision: uint;
Version of C++ standard to support
enum FeatureState: ubyte;
Trivalent boolean to represent the state of a revertable change
default_
Not specified by the user
disabled
Specified as -revert=
enabled
Specified as -preview=
struct Help;
Command line state related to printing usage about other switches
struct Param;
Put command line switches in here
bool parsingUnittestsRequired();
struct Global;
Collection of global compiler settings and global state used by the frontend
const(char)[] inifilename;
filename of configuration file as given by -conf=, or default value
Array!(const(char)*) path;
Array of char*'s which form the import lookup path
Array!(const(char)*) filePath;
Array of char*'s which form the file import lookup path
char[26] datetime;
string returned by ctime()
Param params;
command line parameters
uint errors;
number of errors reported so far
uint warnings;
number of warnings reported so far
uint gag;
!=0 means gag reporting of errors & warnings
uint gaggedErrors;
number of errors reported while gagged
uint gaggedWarnings;
number of warnings reported while gagged
void* console;
opaque pointer to console for controlling text attributes
Array!Identifier versionids;
command line versions and predefined versions
Array!Identifier debugids;
command line debug versions and predefined versions
bool hasMainFunction;
Whether a main function has already been compiled in (for -main switch)
uint varSequenceNumber;
Relative lifetime of VarDeclaration within a function, used for scope checks
FileManager fileManager;
Cache files read from disk
enum int recursionLimit;
number of recursive template expansions before abort
ErrorSink errorSink;
where the error messages go
ErrorSink errorSinkNull;
where the error messages are ignored
nothrow @safe uint startGagging();
Start ignoring compile errors instead of reporting them.
Used for speculative compilation like __traits(compiles, XXX), but also internally to e.g. try out an alias this rewrite without comitting to it.
Works like a stack, so N calls to startGagging should be paired with N calls to endGagging.
Returns:
the current number of gagged errors, which should later be passed to endGagging
nothrow @safe bool endGagging(uint oldGagged);
Stop gagging, restoring the old gagged state before the most recent call to startGagging.
Parameters:
uint oldGagged the previous number of errors, as returned by startGagging
Returns:
true if errors occurred while gagged.
nothrow @safe void increaseErrorCount();
Increment the error count to record that an error has occurred in the current context.
An error message may or may not have been printed.
nothrow void deinitialize();
Deinitializes the global state of the compiler.
This can be used to restore the state set by _init to its original state.
nothrow @safe uint versionNumber();
Returns:
the version as the number that would be returned for __VERSION__
nothrow @safe string versionString();
Returns:
compiler version string.
nothrow const(char*) versionChars();
Returns:
compiler version as char string.
Global global;
Collection of global state