dmd.globals

Stores command line options and contains other miscellaneous declarations.

Authors

Walter Bright

Source: globals.d

  • Declaration

    enum DiagnosticReporting: ubyte;

    Defines a setting for how compiler warnings and deprecations are handled

    • Declaration

      error

      generate an error

    • Declaration

      inform

      generate a warning

    • off

      Declaration

      off

      disable diagnostic

  • Declaration

    enum CHECKENABLE: ubyte;

    In which context checks for assertions, contracts, bounds checks etc. are enabled

    • Declaration

      _default

      initial value

    • off

      Declaration

      off

      never do checking

    • on

      Declaration

      on

      always do checking

    • Declaration

      safeonly

      do checking only in @safe functions

  • Declaration

    enum CHECKACTION: ubyte;

    What should happend when an assertion fails

    • D

      Declaration

      D

      call D assert on failure

    • C

      Declaration

      C

      call C assert on failure

    • Declaration

      halt

      cause program halt on failure

    • Declaration

      context

      call D assert with the error context on failure

  • Declaration

    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

  • Declaration

    enum CppStdRevision: uint;

    Version of C++ standard to support

  • Declaration

    enum FeatureState: byte;

    Trivalent boolean to represent the state of a revertable change

    • Declaration

      default_

      Not specified by the user

    • Declaration

      disabled

      Specified as -revert=

    • Declaration

      enabled

      Specified as -preview=

  • Declaration

    struct Param;

    Put command line switches in here

  • Declaration

    struct Global;

    Collection of global compiler settings and global state used by the frontend

    • Declaration

      const(char)[] inifilename;

      filename of configuration file as given by -conf=, or default value

    • Declaration

      Array!(const(char)*)* path;

      Array of char*'s which form the import lookup path

    • Declaration

      Array!(const(char)*)* filePath;

      Array of char*'s which form the file import lookup path

    • Declaration

      const(char)[] vendor;

      Compiler backend name

    • Declaration

      Param params;

      command line parameters

    • Declaration

      uint errors;

      number of errors reported so far

    • Declaration

      uint warnings;

      number of warnings reported so far

    • gag

      Declaration

      uint gag;

      !=0 means gag reporting of errors & warnings

    • Declaration

      uint gaggedErrors;

      number of errors reported while gagged

    • Declaration

      uint gaggedWarnings;

      number of warnings reported while gagged

    • Declaration

      void* console;

      opaque pointer to console for controlling text attributes

    • Declaration

      Array!Identifier* versionids;

      command line versions and predefined versions

    • Declaration

      Array!Identifier* debugids;

      command line debug versions and predefined versions

    • Declaration

      bool hasMainFunction;

      Whether a main function has already been compiled in (for -main switch)

    • Declaration

      uint varSequenceNumber;

      Relative lifetime of VarDeclaration within a function, used for scope checks

    • Declaration

      FileManager fileManager;

      Cache files read from disk

    • Declaration

      enum int recursionLimit;

      number of recursive template expansions before abort

    • Declaration

      ErrorSink errorSink;

      where the error messages go

    • Declaration

      nothrow uint startGagging();

      Start ignoring compile errors instead of reporting them.

      Discussion

      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.

      Return Value

      the current number of gagged errors, which should later be passed to endGagging

    • Declaration

      nothrow 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

      Return Value

      true if errors occurred while gagged.

    • Declaration

      nothrow void increaseErrorCount();

      Increment the error count to record that an error has occurred in the current context.

      Discussion

      An error message may or may not have been printed.

    • Declaration

      nothrow void deinitialize();

      Deinitializes the global state of the compiler.

      Discussion

      This can be used to restore the state set by _init to its original state.

    • Declaration

      nothrow uint versionNumber();

      Return Value

      the version as the number that would be returned for __VERSION__

    • Declaration

      nothrow string versionString();

      Return Value

      compiler version string.

    • Declaration

      nothrow const(char*) versionChars();

      Return Value

      compiler version as char string.

  • Declaration

    Global global;

    Collection of global state