allow converting static vars to openArray (#19047)
When assigning constant output to a seq, and then passing that static seq to other functions that take `openArray`, the compiler may end up producing errors, as it does not know how to convert `static[seq[T]]` to `openArray[T]`. By ignoring the `static` wrapper on the type for the purpose of determining data memory location and length, this gets resolved cleanly. Unfortunately, it is relatively tricky to come up with a minimal example, as there are followup problems from the failing conversion, e.g., this may lead to `internal error: inconsistent environment type`, instead of the relevant `openArrayLoc` error message. (cherry picked from commit 490c422)
use two underscores for easy demangling [backport:1.6] (#19028)
(cherry picked from commit 1a45da9)
Fix #19052; [backport:1.6.0] (#19053)
* Fix #19052; [backport:1.6.0] Adds a compile flag to avoid a getrandom syscall, fixing #19052. This is neccesary when the getrandom syscall is missing, as noted in #19052, particularly in kernel versions < 3.17 when getrandom was introduced. Specifically relevant is this is missing from kernel 3.10, which is the supported kernel throughout RHEL 7 and CentOS 7, which is widely used at many organizations. Without this, versions of nim that include sysrand (i.e. versions >= 1.6.0) will not compile without modification, however with this change a compile flag may be used to fall back using /dev/urandom as done with any unknown Posix OS (preferred here as a fallback since it already supplies a cryptographically secure PRNG and existing code deals with entropy pool init, etc). The change is placed behind a compile flag, as discussed in github ticket #19052 (summed up here): * First, I can't seem to catch that a importc such as SYS_getrandom is declared without using it (the declared proc returns true, but compiler throws an undeclared identifier flag when referencing it). * Second, it seemed preferable to be behaviorally explicit vs implicit when considering this is intended to be a cryptographically secure PRNG. * Third, if I intend to compile on a kernel >= 3.17 while running the binary on at least one system < 3.17, I'll want to be able to target this without relying on a compile time determination if the getrandom syscall is available. * Documenting compile flag for -d:nimNoGetRandom and adding changelog entry Related to #19052 and comments in PR #19053. Also created a new changelog file since none currently exists. Co-authored-by: Timothy Alexander <talexander@midwestlabs.com> (cherry picked from commit dde5566)
fix #18971 (#19070) [backport:1.6]
since the example code return value from global variable, instead of first argument, the `n.len` is 1 which causes compiler crashes. (cherry picked from commit f755e45)
fix #18410 (Errors initializing an object of RootObj with the C++ bac…
[FIX] Do not break formatted string line (#19085) [backport]
Otherwise, compiler produces broken error message - `$1` is not interpolated `Error: The $1 type doesn't have a default value. The following fields must be initialized: importGraph.` (cherry picked from commit 4c510d5)
fixes another effect inference bug [backport:1.6] (#19100)
* fixes another effect inference bug [backport:1.6] (cherry picked from commit fce89cb)
fix nimindexterm in rst2tex/doc2tex [backport] (#19106)
* fix nimindexterm (rst2tex/doc2tex) [backport] * Add support for indexing in rst (cherry picked from commit 997ccc5)
Remove tlsEmulation enabled from Windows + GCC config (#19119) [backp…
…ort:1.6] This flag has a very significant performance impact on programs compiled with --threads:on. It is also apparently not needed anymore for standard circumstances. Can we remove the config? See #18146 (comment) for discussion and perf impact. [backport:1.6] (cherry picked from commit 77b696c)
fixed colorNames sorting mistake (#19125) [backport]
(cherry picked from commit 528ef6c)
update manual (#19130) [backport]
(cherry picked from commit 3aaa12d)
Fix undeclared 'SYS_getrandom' on emscripten (#19144)
(cherry picked from commit 270a5a3)
fix marshal bugs in VM (#19161) [backport:1.6]
(cherry picked from commit fe46c8b)
renamed 'gc' switch to 'mm'; [backport:1.6] (#19187)
* renamed 'gc' switch to 'mm'; [backport:1.6] * better docs (cherry picked from commit a0073d2)
misc bugfixes [backport:1.2] (#19203)
(cherry picked from commit 23c117a)
allow HSlice bounded by constants of distinct types (#19219) [backp…
…ort:1.2] When creating heterogenous slices of distinct types, the compiler does not initialize the internal type's `size` before accessing it. This then leads to this crash message: ``` compiler/int128.nim(594, 11) `false` masking only implemented for 1, 2, 4 and 8 bytes [AssertionError] ``` This patch initializes the `size` properly, fixing the problem. (cherry picked from commit 0213c73)
re-enable chronos testing once again [backport:1.2] (#19222)
(cherry picked from commit 93c8427)
fixes a converter handling regression that caused private converters …
fixes an old ARC bug: the produced copy/sink operations don't copy th…
move toDeque to after addLast (#19233) [backport:1.0]
Changes the order of procs definitions in order to avoid calling an undefined proc. (cherry picked from commit c989542)
fixes a possible 'javascript:' protocol exploit [backport:1.0] (#19134)
* fixes a possible 'javascript:' protocol exploit [backport:1.0] * add tests * Update tests/stdlib/trstgen.nim * add the same logic for hyperlinks * move the logic into a proc Co-authored-by: narimiran <narimiran@disroot.org> (cherry picked from commit 9338aa2)
nimRawSetjmp: support Windows (#19197)
* nimRawSetjmp: support Windows Using `_setjmp()` directly is required to avoid some rare (but very annoying) exception-related stack corruption leading to segfaults on Windows, with Mingw-w64 and SEH. More details: status-im/nimbus-eth2#3121 Also add "nimBuiltinSetjmp" - mostly for benchmarking. * fix for Apple's Clang++ (cherry picked from commit 69aabda)
nimc.rst: fix table markup (#19239)
(cherry picked from commit 1a92ede)
Update uri.nim (#19148) [backport:1.0]
(cherry picked from commit a3ef5df)
basicopt.txt: Unify the format (#19251)
(cherry picked from commit 78b86b7)
[backport:1.0] json: limit recursion depth (#19252)
* json: limit recursion depth * do not run this check for JS backend (cherry picked from commit c17baae)