Remove volatiles when compiling with ARC/ORC (#19545)
This removes volatiles on ARC/ORC targets in NimMain and PreMainInner. This avoids an issue where they couldn't be optimised out on microcontrollers leading to larger code. Since the stack bottom doesn't have to be initialised this way when using ARC or ORC (or None, which is also covered by this PR) these can be safely removed. (cherry picked from commit 9a49451)
Fix punycode.decode function (#19136)
* Refactor: rename proc to func * Fix punycode.decode function This function could only properly decode punycodes containing a single encoded unicode character. As soon as there was more than one punycode character group to decode it produced invalid output - the number of characters was correct, but their position was not. * Update tpunycode.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> (cherry picked from commit ade85ee)
enable style:usages for stdlib tests [backport: 1.6] (#19715)
* enable style:usages for stdlib tests * freeAddrInfo * more tests * importc * bufSize * fix more * => parseSql and renderSql (cherry picked from commit 98cebad)
testament: include extra options in test name (#19801)
there's currently no (simple) way to disambiguate which option failed (cherry picked from commit 63cca93)
Fix default testament target in docs and cli help (#19796)
Co-authored-by: quantimnot <quantimnot@users.noreply.github.com> (cherry picked from commit a8426fc)
Fix typo in sequtils documentation (#19789)
Found another small typo. (cherry picked from commit 19001c0)
varargs example erroneously transformed "abc" to "def" (#19781)
(cherry picked from commit 85bc832)
tests: Fix warnings in tstrscans (#19082)
(cherry picked from commit 2e0db98)
std/tasks: fix spelling (#19691) [backport]
why aren't these not being caught by style check options? --styleCheck:usages finds it. Co-authored-by: flywind <xzsflywind@gmail.com> (cherry picked from commit cb6ce80)
style usages part one (openarray => openArray) (#19321)
* style usages (openArray) * revert doc changes (cherry picked from commit 9df195e)
fix #19862; make widestrs consistent between refc and orc (#19874) [b…
Initial implementation of nimsuggest v3 (#19826) [backport] (#19892)
* Initial implementation of nimsuggest v3 (#19826) * Initial implementation of nimsuggest v3 Rework `nimsuggest` to use caching to make usage of ide commands more efficient. Previously, all commands no matter what the state of the process is were causing clean build. In the context of Language Server Protocol(LSP) and lsp clients this was causing perf issues and overall instability. Overall, the goal of v3 is to fit to LSP Server needs - added two new commands: - `recompile` to do clean compilation - `changed` which can be used by the IDEs to notify that a particular file has been changed. The later can be utilized when using LSP file watches. - `globalSymbols` - searching global references - added `segfaults` dependency to allow fallback to clean build when incremental fails. I wish the error to be propagated to the client so we can work on fixing the incremental build failures (typically hitting pointer) - more efficient rebuild flow. ATM incremental rebuild is triggered when the command needs that(i. e. it is global) while the commands that work on the current source rebuild only it Things missing in this PR: - Documentation - Extensive unit testing. Although functional I still see this more as a POC that this approach can work. Next steps: - Implement `sug` request. - Rework/extend the protocol to allow better client/server communication. Ideally we will need push events, diagnostics should be restructored to allow per file notifications, etc. - implement v3 test suite. - better logging * Add tests for v3 and implement ideSug * Remove typeInstCache/procInstCache cleanup * Add ideChkFile command * Avoid contains call when adding symbol info * Remove log * Remove segfaults * Fixed bad cherry-pick resolve * modulegraphs.dependsOn does not work on transitive modules - make sure transitive deps are marked as dirty
not generate initStackBottomWith in arc/orc [backport] (#19875)
not generate initStackBottomWith in arc/orc (cherry picked from commit eefca1b)
Pass headers and body correctly to FetchOptions (#19884) [backport]
* Pass headers to FetchOptions Don't pass body if method is HttpGet or HttpHead * Syntax fixes * Restart CI (cherry picked from commit 8fa2c0b)
Fix nimRawSetjmp for VCC [backport: 1.2] (#19899)
(cherry picked from commit 40464fa)
dec inLoop after exiting the while scope in computeLiveRanges [backpo…
once C++, always C++ [backport] (#19938)
* once C++, always C++
When using `{.compile: "file.cc".}` in a nim module, even when compiling
with `nim c` the C++ compiler should be used - once any C++ file has
been compiled, the C++ linker also needs to be used.
* more strict C++ check
* simplify code
(cherry picked from commit ad430c0)sysrand: fix syscall signature [backport] (#19982)
sysrand: fix syscall signature `syscall` is a `C` varags function (cherry picked from commit ad0aee5)
Fix nested finally handling in closureiters [backport] (#19933)
* Fix nested finally handling in closureiters * Fix CI * review comment * third time the charm * Update compiler/closureiters.nim Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com> Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com> (cherry picked from commit fb5fbf1)
[Orc] fixes "streams.readDataStr segafaults" when accepting a string …
Correct emscripten shortcoming (#19987)
emscripten reports infinity for every getrlimit() requests, which does not work when requesting the max number of file descriptors (prlimit64 syscall). This patch provides a default of 1024 which is common on Linux. This is used in particular in ioselectors_poll.nim and te invalid value makes it crash.
Implement type command (#19944)
* Implement type command - this will be mapped to textDocument/typeDefinition in LSP protocol. It will be very useful for `nim` in particular because typically most of the time the type is inferred. * Update nimsuggest/nimsuggest.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> (cherry picked from commit e636c21)
Use module actual file instead of PSym.info (#19956)
After this you can do goto module from module import (cherry picked from commit b0b9a3e)
testament: use full test name in skips [backport] (#19937)
testament: use full test name in skips (cherry picked from commit 094d86f)
Refactor and doc package handling, module name mangling (#19821)
* Refactor and doc package handling, module name mangling * Consolidate, de-duplicate and extend package handling * Alter how duplicate module names of a package are handled * Alter how module names are mangled * Fix crash when another package is named 'stdlib' (test case added) * Doc what defines a package in the manual Modules with duplicate names within a package used to be given 'fake' packages to resolve conflicts. That prevented the ability to discern if a module belonged to the current project package or a foreign package. They now have the proper package owner and the names are mangled in a consistent manner to prevent codegen clashes. All module names are now mangled the same. Stdlib was treated special before, but now it is same as any other package. This fixes a crash when a foreign package is named 'stdlib'. Module mangling is altered for both file paths and symbols used by the backends. Removed an unused module name to package mapping that may have been intended for IC. The mapping was removed because it wasn't being used and was complicating the issue of package modules with duplicate names not having the proper package owner assigned. * Fix some tests * Refactor `packagehandling` * Remove `packagehandling.withPackageName` and its uses * Move module path mangling from `packagehandling` to `modulepaths` * Move `options.toRodFile` to `ic` to break import cycle * Changed import style to match preferred style Co-authored-by: quantimnot <quantimnot@users.noreply.github.com> (cherry picked from commit d30c641)
fixes #19404 by protecting the memory we borrow from. this replaces c…
[cleanup] remove unnecessary procs in vm (#19888)
remove unused procs (cherry picked from commit 2f49006)
[Tiny] correct comment opcDeref => opcLdDeref (#19908)
correct comment opcDeref => opcLdDeref (cherry picked from commit a65db5e)
epoll: correct mapping [backport] (#20058)
* epoll: correct mapping `epoll_data` is a union and `epoll_event` is packed on `amd64` * names (cherry picked from commit f2e4407)
Use passc and passl consistently with compiler checking (#20068)
(cherry picked from commit 1a9123e)
Correctly detect major version of GCC (#20059)
We were doing a very poor job detecting the major version of GCC by parsing the output of --version. This patches uses -dumpversion to make this parsing straightforward and it also fixes a bunch of compiling issues on different platforms with custom output for --version switches. For example, openSUSE first line of the output includes the revision number and the parsing that was being done did mix that number with the major version and breaks building the nim compiler (as it doesn't find the 3 dots for an X.Y.Z semver format, hence returning "false"). In this patch, we simply use -dumpversion (which has been at least from 1993, so we are safe :) (cherry picked from commit efcb89f)
fixes broken CI; bump macOS version to macos-11 (#20098)
* 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 actions/runner-images#5583 * fix CI error (cherry picked from commit 8ef509b)
Change styleCheck to ignore foreign packages (#19822)
* Change `styleCheck` to ignore foreign packages * Symbols from foreign packages are now ignored. * Fixed `styleCheck` violations in `compiler` package. * Added symbol ownership to custom annotation pragmas. * Minor refactors to cleanup style check callsites. * Minor internal documentation of reasons why a symbol isn't checked. Style violations were fixed in the compiler after thet were exposed by the changes. The compiler wouldn't compile otherwise. Symbol ownership for custom pragma annotations is needed for checking the annotation's style. A NPE was raised otherwise. Fixes #10201 See also nim-lang/RFCs#456 * Fix a misunderstanding about excluding field style checks I had refactored the callsites of `styleCheckUse` to apply the DRY principle, but I misunderstood the field access handling in a template as a general case. This corrects it. * Fix some `styleCheck` violations in `compiler/evalffi` The violations were exposed in CI when the compiler was built with libffi. * Removed some uneeded transitionary code * Add changelog entry Co-authored-by: quantimnot <quantimnot@users.noreply.github.com> (cherry picked from commit 800cb00)
Fixed compilation of void closureiters with try stmt (#20138) [backport]
(cherry picked from commit 0d734d7)
Don't require blank line before Markdown code (1.6) (#20216)
Don't require blank line before Markdown code Fixes bug reported in #20189 affecting nimforum. (manually backported version to 1.6 from devel)