On Tuesday, 2 February 2016 at 18:45:20 UTC, Nikolay wrote:
I am porting LDC/phobos/druntime to NetBSD. Currently my patch
is merged into LDC master. I have several questions about
phobos/druntime and general workflow.
As I can understand I should prepare pull requests for
phobos/druntime master branches. LDC team will
merge/cherry-pick changes into ldc branch from master later. Is
it correct workflow? Because it means that I can’t check my
patch: there is no dmd compiler for NetBSD + phobos/druntime
master branches.
You're probably better off porting dmd 2.068 first (as it's the
last dmd written wholly in C++), using it to compile dmd git
master on NetBSD, then porting druntime and phobos master.
Porting dmd to NetBSD/x86 is likely easy: simply follow what the
other BSDs have done, as you did for ldc.
Also I have a set of issues with real (long double) type.
Several functions absent in NetBSD for real type (more specific
- they are just aliases for functions with double). Other
functions return less accurate values.
I have to disable a couple unit tests for NetBSD.
E.g. std/conv.d:2835 assert(to!string(r) ==
to!string(real.min_normal))
see related question:
http://stackoverflow.com/questions/35090322/netbsd-long-double-trouble
But also there are a set of unit tests where I have to reduce
accuracy. This problem affects
std/internal/math/gammafunction.d, std/math.d, std/numeric.d,
std/complex.d
E.g. std/complex.d:792
assert(sin(complex(2.0L, 0)) == std.math.sin(2.0L));
I replace with:
assert(feqrel(sin(complex(2.0L, 0)).re, std.math.sin(2.0L)) >
real.mant_dig-10);
My question is: should I wrap such changes with version(NetBSD)
statement or it is acceptable reduce accuracy for all platforms?
This is the same issue Win64 and Android have had. You should
already see version blocks for those in some places, you can do
the same. Take a look at my Android patches for similar tweaks
that are still unmerged:
https://gist.github.com/joakim-noah/d936d6a339426ad1fac3
https://gist.github.com/joakim-noah/5c03801fa6c59b1e90df