Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[minor] we need a cross-platform way to set dll symbol visibility #13054

Open
timotheecour opened this issue Jan 6, 2020 · 6 comments
Open

Comments

@timotheecour
Copy link
Member

timotheecour commented Jan 6, 2020

dll symbol visibility is a bit messy and platform specific; would be nice to have a cross-platform way to do it.

example

proc fun1() {.exportc.} = discard
proc local_fun1() {.exportc.} = discard
proc global_fun1() {.exportc.} = discard
proc fun1_other() = discard
if false: fun1_other() # prevents optimizing it out (maybe there's a more robust way)

OSX

after trying a bit, the key is to use: --passc:-fvisibility=default --passl:-Wl,-exported_symbol,_fun1 (-exported_symbols_list filename could also be used)
Nothing else worked. In particular, --version-script is not supported on OSX nor is -export-symbols-regex
(note: to help debugging what gets executed, I had to use --listcmd --hint:exec:on)

nim c --app:lib --passl:-Wl,-exported_symbol,_fun1 main.nim
nm libmain.dylib | grep fun1
000000000000eba0 T _fun1
000000000000edb0 t _fun1_other__mxNciiSalhqvqXpk1aCNHw_2
000000000000ed40 t _global_fun1
000000000000ecd0 t _local_fun1

more docs: https://www.unix.com/man-page/osx/1/ld/

linux?

-export-symbols-regex ?
--version-script ?
We need to make sure it works across compilers

windows?

We need to make sure it works across compilers

