summary refs log tree commit diff stats
path: root/compiler/commands.nim
Commit message (Collapse)AuthorAgeFilesLines
* Implemented `compileOption` for `experimental` to test if a feature i… ↵Don-Duong Quach2024-08-121-1/+8
| | | | | | | | (#23933) …s enabled at compile time. #8644 This doesn't handle the case if `{.push experimental.}` is used, but at least we can test if a feature was enabled globally.
* remove nir; succeeded by nif (#23809)ringabout2024-07-091-2/+0
| | | ref https://github.com/nim-lang/nif
* IC: progress and refactorings (#22961)Andreas Rumpf2023-11-201-0/+1
|
* prepare for the enforcement of `std` prefix (#22873)ringabout2023-10-291-1/+3
| | | follow up https://github.com/nim-lang/Nim/pull/22851
* NIR: store sizes, alignments and offsets in the type graph; beginning… ↵Andreas Rumpf2023-10-161-1/+3
| | | | | (#22822) …s of a patent-pending new VM
* fixes #22763; nimcache in nim.cfg uses the relative path to the config file ↵ringabout2023-09-281-1/+8
| | | | | (#22764) fixes #22763
* fixes #22706; turn "unknown hint" into a hint (#22755)ringabout2023-09-251-1/+5
| | | fixes #22706
* Instantiates generics in the module that uses it (#22513)Juan M Gómez2023-09-091-1/+4
| | | | | | | | | | Attempts to move the generic instantiation to the module that uses it. This should decrease re-compilation times as the source module where the generic lives doesnt need to be recompiled --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Improve compiler cli args (#22509)Juan Carlos2023-08-251-4/+10
| | | | | | | * . * Fix cli args out of range with descriptive error instead of crash * https://github.com/nim-lang/Nim/pull/22509#issuecomment-1692259451
* Remove Deprecated Babel (#22507)Juan Carlos2023-08-191-4/+2
|
* use strictdefs for compiler (#22365)ringabout2023-08-061-13/+34
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* fixes #22321; fixes building DLL with --noMain still produces a DllMain (#22323)ringabout2023-07-241-1/+0
| | | | | * fixes #22321; Building DLL with --noMain produces an unexpected DllMain on devel branch * remove implicit nomain
* fixes #21730; adds pkgs2 as well when nimbleDir is set (#22234)ringabout2023-07-071-0/+2
|
* fixes #22212; Compile error when running a Nimscript that compares se… ↵ringabout2023-07-031-1/+2
| | | | | (#22213) fixes #22212; Compile error when running a Nimscript that compares seq with switch("mm", "arc")
* adds nimbasePattern compiler option (#22144)Juan M Gómez2023-06-241-0/+2
| | | adds optonal --nimbasepattern
* adds missing staticlib hints (#22140)ringabout2023-06-211-1/+1
|
* fix #21501 by making --app:lib and --app:staticLib imply --noMain (#21910)heterodoxic2023-05-261-0/+2
|
* js -r defines nodejs & program result undeclared if unavailable (#21849)metagn2023-05-241-0/+6
| | | | | | | | | | | * js -r defines nodejs & program result undefined if unavailable fixes #16985, fixes #16074 * fix * add changelog too * minor word change
* adds an experimental `mm:atomicArc` switch (#21798)ringabout2023-05-081-11/+13
|
* warn on set types bigger than max size, default to 0..255 for int literals ↵metagn2023-04-171-1/+1
| | | | | | | | | | | | | | | | | | | (#21659) * test implicitly huge set types refs https://github.com/nim-lang/RFCs/issues/298 * oh my god * boot at least * don't error, fix remaining issues, no 2 len arrays * fix runnable example * test assuming 0..255 for int literal * test refactor, add changelog, test
* int64/uint64 as bigint in JS (#21613)metagn2023-04-111-0/+3
| | | | | | | | | | | * int64/uint64 as bigint in JS * fix CI * convert to compile option * fix lie * smaller diff, changelog entry
* remove useVersion (#21626)metagn2023-04-081-23/+0
| | | test removing useVersion
* fixes #19396; Nimdoc hide nonexported fields (#21305)ringabout2023-02-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * suppresses non-exported fields of types and adds command-line option to re-enable this if desired * corrected the doctest that produced a CI error * an embarrassingly bad error in reasoning * modified a nimdoc test to reflect updated behavior * needed another change to bring utils.html doctest in sync with update * add info * fix nimdoc * lint * render postfix * fixes a problem * fixes nimdoc * fix nimdoc --------- Co-authored-by: johnperry-math <john.perry@usm.edu> Co-authored-by: johnperry-math <devotus@yahoo.com>
* fixes #21209; exclude threads options for JS (#21233)ringabout2023-01-081-0/+2
|
* docgen: implement cross-document links (#20990)Andrey Makarov2023-01-041-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * docgen: implement cross-document links Fully implements https://github.com/nim-lang/RFCs/issues/125 Follow-up of: https://github.com/nim-lang/Nim/pull/18642 (for internal links) and https://github.com/nim-lang/Nim/issues/20127. Overview -------- Explicit import-like directive is required, called `.. importdoc::`. (the syntax is % RST, Markdown will use it for a while). Then one can reference any symbols/headings/anchors, as if they were in the local file (but they will be prefixed with a module name or markup document in link text). It's possible to reference anything from anywhere (any direction in `.nim`/`.md`/`.rst` files). See `doc/docgen.md` for full description. Working is based on `.idx` files, hence one needs to generate all `.idx` beforehand. A dedicated option `--index:only` is introduced (and a separate stage for `--index:only` is added to `kochdocs.nim`). Performance note ---------------- Full run for `./koch docs` now takes 185% of the time before this PR. (After: 315 s, before: 170 s on my PC). All the time seems to be spent on `--index:only` run, which takes almost as much (85%) of normal doc run -- it seems that most time is spent on file parsing, turning off HTML generation phase has not helped much. (One could avoid it by specifying list of files that can be referenced and pre-processing only them. But it can become error-prone and I assume that these linke will be **everywhere** in the repository anyway, especially considering https://github.com/nim-lang/RFCs/issues/478. So every `.nim`/`.md` file is processed for `.idx` first). But that's all without significant part of repository converted to cross-module auto links. To estimate impact I checked the time for `doc`ing a few files (after all indexes have been generated), and everywhere difference was **negligible**. E.g. for `lib/std/private/osfiles.nim` that `importdoc`s large `os.idx` and hence should have been a case with relatively large performance impact, but: * After: 0.59 s. * Before: 0.59 s. So Nim compiler works so slow that doc part basically does not matter :-) Testing ------- 1) added `extlinks` test to `nimdoc/` 2) checked that `theindex.html` is still correct 2) fixed broken auto-links for modules that were derived from `os.nim` by adding appropriate ``importdoc`` Implementation note ------------------- Parsing and formating of `.idx` entries is moved into a dedicated `rstidx.nim` module from `rstgen.nim`. `.idx` file format changed: * fields are not escaped in most cases because we need original strings for referencing, not HTML ones (the exception is linkTitle for titles and headings). Escaping happens later -- on the stage of `rstgen` buildIndex, etc. * all lines have fixed number of columns 6 * added discriminator tag as a first column, it always allows distinguish Nim/markup entries, titles/headings, etc. `rstgen` does not rely any more (in most cases) on ad-hoc logic to determine what type each entry is. * there is now always a title entry added at the first line. * add a line number as 6th column * linkTitle (4th) column has a different format: before it was like `module: funcName()`, now it's `proc funcName()`. (This format is also propagated to `theindex.html` and search results, I kept it that way since I like it more though it's discussible.) This column is what used for Nim symbols resolution. * also changed details on column format for headings and titles: "keyword" is original, "linkTitle" is HTML one * fix paths on Windows + more clear code * Update compiler/docgen.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Handle .md and .nim paths uniformly in findRefFile * handle titles better + more comments * don't allow markup overwrite index title for .nim files Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Add `--genCDeps` for better integration with CMake (#20950)Jaremy Creechley2022-11-291-0/+3
| | | | | | | | | | | | | | | | | * add gencdeps option * add case statement * Update compiler/main.nim * Update compiler/main.nim * Apply suggestions from code review Fixes Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #20426; remove `maincommand` and `m` options since they are a no op ↵ringabout2022-09-261-1/+1
| | | | | | | | | | | | | | | | | since 2014 (#20429) * bump macOS image on Azure CI to macos-11 ##[warning]The macOS-10.15 environment is deprecated, consider switching to macos-11(macos-latest), macos-12 instead. For more details see https://github.com/actions/virtual-environments/issues/5583 * fix CI error * fixes #20426; remove `maincommand` and `m` options since they are a noop since 2014 and causes confusion fixes #20426 https://github.com/nim-lang/Nim/commit/7f7b13a45f73c6d9dcca3ce8388833189d77426c#diff-d949f8c356fd2dc9ceedc6f3dbbd01e2c806269dd0a8ad6516facf589fa2c99a makes it a no op, but it causes a regression because it should add `expectArg(switch, arg, pass, info)` before the discard statement. It causes https://github.com/nim-lang/Nim/issues/20426 to happen. Without `expectArg(switch, arg, pass, info)`, `-mm:orc` is wrongly interpreted as `-m` and compiler, which doesn't make sense. It should either abort compilation or prints `argument for command line option expected: '-m'` message. Since they are a no op since 2014, let's remove it to clear the confusion. Let's wait and see whether it breaks something. * add a changelog
* defaults to ORC (#19972)ringabout2022-09-231-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * defaults to Orc * bootstrap using refc * use gc * init orc defines * unregister orc * fix gc * fix commands * add prepareMutation for orc * enable deepcopy for orc * prepareMutation * more fixes * some cases * bug #20081 * partial fixes * partial fixes * fixes command line * more fixes * build Nim with refc * use gc * more fixes * rstore * orc doesn't support threadpool * more shallowCopy * more fixes * fixes unsafeNew * workarounds * small * more fixes * fixes some megatest * tcodegenbugs1 refc * fxies megatest * build nimble with refc * workaround tensordsl tests * replace shallowCopy with move * fixes action * workaround * add todo * fixes important packages * unpublic unregisterArcOrc * fixes cpp * enable windows Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* Fix #16937; --clib option pass library name to backend C compiler correctly ↵Tomohiro2022-09-011-1/+1
| | | | | | | | | | | | | (#19754) * Fix 16937: Make --clib option works * Make tests/compiler/tcmdlineclib.nim works from any current dir * Try to fix link error on macosx * Add a comment to tests/compiler/tcmdlineclib.nims Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* defines the `gcRefc` symbol which allows writing specific code for refc (#20009)flywind2022-07-171-0/+1
| | | | | | | | | | | | | | | | | | * define gcRefc symbols * add comments * add a changelog item * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * Update changelog.md Co-authored-by: Yardanico <tiberiumk12@gmail.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: Yardanico <tiberiumk12@gmail.com>
* Improve Markdown code blocks & start moving docs to Markdown style (#19954)Andrey Makarov2022-07-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add additional parameters parsing (other implementations will just ignore them). E.g. if in RST we have: .. code:: nim :test: "nim c $1" ... then in Markdown that will be: ```nim test="nim c $1" ... ``` - implement Markdown interpretation of additional indentation which is less than 4 spaces (>=4 spaces is a code block but it's not implemented yet). RST interpretes it as quoted block, for Markdown it's just normal paragraphs. - add separate `md2html` and `md2tex` commands. This is to separate Markdown behavior in cases when it diverges w.r.t. RST significantly — most conspicously like in the case of additional indentation above, and also currently the contradicting inline rule of Markdown is also turned on only in `md2html` and `md2tex`. **Rationale:** mixing Markdown and RST arbitrarily is a way to nowhere, we need to provide a way to fix the particular behavior. Note that still all commands have **both** Markdown and RST features **enabled**. In this PR `*.nim` files can be processed only in Markdown mode, while `md2html` is for `*.md` files and `rst2html` for `*.rst` files. - rename `*.rst` files to `.*md` as our current default behavior is already Markdown-ish - convert code blocks in `docgen.rst` to Markdown style as an example. Other code blocks will be converted in the follow-up PRs - fix indentation inside Markdown code blocks — additional indentation is preserved there - allow more than 3 backticks open/close blocks (tildas \~ are still not allowed to avoid conflict with RST adornment headings) see also https://github.com/nim-lang/RFCs/issues/355 - better error messages - (other) fix a bug that admonitions cannot be used in sandbox mode; fix annoying warning on line 2711
* remove noop option `gc:v2` (#19810)flywind2022-06-101-2/+0
| | | | | * remove noop option gc:v2 * changelog
* Add 'usages' option to the --stylechecks error msg (#19759)Zoom2022-05-041-2/+2
|
* add warnings for gc:option (#19722)flywind2022-04-251-42/+49
|
* fix nim check nimscript [backport: 1.6] (#19444)flywind2022-03-231-0/+2
| | | | fix #19440; fix #3858
* move assertions out of system (#19599)flywind2022-03-231-0/+3
|
* support useVersion:1.6 (#19601)flywind2022-03-101-0/+4
|
* make compileOption("panics") work (#19568)solarizedalias2022-02-271-0/+1
|
* setjump => setjmp [backport: 1.2] (#19496)flywind2022-02-061-1/+1
|
* undefine C symbols in JS backend [backport:1.6] (#19437)flywind2022-02-041-2/+3
| | | fix #19330; fix #19059
* support set other GCs after `mm = orc` or `mm = arc` is set in the global ↵flywind2022-01-271-20/+34
| | | | | | | | | config (#19455) * support set other GCs after arc/orc in global config fix #15535 * set before
* nimscript ignore the threads option (#19370)flywind2022-01-131-1/+1
| | | because nimscript doesn't support threads and causes troubles when the threads option is on
* added --nimMainPrefix switch; fixes #15955; refs #16945 [backport:1.6] (#19235)Andreas Rumpf2021-12-101-0/+1
|
* renamed 'gc' switch to 'mm'; [backport:1.6] (#19187)Andreas Rumpf2021-11-241-2/+2
| | | | * renamed 'gc' switch to 'mm'; [backport:1.6] * better docs
* fixes #18921 [backport] (#18930)Andreas Rumpf2021-09-301-9/+11
|
* strict effects (#18777)Andreas Rumpf2021-09-021-2/+1
| | | | | | | | | | | | | | | | | * fixes #17369 * megatest is green for --cpu:arm64 * docgen output includes more tags/raises * implemented 'effectsOf' * algorithm.nim: uses new effectsOf annotation * closes #18376 * closes #17475 * closes #13905 * allow effectsOf: [a, b] * added a test case * parameters that are not ours cannot be declared as .effectsOf * documentation * manual: added the 'sort' example * bootstrap with the new better options
* move PNode.comment to a side channel, reducing memory usage during ↵Timothee Cour2021-08-291-1/+2
| | | | | | | | | | | | | | | | | compilation by a factor 1.25x (#18760) * move PNode.comment so a side channel, reducing memory usage * fix a bug * fixup * use sfHasComment to speedup comment lookups * fix for IC * Update compiler/parser.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fix #18674 --nimcache now works better with --os:windows (#18675)Timothee Cour2021-08-111-0/+4
|
* followup #17852, disallow all:on for now (#18311)Timothee Cour2021-06-201-0/+2
|
* support `--hint:all:off --hint:x` (ditto with `--warnings` + friends) (#17852)Timothee Cour2021-06-201-30/+29
| | | | | * select all hints via `--hint:all:on|off`, etc * simplify code with setutils * address comment