Nim/lib
Reimer Behrends f664c576c2 Fix code generation issues with TNimType.
This is an alternative attempt to fix issue #2841 in a way that does not
rely on non-standard C compiler behavior.

The underlying problem is that the typeinfo module includes
system/hti.nim, but system/hti.nim is also included by system.nim. The
result is that the compiler at any given point has two instances of
TNimType with the same external name and will generate code either for
one or both of them. Code generation for the second version is normally
suppressed by using {.importc.}, but that results in a missing type
declaration for modules that only use the second version. This happens
for modules that import typeinfo, because the the second component of
typeinfo.Any has type PNimType = ptr TNimType, which generates a
"TNimType *" struct member.

The previous solution was to have a typedef for TNimType in nimbase.h;
however, this results in duplicate typedefs (specifically, but not only
for the code generated for typeinfo.nim). Duplicate typedefs with the
same type name are allowed in C++ and C11, but are explicitly forbidden
in C89 and C99. Modern versions of gcc and clang accept them anyway, but
this is not standard-compliant and may break for other C compilers or
older versions of gcc and clang.

This patch attempts to fix the issue by making the second component of
typeinfo.Nim a pointer instead of a PNimType and casting back and forth
as needed. Thus, the second version of TNimType occurs only within the
code for typeinfo.nim, where it can be safely omitted.
2015-12-15 13:33:38 +01:00
..
arch Coroutine support for i386/amd64 platforms unix/windows OSes markAndSweep/refCounting GCs. 2015-07-31 17:59:50 +03:00
core Fix code generation issues with TNimType. 2015-12-15 13:33:38 +01:00
deprecated docs now build again 2015-10-12 20:58:46 +02:00
impure Fixed issue 3513: wrong setupQuery realization 2015-11-06 10:24:23 +06:00
js Dom refactoring 2015-11-25 19:27:13 +02:00
packages/docutils udpated the compiler and tester to use getOrDefault 2015-10-13 14:10:33 +02:00
posix fix rawsockets test 2015-10-02 16:00:33 -07:00
pure Fixing too many open files on quit command with an explicit socket close, and importing the net module 2015-12-13 15:36:26 -04:00
system Merge pull request #3595 from dfdeshom/devel 2015-12-04 15:27:06 +00:00
windows added poDemon flag for process management 2015-10-19 16:09:34 +02:00
wrappers Add serach for libssl.so without version suffix. 2015-10-29 20:01:43 +01:00
cycle.h Removes executable bit for text files. 2013-03-16 23:53:07 +01:00
nimbase.h Fix code generation issues with TNimType. 2015-12-15 13:33:38 +01:00
nimrtl.nim lib: Trim .nim files trailing whitespace 2015-09-04 23:03:56 +02:00
nimrtl.nim.cfg Rename *.nimrod.cfg to *.nim.cfg 2015-02-03 09:04:24 +01:00
prelude.nim Nimrod renamed to Nim 2014-08-28 09:59:26 +02:00
stdlib.nimble VM supports math and a few os procs 2014-08-30 16:37:27 +02:00
system.nim 7 div 5 == 1 2015-12-08 00:48:24 +08:00