note

  • the point is to avoid (or have an alternative to) decorating individual symbols with things like __attribute__(("visibility" ("default))) (eg: {.pragma: lib, exportc, codegenDecl: """extern __attribute__((visibility("default"))) $# $#$#""".}), which is not good in many cases (eg maybe different libraries want to export a given symbol differently etc)
  • briefly discussed in IRC by leorize

leorize Araq: btw on *nix Nim isn't hiding unexported symbols when building dlls
leorize should we just enforce -fvisibility=hidden then un-hide symbols like for windows?

proposal

  • we add a nim specific cmdline flag that abstracts away platform specific differences to export what user wants.
  • ideally, it should work even with nim's mangled symbols without needing to know the mangled symbol name; the compilers knows the mapping nimName=>mangledName so should be able to help
  • it should work with non-nim code, eg C/C++ code emitted inside nim code
  • we should have a simple way to list a number of symbols; ideally via a regex (the compiler can then do the magic to support OSX which doesn't have -export-symbols-regex)

links

@Araq
Copy link
Member

Araq commented Jan 8, 2020

The way it is supposed to work, you use .exportc: "my_name_here", dynlib and then it ends up in the DLL/so. It's our job to ensure that this works indeed.

@timotheecour
Copy link
Member Author

timotheecour commented Jan 8, 2020

exportc works but that's now what I'm talking about here: oftentimes library writer doesn't want to decorate individual symbols (and hence change source code) just to tell what's exported / unexported in a library; different libraries (with overlapping source code) may choose to export different symbols; that's the whole point of --version-script / -export-symbols-regex / -exported_symbols_list / -exported_symbol.

case in point: right now if you run nim c --app:lib main.nim and then nm -g libmain.dylib you get a whole lot more that what you'd expect that gets exported:

nm -Ug libmain.dylib | wc -l
      83

including things (eg like _rawNewString etc) that could clash with other symbols (or other nim dlls), or expose un-wanted implementation details

instead with the OSX-specific command I showed above, you can export exactly what you specify on cmd line. Here's a minimal working dll that can be dlopen'd from C++:

nim c --app:lib --passl:-Wl,-exported_symbol,_NimMain main.nim
nm -Ug libmain.dylib # only 1 symbol instead of 83
000000000000eea0 T _NimMain
# now call the nim dll from C++, it works
clang++ -std=c++11 -o /tmp/z01 main2.cpp && /tmp/z01
#include <dlfcn.h>
int main (int argc, char *argv[]) {
  auto lib = dlopen("libmain.dylib", RTLD_NOW);
  auto fun = (void(*)()) dlsym(lib, "NimMain");
  fun(); fun();  return 0;
}

@Araq
Copy link
Member

Araq commented Jan 8, 2020

Ok but then I fail to see what we have to do, passC is available already for the people who know.

@timotheecour
Copy link
Member Author

timotheecour commented Jan 8, 2020

the goal is to abstract away platform differences; maybe a std lib proc is all we need:

# user code
import std/dynlib # or other module
setVisibleSymbols(@["foo", "bar"])

# std/dynlib.nim
proc setVisibleSymbolsImpl(s: seq[string)): string =
  doAssert(appType == "lib")
  for si in s:
    when defined(osx)
      result.add "-Wl,-exported_symbol," & si & "  " 
    else: # TODO: linux, windows
macro setVisibleSymbols*(s: static seq[string)) =
  let ret = setVisibleSymbolsImpl(s)
  quote do: {.passC: `ret`.}

@timotheecour timotheecour changed the title we need a cross-platform way to set dll symbol visibility [minor] we need a cross-platform way to set dll symbol visibility Jan 9, 2020
@alaviss
Copy link
Collaborator

alaviss commented Jan 14, 2020

* briefly discussed in IRC by leorize

leorize Araq: btw on *nix Nim isn't hiding unexported symbols when building dlls
leorize should we just enforce -fvisibility=hidden then un-hide symbols like for windows?

I don't think what I said was related to this issue. What I meant when I said that was because of this:

00000000000110a0 B NTI__d9aje06sbOkiVogdUrGOkfQ_
000000000000c01c T NimMain
000000000000c06c T NimMainInit
000000000000c010 T NimMainInner
000000000000bfbb T PreMain
000000000000bfaf T PreMainInner
000000000000c174 T _fini
0000000000002000 T _init
00000000000110e0 B allocatorStorage__9abMNjDlLVxVrfWZARGJwzw
00000000000115a0 B allocator__Het9ctRSeaVb4hPekZZNCJQ
0000000000011568 B allocs__T3KvbObbC5lve2bgh5sQDg
000000000000ac43 T chckNil
0000000000014898 B cmdCount
00000000000148a8 B cmdLine
0000000000003775 T cstrToNimstr
0000000000011150 B currException__9bVPeDJlYTi9bQApZpfH8wjg
0000000000011140 B errorMessageWriter__ZXnv0JyrWe3HTd07wpSr7A
0000000000011158 B excHandler__rqLlY5bs9atDw2OXYqJEn5g
0000000000011570 B framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw
000000000000d280 R fsLookupTable__Gn52IZvqY4slyBTOYwGNRQ
00000000000148a0 B gEnv
0000000000011590 B gcFramePtr__ot48iojqko9aFxGhyjjjVaA
0000000000011148 B globalRaiseHook__JbO1ti4ULxrw54m4zNPbpA
0000000000011080 B localAllocator__Fo4FsHewuC4VzDNrMpf3Og
0000000000011580 B localRaiseHook__EIvMhANBvB9cp2Ezvt29cADg
000000000000944c T mulInt
000000000000a1aa T nimAddCharV1
000000000000b639 T nimDestroyAndDispose
0000000000014890 B nimInErrorMode__759bT87luu8XGcbkw13FUjA
00000000000033e5 T nimInt64ToStr
0000000000003910 T nimIntToStr
0000000000002ea7 T nimPrepareStrMutationV2
000000000000b4de T nimRawDispose
000000000000b756 T nimTestErrorFlag
0000000000011588 B nim_program_result
0000000000011578 B onUnhandledException__bFrawQlTKZhLweDD36j9b8g
0000000000011560 B outOfMemHook__kZNaA7u1MfSW5ZeoGvw8xg
00000000000099c7 T prepareAdd
00000000000098a9 T raiseDivByZero
000000000000a069 T raiseOverflow
00000000000034ae T raiseRangeError
000000000000ac75 T rawNewString
000000000000b9b5 T sched_getparam
000000000000bb75 T sched_getscheduler
000000000000bc90 T sched_setparam
000000000000be5e T sched_setscheduler
0000000000002d2b T setLengthStrV2
00000000000110c8 B sharedAllocator__14UnoPGASR4x3NgNJ5Y5lA
0000000000011160 B tempFrames__7nBYIr2UsDREpYylZK4fug
00000000000035c0 T toNimStr

A lot of Nim internal symbols was exported when I was building a dynamic library to replace certain libc functions. This is undesirable when I only exported 4 of them: https://github.com/alaviss/liblinux_sched/blob/hidden/linux_sched.nim

This probably have to do with the fact that N_LIB_PRIVATE was applied inconsistently by the compiler. My suggestion was that to use -fvisibility=hidden by default so that the compiler don't have to do the N_LIB_PRIVATE decoration, then add __attribute__((visibility("default"))) to N_LIB_EXPORT so that it works similar to how it's done for Windows (hide all show only specified). Might not be the best idea though.

@timotheecour
Copy link
Member Author

seems at least somewhat related to this issue; in any case for your specific point, see #13136

Araq pushed a commit that referenced this issue Jan 18, 2020
…b.} (#13136)

* refs #13054 correctly handle {.exportc,dynlib.} and {.exportcpp,dynlib.}
* put back NIM_EXTERNC for N_LIB_EXPORT; causes issues with compilerproc
dom96 pushed a commit that referenced this issue Feb 15, 2020
* Add osOpen alias for the operating system specific open command

* Add `--git.devel` option to the documentation
remove unused import (#12900)

fix json regression D20191212T144944 (#12902) [backport]

Peer Review Feedback #12901 (comment)

Merge branch 'devel' of https://github.com/nim-lang/Nim into osopen

Peer Review Feedback #12901 (comment)

Update lib/pure/browsers.nim

Co-Authored-By: Dominik Picheta <dominikpicheta@googlemail.com>
Peer Review Feedback #12901 (comment)

allow typed/untyped in magic procs (#12911)

NaN floatFormat with clang_cl  (#12910)

* clang_cl nan floatFormat

* format

add $nimeq for gdb (#12909)

ARC: cycle detector (#12823)

* first implementation of the =trace and =dispose hooks for the cycle collector
* a cycle collector for ARC: progress
* manual: the .acyclic pragma is a thing once again
* gcbench: adaptations for --gc:arc
* enable valgrind tests for the strutils tests
* testament: better valgrind support
* ARC refactoring: growable jumpstacks
* ARC cycle detector: non-recursive algorithm
* moved and renamed core/ files back to system/
* refactoring: --gc:arc vs --gc:orc since 'orc' is even more experimental and we want to ship --gc:arc soonish

Cleanup leftovers of #12911(#12916)

Fix single match output (#12920)

fixes #12899 (#12921)

* fixes #12899

* fixes regression: destroy global variables in reverse declaration order, closureleak test relies on it

Implement NixOS distro check (#12914)

Better case coverage error message for alias and range enum (#12913)

fix error in assertions document (#12925) [backport]

fix cmdline bugs affecting nimBetterRun correctness (#12933) [backport]

fix #12919 tasyncclosestall flaky: Address already in use (#12934)

system.reset is no longer magic (#12937)

It has now means setting x to default for new and old runtime alike
Fix #12785 (#12943)

* Fix #12785 and add test

* better variable name

update documentation for `closureScope` and `capture` (#12886)

fixes #12735 on osx, call dsymutil for debug builds (#12931)

* fix #12735 osx: dsymutil needs to be called for debug builds
* also write dsymutil command to extraCmds in json build file

Auto-initialize deques (#12879)

case coverage error message for `char` (#12948)

lenVarargs: number of varargs elements (#12907)

docs: tiny style improvements

added guidelines for evolving Nim's stdlib

fixes a bug that kept sugar.collect from working with for loop macros [backport]

fixes #12826

fixes a regression

a better bugfix

fixes a test case

fixes a silly regression

fixes the distros.nim regression

ported channels to ARC

ported osproc.nim to ARC

ported re.nim to ARC

ARC: default to a shared heap with --threads:on

osproc: fixes regression

fixes another regression

fixes #12945 (#12959)

minor refactorings

Fixes stackoverflow links in readme (#12963) [backport]

Allow customize Host header
[ci skip] docfix .. < => ..< (#12981) [backport]

parsecfg: retain CRLF line breaks, fixes #12970 (#12971)

generic stack trace overriding mechanism (#12922)

* libbacktrace support

* switch to a generic stack trace overriding mechanism

When "nimStackTraceOverride" is defined, once of the imported modules
can register its own procedure to replace the default stack trace
generation by calling `registerStackTraceOverride(myOwnProc)`.

Tested with `./koch boot -d:release --debugger:native -d:nimStackTraceOverride --import:libbacktrace`
for the compiler itself and `./bin/nim c -r -f --stacktrace:off --debugger:native -d:nimStackTraceOverride --import:libbacktrace foo.nim`
for an external program.

* make the StackTraceOverrideProc {.noinline.}

Added fix for handling TaintedStrings in streams and httpclient (#12969)

* Added fix for taint mode in streams and httpclient

* Removed taintMode export from system.nim

Check pqntuples > 0 in getValue. Fixes #12973 (#12974)

c_fflush() the rawWrite() buffer (#12987)

Stack traces on an unbuffered stderr get out of sync with line-buffered
stdout - usually on Windows terminals or CI logs. This fixes it by
calling C's fflush() on the output buffer in the procedure used for
printing stack traces.
fixes #12989

Revert "fixes #12989"

This reverts commit 928c2fe.

fixes #12965 (#12991)

fixes #12989 (#12992)

* fixes #12989
* Revert "remove unwanted changes"

This reverts commit 5018297.

fixes disruptek/nimph#102 multi-level nim.cfg use (#13001) [backport]

--exception:goto switch for deterministic exception handling (#12977)

This implements "deterministic" exception handling for Nim based on goto instead of setjmp. This means raising an exception is much cheaper than in C++'s table based implementations. Supports hard realtime systems. Default for --gc:arc and the C target because it's generally a good idea and arc is all about deterministic behavior.

Note: This implies that fatal runtime traps are not catchable anymore! This needs to be documented.
fix #12985 {.push.} now does not apply to generic instantiations (#12986)

Sink to MemMove optimization in injectdestructors (#13002)

remove default argument for readLines (#12807) [backport]

fixes #12978 (#13012)

Fix typo (#13015) [backport]

fixes #12961 (#13019)

fixes #12956 (#13020)

fix #12988 (#13022)

fix #12988
Fixes #13026 (#13028)

fixes #12964 (#13027)

fixes #13032

VM: support importc var, ptr/pointer types, cast int <=> ptr/pointer (#12877)

* VM: allow certain hardcoded special var variables at CT
* VM: allow all importc var, cast[int](ptr)
* fix tests tests/vm/tstaticprintseq.nim, tests/cpp/t8241.nim
* VM: == works for ptr/pointer nodes
* bugfix: ==, cast now also works for pointer, not just ptr
* VM supports cast PtrLikeKinds <=> PtrLikeKinds / int
* improve cname handling
* fixup + bug fix
* VM: support cast from ref to int
* address comment: opcLdGlobalDeref => opcLdGlobalDerefFFI
* defensive check against typ == nil

fix enumtostr crash for enum-range (#13035)

fixes #13013, reverts previous changes to readLines() (#13036) [backport]

* Revert "remove default argument for readLines (#12807) [backport]"

This reverts commit c949b81.

reprjs: style changes

fixes #12996

Rst parser respect `:start-after:` and `:end-before:` in `include` directive (#12972)

* [FEATURE] rst parser respect :start-after: in include

Rst parser now respects `:start-after:` and `:end-before:` attributes
for `include` directive.

* [DOC] include directive parsing proc update

* [TEST] Added unit tests for include rst directive in `rst` module

Allow `-o` option for `buildIndex` (#13037) [backport]

Addressing #12771

This is also included in the docgen documentation [here](https://nim-lang.org/docs/docgen.html) but its not respected as reported in the issue.
[cleanup] remove disabled (and obsolete) ttypetraits; rename ttypetraits2 => ttypetraits (#13041)

* remove disabled (and obsolete) ttypetraits; rename ttypetraits2 => ttypetraits

* D20200105T085828 fix super strange bug that causes CI to fail: builds.sr.ht with: `Error: Settle timed out after 120 attempts`

Continue #13002 (#13021)

testament/important_packages dont run hts (#13052)

Modify the test command for nimly (nimble-package) (#13053)

clean up deprecated stuff and unused imports in tests (#13059)

--styleCheck:hint now works (#13055)

[easy] --hint:link:on now shows link cmd instead of nothing (#13056)

* --hint:link:on now shows link cmd instead of nothing

* update doc for --listCmd

add pqserverVersion,pqconnectionNeedsPassword,pqconnectionUsedPassword (#13060)

basename supports pragmaexpr (#13045)

* basename supports pragmaexpr

* update changelog

distinctBase type trait for distinct types (#13031)

make SuccessX show project file + output file (#13043)

* make SuccessX show project file + output file
* address comments
* fix test and add `result.err = reNimcCrash` otherwise hard to see where reNimcCrash used
* address comments

move entries from the wrong changelog file [ci skip]

fix crash due to errant symbols in nim.cfg (#13073) [backport]

Deleted misplaced separator (#13085) [backport]

Misplaced separator, which was constantly breaking compilation on Haiku OS, was deleted.
take the one good idea from --os:standalone and enable it via -d:StandaloneHeapSize (#13077)

remove all remaining warnings when build nim (with -d:nimHasLibFFI) (#13084)

* cleanup deprecations in evalffi + elsewhere

* remove dead code getOrdValue64

Use '__noinline' instead of 'noinline' for N_NOINLINE gcc attribute, this prevents clashes with systems where 'noinline' might be already defined (#13089)

Fix error check code in osproc (#13090) [backport]

fixes #13072; no test case because it will be added later with more exception handling related bugfixes

fixes #13070

typetraits: fixes #6454; genericParams; added lenTuple; added tuple type get (#13064)

[backport] system/io.nim fix wrong documentation comment [ci skip]

fixes an asyncftpclient bug; refs #13096 [backport]

System cleanup, part 1 (#13069)

* system.nim: mark what every .pop does

* system.nim: un-nest when statements

[backport] fix #12813, fix #13079 (#13099)

Correctly remove a key from CountTable when it is set to zero.
more arc features (#13098)

* config update
* ARC now supports 'repr' and 'new' with finalizers is supported

Remove some unused/disabled OpenSSL functions (#13106)

Add link to posix_utils.html in posix.nim (#13111)

VM FFI: write(stderr, msg) and fprintf(cstderr, msg) now work at CT (#13083)

fix the ftp store function read the local file bug (#13108) [backport]

* Update asyncftpclient.nim

When use newStringOfCap function not have assign memory for the string data,so if use this address the fault is rasise.

* complelete the bugfix

fix rtti sizeof for varargs in global scope (#13125) [backport]

fixes #13122 (#13126)

* fixes #13122

* moved tests to where they belong

fixes #13112 (#13127)

* improve line error information

* fixes #13112

Expose more openSSL methods. (#13131)

fixes #13100 nim doc now treats `export localSymbol` correctly (#13123) [backport]

* fix #13100 nim doc now treats `export localSymbol` correctly
* use owner instead

fixes #13119 (#13128)

* fixes #13119
* fixes a regression

fixes #13105 (#13138)

fixes #10665 (#13141) [backport]

pass platform argument only if vccexe is used (#13078)

* pass platform only if vccexe is used
* fixes #12297

fixes #13104 [backport] (#13142)

fixes #9674 [backport] (#13143)

Fix typo in doc/destructors.rst (#13148)

Added 'ansic' os support for minimal (embedded) targets (#13088)

* os:any implementation
* os:asny: omit flock/funlock calls in echoBinSafe
* Disabled default "unhandled expection" reporting for `--os:any` to reduce
code size. Added unhandledExceptionHook instead which can be used to get
a notification from Nim and handle it from the application.

System cleanup, part 2 (#13155)

* create basic_types, arithmetics, exceptions, comparisons
* create setops.nim
* create memalloc.nim
* create gc_interface.nim
* create iterators_1.nim

export normalizePathEnd (#13152)

successX now correctly shows html output for `nim doc`, `nim jsondoc`; fix #13121 (#13116)

* successX now correctly shows html output for nim doc
* fixes #13121
* fixup hintSuccessX to be less weird

ARC: misc bugfixes (#13156)

* fixes #13102
* closes #13149
* ARC: fixes a move optimizer bug (there are more left regarding array and tuple indexing)
* proper fix; fixes #12957
* fixes yet another case object '=' code generation problem

CI fix timeout error (#13134)

Remove obsolete code from osalloc (#13158)

style fix: change 'JS' to 'js' to make it consistent (#13168)

Working towards arc codegen (#13153)

fixes #13029
fixes #12998 nim doc regression (#13117)

fix tsizeof3 for aarch64 (#13169)

Cleanup DFA (#13173)

Fix docs (#13176)

fixes #13095 (#13181)

* fixes #13095

* fix typo

make case-object transitions explicit, make unknownLineInfo a const, replace a few magic numbers with consts (#13170)

ARC works for async on Windows (#13179)

make sink operator optional (#13068)

* make sink operator optional

* bug fix, add changelog entry

* Trigger build

* fix one regression

* fix test

* Trigger build

* fix typos

Fix docs for subdirs too (#13180)

* Fix doc subdirs
* Extract to helper proc, and fix on windows

followup on #10435 : should be diff, not show (#13162)

fixes #13157

refs #13054 correctly handle {.exportc,dynlib.} and {.exportcpp,dynlib.}  (#13136)

* refs #13054 correctly handle {.exportc,dynlib.} and {.exportcpp,dynlib.}
* put back NIM_EXTERNC for N_LIB_EXPORT; causes issues with compilerproc

fixes #13144 (#13145)

* fixup: genscript now does not copy nimbase.h but uses -I$nim/lib

times: toUnixFloat, fromUnixFloat (#13044)

maybe: allows optional chaining of field access and indexing when LHS i snil (#13023)

* maybe: allows optional chaining
* fix tools/kochdocs.nim
* improve semantics to distinguish valid from invalid values
* for now, wrapnil, isValid, unwrap are not exported

fix docs + API for fieldPairs, fields (#13189)

more on arc codegen (#13178)

* arc codegen for union type

* add more tests

* fix offsetof

* fix tsizeof test

* fix style

Add link to packaging.html (#13194)

Fixes #13186 (#13188)

fixes #13195

revert last commit

Merge branch 'devel' of https://github.com/nim-lang/Nim into devel

Revert "fixes #13195"

This reverts commit cd7904f.

fixes #13110 (#13197)

fixes #13195 (#13198)

* fixes #13195

* extra fix

* fix typo

compiler/ccgtypes: hide exportc proc unless it has dynlib (#13199)

This hides most of stdlib's internal functions from resulting
binaries/libraries, where they aren't needed on *nix. Static libraries
are not affected by this change (visibility doesn't apply to them).
fix range[enum] type conversion (#13204) [backport]

Idxmin & idxmax, continuation (#13208)

* Add idxmin() which returns the index of the minimum value

* Add idxmax() which returns the index of the maximum value

* Add tests for idxmin()

* Add tests for idxmax()

* Remove initialization of result = 0

* Adds overloading for arrays (no enums indexed arrays yet)

* Add support for enum index arrays

* Fix tests with enum

* Fix tests for idxmax

* Change names of the procedures to minIndex and maxIndex

* address Araq's comments:

- remove 'array' versions
- add .since pragma
- return 'int' instead of 'Natural'
- add changelog entry

Co-authored-by: Federico A. Corazza <20555025+Imperator26@users.noreply.github.com>

fix #13211 relativePath("foo", ".") (#13213)

fixes a critical times.nim bug reported on IRC [backport] (#13216)

httpclient, maxredirects to Natural, newHttpClient/newAsyncHttpClient add headers argument instead of hardcoded empty (#13207)

added note to re constructor regarding performance (#13224)

Since I was new to regex I did not know that there is a compilation going on with ``re"[abc]"`` constructor and so I followed the other examples in the docs blindly, that is I just put the constructor directly in the arguments of match, find, etc., which was inside a loop and then wondered why my performance was so bad. Of course putting it outside the loop made it vastly more performant. People like me would benefit from the small note I added I would think :)
[backport] Documentation Fix #12251 (#13226) [ci skip]

[backport] times/getClockStr(): fix mistake in doc (#13229) [ci skip]

new os.isRelativeTo (#13212)

[backport] Fix typo and improve in code-block of 'lib/pure/parseutils.nim' (#13231) [ci skip]

[backport] fix #11440, add docs to isNil for seq types needing nilseq (#13234) [ci skip]

VM: allow overriding MaxLoopIterations without rebuilding nim (#13233)

kochdocs: use a glob instead of hardcoded list; generate docs for compiler/; bugfixes (#13221)

* kochdocs: use a glob instead of hardcoded list; generate docs for compiler/; bugfixes
* fixup after #13212 isRelativeTo got merged

fix lots of bugs with parentDir, refs #8734 (#13236)

Unexport even more symbols (#13214)

* system/gc: don't export markStackAndRegisters

* compiler/cgen: unexport internal symbols

As these functions are Nim-specific walkaround against C's optimization
schemes, they don't serve any purpose being exported.

* compiler/cgen: don't export global var unless marked

* compiler/ccgthreadvars: don't export threadvar unless marked

* tests/dll/visibility: also check for exports

This ensure that these changes don't break manual exports.

* compiler/cgen: hide all variables created for constants

* compiler/ccgtypes: don't export RTTI variables

* compiler/ccgexprs: make all complex const static

* nimbase.h: fix export for windows

* compiler/cgen, ccgthreadvars: export variables correctly

For C/C++ variables, `extern` means that the variable is defined in an
another unit. Added a new N_LIB_EXPORT_VAR to correctly export
variables.

Removed lib/system/allocators.nim. seqs_v2 and strs_v2 now uses allocShared0. (#13190)

* Cleanup, remove lib/system/allocators.nim. seqs_v2 and strs_v2 now use
allocShared0 by default.

* Fixed -d:useMalloc allocShared / reallocShared / deallocShared. These now use the alloc/dealloc/realloc implementation that also takes care of zeroing memory at realloc.

* Removed debug printfs

* Removed unpairedEnvAllocs() from tests/destructor/tnewruntime_misc

* More mmdisp cleanups. The shared allocators do not need to zero memory or throw since the regular ones already do that

* Introduced realloc0 and reallocShared0, these procs are now used by
strs_v2 and seqs_v2. This also allowed the -d:useMalloc allocator to
drop the extra header with allocation length.

* Moved strs_v2/seqs_v2 'allocated' flag into 'cap' field

* Added 'getAllocStats()' to get low level alloc/dealloc counters. Enable with -d:allocStats

* *allocShared implementations for boehm and go allocators now depend on the proper *allocImpl procs

[backport] documentation: Add channels examples (#13202) [ci skip]

[backport] Make all parseutils examples auto-checking (#13238)

- Also fix one example's output (ikString -> ikStr, ikVar instead of ikExpr)
Updated 'nim for embedded systems' section to use --os:any and --gc:arc (#13237)

* Updated 'nim for embedded systems' section to use --os:any and --gc:arc

* Added section about size optimization to embedded systems

Remove name attribute from docutils.nimble (#13239)

Fixes asyncftpclient multiline reading, fixes #4684 (#13242)

Previously, the 4th character of `result` was checked for `'-'` every time, instead of each new line.

Also made it work for taint mode.
Fix typo for literal `[` (#13243)

The literal value for the `tkBracketLe` token was incorrectly set to `]` rather than `[`. I've had a quick glance at the code and it doesn't look like this change will affect anything at all, but I haven't tested yet - let's see if the CI explodes...
Add "origin" to window.location (#13251)

Add "origin" to window location: https://www.w3schools.com/jsref/prop_loc_origin.asp
nim dump: add libpath (#13249)

contributing docs: symbols need package prefix; changed allocStats to nimAllocStats (#13247)

testament/azure: major rewrite (#13246)

This commit features a major rewrite of Azure Pipelines integration,
turning the spaghetti it originally was into something maintainable.

Key changes:
- No longer requires a ton of hooks into testament.
- Results are now cached then bulk-uploaded to prevent throttling from
  Azure Pipelines, avoiding costly timeouts.
- A low timeout is also employed to avoid inflated test time.
- The integration is now documented.
Cleaned up mmdisp.nim, moved implementations into lib/system/mm/ (#13254)

make goto based exceptions available for 'nim cpp' (#13244)

* make goto based exceptions available for 'nim cpp'
* optimize seq.add to be comparable to C++'s emplace_back

ARC: remove unnecessary code

ARC: optimize complete object constructors to use nimNewObjUninit

make nre compile with --gc:arc

Rename isNilOrWhitespace to isEmptyOrWhitespace and make it use allCharsInSet (#13258)

* Rename isNilOrWhitespace to isEmptyOrWhitespace

* Make isEmptyOrWhitespace use allCharsInSet(Whitespace)

Clearer final objects error; fixes #13256 (#13257)

scrollTop must be settable (#13263)

* scrollTop must be assignable

Make scrollTop settable

* add missing export

fixes #13219 (#13272)

fixes #13281 (#13282)

* fixes ##13281

* add comment to test

unittest add resetOutputFormatters proc (#13267)

* add resetOutputFormatters

* remove space

* resolve comments

TlSF Alloctor: use less memory for --gc:arc (#13280)

Tiny since cleanup (#13286)

nimv2 widestring indexing (#13279)

Repr v2 progress (#13268)

* progress on repr_v2

* repr progress

* add ref objects with distrinct

* fix failing tests

refactor htmldocs; gitignore it

removed unused import

fix stdout(etc) for emscripten

csize => csize_t for sysctl

Thread attributes should be destroyed using the pthread_attr_destroy() (#13293)

On some OSes (such as FreeBSD or Solaris), pthread_attr_init allocate
memory. So it is necessary to deallocate that memory by using
pthread_attr_destroy.
fix critical bug discovered by #11591 (#13290) [backport]

miscellaneous bug fixes (#13291)

* fix for emscripten etc

* add testcase for #13290

* replace deprecated isNilOrWhitespace

CT FFI: fix for windows; fix case transition; error msg shows more useful context (#13292)

* evalffi: fix case transition
* evalffi: fix for windows
* evallffi: `cannot import` errmsg now also shows which library it tried to import symbol from

refs #8391 std/os now shows runtime context for raiseOSError exceptions (#13294)

* refs #8391: fix errmsg for setCurrentDir

* raiseOSError calls for copyFile

* refs #8391 std/os now shows runtime context for raiseOSError exceptions

build_all.sh: building csources 5X faster thanks to make -j (#13300)

* build_all.sh: building csources 5X faster thanks to make -j
* fix for freebsd
* use OS-dependent formula to get number of logical cores
* make is an optional dependency

Fix capture for object types (#13315)

* Fix capture for object|tuple|... types

* Add test case

Quote nim executable before executing. (#13316) [backport]

In case nim executable is located in PATH containing spaces.

fixes #13311
ReSync with devel

Make build_all.sh more portable and a bit simpler (#13308)

koch: enable checks in the compiler when running CI (#13323)

fix #13132 tnetdial (#13318)

enable testing -d:nimHasLibFFI mode (#13091)

Fix #10717, fix #13284 (#13307)

Fixed codegen for constant cstring with --gc:arc (#13326)

* Fixed codegen for constant cstring with --gc:arc, fixes  #13321

* Added test for #13321

Option to allow the request body to be processed outside the asynchttpserver library. (#13147)

Allow the request body to be processed outside the asynchttpserver library to break big files into chunks of data. This change does not break anything.

build_all.sh update (#13320)

* Don't overload the system, don't crash when you can't determine the CPU count and don't rely on bash

* Extract to variable

* Limit number of spawned jobs for systems with weak IO

* Use proper arithmetic braces

contributing.rst: Add a special rule for 'outplace'-like features

[backport] -d:danger should imply -d:release (#13336)

nim secret: support linenoise when available (#13328)

fix #13150 `nim doc --project` now works reliably (#13223)

* fix #13150 `nim doc --project` works with duplicate names and with imports below main project file

* add to help; fixup after #13212 isRelativeTo got merged
* fix test tests/compilerapi/tcompilerapi.nim
* remove nimblePkg field; compute on the fly instead
* kochdocs: compiler docs now under compiler/
* --docRoot now has smart default: best among @pkg, @path

make monotimes have zero overhead if you don't use it (#13338) [backport]

fix #13349 regression: isNamedTuple now works with generic tuples (#13350)

fixes #13269 (#13344)

adding sqlite3 backup functions (#13346)

* adding sqlite3 backup functions

* changing sleep to sqlite3_sleep to prevent clashes

Added a basic example how to handle a Post request. (#13339)

* Added a basic example how to handle a Post request.

They were also made minor cosmetic changes.

* Minor fixes suggested by Yardanico

* Fixed a wrong value in chunkSize constant.

* Re-added the request.body for compatibility!

replace old problematic isNamedTuple implementation by TypeTrait isNamedTuple in dollars.nim (#13347)

* replace old problematic isNamedTuple implementation by TypeTrait isNamedTuple

* fix for bootstrap

fix #13182: `proc fun(a: varargs[Foo, conv])` now can be overloaded (#13345) [backport]

miscellaneous bug fixes (part 3) (#13304)

* fix deprecation; fix indentation

* git clone: use -q

* fix Warning: pragma before generic parameter list is deprecated; fix typo

* bugfix: sysTypeFromName("float64") was never cached

testament: introduce 'matrix' for testing multiple options (#13343)

printing float values will have one more digit. (#13276) [backport]

* printing float values will have one more digit. Fixes #13196

[backport] fix #13352

[backport] remove 'CountTable.mget' (#13355)

It didn't work, and it was an oversight to be included in v1.0.
fix #6736: templates in unittest now show actual value (#13354)

Revert "printing float values will have one more digit. (#13276) [backport]" (#13363)

This reverts commit b2c6db9.
Add sideEffect pragma to importC procs in posix, winlean and time module (#13370)

* Add sideEffect pragma to procs in winlean
* Add sideEffect pragma to procs in posix
* Add test for #13306
* Add sideEffect pragma to procs in times
* Fixes #13306
fixes #3339 by documenting the limitations of case-statement (#13366)

fixes #13314 (#13372)

testament: this now works: "testament r /abspath/to/test.nim" (#13358)

fix `is` with generic types; fix `genericHead(Foo[T])` (#13303)

* fix #9855, fix #9855, fix genericHead
* render TTypeKind via toHumanStr

fix #13255 (#13275) [backport]

remove outplace version of 'merge' for CountTables (#13377)

* remove outplace version of 'merge' for CountTables

* remove 'merge' tests

fix #13374 `nim c -r -` now generates $nimcache/stdinfile (#13380) [backport]

fix #9634 don't crash on execCmdEx/readLine when inside gdb/lldb (#13232)

* fix #9634 debugging a program using execCmdEx now works

* only apply EINTR to c_gets for now

This reverts commit c0f5305.

lib.rst: add a link for jsconsole [backport] (#13383)

Make vccexe parse response files (#13329)

expectLen now shows the length that we got (#13387)

fix several bugs with `repr`  (#13386)

fixes #13378 [backport] (#13392)

remove dead code test_nimhcr_integration.(bat,sh) (#13388)

* enable test for osx: import tests/dll/nimhcr_integration

* re-disable osx test

fix linenoise regression (#13395)

* fix nightlies linenoise regression

* fix other installers

Revert "remove dead code test_nimhcr_integration.(bat,sh) (#13388)" (#13396)

This reverts commit 90491ea.
fixes #13368 (#13397)

fix bug in int128 (#13403)

isolate the build process from external config files (#13411)

add ggplotnim to important_packages (#13206)

Fix to asynchttpserver form data/body broken with #13147 (#13394)

* Fix to asynchttpserver form data/body broken with #13147
* New implementation that use a interator instance of future streams
* asynchttpserver now can handle chunks of data.

Merge branch 'devel' of https://github.com/nim-lang/Nim into osopen

Squash Commits; Peer review feedbacks #12901 (comment)
narimiran pushed a commit to narimiran/Nim that referenced this issue Feb 19, 2020
* Add osOpen alias for the operating system specific open command

* Add `--git.devel` option to the documentation
remove unused import (nim-lang#12900)

fix json regression D20191212T144944 (nim-lang#12902) [backport]

Peer Review Feedback nim-lang#12901 (comment)

Merge branch 'devel' of https://github.com/nim-lang/Nim into osopen

Peer Review Feedback nim-lang#12901 (comment)

Update lib/pure/browsers.nim

Co-Authored-By: Dominik Picheta <dominikpicheta@googlemail.com>
Peer Review Feedback nim-lang#12901 (comment)

allow typed/untyped in magic procs (nim-lang#12911)

NaN floatFormat with clang_cl  (nim-lang#12910)

* clang_cl nan floatFormat

* format

add $nimeq for gdb (nim-lang#12909)

ARC: cycle detector (nim-lang#12823)

* first implementation of the =trace and =dispose hooks for the cycle collector
* a cycle collector for ARC: progress
* manual: the .acyclic pragma is a thing once again
* gcbench: adaptations for --gc:arc
* enable valgrind tests for the strutils tests
* testament: better valgrind support
* ARC refactoring: growable jumpstacks
* ARC cycle detector: non-recursive algorithm
* moved and renamed core/ files back to system/
* refactoring: --gc:arc vs --gc:orc since 'orc' is even more experimental and we want to ship --gc:arc soonish

Cleanup leftovers of nim-lang#12911(nim-lang#12916)

Fix single match output (nim-lang#12920)

fixes nim-lang#12899 (nim-lang#12921)

* fixes nim-lang#12899

* fixes regression: destroy global variables in reverse declaration order, closureleak test relies on it

Implement NixOS distro check (nim-lang#12914)

Better case coverage error message for alias and range enum (nim-lang#12913)

fix error in assertions document (nim-lang#12925) [backport]

fix cmdline bugs affecting nimBetterRun correctness (nim-lang#12933) [backport]

fix nim-lang#12919 tasyncclosestall flaky: Address already in use (nim-lang#12934)

system.reset is no longer magic (nim-lang#12937)

It has now means setting x to default for new and old runtime alike
Fix nim-lang#12785 (nim-lang#12943)

* Fix nim-lang#12785 and add test

* better variable name

update documentation for `closureScope` and `capture` (nim-lang#12886)

fixes nim-lang#12735 on osx, call dsymutil for debug builds (nim-lang#12931)

* fix nim-lang#12735 osx: dsymutil needs to be called for debug builds
* also write dsymutil command to extraCmds in json build file

Auto-initialize deques (nim-lang#12879)

case coverage error message for `char` (nim-lang#12948)

lenVarargs: number of varargs elements (nim-lang#12907)

docs: tiny style improvements

added guidelines for evolving Nim's stdlib

fixes a bug that kept sugar.collect from working with for loop macros [backport]

fixes nim-lang#12826

fixes a regression

a better bugfix

fixes a test case

fixes a silly regression

fixes the distros.nim regression

ported channels to ARC

ported osproc.nim to ARC

ported re.nim to ARC

ARC: default to a shared heap with --threads:on

osproc: fixes regression

fixes another regression

fixes nim-lang#12945 (nim-lang#12959)

minor refactorings

Fixes stackoverflow links in readme (nim-lang#12963) [backport]

Allow customize Host header
[ci skip] docfix .. < => ..< (nim-lang#12981) [backport]

parsecfg: retain CRLF line breaks, fixes nim-lang#12970 (nim-lang#12971)

generic stack trace overriding mechanism (nim-lang#12922)

* libbacktrace support

* switch to a generic stack trace overriding mechanism

When "nimStackTraceOverride" is defined, once of the imported modules
can register its own procedure to replace the default stack trace
generation by calling `registerStackTraceOverride(myOwnProc)`.

Tested with `./koch boot -d:release --debugger:native -d:nimStackTraceOverride --import:libbacktrace`
for the compiler itself and `./bin/nim c -r -f --stacktrace:off --debugger:native -d:nimStackTraceOverride --import:libbacktrace foo.nim`
for an external program.

* make the StackTraceOverrideProc {.noinline.}

Added fix for handling TaintedStrings in streams and httpclient (nim-lang#12969)

* Added fix for taint mode in streams and httpclient

* Removed taintMode export from system.nim

Check pqntuples > 0 in getValue. Fixes nim-lang#12973 (nim-lang#12974)

c_fflush() the rawWrite() buffer (nim-lang#12987)

Stack traces on an unbuffered stderr get out of sync with line-buffered
stdout - usually on Windows terminals or CI logs. This fixes it by
calling C's fflush() on the output buffer in the procedure used for
printing stack traces.
fixes nim-lang#12989

Revert "fixes nim-lang#12989"

This reverts commit 928c2fe.

fixes nim-lang#12965 (nim-lang#12991)

fixes nim-lang#12989 (nim-lang#12992)

* fixes nim-lang#12989
* Revert "remove unwanted changes"

This reverts commit 5018297.

fixes disruptek/nimph#102 multi-level nim.cfg use (nim-lang#13001) [backport]

--exception:goto switch for deterministic exception handling (nim-lang#12977)

This implements "deterministic" exception handling for Nim based on goto instead of setjmp. This means raising an exception is much cheaper than in C++'s table based implementations. Supports hard realtime systems. Default for --gc:arc and the C target because it's generally a good idea and arc is all about deterministic behavior.

Note: This implies that fatal runtime traps are not catchable anymore! This needs to be documented.
fix nim-lang#12985 {.push.} now does not apply to generic instantiations (nim-lang#12986)

Sink to MemMove optimization in injectdestructors (nim-lang#13002)

remove default argument for readLines (nim-lang#12807) [backport]

fixes nim-lang#12978 (nim-lang#13012)

Fix typo (nim-lang#13015) [backport]

fixes nim-lang#12961 (nim-lang#13019)

fixes nim-lang#12956 (nim-lang#13020)

fix nim-lang#12988 (nim-lang#13022)

fix nim-lang#12988
Fixes nim-lang#13026 (nim-lang#13028)

fixes nim-lang#12964 (nim-lang#13027)

fixes nim-lang#13032

VM: support importc var, ptr/pointer types, cast int <=> ptr/pointer (nim-lang#12877)

* VM: allow certain hardcoded special var variables at CT
* VM: allow all importc var, cast[int](ptr)
* fix tests tests/vm/tstaticprintseq.nim, tests/cpp/t8241.nim
* VM: == works for ptr/pointer nodes
* bugfix: ==, cast now also works for pointer, not just ptr
* VM supports cast PtrLikeKinds <=> PtrLikeKinds / int
* improve cname handling
* fixup + bug fix
* VM: support cast from ref to int
* address comment: opcLdGlobalDeref => opcLdGlobalDerefFFI
* defensive check against typ == nil

fix enumtostr crash for enum-range (nim-lang#13035)

fixes nim-lang#13013, reverts previous changes to readLines() (nim-lang#13036) [backport]

* Revert "remove default argument for readLines (nim-lang#12807) [backport]"

This reverts commit c949b81.

reprjs: style changes

fixes nim-lang#12996

Rst parser respect `:start-after:` and `:end-before:` in `include` directive (nim-lang#12972)

* [FEATURE] rst parser respect :start-after: in include

Rst parser now respects `:start-after:` and `:end-before:` attributes
for `include` directive.

* [DOC] include directive parsing proc update

* [TEST] Added unit tests for include rst directive in `rst` module

Allow `-o` option for `buildIndex` (nim-lang#13037) [backport]

Addressing nim-lang#12771

This is also included in the docgen documentation [here](https://nim-lang.org/docs/docgen.html) but its not respected as reported in the issue.
[cleanup] remove disabled (and obsolete) ttypetraits; rename ttypetraits2 => ttypetraits (nim-lang#13041)

* remove disabled (and obsolete) ttypetraits; rename ttypetraits2 => ttypetraits

* D20200105T085828 fix super strange bug that causes CI to fail: builds.sr.ht with: `Error: Settle timed out after 120 attempts`

Continue nim-lang#13002 (nim-lang#13021)

testament/important_packages dont run hts (nim-lang#13052)

Modify the test command for nimly (nimble-package) (nim-lang#13053)

clean up deprecated stuff and unused imports in tests (nim-lang#13059)

--styleCheck:hint now works (nim-lang#13055)

[easy] --hint:link:on now shows link cmd instead of nothing (nim-lang#13056)

* --hint:link:on now shows link cmd instead of nothing

* update doc for --listCmd

add pqserverVersion,pqconnectionNeedsPassword,pqconnectionUsedPassword (nim-lang#13060)

basename supports pragmaexpr (nim-lang#13045)

* basename supports pragmaexpr

* update changelog

distinctBase type trait for distinct types (nim-lang#13031)

make SuccessX show project file + output file (nim-lang#13043)

* make SuccessX show project file + output file
* address comments
* fix test and add `result.err = reNimcCrash` otherwise hard to see where reNimcCrash used
* address comments

move entries from the wrong changelog file [ci skip]

fix crash due to errant symbols in nim.cfg (nim-lang#13073) [backport]

Deleted misplaced separator (nim-lang#13085) [backport]

Misplaced separator, which was constantly breaking compilation on Haiku OS, was deleted.
take the one good idea from --os:standalone and enable it via -d:StandaloneHeapSize (nim-lang#13077)

remove all remaining warnings when build nim (with -d:nimHasLibFFI) (nim-lang#13084)

* cleanup deprecations in evalffi + elsewhere

* remove dead code getOrdValue64

Use '__noinline' instead of 'noinline' for N_NOINLINE gcc attribute, this prevents clashes with systems where 'noinline' might be already defined (nim-lang#13089)

Fix error check code in osproc (nim-lang#13090) [backport]

fixes nim-lang#13072; no test case because it will be added later with more exception handling related bugfixes

fixes nim-lang#13070

typetraits: fixes nim-lang#6454; genericParams; added lenTuple; added tuple type get (nim-lang#13064)

[backport] system/io.nim fix wrong documentation comment [ci skip]

fixes an asyncftpclient bug; refs nim-lang#13096 [backport]

System cleanup, part 1 (nim-lang#13069)

* system.nim: mark what every .pop does

* system.nim: un-nest when statements

[backport] fix nim-lang#12813, fix nim-lang#13079 (nim-lang#13099)

Correctly remove a key from CountTable when it is set to zero.
more arc features (nim-lang#13098)

* config update
* ARC now supports 'repr' and 'new' with finalizers is supported

Remove some unused/disabled OpenSSL functions (nim-lang#13106)

Add link to posix_utils.html in posix.nim (nim-lang#13111)

VM FFI: write(stderr, msg) and fprintf(cstderr, msg) now work at CT (nim-lang#13083)

fix the ftp store function read the local file bug (nim-lang#13108) [backport]

* Update asyncftpclient.nim

When use newStringOfCap function not have assign memory for the string data,so if use this address the fault is rasise.

* complelete the bugfix

fix rtti sizeof for varargs in global scope (nim-lang#13125) [backport]

fixes nim-lang#13122 (nim-lang#13126)

* fixes nim-lang#13122

* moved tests to where they belong

fixes nim-lang#13112 (nim-lang#13127)

* improve line error information

* fixes nim-lang#13112

Expose more openSSL methods. (nim-lang#13131)

fixes nim-lang#13100 nim doc now treats `export localSymbol` correctly (nim-lang#13123) [backport]

* fix nim-lang#13100 nim doc now treats `export localSymbol` correctly
* use owner instead

fixes nim-lang#13119 (nim-lang#13128)

* fixes nim-lang#13119
* fixes a regression

fixes nim-lang#13105 (nim-lang#13138)

fixes nim-lang#10665 (nim-lang#13141) [backport]

pass platform argument only if vccexe is used (nim-lang#13078)

* pass platform only if vccexe is used
* fixes nim-lang#12297

fixes nim-lang#13104 [backport] (nim-lang#13142)

fixes nim-lang#9674 [backport] (nim-lang#13143)

Fix typo in doc/destructors.rst (nim-lang#13148)

Added 'ansic' os support for minimal (embedded) targets (nim-lang#13088)

* os:any implementation
* os:asny: omit flock/funlock calls in echoBinSafe
* Disabled default "unhandled expection" reporting for `--os:any` to reduce
code size. Added unhandledExceptionHook instead which can be used to get
a notification from Nim and handle it from the application.

System cleanup, part 2 (nim-lang#13155)

* create basic_types, arithmetics, exceptions, comparisons
* create setops.nim
* create memalloc.nim
* create gc_interface.nim
* create iterators_1.nim

export normalizePathEnd (nim-lang#13152)

successX now correctly shows html output for `nim doc`, `nim jsondoc`; fix nim-lang#13121 (nim-lang#13116)

* successX now correctly shows html output for nim doc
* fixes nim-lang#13121
* fixup hintSuccessX to be less weird

ARC: misc bugfixes (nim-lang#13156)

* fixes nim-lang#13102
* closes nim-lang#13149
* ARC: fixes a move optimizer bug (there are more left regarding array and tuple indexing)
* proper fix; fixes nim-lang#12957
* fixes yet another case object '=' code generation problem

CI fix timeout error (nim-lang#13134)

Remove obsolete code from osalloc (nim-lang#13158)

style fix: change 'JS' to 'js' to make it consistent (nim-lang#13168)

Working towards arc codegen (nim-lang#13153)

fixes nim-lang#13029
fixes nim-lang#12998 nim doc regression (nim-lang#13117)

fix tsizeof3 for aarch64 (nim-lang#13169)

Cleanup DFA (nim-lang#13173)

Fix docs (nim-lang#13176)

fixes nim-lang#13095 (nim-lang#13181)

* fixes nim-lang#13095

* fix typo

make case-object transitions explicit, make unknownLineInfo a const, replace a few magic numbers with consts (nim-lang#13170)

ARC works for async on Windows (nim-lang#13179)

make sink operator optional (nim-lang#13068)

* make sink operator optional

* bug fix, add changelog entry

* Trigger build

* fix one regression

* fix test

* Trigger build

* fix typos

Fix docs for subdirs too (nim-lang#13180)

* Fix doc subdirs
* Extract to helper proc, and fix on windows

followup on nim-lang#10435 : should be diff, not show (nim-lang#13162)

fixes nim-lang#13157

refs nim-lang#13054 correctly handle {.exportc,dynlib.} and {.exportcpp,dynlib.}  (nim-lang#13136)

* refs nim-lang#13054 correctly handle {.exportc,dynlib.} and {.exportcpp,dynlib.}
* put back NIM_EXTERNC for N_LIB_EXPORT; causes issues with compilerproc

fixes nim-lang#13144 (nim-lang#13145)

* fixup: genscript now does not copy nimbase.h but uses -I$nim/lib

times: toUnixFloat, fromUnixFloat (nim-lang#13044)

maybe: allows optional chaining of field access and indexing when LHS i snil (nim-lang#13023)

* maybe: allows optional chaining
* fix tools/kochdocs.nim
* improve semantics to distinguish valid from invalid values
* for now, wrapnil, isValid, unwrap are not exported

fix docs + API for fieldPairs, fields (nim-lang#13189)

more on arc codegen (nim-lang#13178)

* arc codegen for union type

* add more tests

* fix offsetof

* fix tsizeof test

* fix style

Add link to packaging.html (nim-lang#13194)

Fixes nim-lang#13186 (nim-lang#13188)

fixes nim-lang#13195

revert last commit

Merge branch 'devel' of https://github.com/nim-lang/Nim into devel

Revert "fixes nim-lang#13195"

This reverts commit cd7904f.

fixes nim-lang#13110 (nim-lang#13197)

fixes nim-lang#13195 (nim-lang#13198)

* fixes nim-lang#13195

* extra fix

* fix typo

compiler/ccgtypes: hide exportc proc unless it has dynlib (nim-lang#13199)

This hides most of stdlib's internal functions from resulting
binaries/libraries, where they aren't needed on *nix. Static libraries
are not affected by this change (visibility doesn't apply to them).
fix range[enum] type conversion (nim-lang#13204) [backport]

Idxmin & idxmax, continuation (nim-lang#13208)

* Add idxmin() which returns the index of the minimum value

* Add idxmax() which returns the index of the maximum value

* Add tests for idxmin()

* Add tests for idxmax()

* Remove initialization of result = 0

* Adds overloading for arrays (no enums indexed arrays yet)

* Add support for enum index arrays

* Fix tests with enum

* Fix tests for idxmax

* Change names of the procedures to minIndex and maxIndex

* address Araq's comments:

- remove 'array' versions
- add .since pragma
- return 'int' instead of 'Natural'
- add changelog entry

Co-authored-by: Federico A. Corazza <20555025+Imperator26@users.noreply.github.com>

fix nim-lang#13211 relativePath("foo", ".") (nim-lang#13213)

fixes a critical times.nim bug reported on IRC [backport] (nim-lang#13216)

httpclient, maxredirects to Natural, newHttpClient/newAsyncHttpClient add headers argument instead of hardcoded empty (nim-lang#13207)

added note to re constructor regarding performance (nim-lang#13224)

Since I was new to regex I did not know that there is a compilation going on with ``re"[abc]"`` constructor and so I followed the other examples in the docs blindly, that is I just put the constructor directly in the arguments of match, find, etc., which was inside a loop and then wondered why my performance was so bad. Of course putting it outside the loop made it vastly more performant. People like me would benefit from the small note I added I would think :)
[backport] Documentation Fix nim-lang#12251 (nim-lang#13226) [ci skip]

[backport] times/getClockStr(): fix mistake in doc (nim-lang#13229) [ci skip]

new os.isRelativeTo (nim-lang#13212)

[backport] Fix typo and improve in code-block of 'lib/pure/parseutils.nim' (nim-lang#13231) [ci skip]

[backport] fix nim-lang#11440, add docs to isNil for seq types needing nilseq (nim-lang#13234) [ci skip]

VM: allow overriding MaxLoopIterations without rebuilding nim (nim-lang#13233)

kochdocs: use a glob instead of hardcoded list; generate docs for compiler/; bugfixes (nim-lang#13221)

* kochdocs: use a glob instead of hardcoded list; generate docs for compiler/; bugfixes
* fixup after nim-lang#13212 isRelativeTo got merged

fix lots of bugs with parentDir, refs nim-lang#8734 (nim-lang#13236)

Unexport even more symbols (nim-lang#13214)

* system/gc: don't export markStackAndRegisters

* compiler/cgen: unexport internal symbols

As these functions are Nim-specific walkaround against C's optimization
schemes, they don't serve any purpose being exported.

* compiler/cgen: don't export global var unless marked

* compiler/ccgthreadvars: don't export threadvar unless marked

* tests/dll/visibility: also check for exports

This ensure that these changes don't break manual exports.

* compiler/cgen: hide all variables created for constants

* compiler/ccgtypes: don't export RTTI variables

* compiler/ccgexprs: make all complex const static

* nimbase.h: fix export for windows

* compiler/cgen, ccgthreadvars: export variables correctly

For C/C++ variables, `extern` means that the variable is defined in an
another unit. Added a new N_LIB_EXPORT_VAR to correctly export
variables.

Removed lib/system/allocators.nim. seqs_v2 and strs_v2 now uses allocShared0. (nim-lang#13190)

* Cleanup, remove lib/system/allocators.nim. seqs_v2 and strs_v2 now use
allocShared0 by default.

* Fixed -d:useMalloc allocShared / reallocShared / deallocShared. These now use the alloc/dealloc/realloc implementation that also takes care of zeroing memory at realloc.

* Removed debug printfs

* Removed unpairedEnvAllocs() from tests/destructor/tnewruntime_misc

* More mmdisp cleanups. The shared allocators do not need to zero memory or throw since the regular ones already do that

* Introduced realloc0 and reallocShared0, these procs are now used by
strs_v2 and seqs_v2. This also allowed the -d:useMalloc allocator to
drop the extra header with allocation length.

* Moved strs_v2/seqs_v2 'allocated' flag into 'cap' field

* Added 'getAllocStats()' to get low level alloc/dealloc counters. Enable with -d:allocStats

* *allocShared implementations for boehm and go allocators now depend on the proper *allocImpl procs

[backport] documentation: Add channels examples (nim-lang#13202) [ci skip]

[backport] Make all parseutils examples auto-checking (nim-lang#13238)

- Also fix one example's output (ikString -> ikStr, ikVar instead of ikExpr)
Updated 'nim for embedded systems' section to use --os:any and --gc:arc (nim-lang#13237)

* Updated 'nim for embedded systems' section to use --os:any and --gc:arc

* Added section about size optimization to embedded systems

Remove name attribute from docutils.nimble (nim-lang#13239)

Fixes asyncftpclient multiline reading, fixes nim-lang#4684 (nim-lang#13242)

Previously, the 4th character of `result` was checked for `'-'` every time, instead of each new line.

Also made it work for taint mode.
Fix typo for literal `[` (nim-lang#13243)

The literal value for the `tkBracketLe` token was incorrectly set to `]` rather than `[`. I've had a quick glance at the code and it doesn't look like this change will affect anything at all, but I haven't tested yet - let's see if the CI explodes...
Add "origin" to window.location (nim-lang#13251)

Add "origin" to window location: https://www.w3schools.com/jsref/prop_loc_origin.asp
nim dump: add libpath (nim-lang#13249)

contributing docs: symbols need package prefix; changed allocStats to nimAllocStats (nim-lang#13247)

testament/azure: major rewrite (nim-lang#13246)

This commit features a major rewrite of Azure Pipelines integration,
turning the spaghetti it originally was into something maintainable.

Key changes:
- No longer requires a ton of hooks into testament.
- Results are now cached then bulk-uploaded to prevent throttling from
  Azure Pipelines, avoiding costly timeouts.
- A low timeout is also employed to avoid inflated test time.
- The integration is now documented.
Cleaned up mmdisp.nim, moved implementations into lib/system/mm/ (nim-lang#13254)

make goto based exceptions available for 'nim cpp' (nim-lang#13244)

* make goto based exceptions available for 'nim cpp'
* optimize seq.add to be comparable to C++'s emplace_back

ARC: remove unnecessary code

ARC: optimize complete object constructors to use nimNewObjUninit

make nre compile with --gc:arc

Rename isNilOrWhitespace to isEmptyOrWhitespace and make it use allCharsInSet (nim-lang#13258)

* Rename isNilOrWhitespace to isEmptyOrWhitespace

* Make isEmptyOrWhitespace use allCharsInSet(Whitespace)

Clearer final objects error; fixes nim-lang#13256 (nim-lang#13257)

scrollTop must be settable (nim-lang#13263)

* scrollTop must be assignable

Make scrollTop settable

* add missing export

fixes nim-lang#13219 (nim-lang#13272)

fixes nim-lang#13281 (nim-lang#13282)

* fixes #nim-lang#13281

* add comment to test

unittest add resetOutputFormatters proc (nim-lang#13267)

* add resetOutputFormatters

* remove space

* resolve comments

TlSF Alloctor: use less memory for --gc:arc (nim-lang#13280)

Tiny since cleanup (nim-lang#13286)

nimv2 widestring indexing (nim-lang#13279)

Repr v2 progress (nim-lang#13268)

* progress on repr_v2

* repr progress

* add ref objects with distrinct

* fix failing tests

refactor htmldocs; gitignore it

removed unused import

fix stdout(etc) for emscripten

csize => csize_t for sysctl

Thread attributes should be destroyed using the pthread_attr_destroy() (nim-lang#13293)

On some OSes (such as FreeBSD or Solaris), pthread_attr_init allocate
memory. So it is necessary to deallocate that memory by using
pthread_attr_destroy.
fix critical bug discovered by nim-lang#11591 (nim-lang#13290) [backport]

miscellaneous bug fixes (nim-lang#13291)

* fix for emscripten etc

* add testcase for nim-lang#13290

* replace deprecated isNilOrWhitespace

CT FFI: fix for windows; fix case transition; error msg shows more useful context (nim-lang#13292)

* evalffi: fix case transition
* evalffi: fix for windows
* evallffi: `cannot import` errmsg now also shows which library it tried to import symbol from

refs nim-lang#8391 std/os now shows runtime context for raiseOSError exceptions (nim-lang#13294)

* refs nim-lang#8391: fix errmsg for setCurrentDir

* raiseOSError calls for copyFile

* refs nim-lang#8391 std/os now shows runtime context for raiseOSError exceptions

build_all.sh: building csources 5X faster thanks to make -j (nim-lang#13300)

* build_all.sh: building csources 5X faster thanks to make -j
* fix for freebsd
* use OS-dependent formula to get number of logical cores
* make is an optional dependency

Fix capture for object types (nim-lang#13315)

* Fix capture for object|tuple|... types

* Add test case

Quote nim executable before executing. (nim-lang#13316) [backport]

In case nim executable is located in PATH containing spaces.

fixes nim-lang#13311
ReSync with devel

Make build_all.sh more portable and a bit simpler (nim-lang#13308)

koch: enable checks in the compiler when running CI (nim-lang#13323)

fix nim-lang#13132 tnetdial (nim-lang#13318)

enable testing -d:nimHasLibFFI mode (nim-lang#13091)

Fix nim-lang#10717, fix nim-lang#13284 (nim-lang#13307)

Fixed codegen for constant cstring with --gc:arc (nim-lang#13326)

* Fixed codegen for constant cstring with --gc:arc, fixes  nim-lang#13321

* Added test for nim-lang#13321

Option to allow the request body to be processed outside the asynchttpserver library. (nim-lang#13147)

Allow the request body to be processed outside the asynchttpserver library to break big files into chunks of data. This change does not break anything.

build_all.sh update (nim-lang#13320)

* Don't overload the system, don't crash when you can't determine the CPU count and don't rely on bash

* Extract to variable

* Limit number of spawned jobs for systems with weak IO

* Use proper arithmetic braces

contributing.rst: Add a special rule for 'outplace'-like features

[backport] -d:danger should imply -d:release (nim-lang#13336)

nim secret: support linenoise when available (nim-lang#13328)

fix nim-lang#13150 `nim doc --project` now works reliably (nim-lang#13223)

* fix nim-lang#13150 `nim doc --project` works with duplicate names and with imports below main project file

* add to help; fixup after nim-lang#13212 isRelativeTo got merged
* fix test tests/compilerapi/tcompilerapi.nim
* remove nimblePkg field; compute on the fly instead
* kochdocs: compiler docs now under compiler/
* --docRoot now has smart default: best among @pkg, @path

make monotimes have zero overhead if you don't use it (nim-lang#13338) [backport]

fix nim-lang#13349 regression: isNamedTuple now works with generic tuples (nim-lang#13350)

fixes nim-lang#13269 (nim-lang#13344)

adding sqlite3 backup functions (nim-lang#13346)

* adding sqlite3 backup functions

* changing sleep to sqlite3_sleep to prevent clashes

Added a basic example how to handle a Post request. (nim-lang#13339)

* Added a basic example how to handle a Post request.

They were also made minor cosmetic changes.

* Minor fixes suggested by Yardanico

* Fixed a wrong value in chunkSize constant.

* Re-added the request.body for compatibility!

replace old problematic isNamedTuple implementation by TypeTrait isNamedTuple in dollars.nim (nim-lang#13347)

* replace old problematic isNamedTuple implementation by TypeTrait isNamedTuple

* fix for bootstrap

fix nim-lang#13182: `proc fun(a: varargs[Foo, conv])` now can be overloaded (nim-lang#13345) [backport]

miscellaneous bug fixes (part 3) (nim-lang#13304)

* fix deprecation; fix indentation

* git clone: use -q

* fix Warning: pragma before generic parameter list is deprecated; fix typo

* bugfix: sysTypeFromName("float64") was never cached

testament: introduce 'matrix' for testing multiple options (nim-lang#13343)

printing float values will have one more digit. (nim-lang#13276) [backport]

* printing float values will have one more digit. Fixes nim-lang#13196

[backport] fix nim-lang#13352

[backport] remove 'CountTable.mget' (nim-lang#13355)

It didn't work, and it was an oversight to be included in v1.0.
fix nim-lang#6736: templates in unittest now show actual value (nim-lang#13354)

Revert "printing float values will have one more digit. (nim-lang#13276) [backport]" (nim-lang#13363)

This reverts commit b2c6db9.
Add sideEffect pragma to importC procs in posix, winlean and time module (nim-lang#13370)

* Add sideEffect pragma to procs in winlean
* Add sideEffect pragma to procs in posix
* Add test for nim-lang#13306
* Add sideEffect pragma to procs in times
* Fixes nim-lang#13306
fixes nim-lang#3339 by documenting the limitations of case-statement (nim-lang#13366)

fixes nim-lang#13314 (nim-lang#13372)

testament: this now works: "testament r /abspath/to/test.nim" (nim-lang#13358)

fix `is` with generic types; fix `genericHead(Foo[T])` (nim-lang#13303)

* fix nim-lang#9855, fix nim-lang#9855, fix genericHead
* render TTypeKind via toHumanStr

fix nim-lang#13255 (nim-lang#13275) [backport]

remove outplace version of 'merge' for CountTables (nim-lang#13377)

* remove outplace version of 'merge' for CountTables

* remove 'merge' tests

fix nim-lang#13374 `nim c -r -` now generates $nimcache/stdinfile (nim-lang#13380) [backport]

fix nim-lang#9634 don't crash on execCmdEx/readLine when inside gdb/lldb (nim-lang#13232)

* fix nim-lang#9634 debugging a program using execCmdEx now works

* only apply EINTR to c_gets for now

This reverts commit c0f5305.

lib.rst: add a link for jsconsole [backport] (nim-lang#13383)

Make vccexe parse response files (nim-lang#13329)

expectLen now shows the length that we got (nim-lang#13387)

fix several bugs with `repr`  (nim-lang#13386)

fixes nim-lang#13378 [backport] (nim-lang#13392)

remove dead code test_nimhcr_integration.(bat,sh) (nim-lang#13388)

* enable test for osx: import tests/dll/nimhcr_integration

* re-disable osx test

fix linenoise regression (nim-lang#13395)

* fix nightlies linenoise regression

* fix other installers

Revert "remove dead code test_nimhcr_integration.(bat,sh) (nim-lang#13388)" (nim-lang#13396)

This reverts commit 90491ea.
fixes nim-lang#13368 (nim-lang#13397)

fix bug in int128 (nim-lang#13403)

isolate the build process from external config files (nim-lang#13411)

add ggplotnim to important_packages (nim-lang#13206)

Fix to asynchttpserver form data/body broken with nim-lang#13147 (nim-lang#13394)

* Fix to asynchttpserver form data/body broken with nim-lang#13147
* New implementation that use a interator instance of future streams
* asynchttpserver now can handle chunks of data.

Merge branch 'devel' of https://github.com/nim-lang/Nim into osopen

Squash Commits; Peer review feedbacks nim-lang#12901 (comment)

(cherry picked from commit ba25f84)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants