Skip to content

Commit

Permalink
Merge nim-lang#209
Browse files Browse the repository at this point in the history
209: Refactor active configuration handing r=saem a=haxscramper

- Move active configuration handing into a separate type that should
  contain all the required configuration parameters. Use this type in
  `ConfigRef` module, and use accessor procs for getting and setting values
  of different options, thus removing unguarded access for fields in a
  number of cases.
- Move report kind and category enums into `report_enums` in order to make
  them accessible from the `in_options` - it must be a lightweight
  dependency since it is supposed to be reused by other tools, like
  testament, that have to directly interact with the compiler.

Closes nim-works/nimskull#158

Co-authored-by: haxscramper <haxscramper@gmail.com>
  • Loading branch information
bors[bot] and haxscramper committed Feb 6, 2022
2 parents 9d0baf7 + 32308c8 commit 854120b
Show file tree
Hide file tree
Showing 21 changed files with 1,888 additions and 1,657 deletions.
45 changes: 2 additions & 43 deletions compiler/ast/ast_types.nim
@@ -1,52 +1,11 @@
import utils/ropes
import std/[hashes]

from front/in_options import TOption, TOptions # Stored in `PSym`

const
hasFFI = defined(nimHasLibFFI)

type
TOption* = enum
## please make sure we have under 32 options (improves code efficiency
## a lot!) **keep binary compatible**
optNone
optObjCheck ## `ccgenexprs.nim` generates `isObj` check if this options
## is enabled for a procedure
optFieldCheck ## Codegen uses it to conditionally generate check for a
## discriminant field
optRangeCheck ## Control generation of range checks in the backend
optBoundsCheck ## Control generation of the array boundary checks in
## the backend
optOverflowCheck ## Integer overflow check control
optRefCheck ## Deprecated option, does something with refs in te
## `liftdestructors.nim`, need to investigate further
optNaNCheck ## Raise float invalid defect C backend if operation
## returned nan
optInfCheck ## Raise float overflow in C backend if operation reaturned
## inf
optStaticBoundsCheck
optStyleCheck ## Check symbol for spelling consistency
optAssert
optLineDir
optWarns
optHints
optOptimizeSpeed
optOptimizeSize
optStackTrace ## stack tracing support
optStackTraceMsgs ## enable custom runtime msgs via `setFrameMsg`
optLineTrace ## line tracing support (includes stack tracing)
optByRef ## use pass by ref for objects
## (for interfacing with C)
optProfiler ## profiler turned on
optImplicitStatic ## optimization: implicit at compile time
## evaluation
optTrMacros ## en/disable pattern matching
optMemTracker
optSinkInference ## 'sink T' inference
optCursorInference
optImportHidden

TOptions* = set[TOption]


type
FileIndex* = distinct int32
Expand Down

0 comments on commit 854120b

Please sign in to comment.